Ładny brzuch

Chyba niedawno poruszalem podobny temat, ale teraz chodzi mi o wyswietlenie obrazka bmp np 20pikseli x 20pikseli na okreslonej pozycji na ekranie np x=10, y=50, jak to zrobic?



dobra juz wiem sorki za klopot


dobra juz wiem sorki za klopot

ale ze mnie egoista :P , oto kod ktory znalazlem i przynajmniej u mnie dziala bez zarzutu:

program as; const bank : integer =-1; type tmem       = array[0..0] of byte; thandlebmp = record  id        : word;  fsize     : longint;  zerowe    : longint;  bitoffs   : longint;  hsize     : longint;  ResX      : longint;  ResY      : longint;  planes    : word;  bpp       : word;  { dalej sa pierdoly :P } end; procedure SetVesaMode(mode:word); assembler; asm  mov ax, 4f02h  mov bx, mode  int 10h end; procedure off; assembler; asm  mov ax, 0003  int 10h end; procedure zmien_bank(nr:word); assembler; asm  mov AX, 4F05h  mov BX, 0000h  mov dx, nr  mov bank, dx     { zapamietaj nr nowego banku w zmiennej }  int 10h end; Function RGBtoCol(r,g,b:byte):word; begin  RGBToCol:=(b shr 3) or ((word(g) and $FC) shl 3) or ((word(r) and $F8) shl 8); end; procedure Error(msg:string); begin  off;  Write(msg);  readln;  halt; end; procedure LoadBmp(nazwa:string; x,y:longint); var  f        : file;  handle   : THANDLEBMP;  adr      : longint;  ScanLine : ^Tmem;  j,i      : longint;  col      : word;  pal      : array[0..1023] of byte; begin  assign(f, nazwa);  reset(f,1);  blockread(f, handle, sizeof(handle));  if (x+handle.ResX>640) or (y+handle.ResY>480) then   Error('Error : Rysunek sie nie zmiesci ');  seek(f, 54);  case handle.bpp of   24 : begin         adr:=(x+(y+handle.ResY-1)*640)*2;         zmien_bank(adr shr 16);         seek(f, handle.bitoffs);         GetMem(ScanLine, handle.ResX*3);         for j:=Handle.ResY-1 downto 0 do          begin           BlockRead(f, ScanLine^[0], Handle.ResX*3);           for i:=0 to handle.ResX-1 do            begin             col:=RGBToCol(ScanLine^[i*3+2], ScanLine^[i*3+1], ScanLine^[i*3+0]);             if (bank<>((adr+i*2) shr 16)) then Zmien_bank((adr+i*2) shr 16);             Memw[$A000:((adr+i*2) and $0ffff)]:=col;            end;           adr:=adr-640*2;          end;        end;   8  : begin         adr:=(x+(y+handle.ResY-1)*640)*2;         zmien_bank(adr shr 16);         BlockRead(f, pal, 1023);         seek(f, handle.bitoffs);         GetMem(ScanLine, handle.ResX);         for j:=Handle.ResY-1 downto 0 do          begin           BlockRead(f, ScanLine^[0], Handle.ResX);           for i:=0 to handle.ResX-1 do            begin             col:=RGBToCol(pal[ScanLine^[i]*4+2], pal[ScanLine^[i]*4+1], pal[ScanLine^[i]*4+0]);             if (bank<>((adr+i*2) shr 16)) then Zmien_bank((adr+i*2) shr 16);             Memw[$A000:((adr+i*2) and $0ffff)]:=col;            end;           adr:=adr-640*2;          end;        end;  end;  close(f); end; begin SetVesaMode($111); LoadBmp('vesa.bmp',0,0); readln; off; end.




Chyba niedawno poruszalem podobny temat, ale teraz chodzi mi o wyswietlenie obrazka bmp np 20pikseli x 20pikseli na okreslonej pozycji na ekranie np x=10, y=50, jak to zrobic?

pisze tutaj zeby nie robic nowego tematu bo moje pytanie jest zwiazane z kodem ktory podalem. Chcialbym aby program wyswietlal plik bmp, ale np kolor czerwony tego obrazka bedzie wyswietlony jako przezroczysty, jak to zrobic?

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • zsf.htw.pl
  •