GPAC
Open Source Multimedia Framework. For more information, check out http://gpac.wp.mines-telecom.fr
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
color

Color tools. More...

+ Collaboration diagram for color:

Data Structures

struct  GF_VideoSurface
 Video framebuffer object. More...
 
struct  GF_Window
 Video Window object. More...
 
struct  GF_ColorMatrix
 color matrix object More...
 
struct  GF_ColorKey
 Color Key descriptor. More...
 

Macros

#define GF_COL_ARGB(a, r, g, b)
 
#define GF_COL_ARGB_FIXED(_a, _r, _g, _b)
 
#define GF_COL_A(c)
 
#define GF_COL_R(c)
 
#define GF_COL_G(c)
 
#define GF_COL_B(c)
 
#define GF_COL_565(r, g, b)
 
#define GF_COL_555(r, g, b)
 
#define GF_COL_444(r, g, b)
 
#define GF_COL_AG(a, g)
 
#define GF_COL_TO_565(c)
 
#define GF_COL_TO_555(c)
 
#define GF_COL_TO_AG(c)
 
#define GF_COL_TO_444(c)
 

Typedefs

typedef u32 GF_Color
 ARGB color object. More...
 

Functions

void gf_cmx_init (GF_ColorMatrix *_this)
 
void gf_cmx_set_all (GF_ColorMatrix *_this, Fixed *coefs)
 
void gf_cmx_set (GF_ColorMatrix *_this, Fixed mrr, Fixed mrg, Fixed mrb, Fixed mra, Fixed tr, Fixed mgr, Fixed mgg, Fixed mgb, Fixed mga, Fixed tg, Fixed mbr, Fixed mbg, Fixed mbb, Fixed mba, Fixed tb, Fixed mar, Fixed mag, Fixed mab, Fixed maa, Fixed ta)
 
void gf_cmx_copy (GF_ColorMatrix *_this, GF_ColorMatrix *from)
 
void gf_cmx_multiply (GF_ColorMatrix *_this, GF_ColorMatrix *with)
 color matrix multiplication More...
 
GF_Color gf_cmx_apply (GF_ColorMatrix *_this, GF_Color col)
 color matrix transform More...
 
void gf_cmx_apply_fixed (GF_ColorMatrix *_this, Fixed *a, Fixed *r, Fixed *g, Fixed *b)
 color components matrix transform More...
 
GF_Err gf_stretch_bits (GF_VideoSurface *dst, GF_VideoSurface *src, GF_Window *dst_wnd, GF_Window *src_wnd, u8 alpha, Bool flip, GF_ColorKey *colorKey, GF_ColorMatrix *cmat)
 not done yet More...
 

Detailed Description

This section documents color tools for image processing and color conversion


Data Structure Documentation

struct GF_VideoSurface

The video framebuffer object represents uncompressed color data like images in a variety of formats. Data in the video framebuffer MUST be continuous.

+ Collaboration diagram for GF_VideoSurface:
Data Fields
u32 width

Width of the video framebuffer

u32 height

Height of the video framebuffer

s32 pitch_x

Horizontal pitch of the video framebuffer (number of bytes to skip to go to next (right) pixel in the buffer). May be negative for some framebuffers (embedded devices). 0 means linear frame buffer (pitch_x==bytes per pixel)

s32 pitch_y

Vertical pitch of the video framebuffer (number of bytes to skip to go down one line in the buffer). May be negative for some framebuffers (embedded devices)

u32 pixel_format

Pixel format of the video framebuffer

char * video_buffer

pointer to the begining of the video memory (top-left corner)

Bool is_hardware_memory

indicates that the video data reside on systems memory or video card one

char * u_ptr

indicates U and V (and optionnal alpha) buffers in case of planar video with seperated component. If not set, all components are in the video_buffer pointer

char * v_ptr
char * a_ptr
struct GF_Window

The video window object represents a rectangle in framebuffer coordinate system

+ Collaboration diagram for GF_Window:
Data Fields
u32 x

left-most coordinate of the rectangle

u32 y

top-most coordinate of the rectangle

u32 w

width of the rectangle

u32 h

height of the rectangle

struct GF_ColorMatrix

The Color transformation matrix object allows complete color space transformation (shift, rotate, skew, add).
The matrix coefs are in rgba order, hence the color RGBA is transformed to:

R' m0 m1 m2 m3 m4 R
G' m5 m6 m7 m8 m9 G
B' = m10 m11 m12 m13 m14 x B
A' m15 m16 m17 m18 m19 A
0 0 0 0 0 1 0

Coeficients are in intensity scale, ranging from 0 to FIX_ONE.

+ Collaboration diagram for GF_ColorMatrix:
Data Fields
Fixed m[20]

color matrix coefficient

u32 identity

internal flag to speed up things when matrix is identity. This is a read only flag, do not modify it

struct GF_ColorKey

The ColorKey object represents a ColorKey with low and high threshold keying

+ Collaboration diagram for GF_ColorKey:
Data Fields
u8 r

color key R, G, and B components

u8 g
u8 b
u8 alpha

Alpha value for opaque (non-keyed) pixels

