### IBaseColor

  IColor is a concrete class that encapsulates all possible color spaces including RGB, HSV, and CIE-XYZ. IBaseColor is a concrete class that encapsulates all possible color spaces including RGB, HSV, and CIE-XYZ. It has the default representation of compact RGB color; each element of red, green, and blue is represented by an 8-bit unsigned integer.

### IBaseColor - Member Functions and Data by Group

### Constructors & Destructor

Use the constructors and destructor in this group to create and destroy objects of class IBaseColor.

~IBaseColor

      public:
      virtual ~IBaseColor()

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

IBaseColor

  Overload 1
  Constructs of a predefined commonly used color.

      public:
      IBaseColor(EPredefinedColor commonlyUsedColor)

  commonlyUsedColor
    The name of the color to be constructed.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2
  Copy constructor.

      public:
      IBaseColor(const IBaseColor&)

  IBaseColor
    A constant reference to the color object to copy from.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 3
  Constructs a gray color.

      public:
      IBaseColor(CharIntensity gray, CharIntensity opacity = 255)

  gray
    The intensity of the gray color.
  opacity
    The opacity. The default value is 255.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 4
  Constructs the color from a compact RGB color.

      public:
      IBaseColor( CharIntensity red,
                  CharIntensity green,
                  CharIntensity blue,
                  CharIntensity opacity = 255 )

  red
    The red component of the color.
  green
    The green component of the color.
  blue
    The blue component of the color.
  opacity
    The opacity. The default value is 255.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 5
  Constructs a default black color.

      public:
      IBaseColor()

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Assignment Operator

Use the operator in this group to assign the given IBaseColor object to the target one.

operator =

      public:
      IBaseColor& operator =(const IBaseColor& source)

  Assignment operator.

  source
    The source color to be copied.

Return
  A reference to the color object.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Color Indexes

Use the functions in this group to create a color index from intensity values and to allow the object to modify itself from a color index value.

createIndex

      protected:
      long
        createIndex( CharIntensity r,
                     CharIntensity g,
                     CharIntensity b )

  Creates a color index from intensity values.

  r
    The red intensity of the color to be composed.
  g
    The green intensity of the color to be composed.
  b
    The blue intensity of the color to be composed.

Return
  Returns the number representing the color index value.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

rgbFromIndex

      protected:
      void rgbFromIndex(unsigned long index)

  Modifies itself from a color index value.

  index
    The color index value to be read in and converted to RGB.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Comparing Two IBaseColor Objects for Equality or Inequality

Use the functions in this group to test whether two IBaseColor objects are inequal or inequal.

operator !=

      public:
      bool operator !=(const IBaseColor&) const

  Tests two IBaseColor objects for inequality.

  IBaseColor
    A constant reference to the IBaseColor to be compared with this one.

Return
  True if the two colors don't have the same RGB values or opacity.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

operator ==
  Tests two IBaseColor objects for equality.

  IBaseColor
    A constant reference to the IBaseColor to be compared with this one.

      public:
      virtual bool operator ==(const IBaseColor&) const

  Tests two IBaseColor objects for equality.

Return
  True if the two colors have the same RGB values and opacity.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Converting Colors Across Color Spaces

Use the function in this group to convert a color from RGB to XYZ.

elementsInXYZColorSpace

      public:
      virtual void
        elementsInXYZColorSpace( GIntensity& x,
                                 GIntensity& y,
                                 GIntensity& z ) const

  Converts a RGB color to XYZ color space.

  x
    The returned x-component of the XYZ color.
  y
    The returned y-component of the XYZ color.
  z
    The returned z-component of the XYZ color.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Copying Colors

Use the function in this group to copy RGBA values from the source color.

copyRGBA

      protected:
      IBaseColor& copyRGBA(const IBaseColor& source)

  Copies RGBA values over from source color.

  source
    The source color to be copied.

Return
  A reference to the color object.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Getting Color Components

Use the functions in this group to get a color component or opacity value of a color.

blueMix

  Overload 1
  Returns the blue component of the compact RGB color.

      public:
      virtual CharIntensity blueMix() const

Return
  The value of the blue component.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2
  Gets the blue component of a floating-point RGB color by scaling into range of 0-1.

      public:
      virtual void blueMix(GIntensity& blue) const

  blue
    The returned blue component.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

gray

      public:
      virtual CharIntensity gray() const

  Returns the intensity of a gray color.

Return
  The intensity.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

greenMix

  Overload 1
  Gets the green component of a floating-point RGB color by scaling into range of 0-1.

      public:
      virtual void greenMix(GIntensity& green) const

  green
    The returned green component.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2
  Returns the green component of the compact RGB color.

      public:
      virtual CharIntensity greenMix() const

Return
  The value of the green component.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

opacity
  Use the functions in this group to get a color component or opacity value from a color.

  Overload 1
  Returns the opacity of the compact RGB color.

      public:
      virtual CharIntensity opacity() const

Return
  The value of the opacity.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2
  Gets the opacity value of a floating-point RGB color by scaling into range of 0-1.

      public:
      virtual void opacity(GIntensity& opacity) const

  opacity
    The returned opacity value.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

redMix

  Overload 1
  Gets the red component of a floating-point RGB color by scaling into range of 0-1.

      public:
      virtual void redMix(GIntensity& red) const

  red
    The returned red component.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2
  Returns the red component of the compact RGB color.

      public:
      virtual CharIntensity redMix() const

Return
  The value of the red component.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Setting Color Values

Use the functions in this group to set a color component or opacity value of a color.

setBlue

      public:
      virtual IBaseColor& setBlue(CharIntensity blue)

  Sets the blue component of the compact RGB color.

  blue
    The new blue.

Return
  reference of self

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setElementsInXYZColorSpace

      public:
      virtual void
        setElementsInXYZColorSpace( GIntensity x,
                                    GIntensity y,
                                    GIntensity z )

  Sets the color by converting an XYZ color to a compact RGB color.

  x
    The new x-component of the XYZ color.
  y
    The new y-component of the XYZ color.
  z
    The new z-component of the XYZ color.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setGreen

      public:
      virtual IBaseColor& setGreen(CharIntensity green)

  Sets the green component of the compact RGB color.

  green
    The new green.

Return
  reference of self

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setOpacity

      public:
      virtual IBaseColor& setOpacity(CharIntensity opacity)

  Sets the opacity of the compact RGB color.

  opacity
    The new opacity.

Return
  reference of self

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setRed

      public:
      virtual IBaseColor& setRed(CharIntensity red)

  Sets the red component of the compact RGB color.

  red
    The new red.

Return
  reference of self

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setRGB

      protected:
      void
        setRGB( CharIntensity r,
                CharIntensity g,
                CharIntensity b,
                CharIntensity o = 255 )

  Sets RGBA values in a single call.

  r
    The red color component
  g
    The green color component
  b
    The blue color component
  o
    The opacity. The default value is 255.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Streaming the Object In and Out

Use the functions in this group to read an IBaseColor object in from the specified stream or write it out to it.

readFromStream

      protected:
      virtual void readFromStream(IDataStream& fromWhere)

  Stream in this object from the stream in for polymorphic streaming

  fromWhere
    The steam for streaming in this object

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

writeToStream

      protected:
      virtual void writeToStream(IDataStream& toWhere) const

  Stream out this object to the stream for polymorphic streaming

  toWhere
    The steam for streaming out this object

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Miscellaneous Members

colorProfile

      protected:
      const IColorProfile* colorProfile() const

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

fBlue

      protected:
      CharIntensity fBlue

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

fgColorProfile

      protected:
      static const IColorProfile* fgColorProfile

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

fGreen

      protected:
      CharIntensity fGreen

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

fOpacity

      protected:
      CharIntensity fOpacity

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

fRed

      protected:
      CharIntensity fRed

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### IBaseColor - Enumerations

EPredefinedColor

      enum EPredefinedColor { kWhite=0,
                              kBlue,
                              kRed,
                              kPink,
                              kGreen,
                              kCyan,
                              kYellow,
                              kBlack,
                              kDarkGray,
                              kDarkBlue,
                              kDarkRed,
                              kDarkPink,
                              kDarkGreen,
                              kDarkCyan,
                              kBrown,
                              kPaleGray }

  Definition of some commonly used colors for convience.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### IBaseColor - Inherited Member Functions and Data

#### Inherited Public Functions

  IMStreamable

  -     virtual ~IMStreamable()

  -     void externalizeToStream(IDataStream& towhere) const

  -     void internalizeFromStream(IDataStream& fromwhere)

  -     virtual const ITypeRepresentation&
          typeRepresentation() const = 0

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  IMStreamable

  -     IMStreamable(const IMStreamable& other)

  -     IMStreamable()

  -     virtual void readFromStream(IDataStream& fromwhere) = 0

  -     virtual void writeToStream(IDataStream& towhere) const = 0

#### Inherited Protected Data

  - None