| View previous topic :: View next topic |
| Author |
Message |
Moon2 Guest
|
Posted: Fri Nov 10, 2006 10:26 pm Post subject: TBitmap individual pixel access |
|
|
Hi all, I have a mask that passes over my image 3x3 radius so all I need to
do is access 9 pixels at a time.
if i do the ffg tbitmap->Canvas->Pixels[x][y] that returns a TColor. How can
i get pixels in a 24bit format. Essentially I want the following:
TRGBTriple* value;
value = tbitmap->Canvas->Pixels[x][y];
then access the 3 color bands in value. Obviously the line of code above
isnt going to work. Can anyone tell me how to do this. A scanline is not
nessecary here and will be much slower in this case.
Regards Michael |
|
| Back to top |
|
 |
Moon2 Guest
|
Posted: Sat Nov 11, 2006 9:10 am Post subject: Re: TBitmap individual pixel access |
|
|
I found out how to do it using the win api. Thanks
"Moon2" <sbi (AT) telkomsa (DOT) net> wrote in message
news:45556059 (AT) newsgroups (DOT) borland.com...
| Quote: | Hi all, I have a mask that passes over my image 3x3 radius so all I need
to do is access 9 pixels at a time.
if i do the ffg tbitmap->Canvas->Pixels[x][y] that returns a TColor. How
can i get pixels in a 24bit format. Essentially I want the following:
TRGBTriple* value;
value = tbitmap->Canvas->Pixels[x][y];
then access the 3 color bands in value. Obviously the line of code above
isnt going to work. Can anyone tell me how to do this. A scanline is not
nessecary here and will be much slower in this case.
Regards Michael
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Nov 14, 2006 4:05 am Post subject: Re: TBitmap individual pixel access |
|
|
"Moon2" <sbi (AT) telkomsa (DOT) net> wrote in message
news:45556059 (AT) newsgroups (DOT) borland.com...
| Quote: | How can i get pixels in a 24bit format.
|
You have to set the TBitmap's PixelFormat property to pf24bit first, and
then you can use the ScanLines property instead of the Pixels property, ie.
tbitmap->PixelFormat = pf24bit;
...
TRGBTriple* row = (TRGBTriple*) tbitmap->ScanLines[y];
TRGBTriple& value = row[x];
| Quote: | then access the 3 color bands in value. Obviously the line of code
above isnt going to work. Can anyone tell me how to do this.
A scanline is not nessecary here and will be much slower in this case.
|
Not true. Using the ScanLines is the fastest way to access the raw pixel
values. Using the Pixels property, on the other hand, is very slow.
Gambit |
|
| Back to top |
|
 |
|