Functions
RGBConversion

Functions

double mdlColor_intensityOf (UInt32 red, UInt32 green, UInt32 blue)
 Returns the intensity of an RGB triad. More...
 
int mdlColor_getBestBWContrast (UInt32 red, UInt32 green, UInt32 blue)
 Returns the best contrast value for the specified RGB triad. More...
 
int mdlColor_interpolateColors (byte *pInterpRgbs, RgbColorDef *pStart, RgbColorDef *pEnd, int rangeCount, int hsvRgbFlag)
 Used to generate a graduating scale of RGB values from a beginning and ending set of RGB values. More...
 
int mdlColor_elementColorToRGB (byte *pRgb, int *pMstrElemColor, DgnModelRefP modelRef, UInt32 elementColor, DgnPlatform::HsvColorDef *pHsvTable)
 
Used to obtain the RGB value corresponding to a

design file colortable color number. More...

 
int mdlColor_singleRgbToFixedColor (byte *pFixedIndex, int redValue, int grnValue, int bluValue)
 Finds the color index in the current color table for the given RGB triad. More...
 
void mdlColor_paletteToFixedColors (byte *pFixedPalette, byte *pRedMap, byte *pGrnMap, byte *pBluMap, int paletteSize)
 Finds the color entries for the specified RGB color entries. More...
 
int mdlColor_byteMapToFixedColors (byte *pFixed, byte *pByteMap, byte *pRedMap, byte *pGrnMap, byte *pBluMap, int paletteSize, Point2d *pSize)
 Applies a palette of fixed colors from the RGB entries to the specified byte-mapped image. More...
 
int mdlColor_packByteToFixedColors (byte *pFixed, byte *pPackByte, byte *pRedMap, byte *pGrnMap, byte *pBluMap, int paletteSize, Point2d *pSize)
 Applies a palette of fixed colors from the RGB entries to the specified packbyte image. More...
 
int mdlColor_rgbToFixedColors (byte *pFixed, byte *pRgb, Point2d *pSize)
 Applies the palette of fixed colors to the specified RBG image. More...
 
int mdlColor_elementColorToRGBInFile (byte *pRgb, DgnFileP dgnFile, UInt32 elementColor, DgnPlatform::HsvColorDef *pHsvTable)
 Used to obtain the RGB value corresponding to a design file colortable color number. More...
 
int mdlColor_elementColorFromRGBInFile (DgnFileP dgnFile, byte *pRgb)
 Used to obtain an appropriate element color number corresponding to a given DGN file and an RGB value. More...
 
int mdlColor_elementColorFromRGB (DgnModelRefP modelRef, byte *pRgb)
 Used to obtain an appropriate element color number corresponding to a given model reference and an RGB value. More...
 
void mdlColor_rgbToHsv (DgnPlatform::HsvColorDef *pHsv, RgbColorDef const *pRgb)
 Translates an RGB (Red-Green-Blue) color definition into its corresponding HSV (Hue-Saturation-Value) color definition. More...
 
void mdlColor_hsvToRgb (RgbColorDef *pRgb, DgnPlatform::HsvColorDef const *pHsv)
 mdlColor_hsvToRgb translates an HSV (Hue-Saturation-Value) color definition into its corresponding RGB (Red-Green-Blue) color definition. More...
 
double mdlColor_luminosityOf (UInt32 red, UInt32 green, UInt32 blue)
 Returns the luminosity of an RGB triad. More...
 
double mdlColor_brightnessOf (UInt32 red, UInt32 green, UInt32 blue)
 Returns the brightness of an RGB triad. More...
 

Detailed Description

Function Documentation

double mdlColor_brightnessOf ( UInt32  red,
UInt32  green,
UInt32  blue 
)

Returns the brightness of an RGB triad.

The red, green and blue members of the RGB are passed in as individual parameters.

Parameters
[in]redRed component of RGB
[in]greenGreen component of RGB
[in]blueBlue component of RGB
Returns
Returns the brightness of the RGB triad.
Remarks
Required Library: mdlbltin.lib
int mdlColor_byteMapToFixedColors ( byte pFixed,
byte pByteMap,
byte pRedMap,
byte pGrnMap,
byte pBluMap,
int  paletteSize,
Point2d *  pSize 
)

Applies a palette of fixed colors from the RGB entries to the specified byte-mapped image.

Parameters
[out]pFixedThe fixed color image (must be malloc'ed by caller)
[in]pByteMapThe byte-mapped image
[in]pRedMapRed palette entries
[in]pGrnMapGreen palette entries
[in]pBluMapBlue palette entries
[in]paletteSizeNumber of palette entries
[in]pSizeThe size of the image in pixels, X and Y
Returns
SUCCESS
Remarks
Required Library: mdlbltin.lib
int mdlColor_elementColorFromRGB ( DgnModelRefP  modelRef,
byte pRgb 
)

Used to obtain an appropriate element color number corresponding to a given model reference and an RGB value.

Parameters
[in]modelRefIndicates the master design file (MASTERFILE) or an attached reference file.
[in]pRgbPoints to an RGB value that needs a corresponding colortable color number.
Returns
An element color number.
See also
mdlColor_elementColorToRGB
Remarks
Required Library: mdlbltin.lib
int mdlColor_elementColorFromRGBInFile ( DgnFileP  dgnFile,
byte pRgb 
)

Used to obtain an appropriate element color number corresponding to a given DGN file and an RGB value.

Parameters
[in]dgnFileIndicates the design file where the intended color map resides.
[in]pRgbPoints to an RGB value that needs a corresponding colortable color number.
Returns
An element color number.
Remarks
Required Library: mdlbltin.lib
int mdlColor_elementColorToRGB ( byte pRgb,
int *  pMstrElemColor,
DgnModelRefP  modelRef,
UInt32  elementColor,
DgnPlatform::HsvColorDef *  pHsvTable 
)

Used to obtain the RGB value corresponding to a

design file colortable color number.

It can also be used to translate reference file color numbers to the closest matching master design file color number when different color tables are attached to each design file.

Parameters
[out]pRgbPoints to a buffer to receive the RGB value.
[in]pMstrElemColorIs only valid when colorIndex is an index to a reference file's color table; otherwise pMstrElemColorP is ignored. (colorIndex will be an index to a reference file's color table when fileNum is greater than zero). The integer pointed to by mstrElemColorP will be updated to contain the closest matching color to colorIndex that exists in the master colortable index.
[in]modelRefIndicates to which model's colortable the colorIndex parameter applies. If set to MASTERFILE, the active model's color table is used.
[in]elementColorIs the element color value (may contain true color in high bytes).
[in]pHsvTableIs a pointer to the master design file's colortable converted to HSV values. This is usually set to NULL.
Returns
SUCCESS or ERROR if a colortable corresponding to modelRef could not be obtained.
See also
mdlColor_elementColorFromRGB
Remarks
Required Library: mdlbltin.lib
int mdlColor_elementColorToRGBInFile ( byte pRgb,
DgnFileP  dgnFile,
UInt32  elementColor,
DgnPlatform::HsvColorDef *  pHsvTable 
)

Used to obtain the RGB value corresponding to a design file colortable color number.

It can also be used to translate reference file color numbers to the closest matching master design file color number when different color tables are attached to each design file.

Parameters
[out]pRgbPoints to a buffer to receive the RGB value.
[in]dgnFileIndicates to which file's colortable the colorIndex parameter applies.
[in]elementColorIs the element color value (may contain true color in high bytes).
[in]pHsvTableIs a pointer to the master design file's colortable converted to HSV values. This is usually set to NULL.
Returns
SUCCESS or ERROR if a colortable corresponding to modelRef could not be obtained.
Remarks
Required Library: mdlbltin.lib
int mdlColor_getBestBWContrast ( UInt32  red,
UInt32  green,
UInt32  blue 
)

Returns the best contrast value for the specified RGB triad.

The red, green and blue members of the RGB are passed in as individual parameters.

Parameters
[in]redRed component of RGB
[in]greenGreen component of RGB
[in]blueBlue component of RGB
Returns
BLACK_INDEX or WHITE_INDEX, whichever provides the best contrast
Remarks
Required Library: mdlbltin.lib
void mdlColor_hsvToRgb ( RgbColorDef *  pRgb,
DgnPlatform::HsvColorDef const *  pHsv 
)

mdlColor_hsvToRgb translates an HSV (Hue-Saturation-Value) color definition into its corresponding RGB (Red-Green-Blue) color definition.

Parameters
[out]pRgbIs a pointer to where the translated color definition should be placed.
[in]pHsvIs a pointer to the Hue-Saturation-Value definition to be translated.
Returns
No return value.
See also
mdlColor_rgbToHsv
Remarks
Required Library: mdlbltin.lib
double mdlColor_intensityOf ( UInt32  red,
UInt32  green,
UInt32  blue 
)

Returns the intensity of an RGB triad.

The red, green and blue members of the RGB are passed in as individual parameters.

Parameters
[in]redRed component of RGB
[in]greenGreen component of RGB
[in]blueBlue component of RGB
Returns
The intensity of the RGB triad.
Remarks
Required Library: mdlbltin.lib
int mdlColor_interpolateColors ( byte pInterpRgbs,
RgbColorDef *  pStart,
RgbColorDef *  pEnd,
int  rangeCount,
int  hsvRgbFlag 
)

Used to generate a graduating scale of RGB values from a beginning and ending set of RGB values.

The scale starts with the RGB value pointed to by startP and gradually blends over to the value pointed to by pEnd.

Parameters
[out]pInterpRgbsPoints to an array of RGB values to be filled in. The memory for this array must be allocated by the caller.
[in]pStartPoints to a beginning RGB value specifying one end of the color scale.
[in]pEndPoints to an ending RGB value specifying the opposite end of the color scale from pStart.
[in]rangeCountIndicates the number of RGB values to be generated in the scale. The array pointed to by interpRgbP must be large enough to hold rangeCount RGBs.
[in]hsvRgbFlagIndicates whether the color interpolation should be generated across RGB or HSV space. Zero indicates HSV color space. Non-zero indicates RGB color space.
Returns
SUCCESS or MDLERR_BADPARAMETER if rangeCount is invalid.
Remarks
Required Library: mdlbltin.lib
double mdlColor_luminosityOf ( UInt32  red,
UInt32  green,
UInt32  blue 
)

Returns the luminosity of an RGB triad.

The red, green and blue members of the RGB are passed in as individual parameters.

Parameters
[in]redRed component of RGB
[in]greenGreen component of RGB
[in]blueBlue component of RGB
Returns
The luminosity of the RGB triad.
Remarks
Required Library: mdlbltin.lib
int mdlColor_packByteToFixedColors ( byte pFixed,
byte pPackByte,
byte pRedMap,
byte pGrnMap,
byte pBluMap,
int  paletteSize,
Point2d *  pSize 
)

Applies a palette of fixed colors from the RGB entries to the specified packbyte image.

Parameters
[out]pFixedThe fixed color image (must be malloc'ed by caller)
[in]pPackByteThe packbyte image
[in]pRedMapRed palette entries
[in]pGrnMapGreen palette entries
[in]pBluMapBlue palette entries
[in]paletteSizeNumber of palette entries
[in]pSizeThe size of the image in pixels, X and Y
Returns
SUCCESS
Remarks
Required Library: mdlbltin.lib
void mdlColor_paletteToFixedColors ( byte pFixedPalette,
byte pRedMap,
byte pGrnMap,
byte pBluMap,
int  paletteSize 
)

Finds the color entries for the specified RGB color entries.

Parameters
[out]pFixedPalettethe array of fixed colors in the color palette
[in]pRedMapRed palette entries
[in]pGrnMapGreen palette entries
[in]pBluMapBlue palette entries
[in]paletteSizeNumber of palette entries
Returns
No return value.
Remarks
Required Library: mdlbltin.lib
int mdlColor_rgbToFixedColors ( byte pFixed,
byte pRgb,
Point2d *  pSize 
)

Applies the palette of fixed colors to the specified RBG image.

Parameters
[out]pFixedThe fixed color image (must be malloc'ed by caller)
[in]pRgbThe RGB image to apply the colors to
[in]pSizeThe size of the image, X and Y
Returns
SUCCESS
Remarks
Required Library: mdlbltin.lib
void mdlColor_rgbToHsv ( DgnPlatform::HsvColorDef *  pHsv,
RgbColorDef const *  pRgb 
)

Translates an RGB (Red-Green-Blue) color definition into its corresponding HSV (Hue-Saturation-Value) color definition.

Remarks
In the HSV color system, Hue ranges from 0-360 degrees with each value representing the spread of colors ranging from Red (0 & 360 degrees), Yellow (60 degrees), Green (120 degrees), Cyan (180 degrees), Blue (240 degrees), Magenta (300 degrees) and all colors in between. Saturation determines how much "whiteness" is mixed in with the color chosen by hue. A fully saturated (S = 100) color has no whiteness mixed in. On the other hand, an HSV color with a saturation value of zero will appear to be all white (or some shade of gray) regardless of the hue. The Value parameter of an HSV color determines the brightness of a color. When Value = 0, the color will appear black.
Parameters
[out]pHsvIs a pointer to where the translated color definition should be placed.
[in]pRgbIs a pointer to the Red-Green-Blue definition to be translated into an HSV color.
Returns
No return value.
See also
mdlColor_hsvToRgb
Remarks
Required Library: mdlbltin.lib
int mdlColor_singleRgbToFixedColor ( byte pFixedIndex,
int  redValue,
int  grnValue,
int  bluValue 
)

Finds the color index in the current color table for the given RGB triad.

Parameters
[out]pFixedIndexthe color table index for the given color
[in]redValueRed component of RGB
[in]grnValueGreen component of RGB
[in]bluValueBlue component of RGB
Returns
SUCCESS
Remarks
Required Library: mdlbltin.lib

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.