+++ /dev/null
-/*\r
- * GPAC - Multimedia Framework C SDK\r
- *\r
- * Copyright (c) Jean Le Feuvre 2000-2005\r
- * All rights reserved\r
- *\r
- * This file is part of GPAC / common tools interfaces\r
- *\r
- * GPAC is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU Lesser General Public License as published by\r
- * the Free Software Foundation; either version 2, or (at your option)\r
- * any later version.\r
- * \r
- * GPAC is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU Lesser General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; see the file COPYING. If not, write to\r
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
- *\r
- */\r
-\r
-\r
-#ifndef _GF_RASTER_2D_H_\r
-#define _GF_RASTER_2D_H_\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-#include <gpac/constants.h>\r
-\r
-\r
-/*!\r
- *\addtogroup color_grp color\r
- *\ingroup utils_grp\r
- *\brief Color tools\r
- *\r
- *This section documents color tools for image processing and color conversion\r
- * @{\r
- */\r
-\r
-\r
-/*!\brief Video framebuffer object\r
- *\r
- *The video framebuffer object represents uncompressed color data like images in a variety of formats. Data in\r
- *the video framebuffer MUST be continuous.\r
-*/\r
-typedef struct\r
-{\r
- /*!Width of the video framebuffer */\r
- u32 width;\r
- /*!Height of the video framebuffer */\r
- u32 height;\r
- /*!Vertical pitch of the video framebuffer (number of bytes to skip to go down one line in the buffer). May be \r
- negative for some framebuffers (embedded devices)*/\r
- s32 pitch;\r
- /*!Pixel format of the video framebuffer*/\r
- u32 pixel_format;\r
- /*!pointer to the begining of the video memory (top-left corner)*/\r
- char *video_buffer;\r
- /*!indicates that the video data reside on systems memory or video card one*/\r
- Bool is_hardware_memory;\r
-} GF_VideoSurface;\r
-\r
-/*!\brief Video Window object\r
- *\r
- *The video window object represents a rectangle in framebuffer coordinate system\r
-*/\r
-typedef struct\r
-{\r
- /*!left-most coordinate of the rectangle*/\r
- u32 x;\r
- /*!top-most coordinate of the rectangle*/\r
- u32 y;\r
- /*!width of the rectangle*/\r
- u32 w;\r
- /*!height of the rectangle*/\r
- u32 h;\r
-} GF_Window;\r
-\r
-\r
-/*!\brief color matrix object\r
- *\r
- *The Color transformation matrix object allows complete color space transformation (shift, rotate, skew, add).\n\r
- *The matrix coefs are in rgba order, hence the color RGBA is transformed to:\r
- \code\r
- R' m0 m1 m2 m3 m4 R\r
- G' m5 m6 m7 m8 m9 G\r
- B' = m10 m11 m12 m13 m14 x B\r
- A' m15 m16 m17 m18 m19 A\r
- 0 0 0 0 0 1 0\r
- \endcode\r
- *Coeficients are in intensity scale, ranging from 0 to \ref FIX_ONE.\r
-*/\r
-typedef struct\r
-{\r
- /*!color matrix coefficient*/\r
- Fixed m[20];\r
- /*!internal flag to speed up things when matrix is identity. This is a read only flag, do not modify it*/\r
- u32 identity;\r
-} GF_ColorMatrix;\r
-\r
-/*!\brief ARGB color object\r
- *\r
- *The color type used in the GPAC framework represents colors in the form 0xAARRGGBB, with each component ranging from 0 to 255\r
-*/\r
-typedef u32 GF_Color;\r
-/*!\hideinitializer color formating macro from alpha, red, green and blue components expressed as integers ranging from 0 to 255*/\r
-#define GF_COL_ARGB(a, r, g, b) ((a)<<24 | (r)<<16 | (g)<<8 | (b))\r
-/*!\hideinitializer color formating macro from alpha, red, green and blue components expressed as fixed numbers ranging from 0 to \ref FIX_ONE*/\r
-#define GF_COL_ARGB_FIXED(_a, _r, _g, _b) GF_COL_ARGB(FIX2INT(255*(_a)), FIX2INT(255*(_r)), FIX2INT(255*(_g)), FIX2INT(255*(_b)))\r
-/*!\hideinitializer gets alpha component of a color*/\r
-#define GF_COL_A(c) (u8) ((c)>>24)\r
-/*!\hideinitializer gets red component of a color*/\r
-#define GF_COL_R(c) (u8) ( ((c)>>16) & 0xFF)\r
-/*!\hideinitializer gets green component of a color*/\r
-#define GF_COL_G(c) (u8) ( ((c)>>8) & 0xFF)\r
-/*!\hideinitializer gets blue component of a color*/\r
-#define GF_COL_B(c) (u8) ( (c) & 0xFF)\r
-/*!\hideinitializer 16-bits color formating macro from red, green and blue components*/\r
-#define GF_COL_565(r, g, b) (u16) (((r & 248)<<8) + ((g & 252)<<3) + (b>>3))\r
-/*!\hideinitializer 15-bits color formating macro from red, green and blue components*/\r
-#define GF_COL_555(r, g, b) (u16) (((r & 248)<<7) + ((g & 248)<<2) + (b>>3))\r
-/*!\hideinitializer 15-bits color formating macro from red, green and blue components*/\r
-#define GF_COL_444(r, g, b) (u16) (((r & 240)<<4) + ((g & 240)) + ((b & 240)>>4))\r
-/*!\hideinitializer 16-bits alphagrey color formating macro alpha and grey components*/\r
-#define GF_COL_AG(a, g) (u16) ( (a << 8) | g)\r
-/*!\hideinitializer transfoms a 32-bits color into a 16-bits one.\note alpha component is lost*/\r
-#define GF_COL_TO_565(c) (((GF_COL_R(c) & 248)<<8) + ((GF_COL_G(c) & 252)<<3) + (GF_COL_B(c)>>3))\r
-/*!\hideinitializer transfoms a 32-bits color into a 15-bits one.\note alpha component is lost*/\r
-#define GF_COL_TO_555(c) (((GF_COL_R(c) & 248)<<7) + ((GF_COL_G(c) & 248)<<2) + (GF_COL_B(c)>>3))\r
-/*!\hideinitializer transfoms a 32-bits color into a 16-bits alphagrey one.\note red component is used for grey, green and blue components are lost.*/\r
-#define GF_COL_TO_AG(c) ( (GF_COL_A(c) << 8) | GF_COL_R(c))\r
-/*!\hideinitializer transfoms a 32-bits color into a 15-bits one.\note alpha component is lost*/\r
-#define GF_COL_TO_444(c) (((GF_COL_R(c) & 240)<<4) + ((GF_COL_G(c) & 240)) + ((GF_COL_B(c)>>4) & 240) )\r
-\r
-/*!Inits a color matrix to identity*/\r
-void gf_cmx_init(GF_ColorMatrix *_this);\r
-/*!Inits all coefficients of a color matrix \r
- *\param _this color matrix to initialize\r
- *\param coefs list of the 20 fixed numbers to copy\r
-*/\r
-void gf_cmx_set_all(GF_ColorMatrix *_this, Fixed *coefs);\r
-/*!Inits all coefficients of a color matrix \r
- *\param _this color matrix to initialize\r
- *\param mrr red-to-red multiplication factor\r
- *\param mrg red-to-green multiplication factor\r
- *\param mrb red-to-blue multiplication factor\r
- *\param mra red-to-alpha multiplication factor\r
- *\param tr red translation factor\r
- *\param mgr green-to-red multiplication factor\r
- *\param mgg green-to-green multiplication factor\r
- *\param mgb green-to-blue multiplication factor\r
- *\param mga green-to-alpha multiplication factor\r
- *\param tg green translation factor\r
- *\param mbr blue-to-red multiplication factor\r
- *\param mbg blue-to-green multiplication factor\r
- *\param mbb blue-to-blue multiplication factor\r
- *\param mba blue-to-alpha multiplication factor\r
- *\param tb blue translation factor\r
- *\param mar alpha-to-red multiplication factor\r
- *\param mag alpha-to-green multiplication factor\r
- *\param mab alpha-to-blue multiplication factor\r
- *\param maa alpha-to-alpha multiplication factor\r
- *\param ta alpha translation factor\r
-*/\r
-void gf_cmx_set(GF_ColorMatrix *_this, \r
- Fixed mrr, Fixed mrg, Fixed mrb, Fixed mra, Fixed tr,\r
- Fixed mgr, Fixed mgg, Fixed mgb, Fixed mga, Fixed tg,\r
- Fixed mbr, Fixed mbg, Fixed mbb, Fixed mba, Fixed tb,\r
- Fixed mar, Fixed mag, Fixed mab, Fixed maa, Fixed ta);\r
-/*!Inits a matrix from another matrix\r
- *\param _this color matrix to initialize\r
- *\param from color matrix to copy from\r
-*/\r
-void gf_cmx_copy(GF_ColorMatrix *_this, GF_ColorMatrix *from);\r
-/*!\brief color matrix multiplication\r
- *\r
- *Multiplies a color matrix by another one. Result is _this*with\r
- *\param _this color matrix to transform. Once the function called, _this will contain the resulting color matrix\r
- *\param with color matrix to add\r
-*/\r
-void gf_cmx_multiply(GF_ColorMatrix *_this, GF_ColorMatrix *with);\r
-/*!\brief color matrix transform\r
- *\r
- *Transforms a color with a given color matrix\r
- *\param _this color matrix to use.\r
- *\param col color to transform\r
- *\return transformed color\r
-*/\r
-GF_Color gf_cmx_apply(GF_ColorMatrix *_this, GF_Color col);\r
-/*!\brief color components matrix transform\r
- *\r
- *Transforms color components with a given color matrix\r
- *\param _this color matrix to use.\r
- *\param a pointer to alpha component. Once the function is called, a contains the transformed alpha component\r
- *\param r pointer to red component. Once the function is called, r contains the transformed red component\r
- *\param g pointer to green component. Once the function is called, g contains the transformed green component\r
- *\param b pointer to blue component. Once the function is called, b contains the transformed blue component\r
-*/\r
-void gf_cmx_apply_fixed(GF_ColorMatrix *_this, Fixed *a, Fixed *r, Fixed *g, Fixed *b);\r
-\r
-\r
-/*!\brief Color Key descriptor\r
- *\r
- *The ColorKey object represents a ColorKey with low and high threshold keying\r
-*/\r
-typedef struct\r
-{\r
- /*!color key R, G, and B components*/\r
- u8 r, g, b;\r
- /*!Alpha value for opaque (non-keyed) pixels*/\r
- u8 alpha;\r
- /*!low variance threshold*/\r
- u8 low;\r
- /*!high variance threshold*/\r
- u8 high;\r
-} GF_ColorKey;\r
-\r
-/*!\brief not done yet\r
- *\r
- */\r
-GF_Err gf_stretch_bits(GF_VideoSurface *dst, GF_VideoSurface *src, GF_Window *dst_wnd, GF_Window *src_wnd, s32 dst_x_pitch, u8 alpha, Bool flip, GF_ColorKey *colorKey, GF_ColorMatrix * cmat);\r
-\r
-\r
-\r
-/*! @} */\r
-\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-\r
-#endif /*_GF_RASTER_2D_H_*/\r
-\r