Functions
Color Descriptors

Functions

int mdlColor_convertRGBtoIndex (int screen, RgbColorDef *pColor)
 Obtains an index of the Color Manager's display colors representing the closest match to rgb. More...
 
int mdlColorDescr_getColorId (int *pColorId, BSIColorDescrCP pCd)
 Used to query a color descriptor for its X Color ID value. More...
 
int mdlColorDescr_getElemColorNumber (int *pElemColorNumber, BSIColorDescrCP pCd)
 Used to query a color descriptor for its associated element color number. More...
 
int mdlColorDescr_getHsv (DgnPlatform::HsvColorDef *pHsv, BSIColorDescrCP pCd)
 Used to query a color descriptor for its HSV value. More...
 
int mdlColorDescr_getMenuColor (int *pMenuColorId, BSIColorDescrCP pCd)
 Used to query a color descriptor for its associated menu color, also known as a "fixed color.". More...
 
int mdlColorDescr_getRgb (RgbColorDef *pRgb, BSIColorDescrCP pCd)
 Query a color descriptor for its RGB value. More...
 
BSIColorDescrP mdlColorDescr_getBestBWContrast (int screen, BSIColorDescrCP pCd)
 Returns a pointer to either a black or white color descriptor, whichever provides the best contrast to pCd as a foreground color. More...
 
int mdlColorDescr_getDrawIndex (int *pDrawIndex, BSIColorDescrCP pColorDescr, int screen)
 Acquire a draw value from a color descriptor for a given screen. More...
 
int mdlColorDescr_setDrawIndex (BSIColorDescr *pColorDescr, long drawIndex, int screen)
 Used to force a color descriptor to always yield a specific draw value for a given screen. More...
 
int mdlColorDescr_setByRgb (BSIColorDescr *pColorDescr, RgbColorDef *pRgb, int matchToDgnCtbl)
 Set a color descriptor from the given RGB triad. More...
 
int mdlColorDescr_setByHsv (BSIColorDescr *pColorDescr, DgnPlatform::HsvColorDef *pHsv, int matchToDgnCtbl)
 Set a color descriptor from an HSV color structure. More...
 
int mdlColorDescr_setByColorId (BSIColorDescr *pColorDescr, int colorID, int matchToDgnCtbl)
 Set the RGB value of the given color descriptor according to the RGB associated with colorID. More...
 
int mdlColorDescr_setByColorName (BSIColorDescr *pColorDescr, WCharCP pColorName, int matchToDgnCtbl)
 Used to set the RGB value of the given color descriptor according to the RGB associated with colorName. More...
 
int mdlColorDescr_setByMenuColor (BSIColorDescr *pColorDescr, int menuColorId)
 Used to set a color descriptor according to the MicroStation defined "menu colors." The menu colors are:
BLACK_INDEX,
BLUE_INDEX,
GREEN_INDEX,
CYAN_INDEX,
RED_INDEX,
MAGENTA_INDEX,
YELLOW_INDEX,
WHITE_INDEX,
LGREY_INDEX,
DGREY_INDEX,
MGREY_INDEX and
PSEUDOWHITE_INDEX. More...
 
int mdlColorDescr_setByElemColorNumber (BSIColorDescr *pColorDescr, int elemColorNumber)
 Used to set the RGB value of the given color descriptor with the design file colortable RGB indexed by elemColorNumber. More...
 

Detailed Description

Function Documentation

int mdlColor_convertRGBtoIndex ( int  screen,
RgbColorDef *  pColor 
)

Obtains an index of the Color Manager's display colors representing the closest match to rgb.

Parameters
[in]screenIndicates the right (0) or left (1) screen.
[in]pColorIs the color definition to match against the Color Manager's display colors.
Returns
Color Manager display color index corresponding to rgb. The index will be in the 0-255 range, depending on the video hardware in use.
See also
mdlColor_matchColorMap
Remarks
Required Library: mdlbltin.lib
BSIColorDescrP mdlColorDescr_getBestBWContrast ( int  screen,
BSIColorDescrCP  pCd 
)

