Main Page | Modules | Class List | File List | Class Members | File Members

pixel.h

Go to the documentation of this file.
00001 
00014 /* This library is free software; you can redistribute it and/or
00015    modify it under the terms of the GNU Lesser General Public
00016    License as published by the Free Software Foundation; either
00017    version 2.1 of the License, or (at your option) any later version.
00018 
00019    This library is distributed in the hope that it will be useful,
00020    but WITHOUT ANY WARRANTY; without even the implied warranty of
00021    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022    Lesser General Public License for more details.
00023 
00024    You should have received a copy of the GNU Lesser General Public
00025    License along with this library; if not, write to the Free Software
00026    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00027 */
00028 
00029 #ifndef _GAN_PIXEL_H
00030 #define _GAN_PIXEL_H
00031 
00032 #include <gandalf/common/misc_defs.h>
00033 #include <gandalf/common/bit_array.h>
00034 #include <gandalf/linalg/2vector.h>
00035 #include <gandalf/linalg/2vectorf.h>
00036 #include <gandalf/linalg/3vector.h>
00037 #include <gandalf/linalg/3vectorf.h>
00038 
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042 
00056 typedef enum
00057 {
00058    GAN_GREY_LEVEL_IMAGE,       
00059    GAN_GREY_LEVEL_ALPHA_IMAGE, 
00060    GAN_RGB_COLOUR_IMAGE,       
00061    GAN_RGB_COLOUR_ALPHA_IMAGE, 
00062    GAN_VECTOR_FIELD_2D,        
00063    GAN_VECTOR_FIELD_3D,        
00064    GAN_RGBX,                   
00065    GAN_RGBAS,                  
00066    GAN_YUVX444,                
00067    GAN_YUVA444,                
00068    GAN_YUV422,                 
00069    GAN_UNDEFINED_IMAGE_FORMAT
00070 } Gan_ImageFormat;
00071 
00075 typedef struct Gan_GLAPixel_uc
00076 {
00077    unsigned char I, 
00078                  A; 
00079 } Gan_GLAPixel_uc;
00080 
00084 typedef struct Gan_GLAPixel_s
00085 {
00086    short I, 
00087          A; 
00088 } Gan_GLAPixel_s;
00089 
00093 typedef struct Gan_GLAPixel_us
00094 {
00095    unsigned short I, 
00096                   A; 
00097 } Gan_GLAPixel_us;
00098 
00102 typedef struct Gan_GLAPixel_i
00103 {
00104    int I, 
00105        A; 
00106 } Gan_GLAPixel_i;
00107 
00111 typedef struct Gan_GLAPixel_ui
00112 {
00113    unsigned int I, 
00114                 A; 
00115 } Gan_GLAPixel_ui;
00116 
00120 typedef struct Gan_GLAPixel_f
00121 {
00122    float I, 
00123          A; 
00124 } Gan_GLAPixel_f;
00125 
00129 typedef struct Gan_GLAPixel_d
00130 {
00131    double I, 
00132           A; 
00133 } Gan_GLAPixel_d;
00134 
00138 typedef struct Gan_RGBPixel_uc
00139 {
00140    unsigned char R, 
00141                  G, 
00142                  B; 
00143 } Gan_RGBPixel_uc;
00144 
00148 typedef struct Gan_RGBPixel_s
00149 {
00150    short R, 
00151          G, 
00152          B; 
00153 } Gan_RGBPixel_s;
00154 
00158 typedef struct Gan_RGBPixel_us
00159 {
00160    unsigned short R, 
00161                   G, 
00162                   B; 
00163 } Gan_RGBPixel_us;
00164 
00168 typedef struct Gan_RGBPixel_i
00169 {
00170    int R, 
00171        G, 
00172        B; 
00173 } Gan_RGBPixel_i;
00174 
00178 typedef struct Gan_RGBPixel_ui
00179 {
00180    unsigned int R, 
00181                 G, 
00182                 B; 
00183 } Gan_RGBPixel_ui;
00184 
00188 typedef struct Gan_RGBPixel_f
00189 {
00190    float R, 
00191          G, 
00192          B; 
00193 } Gan_RGBPixel_f;
00194 
00198 typedef struct Gan_RGBPixel_d
00199 {
00200    double R, 
00201           G, 
00202           B; 
00203 } Gan_RGBPixel_d;
00204 
00208 typedef struct Gan_RGBAPixel_uc
00209 {
00210    unsigned char R, 
00211                  G, 
00212                  B, 
00213                  A; 
00214 } Gan_RGBAPixel_uc;
00215 
00219 typedef struct Gan_RGBAPixel_s
00220 {
00221    short R, 
00222          G, 
00223          B, 
00224          A; 
00225 } Gan_RGBAPixel_s;
00226 
00230 typedef struct Gan_RGBAPixel_us
00231 {
00232    unsigned short R, 
00233                   G, 
00234                   B, 
00235                   A; 
00236 } Gan_RGBAPixel_us;
00237 
00241 typedef struct Gan_RGBAPixel_i
00242 {
00243    int R, 
00244        G, 
00245        B, 
00246        A; 
00247 } Gan_RGBAPixel_i;
00248 
00252 typedef struct Gan_RGBAPixel_ui
00253 {
00254    unsigned int R, 
00255                 G, 
00256                 B, 
00257                 A; 
00258 } Gan_RGBAPixel_ui;
00259 
00263 typedef struct Gan_RGBAPixel_f
00264 {
00265    float R, 
00266          G, 
00267          B, 
00268          A; 
00269 } Gan_RGBAPixel_f;
00270 
00274 typedef struct Gan_RGBAPixel_d
00275 {
00276    double R, 
00277           G, 
00278           B, 
00279           A; 
00280 } Gan_RGBAPixel_d;
00281 
00285 typedef struct Gan_RGBXPixel_ui8
00286 {
00287    unsigned int X : 8; 
00288    unsigned int B : 8; 
00289    unsigned int G : 8; 
00290    unsigned int R : 8; 
00291 } Gan_RGBXPixel_ui8;
00292 
00296 typedef struct Gan_RGBXPixel_ui10
00297 {
00298    unsigned int X : 2;  
00299    unsigned int B : 10; 
00300    unsigned int G : 10; 
00301    unsigned int R : 10; 
00302 } Gan_RGBXPixel_ui10;
00303 
00307 typedef struct Gan_RGBASPixel_ui10
00308 {
00309    unsigned int A : 2; 
00310    unsigned int B : 10; 
00311    unsigned int G : 10; 
00312    unsigned int R : 10; 
00313 } Gan_RGBASPixel_ui10;
00314 
00320 typedef struct Gan_RGBAPixel_ui12
00321 {
00322    unsigned int A : 12; 
00323    unsigned int B : 12; 
00324    unsigned int G : 12; 
00325    unsigned int R : 12; 
00326 } Gan_RGBAPixel_ui12;
00327 
00331 typedef struct Gan_YUVX444Pixel_ui8
00332 {
00333    gan_uint8 Y; 
00334    gan_uint8 U; 
00335    gan_uint8 V; 
00336    gan_uint8 X; 
00337 } Gan_YUVX444Pixel_ui8;
00338 
00342 typedef struct Gan_YUVA444Pixel_ui8
00343 {
00344    gan_uint8 Y; 
00345    gan_uint8 U; 
00346    gan_uint8 V; 
00347    gan_uint8 A; 
00348 } Gan_YUVA444Pixel_ui8;
00349 
00355 typedef struct Gan_YUV422Pixel_ui8
00356 {
00357    gan_uint8 UV; 
00358    gan_uint8 Y;  
00359 } Gan_YUV422Pixel_ui8;
00360 
00364 typedef struct Gan_YXPixel_ui10
00365 {
00366    gan_uint16 X :  6; 
00367    gan_uint16 Y : 10; 
00368 } Gan_YXPixel_ui10;
00369 
00373 typedef struct Gan_YXPixel_ui12
00374 {
00375    gan_uint16 X :  4; 
00376    gan_uint16 Y : 12; 
00377 } Gan_YXPixel_ui12;
00378 
00379 #if (SIZEOF_CHAR == 1)
00380 
00383 typedef struct Gan_GLAPixel_uc Gan_GLAPixel_ui8;
00384 
00388 typedef struct Gan_RGBPixel_uc Gan_RGBPixel_ui8;
00389 
00394 typedef struct Gan_RGBAPixel_uc Gan_RGBAPixel_ui8;
00395 #else
00396 #error "8-bit type conflict"
00397 #endif /* #if (SIZEOF_CHAR == 1) */
00398 
00399 #if (SIZEOF_SHORT == 2)
00400 
00404 typedef struct Gan_GLAPixel_us Gan_GLAPixel_ui16;
00405 
00409 typedef struct Gan_RGBPixel_us Gan_RGBPixel_ui16;
00410 
00415 typedef struct Gan_RGBAPixel_us Gan_RGBAPixel_ui16;
00416 #else
00417 #error "16-bit type conflict"
00418 #endif /* #if (SIZEOF_SHORT == 2) */
00419 
00420 #if (SIZEOF_INT == 4)
00421 
00424 typedef struct Gan_GLAPixel_ui Gan_GLAPixel_ui32;
00425 
00429 typedef struct Gan_RGBPixel_ui Gan_RGBPixel_ui32;
00430 
00434 typedef struct Gan_RGBPixel_i Gan_RGBPixel_i32;
00435 
00439 typedef struct Gan_RGBAPixel_ui Gan_RGBAPixel_ui32;
00440 
00444 typedef struct Gan_RGBAPixel_i Gan_RGBAPixel_i32;
00445 
00446 #else
00447 #error "32-bit type conflict"
00448 #endif /* #if (SIZEOF_INT == 4) */
00449 
00450 #if (SIZEOF_FLOAT == 4)
00451 
00454 typedef struct Gan_GLAPixel_f Gan_GLAPixel_f32;
00455 
00459 typedef struct Gan_RGBPixel_f Gan_RGBPixel_f32;
00460 
00464 typedef struct Gan_RGBAPixel_f Gan_RGBAPixel_f32;
00465 #else
00466 #error "32-bit float type conflict"
00467 #endif /* #if (SIZEOF_FLOAT == 4) */
00468 
00469 #if (SIZEOF_DOUBLE == 8)
00470 
00474 typedef struct Gan_GLAPixel_d Gan_GLAPixel_f64;
00475 
00479 typedef struct Gan_RGBPixel_d Gan_RGBPixel_f64;
00480 
00485 typedef struct Gan_RGBAPixel_d Gan_RGBAPixel_f64;
00486 #else
00487 #error "64-bit float type conflict"
00488 #endif /* #if (SIZEOF_DOUBLE == 8) */
00489 
00493 typedef struct Gan_Pixel
00494 {
00496    Gan_ImageFormat format;
00497 
00499    Gan_Type type;
00500 
00502    union
00503    {
00505       union
00506       {
00507          unsigned char  uc;
00508          short          s;
00509          unsigned short us;
00510          int            i;
00511          unsigned int   ui;
00512          double         d;
00513          float          f;
00514          Gan_Bool       b;
00515          void          *p;
00516 
00517          gan_uint8 ui8;
00518          gan_uint16 ui16;
00519          gan_uint32 ui32;
00520          Gan_YXPixel_ui10 ui10;
00521          Gan_YXPixel_ui12 ui12;
00522       } gl;
00523 
00525       union
00526       {
00527          Gan_GLAPixel_uc uc;
00528          Gan_GLAPixel_s  s;
00529          Gan_GLAPixel_us us;
00530          Gan_GLAPixel_i  i;
00531          Gan_GLAPixel_ui ui;
00532          Gan_GLAPixel_d  d;
00533          Gan_GLAPixel_f  f;
00534 
00535          Gan_GLAPixel_ui8 ui8;
00536          Gan_GLAPixel_ui16 ui16;
00537          Gan_GLAPixel_ui32 ui32;
00538       } gla;
00539 
00541       union
00542       {
00543          Gan_RGBPixel_uc uc;
00544          Gan_RGBPixel_s  s;
00545          Gan_RGBPixel_us us;
00546          Gan_RGBPixel_i  i;
00547          Gan_RGBPixel_ui ui;
00548          Gan_RGBPixel_d  d;
00549          Gan_RGBPixel_f  f;
00550 
00551          Gan_RGBPixel_ui8 ui8;
00552          Gan_RGBPixel_ui16 ui16;
00553          Gan_RGBPixel_ui32 ui32;
00554       } rgb;
00555 
00557       union
00558       {
00559          Gan_RGBAPixel_uc uc;
00560          Gan_RGBAPixel_s  s;
00561          Gan_RGBAPixel_us us;
00562          Gan_RGBAPixel_i  i;
00563          Gan_RGBAPixel_ui ui;
00564          Gan_RGBAPixel_d  d;
00565          Gan_RGBAPixel_f  f;
00566 
00567          Gan_RGBAPixel_ui8 ui8;
00568          Gan_RGBAPixel_ui16 ui16;
00569          Gan_RGBAPixel_ui32 ui32;
00570          Gan_RGBAPixel_ui12 ui12;
00571       } rgba;
00572 
00574       union
00575       {
00576          Gan_Vector2_f f;
00577          Gan_Vector2   d;
00578          Gan_Vector2_s s;
00579          Gan_Vector2_i i;
00580       } vfield2D;
00581 
00583       union
00584       {
00585          Gan_Vector3_f f;
00586          Gan_Vector3   d;
00587          Gan_Vector3_s s;
00588          Gan_Vector3_i i;
00589       } vfield3D;
00590 
00592       union
00593       {
00594          Gan_RGBXPixel_ui8   ui8;
00595          Gan_RGBXPixel_ui10 ui10;
00596       } rgbx;
00597 
00599       union
00600       {
00601          Gan_RGBASPixel_ui10 ui10;
00602       } rgbas;
00603 
00605       union
00606       {
00607          Gan_YUVX444Pixel_ui8 ui8;
00608       } yuvx444;
00609 
00611       union
00612       {
00613          Gan_YUVA444Pixel_ui8 ui8;
00614       } yuva444;
00615 
00617       union
00618       {
00619          Gan_YUV422Pixel_ui8 ui8;
00620       } yuv422;
00621    } data;
00622 } Gan_Pixel;
00623 
00624  unsigned char  gan_pixel_rgbuc_to_yuc ( const Gan_RGBPixel_uc *rgb );
00625  unsigned short gan_pixel_rgbuc_to_yus ( const Gan_RGBPixel_uc *rgb );
00626  unsigned int   gan_pixel_rgbuc_to_yui ( const Gan_RGBPixel_uc *rgb );
00627  unsigned char  gan_pixel_rgbus_to_yuc ( const Gan_RGBPixel_us *rgb );
00628  unsigned short gan_pixel_rgbus_to_yus ( const Gan_RGBPixel_us *rgb );
00629  float          gan_pixel_rgbui_to_yf  ( const Gan_RGBPixel_ui *rgb );
00630  float          gan_pixel_rgbf_to_yf   ( const Gan_RGBPixel_f  *rgb );
00631  double         gan_pixel_rgbd_to_yd   ( const Gan_RGBPixel_d  *rgb );
00632  unsigned char  gan_pixel_rgbauc_to_yuc ( const Gan_RGBAPixel_uc *rgba );
00633  unsigned short gan_pixel_rgbauc_to_yus ( const Gan_RGBAPixel_uc *rgba );
00634  unsigned int   gan_pixel_rgbauc_to_yui ( const Gan_RGBAPixel_uc *rgba );
00635  unsigned char  gan_pixel_rgbaus_to_yuc ( const Gan_RGBAPixel_us *rgba );
00636  unsigned short gan_pixel_rgbaus_to_yus ( const Gan_RGBAPixel_us *rgba );
00637  float          gan_pixel_rgbaui_to_yf  ( const Gan_RGBAPixel_ui *rgba );
00638  float          gan_pixel_rgbaf_to_yf   ( const Gan_RGBAPixel_f  *rgba );
00639  double         gan_pixel_rgbad_to_yd   ( const Gan_RGBAPixel_d  *rgba );
00640 
00641  Gan_Bool gan_image_convert_pixel ( Gan_Pixel *inpix,
00642                                    Gan_ImageFormat format, Gan_Type type,
00643                                    Gan_Pixel *outpix, int *error_code );
00644  double gan_image_convert_scale ( Gan_Type gtFromType, Gan_Type gtToType );
00645  Gan_Bool gan_image_offset_pixel_q ( Gan_Pixel *pixel, double offset,
00646                                     Gan_Pixel *offset_pixel );
00647  Gan_Bool gan_image_scale_pixel_q ( Gan_Pixel *pixel, double scale,
00648                                    Gan_Pixel *scaled_pixel );
00649  Gan_Bool gan_image_divide_pixel_q ( Gan_Pixel *pixel, double scale,
00650                                     Gan_Pixel *scaled_pixel );
00651  Gan_Bool gan_image_fill_zero_pixel ( Gan_Pixel *pixel );
00652  const char *gan_image_format_string ( Gan_ImageFormat format );
00653  Gan_ImageFormat gan_image_format_with_alpha ( Gan_ImageFormat format );
00654  Gan_ImageFormat gan_image_format_without_alpha ( Gan_ImageFormat format );
00655 
00659  gan_uint8  gan_pixel_rgbui8_to_yui8 ( const Gan_RGBPixel_ui8 *rgb );
00660 
00664  gan_uint16 gan_pixel_rgbui8_to_yui16 ( const Gan_RGBPixel_ui8 *rgb );
00665 
00669  gan_uint32  gan_pixel_rgbui8_to_yui32   ( const Gan_RGBPixel_ui8 *rgb );
00670 
00674  gan_uint8   gan_pixel_rgbui16_to_yui8   ( const Gan_RGBPixel_ui16 *rgb );
00675 
00679  gan_uint16  gan_pixel_rgbui16_to_yui16  ( const Gan_RGBPixel_ui16 *rgb );
00680 
00684  gan_float32 gan_pixel_rgbui32_to_yf32   ( const Gan_RGBPixel_ui32 *rgb );
00685 
00689  gan_float32 gan_pixel_rgbf32_to_yf32    ( const Gan_RGBPixel_f32  *rgb );
00690 
00694  gan_float64 gan_pixel_rgbf64_to_yf64    ( const Gan_RGBPixel_f64  *rgb );
00695 
00699  gan_uint8   gan_pixel_rgbaui8_to_yui8   ( const Gan_RGBAPixel_ui8 *rgba );
00700 
00704  gan_uint16  gan_pixel_rgbaui8_to_yui16  ( const Gan_RGBAPixel_ui8 *rgba );
00705 
00709  gan_uint32  gan_pixel_rgbaui8_to_yui32  ( const Gan_RGBAPixel_ui8 *rgba );
00710 
00714  gan_uint8   gan_pixel_rgbaui16_to_yui8  ( const Gan_RGBAPixel_ui16 *rgba );
00715 
00719  gan_uint16  gan_pixel_rgbaui16_to_yui16 ( const Gan_RGBAPixel_ui16 *rgba );
00720 
00724  gan_float32 gan_pixel_rgbaui32_to_yf32  ( const Gan_RGBAPixel_ui32 *rgba );
00725 
00729  gan_float32 gan_pixel_rgbaf32_to_yf32   ( const Gan_RGBAPixel_f32  *rgba );
00730 
00734  gan_float64 gan_pixel_rgbaf64_to_yf64   ( const Gan_RGBAPixel_f64  *rgba );
00735 
00739  unsigned char gan_pixel_us_to_uc ( unsigned short x );
00740 
00744  gan_uint8 gan_pixel_ui16_to_ui8 ( gan_uint16 x );
00745 
00749  unsigned char gan_pixel_ui_to_uc ( unsigned x );
00750 
00754  gan_uint8 gan_pixel_ui32_to_ui8 ( gan_uint32 x );
00755 
00761  unsigned char gan_pixel_f_to_uc ( float x );
00762 
00768  gan_uint8 gan_pixel_f32_to_ui8 ( gan_float32 x );
00769 
00775  unsigned char gan_pixel_d_to_uc ( double x );
00776 
00782  gan_uint8 gan_pixel_f64_to_ui8 ( gan_float64 x );
00783 
00787  unsigned short gan_pixel_uc_to_us ( unsigned char x );
00788 
00792  gan_uint16 gan_pixel_ui8_to_ui16 ( gan_uint8 x );
00793 
00797  unsigned short gan_pixel_ui_to_us ( unsigned x );
00798 
00802  gan_uint16 gan_pixel_ui32_to_ui16 ( gan_uint32 x );
00803 
00807  short gan_pixel_i_to_s ( int x );
00808 
00812  gan_int16 gan_pixel_i32_to_i16 ( gan_int32 x );
00813 
00819  unsigned short gan_pixel_f_to_us ( float x );
00820 
00826  gan_int16 gan_pixel_f32_to_ui16 ( gan_float32 x );
00827 
00833  unsigned short gan_pixel_d_to_us ( double x );
00834 
00840  gan_int16 gan_pixel_f64_to_ui16 ( gan_float64 x );
00841 
00845  unsigned int gan_pixel_uc_to_ui ( unsigned char x );
00846 
00850  gan_uint32 gan_pixel_ui8_to_ui32 ( gan_uint8 x );
00851 
00855  unsigned int gan_pixel_us_to_ui ( unsigned short x );
00856 
00860  gan_uint32 gan_pixel_ui16_to_ui32 ( gan_uint16 x );
00861 
00865  int gan_pixel_s_to_i ( short x );
00866 
00870  gan_int32 gan_pixel_i16_to_i32 ( gan_int16 x );
00871 
00877  unsigned int gan_pixel_f_to_ui ( float x );
00878 
00884  gan_uint32 gan_pixel_f32_to_ui32 ( gan_float32 x );
00885 
00891  unsigned int gan_pixel_d_to_ui ( double x );
00892 
00898  gan_uint32 gan_pixel_f64_to_ui32 ( gan_float64 x );
00899 
00900  extern float lookup_table_8bit[];
00901 
00902 /*
00903  * \brief Macro: Convert a pixel field from \c unsigned \c char to \c float type.
00904  */
00905  float gan_pixel_uc_to_f ( unsigned char x );
00906 
00907 /*
00908  * \brief Macro: Convert a pixel field from 8-bit unsigned integer to 32-bit float type.
00909  */
00910  gan_float32 gan_pixel_ui8_to_f32 ( gan_uint8 x );
00911 
00915  float gan_pixel_us_to_f ( unsigned short x );
00916 
00920  gan_float32 gan_pixel_ui16_to_f32 ( gan_uint16 x );
00921 
00925  float gan_pixel_ui_to_f ( unsigned int x );
00926 
00930  gan_float32 gan_pixel_ui32_to_f32 ( gan_uint32 x );
00931 
00935  double gan_pixel_uc_to_d ( unsigned char x );
00936 
00940  gan_float64 gan_pixel_ui8_to_f64 ( gan_uint8 x );
00941 
00945  double gan_pixel_us_to_d ( unsigned short x );
00946 
00950  gan_float64 gan_pixel_ui16_to_f64 ( gan_uint16 x );
00951 
00955  double gan_pixel_ui_to_d ( unsigned int x );
00956 
00960  gan_float64 gan_pixel_ui32_to_f64 ( gan_uint32 x );
00961    
00967  int gan_pixel_f_to_i ( float x );
00968 
00974  gan_int32 gan_pixel_f32_to_i32 ( gan_float32 x );
00975 
00981  int gan_pixel_d_to_i ( double x );
00982 
00988  gan_int32 gan_pixel_f64_to_i32 ( gan_float64 x );
00989 
00995  short gan_pixel_f_to_s ( float x );
00996 
01002  gan_int16 gan_pixel_f32_to_i16 ( gan_float32 x );
01003 
01009  short gan_pixel_d_to_s ( double x );
01010 
01016  gan_int16 gan_pixel_f64_to_i16 ( gan_float64 x );
01017 
01021  float gan_pixel_s_to_f ( short x );
01022 
01026  gan_float32 gan_pixel_i16_to_f32 ( gan_int16 x );
01027 
01031  double gan_pixel_s_to_d ( short x );
01032 
01036  gan_float64 gan_pixel_i16_to_f64 ( gan_int16 x );
01037    
01041  float gan_pixel_i_to_f ( int x );
01042 
01046  gan_float32 gan_pixel_i32_to_f32 ( gan_int32 x );
01047 
01051  double gan_pixel_i_to_d ( int x );
01052 
01056  gan_float64 gan_pixel_i32_to_f64 ( gan_int32 x );
01057 
01058 // other hard-wired 8 bit conversions
01059 #if (SIZEOF_CHAR == 1)
01060 
01062  int gan_pixel_f_to_ui8 ( float x );
01063 
01065  int gan_pixel_d_to_ui8 ( double x );
01066 
01068  float gan_pixel_ui8_to_f ( gan_uint8 x );
01069 
01071  double gan_pixel_ui8_to_d ( gan_uint8 x );
01072 
01073 #endif /* (SIZEOF_CHAR == 1) */
01074 
01075 // other hard-wired 16 bit conversions
01076 #if (SIZEOF_SHORT == 2)
01077 
01079  int gan_pixel_f_to_ui16 ( float x );
01080 
01082  int gan_pixel_d_to_ui16 ( double x );
01083 
01085  float gan_pixel_ui16_to_f ( gan_uint16 x );
01086 
01088  double gan_pixel_ui16_to_d ( gan_uint16 x );
01089 
01090 #endif /* (SIZEOF_SHORT == 2) */
01091 
01092 // hard-wired 32 bit conversions
01093 #if (SIZEOF_INT == 4)
01094 
01096  int gan_pixel_f_to_ui32 ( float x );
01097 
01099  int gan_pixel_d_to_ui32 ( double x );
01100 
01102  float gan_pixel_ui32_to_f ( gan_uint32 x );
01103 
01105  double gan_pixel_ui32_to_d ( gan_uint32 x );
01106 
01107 #endif /* (SIZEOF_INT == 4) */
01108 
01116  Gan_Bool gan_image_convert_pixel_q ( Gan_Pixel *inpix,
01117                                      Gan_ImageFormat format, Gan_Type type,
01118                                      Gan_Pixel *outpix );
01119 
01127  Gan_Bool gan_image_convert_pixel_i ( Gan_Pixel *pix,
01128                                      Gan_ImageFormat format, Gan_Type type );
01129 
01137  Gan_Bool gan_image_offset_pixel_i ( Gan_Pixel *pixel, double offset );
01138 
01146  Gan_Bool gan_image_scale_pixel_i ( Gan_Pixel *pixel, double scale );
01147 
01155  Gan_Bool gan_image_divide_pixel_i ( Gan_Pixel *pixel, double scale );
01156 
01165 #ifdef __cplusplus
01166 }
01167 #endif
01168 
01169 #endif /* #ifndef _GAN_PIXEL_H */

Generated on Fri Mar 17 12:44:48 2006 by  doxygen 1.3.9.1