bitmap - Delphi TBitmap - why are Pixels and ScanLine different? -
while using 32 bit tbitmap, switched canvas.pixels scanline.
i set value red, find displayed blue.
any idea why?
here's code excerpt:
procedure tform1.formpaint(sender: tobject); var varbitmap: tbitmap; plock: pintegerarray; icolor: integer; begin varbitmap := tbitmap.create; varbitmap.pixelformat := pf32bit; varbitmap.width := 800; varbitmap.height := 600; // set pixels red varbitmap.canvas.pixels[0, 0] := $0000ff; // shows $ff0000 (blue) plock := varbitmap.scanline[0]; icolor := plock[0]; showmessagefmt('%x', [icolor]); // set scanline red plock[0] := $0000ff; // displays blue pixel canvas.draw(0, 0, varbitmap); end;
it seems somehow tcolor not same in memory, makes no sense.
any suggestions welcome. ;)
32bit pixel data in $aarrggbb
format. setting blue component, not red component. use $ff0000
instead of $0000ff
. or better, use rgb()
function.
Comments
Post a Comment