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 

How get the TCanvas pixel color for use with GDI+ SetColor ?

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





PostPosted: Thu Dec 08, 2005 8:51 pm    Post subject: How get the TCanvas pixel color for use with GDI+ SetColor ? Reply with quote



Hi all !!
I would like to know, how to get the pixel color from the TCanvas of my
TForm,
and then use it with a GDI+ function, for example:

Gdiplus::Pen pen(Gdiplus::Color(255,0,0,0),1);
TColor myColor;

myColor = Canvas->Pixels[x][y];

// this line doesnt work like this...
// its only a pseudo code, right ?

pen->SetColor( myColor );


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Dec 08, 2005 10:05 pm    Post subject: Re: How get the TCanvas pixel color for use with GDI+ SetCol Reply with quote




"Pablo Bacigalupo" <pablolupo (AT) yahoo (DOT) com.ar> wrote


Quote:
// this line doesnt work like this...
// its only a pseudo code, right ?

pen->SetColor( myColor );

The Pen::SetColor() method expects a Gdiplus::Color object, ie:

Gdiplus::Pen pen(Gdiplus::Color(0,0,0), 1.0);
int rgb = ColorToRGB(Canvas->Pixels[x][y]);
pen->SetColor(Gdiplus::Color(GetRValue(rgb), GetGValue(rgb),
GetBValue(rgb)));

Or:
int rgb = ColorToRGB(Canvas->Pixels[x][y]);
Gdiplus::Pen pen(Gdiplus::Color(GetRValue(rgb), GetGValue(rgb),
GetBValue(rgb)), 1.0);


Gambit



Back to top
Pablo Bacigalupo
Guest





PostPosted: Tue Dec 13, 2005 11:22 pm    Post subject: Re: How get the TCanvas pixel color for use with GDI+ SetCol Reply with quote



Thank you very much Gambito, it is just what i was needing !!

"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> escribió en el mensaje
news:4398aed0$1 (AT) newsgroups (DOT) borland.com...
Quote:

"Pablo Bacigalupo" <pablolupo (AT) yahoo (DOT) com.ar> wrote in message
news:43989cb9 (AT) newsgroups (DOT) borland.com...

// this line doesnt work like this...
// its only a pseudo code, right ?

pen->SetColor( myColor );

The Pen::SetColor() method expects a Gdiplus::Color object, ie:

Gdiplus::Pen pen(Gdiplus::Color(0,0,0), 1.0);
int rgb = ColorToRGB(Canvas->Pixels[x][y]);
pen->SetColor(Gdiplus::Color(GetRValue(rgb), GetGValue(rgb),
GetBValue(rgb)));

Or:
int rgb = ColorToRGB(Canvas->Pixels[x][y]);
Gdiplus::Pen pen(Gdiplus::Color(GetRValue(rgb), GetGValue(rgb),
GetBValue(rgb)), 1.0);


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.