Functions
Color Palettes

Functions

int mdlColorPal_create (DgnPlatform::BSIColorPalette **ppPalette, int numEntries)
 Used to create a MicroStation color palette. More...
 
int mdlColorPal_destroy (DgnPlatform::BSIColorPalette **ppPalette)
 Used to free a color palette and its constituent color descriptors. More...
 
int mdlColorPal_queryEntry (void *pReply, int replyDataSize, DgnPlatform::BSIColorPalette *pPalette, int index, long queryMethodId, int screen)
 Retrieves a single entry from the specified color palette. More...
 
int mdlColorPal_getDrawValue (long *pDrawIndex, DgnPlatform::BSIColorPalette *pPalette, int index, int screen)
 
Used to acquire a draw value from a color palette

entry for a given screen. More...

 
int mdlColorPal_setPaletteFromColortable (DgnPlatform::BSIColorPalette *pPalette, byte *pCtbl)
 Set a color palette of 256 entries from a 256 color colortable. More...
 
int mdlColorPal_modifyStatus (DgnPlatform::BSIColorPalette *pPalette, UInt32 statusMask, int setFlag)
 Change the status of a color palette. More...
 
BSIColorDescr * mdlColorPal_getColorDescr (DgnPlatform::BSIColorPalette *pPalette, int index)
 Used to obtain a color descriptor pointer from the palette entry indicated by index. More...
 
int mdlColorPal_getNumColors (DgnPlatform::BSIColorPalette *pPalette)
 Returns the number of color entries defined in the color palette pointed to by paletteP. More...
 
int mdlColorPal_getElemColorDescrByModelRef (BSIColorDescr **ppCd, int colorNumber, DgnModelRefP modelRef, int screen)
 Returns a color descriptor obtained from the specified model for the given color index. More...
 
int mdlColor_getNumLoadedColors (int screen)
 Returns the number of colors loaded for the specified screen. More...
 

Detailed Description

Function Documentation

int mdlColor_getNumLoadedColors ( int  screen)

Returns the number of colors loaded for the specified screen.

Parameters
[in]screenThe index of the screen to get the information from
Returns
The number of colors loaded for the screen
Remarks
Required Library: mdlbltin.lib
int mdlColorPal_create ( DgnPlatform::BSIColorPalette **  ppPalette,
int  numEntries 
)

Used to create a MicroStation color palette.

A MicroStation color palette is a collection of color descriptors. Each color descriptor, in turn, allows a programmer to define a color for drawing to a window without regard to the color capabilities of the video hardware present. For example, a color palette of 300 color descriptors may be set up even if the hardware capabilities of the current system can only display 16 colors. This helps to provide for hardware independent applications.

Parameters
[out]ppPaletteIs the address of a color palette pointer. The pointer will be set to the newly allocated palette. When an application terminates, the palette and all associated descriptors are automatically freed. After allocating a color palette, mdlColorPal_setEntries must be called to initialize the color descriptors therein.
[in]numEntriesParameter specifies the number of color descriptors in the palette.
Returns
SUCCESS if the palette could be created. MDLERR_BADARG is returned if numEntries is zero or palettePP is NULL. MDLERR_INSFMEMORY is returned if there was not enough memory to allocate a palette of numEntries in size.
See also
mdlColorPal_destroy mdlColorPal_setEntries mdlColorPal_getColorDescr
Remarks
Required Library: mdlbltin.lib
int mdlColorPal_destroy ( DgnPlatform::BSIColorPalette **  ppPalette)

Used to free a color palette and its constituent color descriptors.

Parameters
[in,out]ppPaletteis the address of a color palette pointer which will be freed and afterwards set to NULL.
Returns
SUCCESS after the palette is successfully destroyed. MDLERR_BADCOLORPALETTE is returned if ppPalette is not the address of a valid palette pointer.
See also
mdlColorPal_create
Remarks
Required Library: mdlbltin.lib
BSIColorDescr* mdlColorPal_getColorDescr ( DgnPlatform::BSIColorPalette *  pPalette,
int  index 
)

Used to obtain a color descriptor pointer from the palette entry indicated by index.

Parameters
[in]pPaletteIs a pointer to a palette obtained from mdlColorPal_create. If pPalette is NULL, the color palette associated with the currently attached colortable is used.
[in]indexIndicates the entry in the palette for which a color descriptor pointer is desired.
Returns
A pointer to a color descriptor or NULL if index is larger than the size of the color palette.
See also
mdlColorPal_create mdlColorPal_setEntries
Remarks
Required Library: mdlbltin.lib
int mdlColorPal_getDrawValue ( long *  pDrawIndex,
DgnPlatform::BSIColorPalette *  pPalette,
int  index,
int  screen 
)

