...

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                         0x00010007 // 08 Apr 2023

 

struct pi_BASICCOLOR

{

      unsigned long     version;

      unsigned long     host_id;

//8

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

            unsigned long csflags_src,void* icc_xfrm_src,

            unsigned long csflags_dst,void* icc_xfrm_dst);

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

            unsigned long count,unsigned long bpp,unsigned long flags);

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

      unsigned long     unused_1;

//24

      void* (__cdecl*   icc_xfrm_load)(unsigned char *data,unsigned long size);

      int   (__cdecl*   icc_xfrm_free)(void *p_icc_xfrm);

//32

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

};

 

//flags for "csflags_*" 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_HI_BIT_FIRST                    0x00000002 //highest bit first for <8 bpp

#define PI_BC_READRGB_DONT_EXPAND                     0x00000004 //don't expand grays or <8 bpp

#define PI_BC_READRGB_BIG_ENDIAN                      0x00000008 //treat words as big-endian

#define PI_BC_READRGB_FORCE_GRAY                      0x00000010 //treat all bit-depths as grayscale

#define PI_BC_READRGB_ALPHA_KEEP                      0x00000000

#define PI_BC_READRGB_ALPHA_DROP                      0x00001000

#define PI_BC_READRGB_ALPHA_INVERT                    0x00002000

#define PI_BC_READRGB_ALPHA_PREMUL                    0x00003000 //output is inverted

#define PI_BC_READRGB_ALPHA_UNMULT                    0x00004000 //input is inverted

#define PI_BC_READRGB_ALPHA_xxxx                      0x0000f000

 

convert() converts one or more pixels from the color space referenced in csflags_src to the color space referenced in csflags_dst while optionally applying the ICC profiles specified by icc_src_ptr and icc_dst_ptr. These ICC profiles may be loaded using icc_xfrm_load() .

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-2024

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