The IColor class allows you to query and set the color of various areas of windows represented by Open Class Library window objects. IColor is also a base class for other color classes.
The color intensities of this class are 8-bit quantities and are represented as an unsigned char, resulting in intensity values from 0 to 255, with 255 the maximum intensity. X supports color intensities that are an unsigned short or 16 bits, and recognizes values from 0 to 65535.
Use the asPixel and the constructor that takes a pixel.
Constructors & DestructorUse the constructors and destructor in this group to create and destroy objects of class IColor.
![]() |
public:
virtual ~IColor()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
IColor(ESystemColor value)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IColor(const IColor& color)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IColor( unsigned long index, const IColorMap* referencedColorMap = NULL )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IColor(EPredefinedColor color)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IColor( CharIntensity red, CharIntensity green, CharIntensity blue, CharIntensity opacity = 255 )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Assignment OperatorUse the operator in this group to assign the given IColor object to the target one.
![]() |
public:
IColor& operator =(const IColor& color)
This assignment operator replaces the color. If the IColor object on the right hand side of the = was created using the constructor that accepts a ESystemColor value and still is linked to the system color area, the link is copied also.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Comparing Two IColor Objects for EqualityUse the function in this group to compare two IColor objects for equality.
![]() |
public:
virtual bool operator ==(const IBaseColor& color) const
Returns true if the colors are identical. The current red, green, and blue values are compared to determine identity.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Converting Across Color SpacesUse the function in this group to convert an RGB color to XYZ.
![]() |
public:
virtual void elementsInXYZColorSpace( GIntensity& x, GIntensity& y, GIntensity& z ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Getting Color ValuesUse the functions in this group to obtain a color component value or intensity value.
![]() |
public:
long asRGBLong() const
Returns the red, green, and blue color values combined into a long integer.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
You can use this function to obtain the color as a long value and; then convert it to the hexadecimal format #RRGGBB. X11 recognizes this format; however, this format has been discouraged as of Release 5 of XLib (X11R5).
![]() |
public:
virtual void blueMix(GIntensity& blue) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
virtual CharIntensity blueMix() const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual CharIntensity gray() const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual CharIntensity greenMix() const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
virtual void greenMix(GIntensity& green) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual void opacity(GIntensity& opacity) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
virtual CharIntensity opacity() const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
IBaseColor::EPredefinedColor predefinedColor() const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Returns the value of the red component.
public:
virtual void redMix(GIntensity& red) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
virtual CharIntensity redMix() const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
ESystemColor runtimeGuiColor() const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Setting Color ValuesUse the functions in this group to set color component values or intensity values.
![]() |
public:
virtual IBaseColor& setBlue(CharIntensity blue)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual void setElementsInXYZColorSpace( GIntensity x, GIntensity y, GIntensity z )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual IBaseColor& setGreen(CharIntensity green)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual IBaseColor& setOpacity(CharIntensity opacity)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual IBaseColor& setRed(CharIntensity red)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Streaming an Object In and OutUse the functions in this group to read an IColor object in from the specified stream or write it out to it.
![]() |
protected:
virtual void readFromStream(IDataStream& fromWhere)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
protected:
virtual void writeToStream(IDataStream& toWhere) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Miscellaneous MembersThe color intensities of this class are 8-bit quantities and are represented as an unsigned char, resulting in intensity values from 0 to 255, with 255 the maximum intensity. X supports color intensities that are an unsigned short or 16 bits, and recognizes values from 0 to 65535.
Use the asPixel and the constructor that takes a pixel.
![]() |
public:
virtual long index() const
| IInvalidRequest | The object cannot be represented by a color table index. |
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
The following list contains the index values and colors found in a logical color table. The values in parentheses show the corresponding color from the file rgb.txt.
The following list contains the index values and colors found in a logical color table:
The following list contains the index values and colors found in the default system palette:
![]() |
enum ESystemColor { kShadowIconHiliteBgnd=0,
kShadowIconHiliteFgnd,
kShadowIconText,
kEntryFieldBgnd,
kListBoxBgnd,
kDisableMenuText,
kMenuHiliteText,
kMenuHiliteBgnd,
kNotebookPageBgnd,
kInactiveScrollBar,
kDefaultControl,
kButtonLight,
kButtonMiddle,
kButtonDark,
kDefaultButton,
kTitleLine,
kMenuShadow,
kDialogShadow,
kIconText,
kDialogBgnd,
kHiliteFgnd,
kHiliteBgnd,
kInactiveTitleTextBgnd,
kActiveTitleTextBgnd,
kInactiveTitleText,
kActiveTitleText,
kOutputText,
kWindowStaticText,
kScrollBar,
kDesktopBgnd,
kActiveTitleBgnd,
kInactiveTitleBgnd,
kMenuBgnd,
kWindowBgnd,
kFrameBorder,
kMenuText,
kWindowText,
kTitleText,
kSizeBar,
kScrollArrow,
kActiveFrameBorder,
kInactiveFrameBorder,
kMainWindowBgnd,
kHelpWindowBgnd,
kHelpText,
kHelpHiliteText,
shadowIconHiliteBgnd=0,
shadowIconHiliteFgnd=1,
shadowIconText=2,
entryFieldBgnd=3,
listBoxBgnd=4,
disableMenuText=5,
menuHiliteText=6,
menuHiliteBgnd=7,
notebookPageBgnd=8,
inactiveScrollBar=9,
defaultControl=10,
buttonLight=11,
buttonMiddle=12,
buttonDark=13,
defaultButton=14,
titleLine=15,
menuShadow=16,
dialogShadow=17,
iconText=18,
dialogBgnd=19,
hiliteFgnd=20,
hiliteBgnd=21,
inactiveTitleTextBgnd=22,
activeTitleTextBgnd=23,
inactiveTitleText=24,
activeTitleText=25,
outputText=26,
windowStaticText=27,
scrollBar=28,
desktopBgnd=29,
activeTitleBgnd=30,
inactiveTitleBgnd=31,
menuBgnd=32,
windowBgnd=33,
frameBorder=34,
menuText=35,
windowText=36,
titleText=37,
sizeBar=38,
scrollArrow=39,
activeFrameBorder=40,
inactiveFrameBorder=41,
mainWindowBgnd=42,
helpWindowBgnd=43,
helpText=44,
helpHiliteText=45 }| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
virtual ~IBaseColor()
IBaseColor()
IBaseColor(const IBaseColor&)
IBaseColor(EPredefinedColor commonlyUsedColor)
IBaseColor(CharIntensity gray, CharIntensity opacity = 255)
IBaseColor( CharIntensity red, CharIntensity green, CharIntensity blue, CharIntensity opacity = 255 )
bool operator !=(const IBaseColor&) const
IBaseColor& operator =(const IBaseColor& source)
virtual bool operator ==(const IBaseColor&) const
virtual ~IMStreamable()
void externalizeToStream(IDataStream& towhere) const
void internalizeFromStream(IDataStream& fromwhere)
virtual const ITypeRepresentation& typeRepresentation() const = 0
const IColorProfile* colorProfile() const
IBaseColor& copyRGBA(const IBaseColor& source)
long createIndex( CharIntensity r, CharIntensity g, CharIntensity b )
void rgbFromIndex(unsigned long index)
void setRGB( CharIntensity r, CharIntensity g, CharIntensity b, CharIntensity o = 255 )
IMStreamable()
IMStreamable(const IMStreamable& other)
virtual void readFromStream(IDataStream& fromwhere) = 0
virtual void writeToStream(IDataStream& towhere) const = 0
CharIntensity fBlue
static const IColorProfile* fgColorProfile
CharIntensity fGreen
CharIntensity fOpacity
CharIntensity fRed