 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Pablo Bacigalupo Guest
|
Posted: Thu Dec 08, 2005 8:51 pm Post subject: How get the TCanvas pixel color for use with GDI+ SetColor ? |
|
|
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
|
Posted: Thu Dec 08, 2005 10:05 pm Post subject: Re: How get the TCanvas pixel color for use with GDI+ SetCol |
|
|
"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
|
Posted: Tue Dec 13, 2005 11:22 pm Post subject: Re: How get the TCanvas pixel color for use with GDI+ SetCol |
|
|
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 |
|
 |
|
|
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
|
|