Returns a pointer to either a black or white color descriptor, whichever provides the best contrast to pCd as a foreground color.

Parameters
[in]screenIndicates the screen being drawn to.
[in]pCdIs a color descriptor pointer for the background color.
Returns
mdlColorDescr_getBestBWContrast returns a pointer to a color descriptor.
Remarks
Required Library: mdlbltin.lib
int mdlColorDescr_getColorId ( int *  pColorId,
BSIColorDescrCP  pCd 
)

Used to query a color descriptor for its X Color ID value.

Valid X Color ID values are defined in colrname.r.h.

Parameters
[out]pColorIdPoints to an integer that is to receive the color ID.
[in]pCdIs a color descriptor pointer usually obtained from a MicroStation color palette using the mdlColorPal_getColorDescr function.
Returns
SUCCESS or MDLERR_BADCOLORDESCR if the color descriptor pointer pCd is invalid.
See also
mdlColorDescr_getColorName mdlColorDescr_setByColorId mdlColorPal_getColorDescr
Remarks
Required Library: mdlbltin.lib
int mdlColorDescr_getDrawIndex ( int *  pDrawIndex,
BSIColorDescrCP  pColorDescr,
int  screen 
)

Acquire a draw value from a color descriptor for a given screen.

This function rarely needs to be called from MDL applications since drawing routines accept pointers to color descriptors directly. MicroStation uses this function internally to obtain the draw values contained in color descriptors.

Parameters
[out]pDrawIndexIs the address of a memory location to receive the draw value. Depending on the hardware/operating system platform, the draw value will be a video hardware pixel index or the native operating system's equivalent type.
[in]pColorDescris the color descriptor from which drawValueP will be obtained.
[in]screenindicates the screen for which pDrawValue will be obtained.
Remarks
Error Code Reason
MDLERR_BADSCREENNUMBER Invalid screen parameter
MDLERR_BADCOLORDESCR pColorDescr is not valid
Returns
SUCCESS if pDrawValue can be obtained.
See also
mdlColorDescr_setDrawIndex
int mdlColorDescr_getElemColorNumber ( int *  pElemColorNumber,
BSIColorDescrCP  pCd 
)

Used to query a color descriptor for its associated element color number.

Parameters
[out]pElemColorNumberIs a pointer to an integer to receive the element color number.
[in]pCdIs a color descriptor pointer usually obtained from a MicroStation color palette using the mdlColorPal_getColorDescr function.
Returns
SUCCESS or MDLERR_BADCOLORDESCR if the color descriptor pointer pCd is invalid.
See also
mdlColorDescr_setByElemColorNumber mdlColorPal_getColorDescr
Remarks
Required Library: mdlbltin.lib
int mdlColorDescr_getHsv ( DgnPlatform::HsvColorDef *  pHsv,
BSIColorDescrCP  pCd 
)

Used to query a color descriptor for its HSV value.

Parameters
[out]pHsvPoints to an HSV variable to receive the HSV data.
[in]pCdIs a color descriptor pointer usually obtained from a MicroStation color palette using the mdlColorPal_getColorDescr function.
Returns
SUCCESS or MDLERR_BADCOLORDESCR if the color descriptor pointer pCd is invalid.
See also
mdlColorDescr_getRgb mdlColorDescr_setByHsv mdlColorPal_getColorDescr
Remarks
Required Library: mdlbltin.lib
int mdlColorDescr_getMenuColor ( int *  pMenuColorId,
BSIColorDescrCP  pCd 
)

Used to query a color descriptor for its associated menu color, also known as a "fixed color.".

Parameters
[out]pMenuColorIdPoints to an integer that is to receive the color ID.
[in]pCdIs a color descriptor pointer usually obtained from a MicroStation color palette using the mdlColorPal_getColorDescr function.
Returns
SUCCESS or MDLERR_BADCOLORDESCR if the color descriptor pointer pCd is invalid.
See also
mdlColorDescr_setByMenuColor mdlColorPal_getColorDescr
Remarks
Required Library: mdlbltin.lib
int mdlColorDescr_getRgb ( RgbColorDef *  pRgb,
BSIColorDescrCP  pCd 
)

