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

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -