diff options
-rw-r--r-- | canvas/source/cairo/cairo_cairo.hxx | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/canvas/source/cairo/cairo_cairo.hxx b/canvas/source/cairo/cairo_cairo.hxx new file mode 100644 index 000000000000..043ff32497ec --- /dev/null +++ b/canvas/source/cairo/cairo_cairo.hxx @@ -0,0 +1,82 @@ +#ifndef _CAIROCANVAS_CAIRO_HXX +#define _CAIROCANVAS_CAIRO_HXX + +namespace cairo { + +#include <cairo.h> + + typedef cairo_t Cairo; + typedef cairo_matrix_t Matrix; + typedef cairo_format_t Format; + typedef cairo_content_t Content; + typedef cairo_pattern_t Pattern; + + class Surface { + const void* mpSysData; + void* mpDisplay; + long mhDrawable; + void *mpRenderFormat; + int mnRefCount; + bool mbFreePixmap; + public: + cairo_surface_t* mpSurface; + + Surface( const void* pSysData, void* pDisplay, long hDrawable, void* pRenderFormat, cairo_surface_t* pSurface ) + : mpSysData( pSysData ), + mpDisplay( pDisplay ), + mhDrawable( hDrawable ), + mpRenderFormat( pRenderFormat ), + mpSurface( pSurface ), + mbFreePixmap( true ), + mnRefCount( 1 ) + { + } + + Surface( cairo_surface_t* pSurface ) + : mpSurface( pSurface ), + mpDisplay( NULL ), + mhDrawable( 0 ), + mpSysData( NULL ), + mbFreePixmap( false ), + mnRefCount( 1 ) + { + } + + Surface( const void* pSysData, int x, int y, int width, int height ); + Surface( const void* pSysData, void *pBmpData, int width, int height ); + + + ~Surface(); + + void Ref() + { + mnRefCount ++; + } + + void Unref() + { + mnRefCount --; + if( mnRefCount <= 0 ) + delete this; + } + + Cairo* getCairo() + { + return cairo_create( mpSurface ); + } + + Surface* getSimilar( Content aContent, int width, int height ); + + long getPixmap() + { + return mhDrawable; + } + + void* getRenderFormat() + { + return mpRenderFormat; + } + }; +} + +#endif |