Query a color descriptor for its RGB value.

Parameters
[out]pRgbPoints to an RGB variable to receive the RGB data.
[in]pCdIs a color descriptor pointer usually obtained from a MicroStation color palette using the mdlColorPal_getColorDescr function.
Returns
SUCCESS or MDLERR_BADCOLORDESCR if the color descriptor pointer pCd is invalid.
See also
mdlColorDescr_getHsv mdlColorDescr_setByRgb mdlColorPal_getColorDescr
Remarks
Required Library: mdlbltin.lib
int mdlColorDescr_setByColorId ( BSIColorDescr *  pColorDescr,
int  colorID,
int  matchToDgnCtbl 
)

Set the RGB value of the given color descriptor according to the RGB associated with colorID.

Parameters
[out]pColorDescrPoints to the color descriptor to receive the new setting.
[in]colorIDIs one of the color ID macros defined in colrname.r.h and indicates (indirectly) the RGB value to set in cdP.
[in]matchToDgnCtblControls how the draw value for cdP is calculated. If matchToDgnCtbl is true, the draw value will correspond to the closest RGB in the attached colortable. If matchToDgnCtbl is false, the draw value will correspond to the closest RGB in the video hardware. This parameter is usually set to false.
Returns
SUCCESS if the color descriptor was set. MDLERR_BADCOLORDESCR is returned if cdP is an invalid pointer. MDLERR_RSCSTRINGNOTFOUND is returned if the stringlist resource containing the colorids could not be loaded or if colorID did not match any IDs in MicroStation's list of valid color IDs.
See also
mdlColorDescr_getColorId mdlColorDescr_setByColorName
Remarks
Required Library: mdlbltin.lib
int mdlColorDescr_setByColorName ( BSIColorDescr *  pColorDescr,
WCharCP  pColorName,
int  matchToDgnCtbl 
)

Used to set the RGB value of the given color descriptor according to the RGB associated with colorName.

Parameters
[out]pColorDescrPoints to the color descriptor to receive the new setting.
[in]pColorNameIs an ASCII color name which is contained in one of the standard MicroStation color name stringlists. The string is located in the stringlists and its associated RGB value is saved. This RGB value will be used to set the color descriptor.
[in]matchToDgnCtblControls how the draw value for cdP is calculated. If matchToDgnCtbl is true, the draw value will correspond to the closest RGB in the attached colortable. If matchToDgnCtbl is false, the draw value will correspond to the closest RGB in the video hardware. This parameter is usually set to false.
Returns
SUCCESS if the color name was valid and the color descriptor could be set. MDLERR_BADCOLORDESCR is returned if cdP is an invalid pointer. MDLERR_RSCSTRINGNOTFOUND is returned if the stringlist resource containing the color names could not be loaded or if colorName did not match any names in MicroStation's list of valid color names.
See also
mdlColorDescr_setByColorId
Remarks
Required Library: mdlbltin.lib
int mdlColorDescr_setByElemColorNumber ( BSIColorDescr *  pColorDescr,
int  elemColorNumber 
)

Used to set the RGB value of the given color descriptor with the design file colortable RGB indexed by elemColorNumber.

Parameters
[out]pColorDescrPoints to the color descriptor to receive the new setting.
[in]elemColorNumberIs an index into the currently attached master design file colortable, or the MicroStation default colortable if no colortable is attached.
Returns
SUCCESS if the color descriptor could be set. MDLERR_BADCOLORDESCR is returned if pColorDescr is an invalid pointer.
See also
mdlColorDescr_getElemColorNumber
Remarks
Required Library: mdlbltin.lib
int mdlColorDescr_setByHsv ( BSIColorDescr *  pColorDescr,
DgnPlatform::HsvColorDef *  pHsv,
int  matchToDgnCtbl 
)

