BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TBitmap individual pixel access

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
Moon2
Guest





PostPosted: Fri Nov 10, 2006 10:26 pm    Post subject: TBitmap individual pixel access Reply with 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
Moon2
Guest





PostPosted: Sat Nov 11, 2006 9:10 am    Post subject: Re: TBitmap individual pixel access Reply with quote



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





PostPosted: Tue Nov 14, 2006 4:05 am    Post subject: Re: TBitmap individual pixel access Reply with quote



"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.