The SEDRIS Data Representation Model
APPENDIX D - Functions
SE ConvertColourToGivenModel
extern SE_DRM_Status_Code
SE_ConvertColourToGivenModel
(
constSE_Colour_Data *original_colour_ptr,1
SE_Colour_Model new_colour_model,2
SE_Colour_Data *new_colour_ptr3
);

Definition

Converts a colour data value in one colour model to the equivalent colour data value in another colour model.

The colour model conversion algorithms are based on the algorithms published in 13.3.2, "The CMY Model", and 13.3.4, "The HSV Model" in Computer Graphics: Principles and Practice - Second Edition in C, by James D. Foley, Andries van Dam, Steven K. Feiner, and John F. Hughes, published by Addison-Wesley Publishing Company (Reprinted with corrections November 1992, November 1993, and July 1995), Copyright 1996, 1990 by Addison-Wesley Publishing Company, Inc.

All incoming data values are expected to be valid, as defined by their respective colour models.

The value of SE_POSITIVE_INFINITY will be returned for the Hue value of 'undefined'. When converting from HSV to any other system, if the Saturation value is 0.0, then the Hue value is ignored.

CMYK, HLS, YIQ SUPPORT NOTE: Support for the CMYK (Cyan Magenta Yellow blacK), HLS (Hue Lightness Saturation), and YIQ colour models is provided as a convenience, but it is provided in separate functions, e.g. the SE_CMYtoCMYK() and SE_CMYKtoCMY() functions.


Returns

SE_DRM_STAT_CODE_SUCCESS and *new_colour_ptr is set appropriately, if valid parameters were passed in.
SE_DRM_STAT_CODE_NULL_REQUIRED_PARAMETER and no changes are made, if original_colour_ptr or new_colour_ptr was NULL.
SE_DRM_STAT_CODE_INVALID_SOURCE_COLOUR and no changes are made, if *original_colour_ptr is invalid.
SE_DRM_STAT_CODE_INVALID_DEST_COLOUR_MODEL and no changes are made, if new_colour_model is invalid.

Parameters Notes

1 a pointer to the incoming colour, the colour to convert

2 the target colour model

3 a pointer to where the converted colour will be stored. This can be the same location that original_colour_ptr points to, but it does not have to be.


Prev: SE_ConvertColourDataToFields. Next: SE_ConvertCoordinateToFields. Up:Index.

Last updated: July 26, 2006 Copyright © 2006 SEDRIS