Online Help for Chasys Draw IES: SDK - Callback Suites - pi_BasicColor

SDK - Callback Suites - pi_BasicColor

SDK - Callback Suites - pi_BasicColor

Callback Overview

This callback suite provides the plug-in with basic color conversion and manipulation functionality. These include color space conversions.


Callback Interface Description

This interface operates at the pixel level, with callbacks accepting a pointer to one or more pixels. The interface itself is encapsulated in an object of type pi_BASICCOLOR. This object is defined in plugin.h.



#define PI_BASICCOLOR_VERSION                         0x00010004


struct pi_BASICCOLOR


      unsigned long     version;

      unsigned long     unused_1;


      int   (__cdecl*   convert)(unsigned long *p_pix,int count,

            unsigned long cp_in,unsigned long cp_out);

      int   (__cdecl*   read_rgb)(unsigned long *p_pix,unsigned char *p_rgb,

            int count,int bpp,unsigned long flags);

      int   (__cdecl*   transform)(unsigned long *p_pix,float *matrix_5x4);


      unsigned char     reserved_x[1024-16];//do not touch



//flags for "cp_in" and "cp_out" in ::convert()

#define PI_BC_CONVERT_CS_RGB                          0x00000000

#define PI_BC_CONVERT_CS_YUV                          0x00000001

#define PI_BC_CONVERT_CS_CMY                          0x00000002

#define PI_BC_CONVERT_CS_CMYK                         0x00000003

#define PI_BC_CONVERT_CS_HSL                          0x00000004

#define PI_BC_CONVERT_CS_HSV                          0x00000005

#define PI_BC_CONVERT_CS_HHSL                         0x00000006

#define PI_BC_CONVERT_CS_HHSV                         0x00000007

#define PI_BC_CONVERT_CS_LAB                          0x00000008

#define PI_BC_CONVERT_CS_xxxx                         0x0000000f

#define PI_BC_CONVERT_OPT_INVT                        0x00001000

#define PI_BC_CONVERT_OPT_xxxx                        0x0000f000


//flags for "flags" in ::read_rgb()

#define PI_BC_READRGB_LSB_IS_RED                      0x00000001

#define PI_BC_READRGB_ALPHA_NORM                      0x00000000

#define PI_BC_READRGB_ALPHA_INVT                      0x00000002

#define PI_BC_READRGB_ALPHA_NONE                      0x00000006

#define PI_BC_READRGB_ALPHA_xxxx                      0x00000006


convert() converts one or more pixels from the color space referenced in cp_in to the color space referenced in cp_out.

read_rgb() converts one or more pixels from packed 24 or 32 bit-per-pixel with RGB or BGR ordering to the RGBA format used by Chasys Draw IES. It also accepts 8 bits-per-pixel greyscale data. This function has highly optimized SIMD routines that can process up to 4 pixels at a time. The source data is pointed to by p_rgb, which must contain at least 8 bytes of padding to allow for large SIMD read/write operations.

transform() allows you to do color-channel manipulations using matrices (color transformations). The input matrix defines that mixture of the existing channel information that would comprise each output pixel, and is always 5x4. The columns are input B, G, R, A and Offset, while the rows are output B, G, R and A. All values use 1.0 as 100%.

The internal implementation of pi_BasicColor is neither defined nor fixed, and is purely host dependent. Do not attempt to access the reserved portion of the object.



Copyright © John Paul Chacha, 2001-2022

The information herein is subject to change without any notice. The author makes no guarantees as to the completeness of this documentation.