00001 #ifndef __BITFLINGER_H__ 00002 #define __BITFLINGER_H__ 00003 00004 #ifdef __cplusplus 00005 extern "C" { 00006 #endif 00007 00008 #include <OS.h> 00009 #include <GL/gl.h> 00010 00011 00012 #define B_BIT_IN 0x1000 00013 #define B_BIT_OUT 0x1001 00014 00015 #define B_BIT_CACHE_L1 1 00016 #define B_BIT_CACHE_L2 2 00017 #define B_BIT_CACHE_L3 3 00018 #define B_BIT_CACHE_RAM 4 00019 #define B_BIT_CACHE_WC 5 00020 #define B_BIT_CACHE_NC 6 00021 #define B_BIT_CACHE_PCI 7 00022 #define B_BIT_CACHE_PCI_WC 8 00023 00024 00025 /* 00026 #define B_BIT_MAP_I_TO_I 0x0C70 00027 #define B_BIT_MAP_S_TO_S 0x0C71 00028 #define B_BIT_MAP_I_TO_R 0x0C72 00029 #define B_BIT_MAP_I_TO_G 0x0C73 00030 #define B_BIT_MAP_I_TO_B 0x0C74 00031 #define B_BIT_MAP_I_TO_A 0x0C75 00032 #define B_BIT_MAP_R_TO_R 0x0C76 00033 #define B_BIT_MAP_G_TO_G 0x0C77 00034 #define B_BIT_MAP_B_TO_B 0x0C78 00035 #define B_BIT_MAP_A_TO_A 0x0C79 00036 */ 00037 00038 typedef void (*cv_extractor)( void *context, int32 x, int32 y, void *pixel, const void *srcData ); 00039 extern void * cvCreateContext(); 00040 extern void cvDestroyContext( void *context ); 00041 00042 /********************************************************************************** 00043 * cvSetType 00044 * context : The context from cvCreateContext() 00045 * 00046 * dir : The direction to set. Allowed values are 00047 * B_BIT_IN, B_BIT_OUT 00048 * 00049 * type : The type of data to be processed. Allowed values are 00050 * GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, 00051 * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, 00052 * GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV, 00053 * GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, 00054 * GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV, 00055 * GL_UNSIGNED_INT_10_10_10_2, GL_UNSIGNED_INT_2_10_10_10_REV, 00056 * GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, 00057 * GL_INT, GL_UNSIGNED_INT, GL_FLOAT, GL_DOUBLE 00058 * 00059 * format : The format of the data to be processed. Allowed values are 00060 * GL_COLOR_INDEX, GL_STENCIL_INDEX, GL_DEPTH_COMPONENT, 00061 * GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_RGB, GL_RGBA, 00062 * GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_BGR, GL_BGRA, GL_ABGR_EXT 00063 * 00064 * swap_endian : 0= no swap, 1= swap 00065 * 00066 * lsb_first : 0= no change, 1= reverse bit ordering 00067 * 00068 *******************************************************************************/ 00069 extern status_t cvSetType( void *context, int32 dir, int32 type, int32 format, uint8 swap_endian, uint8 lsb_first ); 00070 00071 00072 /********************************************************************************** 00073 * cvSetTransferParam 00074 * context : The context from cvCreateContext() 00075 * 00076 * name : The name of the value to set. Allowed values are: 00077 * GL_RED_SCALE, GL_GREEN_SCALE, GL_BLUE_SCALE, GL_ALPHA_SCALE, GL_DEPTH_SCALE 00078 * GL_RED_BIAS, GL_GREEN_BIAS, GL_BLUE_BIAS, GL_ALPHA_BIAS, GL_DEPTH_BIAS 00079 * GL_INDEX_SHIFT, GL_INDEX_OFFSET, GL_MAP_COLOR, GL_MAP_STENCIL 00080 * 00081 * value : The value of name to set 00082 * 00083 *******************************************************************************/ 00084 extern status_t cvSetTransferParam( void *context, int32 name, float value); 00085 00086 00087 /********************************************************************************** 00088 * cvSetMapXX 00089 * context : The context from cvCreateContext() 00090 * 00091 * mapName : The name of the value to set. Allowed values are: 00092 * GL_PIXEL_MAP_I_TO_I, GL_PIXEL_MAP_S_TO_S, GL_PIXEL_MAP_I_TO_R, 00093 * GL_PIXEL_MAP_I_TO_G, GL_PIXEL_MAP_I_TO_B, GL_PIXEL_MAP_I_TO_A, 00094 * GL_PIXEL_MAP_R_TO_R, GL_PIXEL_MAP_G_TO_G, GL_PIXEL_MAP_B_TO_B, 00095 * GL_PIXEL_MAP_A_TO_A 00096 * 00097 * size : The size of the map. This should be the number of entries. 00098 * 00099 * map : Pointer to the map data. 00100 * 00101 *******************************************************************************/ 00102 extern status_t cvSetMapUIV( void *context, uint32 mapName, uint32 size, uint32 *map ); 00103 extern status_t cvSetMapUSV( void *context, uint32 mapName, uint32 size, uint16 *map ); 00104 extern status_t cvSetMapFV( void *context, uint32 mapName, uint32 size, float *map ); 00105 00106 00107 /********************************************************************************** 00108 * cvSetCache 00109 * context : The context from cvCreateContext() 00110 * 00111 * dir : The direction to set. Allowed values are 00112 * B_BIT_IN, B_BIT_OUT 00113 * 00114 * type : The type of memory for direction. Allowed values are 00115 * B_BIT_CACHE_L1 : Data expected to be in the L1 cache 00116 * B_BIT_CACHE_L2 : Data expected to be in the L2 cache 00117 * B_BIT_CACHE_L3 : Data expected to be in the L3 cache 00118 * B_BIT_CACHE_RAM : Data expected to be in cached system ram 00119 * B_BIT_CACHE_WC : Data expected to be in non-cached system ram with write combining enabled 00120 * B_BIT_CACHE_NC : Data expected to be in non-cached system ram 00121 * B_BIT_CACHE_PCI : Data expected to be accessed across a PCI / AGP bus. 00122 * B_BIT_CACHE_PCI_WC : Data expected to be accessed across a PCI / AGP bus with write combining enabled. 00123 * 00124 *******************************************************************************/ 00125 extern status_t cvSetCache( void *context, uint32 dir, uint32 type ); 00126 00127 00128 /********************************************************************************** 00129 * cvSetBlendFunction 00130 * context : The context from cvCreateContext() 00131 * 00132 * srcFactor : The operation to be applied to the source when 00133 * combining the extraced pixel with the destination. 00134 * GL_ZERO, GL_ONE, GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR, GL_SRC_ALPHA, 00135 * GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA, 00136 * GL_SRC_ALPHA_SATURATE, GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR 00137 * GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA 00138 * 00139 * dstFactor : The operation to be applied to the destination when 00140 * combining the extraced pixel with the destination. 00141 * GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA, 00142 * GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA, 00143 * GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR 00144 * GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA 00145 * 00146 *******************************************************************************/ 00147 extern status_t cvSetBlendFunction( void *context, uint32 srcFactor, uint32 dstFactor ); 00148 00149 00150 /********************************************************************************** 00151 * cvSetBlendEquation 00152 * context : The context from cvCreateContext() 00153 * 00154 * equ : The equation to be used to combine the two blending functions. 00155 * GL_FUNC_ADD : D = (src * fs) + (dst * fd) 00156 * GL_FUNC_SUBTRACT : D = (src * fs) - (dst * fd) 00157 * GL_FUNC_REVERSE_SUBTRACT : D = (dst * fd) - (src * fs) 00158 * GL_MIN : D = MIN( (src * fs), (dst * fd) ) 00159 * GL_MAX : D = MAX( (src * fs), (dst * fd) ) 00160 * 00161 *******************************************************************************/ 00162 extern status_t cvSetBlendEquation( void *context, uint32 equ ); 00163 00164 /********************************************************************************** 00165 * cvSetBlendColor 00166 * context : The context from cvCreateContext() 00167 * 00168 * r : The red component of the blending color. 00169 * 00170 * g : The green component of the blending color. 00171 * 00172 * b : The blue component of the blending color. 00173 * 00174 * a : The alpha component of the blending color. 00175 * 00176 *******************************************************************************/ 00177 extern status_t cvSetBlendColor( void *context, float r, float g, float b, float a ); 00178 00179 /********************************************************************************** 00180 * cvSetWriteMask 00181 * context : The context from cvCreateContext() 00182 * 00183 * r : Enable flag for red component. 1=write, 0=don't write. 00184 * 00185 * g : Enable flag for green component. 1=write, 0=don't write. 00186 * 00187 * b : Enable flag for blue component. 1=write, 0=don't write. 00188 * 00189 * a : Enable flag for alpha component. 1=write, 0=don't write. 00190 * 00191 *******************************************************************************/ 00192 extern status_t cvSetWriteMask( void *context, int8 r, int8 g, int8 b, int8 a ); 00193 00194 00195 /********************************************************************************** 00196 * cvSetLogicOp 00197 * context : The context from cvCreateContext() 00198 * 00199 * operation : The operation to be applied when combining the extraced pixel with the destination. 00200 * GL_CLEAR : D = 0 00201 * GL_SET : D = 1 00202 * GL_COPY : D = S 00203 * GL_COPY_INVERTEX : D = ~S 00204 * GL_NOOP : D = D 00205 * GL_INVERT : D = ~D 00206 * GL_AND : D = S & D 00207 * GL_NAND : D = ~(S & D) 00208 * GL_OR : D = S | D 00209 * GL_NOR : D = (~S | D) 00210 * GL_XOR : D = S ^ D 00211 * GL_EQUIV : D = ~(S ^ D) 00212 * GL_AND_REVERSE : D = S & (~D) 00213 * GL_AND_INVERTED : D = (~S) & D 00214 * GL_OR_REVERSE : D = S | (~D) 00215 * GL_OR_INVERTED : D = (~S) | D 00216 * 00217 * Note: Logic ops will be ignored if the destination type is double. 00218 *******************************************************************************/ 00219 extern status_t cvSetLogicOp( void *context, uint32 operation ); 00220 00221 /********************************************************************************** 00222 * cvSetEnvMode 00223 * context : The context from cvCreateContext() 00224 * 00225 * mode : The enviroment mode. Allowed values are: 00226 * GL_REPLACE, GL_MODULATE, GL_DECAL, GL_BLEND 00227 * 00228 *******************************************************************************/ 00229 extern status_t cvSetEnvMode( void *context, uint32 mode ); 00230 00231 00232 /********************************************************************************** 00233 * cvSetEnvColor 00234 * context : The context from cvCreateContext() 00235 * 00236 * r,g,b,a : The enviroment color used for GL_MODULATE and GL_BLEND 00237 * 00238 *******************************************************************************/ 00239 extern status_t cvSetEnvColor( void *context, float r, float g, float b, float a ); 00240 00241 /********************************************************************************** 00242 * cvSetEnvConstColor 00243 * context : The context from cvCreateContext() 00244 * 00245 * r,g,b,a : The constant enviroment color used for GL_BLEND 00246 * 00247 *******************************************************************************/ 00248 extern status_t cvSetEnvConstColor( void *context, float r, float g, float b, float a ); 00249 00250 /********************************************************************************** 00251 * cvPickExtractor 00252 * context : The context from cvCreateContext() 00253 * 00254 * width : The width of the source data in pixels 00255 * 00256 * height : The height of the source data in pixels 00257 * 00258 * skipPixels : The number of pixels to skip at the beginning of each line. 00259 * 00260 * skipRows : The number of rows to skip at the top of the image. 00261 * 00262 * rowLength : The stride of the image in bytes. If 0 the width is used. 00263 * 00264 * This function builds and returns a pixel extractor. It is only valid until any 00265 * other cv function is called. 00266 * 00267 *******************************************************************************/ 00268 extern cv_extractor cvPickExtractor( void *context, int32 width, int32 height, 00269 int32 skipPixels, int32 skipRows, int32 rowLength ); 00270 00271 00272 /********************************************************************************** 00273 * cvConvert 00274 * context : The context from cvCreateContext() 00275 * 00276 * width : The width of the source data in pixels 00277 * 00278 * height : The height of the source data in pixels 00279 * 00280 * srcSkipPixels : The number of pixels to skip at the beginning of each source line. 00281 * 00282 * srcSkipRows : The number of rows to skip at the top of the source image. 00283 * 00284 * srcRowLength : The stride of the source image in bytes. If 0 the width is used. 00285 * 00286 * srcData : Pointer to the source data 00287 * 00288 * dstSkipPixels : The number of pixels to skip at the beginning of each destination line. 00289 * 00290 * dstSkipRows : The number of rows to skip at the top of the destination image. 00291 * 00292 * dstRowLength : The stride of the destination image in bytes. If 0 the width is used. 00293 * 00294 * dstData : Pointer to the destination data 00295 * 00296 * 00297 * This function converts the pixel data from the source format to the destination format. 00298 * 00299 *******************************************************************************/ 00300 extern status_t cvConvert( void *context, int32 width, int32 height, 00301 int32 srcSkipPixels, int32 srcSkipRows, int32 srcRowLength, const void *srcData, 00302 int32 dstSkipPixels, int32 dstSkipRows, int32 dstRowLength, void *dstData ); 00303 00304 00305 #ifdef __cplusplus 00306 } 00307 #endif 00308 00309 #endif 00310