### IColorMap

### IColorMap - Member Functions and Data by Group

### Constructors & Destructor

Use these functions to create and destroy instances of this class.

~IColorMap

      public:
      virtual ~IColorMap()

  Destroy a color map instance.

Supported Platforms

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

IColorMap

  Construct a color map object.

  Overload 1

      public:
      IColorMap(const IColorMap&)

  Copy constructor.

  src
    The color map to be copied.

Supported Platforms

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

  Overload 2

      public:
      IColorMap(EColorMapType colorMapType = kUserDefined)

  Constructs a color map of the specified map type. The default map type is kUserDefined.

Supported Platforms

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

  Overload 3

      public:
      IColorMap(unsigned long, const IR8G8B8A8Color*)

  Constructs a color map.

  unsigned long
    The number of colors.
  const IR8G8B8A8Color*
    A pointer to a color array.

Supported Platforms

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

  Overload 4

      public:
      IColorMap(unsigned long numberOfColors = 256)

  Constructs a color map with the specified number of colors. The default is 256 colors.

Supported Platforms

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

  Overload 5

      public:
      IColorMap(IRGBAColorArray* colorArrayToAdopt)

  Constructs a color map with a color array. Accepts a pointer to the color array.

Supported Platforms

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

### Accessing the Color Data

Use these functions to access and manipulate the color data.

colorIndex

      public:
      unsigned long colorIndex(const IBaseColor&) const

  Returns the index of a color in the color map.

  p
    The IBaseColor whose index we need to get.

Exception

  IGraphicException | if the index is invalid

Supported Platforms

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

hasColorMapSupport

      public:
      static bool hasColorMapSupport()

  Returns true if the system supports colormaps.

Supported Platforms

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

isColorIndexAllocated

      public:
      bool isColorIndexAllocated(unsigned long index) const

  Returns true if the color index is allocated.

Supported Platforms

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

isSystemColor

      public:
      virtual bool isSystemColor(unsigned long) const

  Tests whether a color is a system color and returns true if the color is a system color.

  i
    The color index need to be tested.

Supported Platforms

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

mapColors

      public:
      unsigned long
        mapColors( unsigned long,
                   const IR8G8B8A8Color* )

  Map colors into the color array.

  unsigned long
    The number of colors.
  const IR8G8B8A8Color*
    A pointer to a color array.

Supported Platforms

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

numberOfColors

      public:
      unsigned long numberOfColors() const

  Returns the size of the color array.

Supported Platforms

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

operator []

      public:
      const IR8G8B8A8Color& operator [](unsigned long) const

  Index of operator to access the colors within the data structure.

Supported Platforms

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

releaseCells

      public:
      unsigned long releaseCells()

  Release all cells other than Reserved cells. Returns the number of released cells.

Supported Platforms

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

setColor

      public:
      virtual void setColor(unsigned long i, const IBaseColor& p)

  Sets the color of the specified index in the color map.
  i
    The index to the color map.
  p
    The IBaseColor of the specified index.

Exception

  IGraphicException | if the index is invalid

Supported Platforms

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

systemColorIndex

      public:
      static unsigned long systemColorIndex(const IBaseColor&)

  Get the index of a color in the system color map.

Supported Platforms

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

systemColorRGB

      public:
      static unsigned long systemColorRGB(const long)

  Get the rgb value of a color in the system color map, given the index.

Supported Platforms

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

### Assignment and Equality Operators

Use this operator function to handle color array assignment and equality tests.

operator =

      public:
      IColorMap& operator =(const IColorMap&)

  Assignment operator. Returns a non-constant reference to the left hand side object.

  Src
    The color map to be copied.

Supported Platforms

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

operator ==

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

  Tests the two color arrays for equality.

Supported Platforms

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

### Color Array Ownership

Use these functions to adopt and relinquish control of a color data array.

adoptColorArray

      public:
      virtual void
        adoptColorArray( unsigned long size,
                         IR8G8B8A8Color* colorArrayToAdopt )

  Accept ownership of a color array.

  size
    The size of the new color array data.
  colorArrayToAdopt
    Pointer to the color array data to be adopted.

Supported Platforms

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

orphanColorArray

      public:
      virtual IR8G8B8A8Color* orphanColorArray()

  Relinquishes knowledge of, and responsibility for, the color array and returns it to the caller. Returns a pointer to the color array data that was orphaned.

Supported Platforms

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

### Streaming Support

Use these functions to enable streaming of color maps.

operator <<=

      public:
      IDataStream& operator <<=(IDataStream&)

  This function supports streaming in the color map data.

Supported Platforms

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

operator >>=

      public:
      IDataStream& operator >>=(IDataStream&) const

  This function supports streaming out the color map data.

Supported Platforms

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

### Using Color Maps

Use these functions to work with various types of color maps for the underlying platform.

colorMapType

      public:
      EColorMapType colorMapType() const

  Return the type of the color map.

Supported Platforms

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

defaultColorMap

      public:
      static IColorMap& defaultColorMap()

  Returns a reference to a default system color map.

Supported Platforms

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

defaultSystemColorMap

      public:
      static IColorMap& defaultSystemColorMap()

  Returns a reference to a default system color map.

Supported Platforms

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

nativeColorMap

      public:
      unsigned long nativeColorMap()

  Creates a platform specific native palette using IRGBAColorArray data. Returns the native palette being created.

Supported Platforms

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

setColorMapType

      public:
      void setColorMapType(EColorMapType)

  Set the color map type to one of the values in EColorMapType.

Supported Platforms

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

setDefaultColorMap

      public:
      static void setDefaultColorMap(IColorMap*)

  Sets the default color map.

Supported Platforms

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

trueColorMap

      public:
      static IColorMap& trueColorMap()

  Returns a reference to a default true color map.

Supported Platforms

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

webSafeColorMap

      public:
      static IColorMap& webSafeColorMap()

  Returns a reference to a default web-safe color map.

Supported Platforms

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

### IColorMap - Enumerations

EColorCellStatus

      enum EColorCellStatus { kNotFound=-,
                              kReserved=0,
                              kFree=1,
                              kUsed=2 }

  The status of cells in the color array.

Supported Platforms

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

EColorMapType

      enum EColorMapType { kSystem=-,
                           kTrueColor=0,
                           kUserDefined=1 }

Supported Platforms

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

### IColorMap - Inherited Member Functions and Data

#### Inherited Public Functions

  IRGBAColorArray

  -     virtual ~IRGBAColorArray()

  -     IBaseColor color(unsigned long i) const

  -     IRGBAColorArray(unsigned long numberOfColors = 256)

  -     IRGBAColorArray(const IRGBAColorArray& source)

  -     IDataStream& operator <<=(IDataStream& fromWhere)

  -     IRGBAColorArray& operator =(const IRGBAColorArray& Src)

  -     virtual bool operator ==(const IRGBAColorArray&) const

  -     IDataStream& operator >>=(IDataStream& toWhere) const

  -     const IR8G8B8A8Color& operator [](unsigned long i) const

  -     IR8G8B8A8Color& operator [](unsigned long i)

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  - None

#### Inherited Protected Data

  - None