Cairo-Dock  3.4.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
cairo-dock-image-buffer.h File Reference

Data Structures

struct  _CairoDockImageBuffer
 Definition of an Image Buffer. It provides an unified interface for a cairo/opengl image buffer. More...
 

Macros

#define cairo_dock_load_image_buffer(pImage, cImageFile, iWidth, iHeight, iLoadModifier)
 
#define cairo_dock_apply_image_buffer_surface(pImage, pCairoContext)
 
#define cairo_dock_apply_image_buffer_texture(pImage)
 

Functions

gchar * cairo_dock_search_image_s_path (const gchar *cImageFile)
 
void cairo_dock_load_image_buffer_full (CairoDockImageBuffer *pImage, const gchar *cImageFile, int iWidth, int iHeight, CairoDockLoadImageModifier iLoadModifier, double fAlpha)
 
void cairo_dock_load_image_buffer_from_surface (CairoDockImageBuffer *pImage, cairo_surface_t *pSurface, int iWidth, int iHeight)
 
CairoDockImageBuffercairo_dock_create_image_buffer (const gchar *cImageFile, int iWidth, int iHeight, CairoDockLoadImageModifier iLoadModifier)
 
void cairo_dock_unload_image_buffer (CairoDockImageBuffer *pImage)
 
void cairo_dock_free_image_buffer (CairoDockImageBuffer *pImage)
 
void cairo_dock_apply_image_buffer_surface_with_offset (const CairoDockImageBuffer *pImage, cairo_t *pCairoContext, double x, double y, double fAlpha)
 
void cairo_dock_apply_image_buffer_texture_with_offset (const CairoDockImageBuffer *pImage, double x, double y)
 
void cairo_dock_apply_image_buffer_surface_at_size (const CairoDockImageBuffer *pImage, cairo_t *pCairoContext, int w, int h, double x, double y, double fAlpha)
 
void cairo_dock_apply_image_buffer_texture_at_size (const CairoDockImageBuffer *pImage, int w, int h, double x, double y)
 
void cairo_dock_create_icon_fbo (void)
 
void cairo_dock_destroy_icon_fbo (void)
 

Detailed Description

This class defines a generic image API that works for both Cairo and OpenGL. It allows to easily load and display images, without having to care the rendering mode. It supports animated images (an animated image is made of several frames, ordered side by side from left to right).

Use cairo_dock_create_image_buffer to create an image buffer from a file, or cairo_dock_load_image_buffer to load an image into an existing image buffer. Use cairo_dock_free_image_buffer to destroy it or cairo_dock_unload_image_buffer to unload and reset it to 0.

Use cairo_dock_apply_image_buffer_surface or cairo_dock_apply_image_buffer_texture to display the image.

Macro Definition Documentation

cairo_dock_load_image_buffer (   pImage,
  cImageFile,
  iWidth,
  iHeight,
  iLoadModifier 
)

Load an image into an ImageBuffer. If the image is given by its sole name, it is taken in the root folder of the current theme.

Parameters
pImagean ImageBuffer.
cImageFilename of a file
iWidthwidth it should be loaded. The resulting width can be different depending on the modifier.
iHeightheight it should be loaded. The resulting width can be different depending on the modifier.
iLoadModifiermodifier
#define cairo_dock_apply_image_buffer_surface (   pImage,
  pCairoContext 
)

Draw an ImageBuffer on a cairo context.

Parameters
pImagean ImageBuffer.
pCairoContextthe current cairo context.
#define cairo_dock_apply_image_buffer_texture (   pImage)

Draw an ImageBuffer on the current OpenGL context.

Parameters
pImagean ImageBuffer.

Function Documentation

gchar* cairo_dock_search_image_s_path ( const gchar *  cImageFile)

Find the path of an image. '~' is handled, as well as the 'images' folder of the current theme. Use cairo_dock_search_icon_s_path to search theme icons.

Parameters
cImageFilea file name or path. If it's already a path, it will just be duplicated.
Returns
the path of the file, or NULL if it has not been found.
void cairo_dock_load_image_buffer_full ( CairoDockImageBuffer pImage,
const gchar *  cImageFile,
int  iWidth,
int  iHeight,
CairoDockLoadImageModifier  iLoadModifier,
double  fAlpha 
)

Load an image into an ImageBuffer with a given transparency. If the image is given by its sole name, it is taken in the root folder of the current theme.

Parameters
pImagean ImageBuffer.
cImageFilename of a file
iWidthwidth it should be loaded.
iHeightheight it should be loaded.
iLoadModifiermodifier
fAlphatransparency (1:fully opaque)
void cairo_dock_load_image_buffer_from_surface ( CairoDockImageBuffer pImage,
cairo_surface_t *  pSurface,
int  iWidth,
int  iHeight 
)

Load a surface into an ImageBuffer.

Parameters
pImagean ImageBuffer.
pSurfacea cairo surface
iWidthwidth of the surface
iHeightheight of the surface
CairoDockImageBuffer* cairo_dock_create_image_buffer ( const gchar *  cImageFile,
int  iWidth,
int  iHeight,
CairoDockLoadImageModifier  iLoadModifier 
)

Create and load an image into an ImageBuffer. If the image is given by its sole name, it is taken in the root folder of the current theme.

Parameters
cImageFilename of a file
iWidthwidth it should be loaded.
iHeightheight it should be loaded.
iLoadModifiermodifier
Returns
a newly allocated ImageBuffer.
void cairo_dock_unload_image_buffer ( CairoDockImageBuffer pImage)

Reset an ImageBuffer's ressources. It can be used to load another image then.

Parameters
pImagean ImageBuffer.
void cairo_dock_free_image_buffer ( CairoDockImageBuffer pImage)

Reset and free an ImageBuffer.

Parameters
pImagean ImageBuffer.
void cairo_dock_apply_image_buffer_surface_with_offset ( const CairoDockImageBuffer pImage,
cairo_t *  pCairoContext,
double  x,
double  y,
double  fAlpha 
)

Draw an ImageBuffer with an offset on a Cairo context, at the size it was loaded.

Parameters
pImagean ImageBuffer.
pCairoContextthe current cairo context.
xhorizontal offset.
yvertical offset.
fAlphatransparency (in [0;1])
void cairo_dock_apply_image_buffer_texture_with_offset ( const CairoDockImageBuffer pImage,
double  x,
double  y 
)

Draw an ImageBuffer with an offset on the current OpenGL context, at the size it was loaded.

Parameters
pImagean ImageBuffer.
xhorizontal offset.
yvertical offset.
void cairo_dock_apply_image_buffer_surface_at_size ( const CairoDockImageBuffer pImage,
cairo_t *  pCairoContext,
int  w,
int  h,
double  x,
double  y,
double  fAlpha 
)

Draw an ImageBuffer with an offset on a Cairo context, at a given size.

Parameters
pImagean ImageBuffer.
pCairoContextthe current cairo context.
wrequested width
hrequested height
xhorizontal offset.
yvertical offset.
fAlphatransparency (in [0;1])
void cairo_dock_apply_image_buffer_texture_at_size ( const CairoDockImageBuffer pImage,
int  w,
int  h,
double  x,
double  y 
)

Draw an ImageBuffer on the current OpenGL context at a given size.

Parameters
pImagean ImageBuffer.
wrequested width
hrequested height
xhorizontal offset.
yvertical offset.
void cairo_dock_create_icon_fbo ( void  )

Create an FBO to render the icons inside a dock.

void cairo_dock_destroy_icon_fbo ( void  )

Destroy the icons FBO.