src/share/native/sun/awt/image/cvutils/img_dcm8.h

Print this page




  35  * examines some of the private fields of the DirectColorModel
  36  * object and decodes the red, green, blue, and possibly alpha values
  37  * directly rather than calling the getRGB method on the Java object.
  38  */
  39 
  40 /*
  41  * These definitions vector the standard macro names to the "DCM8"
  42  * versions of those macros only if the "DecodeDeclared" keyword has
  43  * not yet been defined elsewhere.  The "DecodeDeclared" keyword is
  44  * also defined here to claim ownership of the primary implementation
  45  * even though this file does not rely on the definitions in any other
  46  * files.
  47  */
  48 #ifndef DecodeDeclared
  49 #define DeclareDecodeVars       DeclareDCM8Vars
  50 #define InitPixelDecode(CM)     InitPixelDCM8(unhand(CM))
  51 #define PixelDecode             PixelDCM8Decode
  52 #define DecodeDeclared
  53 #endif
  54 
  55 #include "java_awt_image_DirectColorModel.h"
  56 
  57 #define DeclareDCM8Vars                                         \
  58     IfAlpha(unsigned int alpha_off;)                            \
  59     unsigned int red_off, green_off, blue_off;
  60 
  61 #define InitPixelDCM8(CM)                                               \
  62     do {                                                                \
  63         Classjava_awt_image_DirectColorModel *dcm =                     \
  64             (Classjava_awt_image_DirectColorModel *) CM;                \
  65         red_off = dcm->red_offset;                                      \
  66         green_off = dcm->green_offset;                                  \
  67         blue_off = dcm->blue_offset;                                    \
  68         IfAlpha(alpha_off = (dcm->alpha_mask == 0                       \
  69                              ? -1                                       \
  70                              : dcm->alpha_offset);)                     \
  71     } while (0)
  72 
  73 #define PixelDCM8Decode(CM, pixel, red, green, blue, alpha)             \
  74     do {                                                                \
  75         IfAlpha(alpha = ((alpha_off < 0)                                \
  76                          ? 255                                          \


  35  * examines some of the private fields of the DirectColorModel
  36  * object and decodes the red, green, blue, and possibly alpha values
  37  * directly rather than calling the getRGB method on the Java object.
  38  */
  39 
  40 /*
  41  * These definitions vector the standard macro names to the "DCM8"
  42  * versions of those macros only if the "DecodeDeclared" keyword has
  43  * not yet been defined elsewhere.  The "DecodeDeclared" keyword is
  44  * also defined here to claim ownership of the primary implementation
  45  * even though this file does not rely on the definitions in any other
  46  * files.
  47  */
  48 #ifndef DecodeDeclared
  49 #define DeclareDecodeVars       DeclareDCM8Vars
  50 #define InitPixelDecode(CM)     InitPixelDCM8(unhand(CM))
  51 #define PixelDecode             PixelDCM8Decode
  52 #define DecodeDeclared
  53 #endif
  54 


  55 #define DeclareDCM8Vars                                         \
  56     IfAlpha(unsigned int alpha_off;)                            \
  57     unsigned int red_off, green_off, blue_off;
  58 
  59 #define InitPixelDCM8(CM)                                               \
  60     do {                                                                \
  61         Classjava_awt_image_DirectColorModel *dcm =                     \
  62             (Classjava_awt_image_DirectColorModel *) CM;                \
  63         red_off = dcm->red_offset;                                      \
  64         green_off = dcm->green_offset;                                  \
  65         blue_off = dcm->blue_offset;                                    \
  66         IfAlpha(alpha_off = (dcm->alpha_mask == 0                       \
  67                              ? -1                                       \
  68                              : dcm->alpha_offset);)                     \
  69     } while (0)
  70 
  71 #define PixelDCM8Decode(CM, pixel, red, green, blue, alpha)             \
  72     do {                                                                \
  73         IfAlpha(alpha = ((alpha_off < 0)                                \
  74                          ? 255                                          \