Page 1 of 1
Pen RGB values
Posted: Sun Jul 02, 2017 9:20 pm
by mritter0
Code: Select all
if ((di=IIntuition->GetScreenDrawInfo(Scr)))
{
BackgroundPen=di->dri_Pens[BACKGROUNDPEN];
IIntuition->FreeScreenDrawInfo(Scr,di);
}
How do I go about getting the RGB values for BackgroundPen? Or any pen. I eventually want to turn them into HTML hex code, #FF00FF.
Re: Pen RGB values
Posted: Sun Jul 02, 2017 10:49 pm
by broadblues
You need to get the Colour Map of the current ViewPort and use IGraphics->GetRGB32() to read out the entries your are interested in.
in psuedo code
Screen = LockPubScreen
ViewPort = Screen->ViewPort
ColourMap = Viewport->ColourMap
uint32 colour[3];
IGraphics->GetRGB32(cm, pen, 1, &colour)
UnlockScreen
remeber the colours are in 32bits left justified fractions, dive bu 0x10101010 to get back to 0 to 255 per channel.
See intuition/screens.h and graphicas library autodoc etc for the exact structure definition in the above pseudo code.
Re: Pen RGB values
Posted: Mon Jul 03, 2017 1:17 am
by mritter0
Got it. Thanks.