MM Developer's Guide
MM Interfaces | MM Methods | MM Types and Misc API

IMoaMmColor


Interface ID: IID_IMoaMmColor
Pointer type: PIMoaMmColor
Inheritance: IMoaUnknown
Header file: mmiClr.h

Description

This interface provides methods used to manipulate a MoaMmColorSpec. ColorToValue() and ValueToColor() convert between MoaMmColorSpec and MoaMmValue type. Included for convenience are IndexToRGB() and RGBToIndex(), which are exact duplicates of methods in IMoaUtils2.

Constants and Structures

MoaMmColorSpec
MoaMmRGBTriple
MoaMmColorIndex
typedef MoaByte MoaMmColorIndex, * PMoaMmColorIndex;


typedef struct
{
     MoaByte   red;
     MoaByte   green;
     MoaByte   blue;
} MoaMmRGBTriple, *PMoaMmRGBTriple;
typedef const MoaMmRGBTriple * ConstPMoaMmRGBTriple;


typedef struct
{
     union
     {
          MoaMmRGBTriple  rgb;        /* rgb color */
          MoaMmColorIndex index;      /* palette index */
     } color;

     MoaByte type; 

} MoaMmColorSpec, *PMoaMmColorSpec;
typedef const MoaMmColorSpec * ConstPMoaMmColorSpec;

Methods

ValueToColor()
ColorToValue()
RGBToIndex()
IndexToRGB()

ColorToValue()

Syntax

ColorToValue(ConstPMoaMmColorSpec pColor, PMoaMmValue pValue)

Parameters

pColor
ConstPointer to a moaMmColorSpec used as the basis for the new value
pValue
Pointer to a MoaMmValue that receives the result

Returns

MoaError

Description

Creates a new color type MoaMmValue from a MoaMmColorSpec. On entry, pColor contains a pointer to a MoaMmColorSpec to be used as the basis for the new value. See mmtypndx for the values to use in the type field. pValue contains a pointer to a MoaMmValue to receive the result. This call populates the data at pValue with a new MoaMmValue, overwriting any current value. Make sure to release any preexisting value before making this call. The caller is responsible for releasing the returned value. See IMoaValue::ValueRelease().

IndexToRGB()

Syntax

IndexToRGB(MoaMmColorIndex index, PMoaMmRGBTriple pRGBColor)

Parameters

index
The color index of the palette entry
pRGBColor
Pointer to a MoaMmRGBTriple to receive the result

Returns

MoaError

Description

Cross-platform method to convert color index specified to the corresponding RGB color in the current color palette. The palette currently in use by the playback window device is used for the lookup. The device must be set to indexed color (less than or equal to 8 bits pixel depth) for this method to work properly. If the device is set to a direct color mode (greater than 8 bits), the results are unpredictable. index specifies the color index of the palette entry of interest. pRGBColor contains a pointer to a MoaMmRGBTriple to receive the result.

RGBToIndex()

Syntax

RGBToIndex(ConstPMoaMmRGBTriple pRGBColor, PMoaMmColorIndex pIndex)

Parameters

pRGBColor
ConstPMoaMmRGBTriple
pIndex
PMoaMmColorIndex

Returns

MoaError

Description

Cross-platform method to convert RGB value specified to the closest corresponding index in the current color palette.

ValueToColor()

Syntax

ValueToColor(ConstPMoaMmValue pValue, PMoaMmColorSpec pColor)

Parameters

pValue
Const pointer to a color-type MoaMmValue
pColor
Pointer to a MoaMmColorSpec to receive the result

Returns

MoaError

Description

Obtains the MoaMmColorSpec for a color-type MoaMmValue. Returns kMoaMmErr_colorExpected if pValue is not a color-type value.

Copyright © 1995-2008 Adobe Macromedia Software LLC, Inc.