Set a color descriptor from an HSV color structure.

The HSV data is stored internally to the color descriptor as RGB data.

Parameters
[out]pColorDescrPoints to a color descriptor to receive the setting.
[in]pHsvPoints to the HSV data. This data will be converted to RGB and used to set the color descriptor.
[in]matchToDgnCtblControls how the draw value for cdP is calculated. If matchToDgnCtbl is true, the draw value will correspond to the closest RGB in the attached colortable. If matchToDgnCtbl is false, the draw value will correspond to the closest RGB in the video hardware. This parameter is usually set to false.
Returns
SUCCESS if the color descriptor could be set. MDLERR_BADCOLORDESCR is returned if pColorDescr is an invalid pointer. MDLERR_BADARG is returned if pHsv is NULL.
See also
mdlColorDescr_getHsv mdlColorDescr_setByRgb
Remarks
Required Library: mdlbltin.lib
int mdlColorDescr_setByMenuColor ( BSIColorDescr *  pColorDescr,
int  menuColorId 
)

Used to set a color descriptor according to the MicroStation defined "menu colors." The menu colors are:
BLACK_INDEX,
BLUE_INDEX,
GREEN_INDEX,
CYAN_INDEX,
RED_INDEX,
MAGENTA_INDEX,
YELLOW_INDEX,
WHITE_INDEX,
LGREY_INDEX,
DGREY_INDEX,
MGREY_INDEX and
PSEUDOWHITE_INDEX.

Parameters
[out]pColorDescrPoints to a color descriptor to receive the setting.
[in]menuColorIdIs one of the menu color IDs (shown above) defined in msdefs.h.
Returns
SUCCESS if the color descriptor could be set. MDLERR_BADCOLORDESCR is returned if pColorDescr is an invalid pointer.
See also
mdlColorDescr_getMenuColor
Remarks
Required Library: mdlbltin.lib
int mdlColorDescr_setByRgb ( BSIColorDescr *  pColorDescr,
RgbColorDef *  pRgb,
int  matchToDgnCtbl 
)

Set a color descriptor from the given RGB triad.

Parameters
[out]pColorDescrPoints to a color descriptor to receive the setting.
[in]pRgbPoints to the RGB data that is used to set the color descriptor.
[in]matchToDgnCtblControls how the draw value for cdP is calculated. If matchToDgnCtbl is true, the draw value will correspond to the closest RGB in the attached colortable. If matchToDgnCtbl is false, the draw value will correspond to the closest RGB in the video hardware. This parameter is usually set to false.
Returns
SUCCESS if the color descriptor could be set. MDLERR_BADCOLORDESCR is returned if pColorDescr is an invalid pointer. MDLERR_BADARG is returned if rgbP is NULL.
See also
mdlColorDescr_getRgb mdlColorDescr_setByHsv
Remarks
Required Library: mdlbltin.lib
int mdlColorDescr_setDrawIndex ( BSIColorDescr *  pColorDescr,
long  drawIndex,
int  screen 
)

Used to force a color descriptor to always yield a specific draw value for a given screen.

(A color descriptor "yields" a draw value when queried by the function mdlColorDescr_getDrawIndex). It is up to the caller to maintain this draw value as the MicroStation color environment changes. This function is not recommended for general use. Instead, use one of the mdlColorDescr_setBy... routines to set color descriptors since this will allow MicroStation to maintain the draw values automatically.

Parameters
[out]pColorDescrPoints to a color descriptor to receive the setting.
[in]drawIndexSpecifies the draw value to store in the color descriptor.
[in]screenIndicates for which screen the color descriptor will yield drawIndex when queried by mdlColorDescr_getDrawIndex.
Returns
SUCCESS if the color descriptor could be set. MDLERR_BADCOLORDESCR is returned if cdP is an invalid pointer.
See also
mdlColorDescr_getDrawIndex
Remarks
Required Library: mdlbltin.lib

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