u8 low

low variance threshold

u8 high

high variance threshold

Macro Definition Documentation

#define GF_COL_ARGB (   a,
  r,
  g,
 
)

color formating macro from alpha, red, green and blue components expressed as integers ranging from 0 to 255

#define GF_COL_ARGB_FIXED (   _a,
  _r,
  _g,
  _b 
)

color formating macro from alpha, red, green and blue components expressed as fixed numbers ranging from 0 to FIX_ONE

#define GF_COL_A (   c)

gets alpha component of a color

#define GF_COL_R (   c)

gets red component of a color

#define GF_COL_G (   c)

gets green component of a color

#define GF_COL_B (   c)

gets blue component of a color

#define GF_COL_565 (   r,
  g,
 
)

16-bits color formating macro from red, green and blue components

#define GF_COL_555 (   r,
  g,
 
)

15-bits color formating macro from red, green and blue components

#define GF_COL_444 (   r,
  g,
 
)

15-bits color formating macro from red, green and blue components

#define GF_COL_AG (   a,
 
)

16-bits alphagrey color formating macro alpha and grey components

#define GF_COL_TO_565 (   c)

transfoms a 32-bits color into a 16-bits one.

Note
alpha component is lost
#define GF_COL_TO_555 (   c)

transfoms a 32-bits color into a 15-bits one.

Note
alpha component is lost
#define GF_COL_TO_AG (   c)

transfoms a 32-bits color into a 16-bits alphagrey one.

Note
red component is used for grey, green and blue components are lost.
#define GF_COL_TO_444 (   c)

transfoms a 32-bits color into a 15-bits one.

Note
alpha component is lost

Typedef Documentation

typedef u32 GF_Color

The color type used in the GPAC framework represents colors in the form 0xAARRGGBB, with each component ranging from 0 to 255

Function Documentation

void gf_cmx_init ( GF_ColorMatrix _this)

Inits a color matrix to identity

+ Here is the caller graph for this function:

void gf_cmx_set_all ( GF_ColorMatrix _this,
Fixed coefs 
)

Inits all coefficients of a color matrix

Parameters
_thiscolor matrix to initialize
coefslist of the 20 fixed numbers to copy
void gf_cmx_set ( GF_ColorMatrix _this,
Fixed  mrr,
Fixed  mrg,
Fixed  mrb,
Fixed  mra,
Fixed  tr,
Fixed  mgr,
Fixed  mgg,
Fixed  mgb,
Fixed  mga,
Fixed  tg,
Fixed  mbr,
Fixed  mbg,
Fixed  mbb,
Fixed  mba,
Fixed  tb,
Fixed  mar,
Fixed  mag,
Fixed  mab,
Fixed  maa,
Fixed  ta 
)

Inits all coefficients of a color matrix

Parameters
_thiscolor matrix to initialize
mrrred-to-red multiplication factor
mrgred-to-green multiplication factor
mrbred-to-blue multiplication factor
mrared-to-alpha multiplication factor
trred translation factor
mgrgreen-to-red multiplication factor
mgggreen-to-green multiplication factor
mgbgreen-to-blue multiplication factor
mgagreen-to-alpha multiplication factor
tggreen translation factor
mbrblue-to-red multiplication factor
mbgblue-to-green multiplication factor
mbbblue-to-blue multiplication factor
mbablue-to-alpha multiplication factor
tbblue translation factor
maralpha-to-red multiplication factor
magalpha-to-green multiplication factor
mabalpha-to-blue multiplication factor
maaalpha-to-alpha multiplication factor
taalpha translation factor

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void gf_cmx_copy ( GF_ColorMatrix _this,
GF_ColorMatrix from 
)

Inits a matrix from another matrix

Parameters
_thiscolor matrix to initialize
fromcolor matrix to copy from

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void gf_cmx_multiply ( GF_ColorMatrix _this,
GF_ColorMatrix with 
)

Multiplies a color matrix by another one. Result is _this*with

Parameters
_thiscolor matrix to transform. Once the function called, _this will contain the resulting color matrix
withcolor matrix to add

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GF_Color gf_cmx_apply ( GF_ColorMatrix _this,
GF_Color  col 
)

Transforms a color with a given color matrix

Parameters
_thiscolor matrix to use.
colcolor to transform
Returns
transformed color

+ Here is the caller graph for this function:

void gf_cmx_apply_fixed ( GF_ColorMatrix _this,
Fixed a,
Fixed r,
Fixed g,
Fixed b 
)

Transforms color components with a given color matrix

Parameters
_thiscolor matrix to use.
apointer to alpha component. Once the function is called, a contains the transformed alpha component
rpointer to red component. Once the function is called, r contains the transformed red component
gpointer to green component. Once the function is called, g contains the transformed green component
bpointer to blue component. Once the function is called, b contains the transformed blue component

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GF_Err gf_stretch_bits ( GF_VideoSurface dst,
GF_VideoSurface src,
GF_Window dst_wnd,
GF_Window src_wnd,
u8  alpha,
Bool  flip,
GF_ColorKey colorKey,
GF_ColorMatrix cmat 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: