gml_RGBColor.h

Go to the documentation of this file.
00001 /**
00002  * @file gml_RGBColor.h
00003  *
00004  *  Defines the gml_TRGBColor struct: a structure for representing color and converting from
00005  *  the canonical RGB representation to other representations.
00006  *
00007  * Copyright (c) 1999-2003 CLIPS-IMAG
00008  *
00009  * See the file "gml_LicenseTerms.txt" for information on usage and redistribution
00010  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00011  *
00012  *  August 22, 2003 (F.B.)
00013  *    Rewritten for gml standards.
00014  *
00015  *  Created on April 1999 (Michel Prodhomme).
00016  */
00017 
00018 
00019 #ifndef __GML_COLOR__
00020 #define __GML_COLOR__
00021 
00022 #include "gml/base/gml_Types.h"
00023 #include "gml/base/gml_Errors.h"
00024 #include "gml/image/gml_Bitmap.h"
00025 
00026 
00027 
00028 
00029 /**
00030  * gml_TRGBColor --
00031  *    High-resolution (48-bit) colors
00032  */
00033 
00034 typedef struct gml_TRGBColor
00035 {
00036   UInt16  fRed;     ///< red component
00037   UInt16  fGreen;   ///< green component
00038   UInt16  fBlue;    ///< blue component
00039 } gml_TRGBColor;
00040 
00041 
00042 /// number of predefined colors
00043 #define               GML_CCOLORARRAYNBELEM     50
00044 
00045 /// array of predefined colors
00046 GML_EXTERN_C
00047 gml_TRGBColor  gml_gRGBColor_DefaultArray[GML_CCOLORARRAYNBELEM];
00048 
00049 GML_EXTERN_C gml_TRGBColor  gml_gRGBColor_White;
00050 GML_EXTERN_C gml_TRGBColor  gml_gRGBColor_Black;
00051 GML_EXTERN_C gml_TRGBColor  gml_gRGBColor_Red;
00052 GML_EXTERN_C gml_TRGBColor  gml_gRGBColor_Green;
00053 GML_EXTERN_C gml_TRGBColor  gml_gRGBColor_Blue;
00054 
00055 
00056 
00057 /**
00058  * gml_RGBColorPixelValue --
00059  *
00060  *  Converts the color <c> into a pixel value according to the encoding <encoding>.
00061  *  Stores the result at the address <value>.
00062  *  The size of what is pointed to by <value> varies depends on <encoding>:
00063  *  - 4 bytes per pixel encodings translate to an UInt32
00064  *  - 3 bytes per pixel encodings translate to an UInt32 (the high order byte is 0)
00065  *  - 2 bytes per pixel encodings translate to an UInt16
00066  *  - 1 bytes per pixel encodings translate to an UInt8
00067  */
00068 GML_EXTERN_C
00069 gml_TError gml_RGBColorPixelValue  (gml_TRGBColor*        c,
00070             gml_TPixelEncoding    encoding,
00071             void*                 value);
00072 
00073 /**
00074  * gml_RGBColorSetFromValue --
00075  *
00076  * Sets the color <c> from the pixel value at address <value>. Conversion
00077  * is done according to the <encoding> of the pixel.
00078  * See gml_RGBColorPixelValue() for a discussion on the size of <value>.
00079  */
00080 GML_EXTERN_C
00081 gml_TError gml_RGBColorSetFromValue  (gml_TRGBColor*        c,
00082               gml_TPixelEncoding    encoding,
00083               void*                 value);
00084 
00085 
00086 
00087 #endif
00088 
00089 
Generated on Tue Jun 12 14:03:27 2007 for gml by Doxygen 1.5.2.