A3DGlobalInsertGraphRgbColor
-
A3DStatus
A3DGlobalInsertGraphRgbColor(const A3DGraphRgbColorData *pData, A3DUns32 *puiIndexRgbColor) A3DStatusA3DGlobalInsertGraphRgbColor(constA3DGraphRgbColorData* pData,A3DUns32* puiIndexRgbColor)Creates a new indexed color, returning its index.
2.0When given an
A3DGraphRgbColorData, the function searches for an already existing color code of the same value and returns its index. If the color does not exist, it is created and a new index is returned.In case of success,
puiIndexRgbColoris set to the index of the color. This index can be compared toA3D_DEFAULT_COLOR_INDEXto check whether the input color code matches the default color. In case of failure*puiIndexRgbColoris unchanged.A3DGraphRgbColorData rgb = A3D_MAKE_DATA(A3DGraphRgbColorData); rgb.m_dRed = rgb.m_dGreen = rgb.m_dBlue = 0.75f; A3DUns32 idx_0 = A3D_DEFAULT_COLOR_INDEX; A3DStatus result = A3DGlobalInsertGraphRgbColor(&rgb, &idx_0); assert(result == A3D_SUCCESS); Second insertion with the same color, expect index to be the same. A3DUns32 idx_1 = A3D_DEFAULT_COLOR_INDEX; result = A3DGlobalInsertGraphRgbColor(&rgb, &idx_1); assert(result == A3D_SUCCESS); assert(idx_0 == idx_1);
Return Values
A3D_SUCCESS: in case of success.
A3D_INITIALIZE_NOT_CALLED: if the library is not initialized.
A3D_INVALID_DATA_STRUCT_SIZE: if
pDatais incorrectly initializedA3D_INVALID_DATA_STRUCT_NULL: if
pDatais null.Parameters
pData: The color code to insert.
puiIndexRgbColor: The resulting index for the input color.
Returns
A3D_SUCCESS or an error code.