Recent

Author Topic: BGLBitmap and PBGRAPixel  (Read 1100 times)

denisduc

  • Newbie
  • Posts: 1
BGLBitmap and PBGRAPixel
« on: May 12, 2020, 12:18:41 pm »
Hi,

I need to create a bglbitmap using pixels color info, and for a BGRABitmap I used to do like this:

var
../..

p: PBGRAPixel;

begin
…/…

abgra:=tbgrabitmap.create(voxdimx,voxdimy,ColorToBGRA(ColorToRGB(clblack)));
p := abgra.Data;

j:=0;
while j<voxdimy do begin
k:=0;
while k<voxdimx do begin
p^.red:=imgbuffer8[voxdimy-j-1,k,0];
p^.green:=imgbuffer8[voxdimy-j-1,k,1];
p^.blue:=imgbuffer8[voxdimy-j-1,k,2];
inc(p);
inc(k);
end; //k
inc(j);
end; //j

Is there a way to do the same using a BGLBitmap ? I can not find a "PBGRAPixel" like for BGLBitmap….

I also assign the resulting abgra to a bglbitmap, but I think it's quite slow and may be speeded up.

Thanks a lot.

circular

  • Hero Member
  • *****
  • Posts: 4471
    • Personal webpage
Re: BGLBitmap and PBGRAPixel
« Reply #1 on: May 12, 2020, 06:26:56 pm »
Hello,

You can do something similar with TBGLBitmap, there is Data property as well, though there may be gaps between scanlines. So a safe way to get the address is to use ScanLine or GetPixelAddress.

Then you can use a PBGRAPixel as usual.

Regards
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018