Used to acquire a draw value from a color palette

entry 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 palette entries. This function is equivalent to calling mdlColorPal_getColorDescr followed by mdlColorDescr_getDrawIndex.

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]pPaletteIs a pointer to a palette obtained from mdlColorPal_create. If pPalette is NULL, the color palette associated with the currently attached colortable is used.
[in]indexIndicates the entry in the palette for which a draw value is desired.
[in]screenIndicates for which drawing surface a draw value is desired.
Remarks
Error Code Reason
MDLERR_BADSCREENNUMBER Invalid screen parameter
MDLERR_BADCOLORPALETTE Invalid pPalette
Returns
SUCCESS if pDrawIndex can be obtained.
See also
mdlColorDescr_getDrawIndex
Remarks
Required Library: mdlbltin.lib
int mdlColorPal_getElemColorDescrByModelRef ( BSIColorDescr **  ppCd,
int  colorNumber,
DgnModelRefP  modelRef,
int  screen 
)

Returns a color descriptor obtained from the specified model for the given color index.

Parameters
[in,out]ppCdA pointer to a color descriptor pointer that indicates the structure where the data will be copied.
[in]colorNumberThe index of the color in the color table to get the color descriptor from.
[in]modelRefThe model to get the color descriptor from.
[in]screenThe index of the screen (if needed)
Returns
SUCCESS unless an error occurred, then ERROR
Remarks
Required Library: mdlbltin.lib
int mdlColorPal_getNumColors ( DgnPlatform::BSIColorPalette *  pPalette)

Returns the number of color entries defined in the color palette pointed to by paletteP.

Parameters
[in]pPaletteParameter is a pointer to a palette obtained from mdlColorPal_create.
Returns
The number of entries in the color palette.
See also
mdlColorPal_create mdlColorPal_setEntries
Remarks
Required Library: mdlbltin.lib
int mdlColorPal_modifyStatus ( DgnPlatform::BSIColorPalette *  pPalette,
UInt32  statusMask,
int  setFlag 
)

Change the status of a color palette.

Parameters
[out]pPalettePoints to the palette whose status is to be changed.
[in]statusMaskIndicates the status bits to be affected. Currently the only valid status bit mask is PALSTATUS_SYNCHABLE. This is used by the MicroStation Color Manager to determine if a color palette should be synchronized to changes in the MicroStation color environment. By default, this status bit is set to the ON position.
[in]setFlagIndicates whether the status bits should be turned on (1) or off (0).
Returns
Always returns SUCCESS.
Remarks
Required Library: mdlbltin.lib
int mdlColorPal_queryEntry ( void *  pReply,
int  replyDataSize,
DgnPlatform::BSIColorPalette *  pPalette,
int  index,
long  queryMethodId,
int  screen 
)

Retrieves a single entry from the specified color palette.

Parameters
[in,out]pReplyThe location to store the query reply data.
[in]replyDataSizeMaximum size of caller's reply data area.
[in]pPaletteThe palette to get the entry data from.
[in]indexThe index of the palette entry to get.
[in]queryMethodIdThe method to use to query the palette entry.
[in]screenThe index of the screen (if needed).
Returns
SUCCESS if the entry data was retrieved successfully
See also
mdlColorPal_setEntries
Remarks
Required Library: mdlbltin.lib
int mdlColorPal_setPaletteFromColortable ( DgnPlatform::BSIColorPalette *  pPalette,
byte pCtbl 
)

Set a color palette of 256 entries from a 256 color colortable.

Internally, this function will call mdlColorPal_setEntries, automatically specifying a setMethod of COLORD_RGB for each of the colors in the colortable.

Parameters
[out]pPaletteParameter points to the color palette to be initialized.
[in]pCtblParameter points to the RGB values to use to set the color palette.
Remarks
Error Code Reason
MDLERR_BADCOLORPALETTE Invalid pPalette
MDLERR_BADCOLORTABLE Invalid pCtbl
MDLERR_PALETTEWRONGSIZE the color palette is not 256 entries in size
Returns
SUCCESS
See also
mdlColorPal_setEntries
Remarks
Required Library: mdlbltin.lib

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