nux-0.9.46

nux::CairoGraphics Class Reference

A cairo graphics container. More...

#include <NuxImage/CairoGraphics.h>

Public Types

enum  Alignment { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_JUSTIFY }
 

Enum used to specify horizontal alignment.

More...
enum  VAlignment { VALIGN_TOP, VALIGN_MIDDLE, VALIGN_BOTTOM }
 

Enum used to specify vertical alignment.

More...
enum  Trimming {
  TRIMMING_NONE, TRIMMING_CHARACTER, TRIMMING_WORD, TRIMMING_CHARACTER_ELLIPSIS,
  TRIMMING_WORD_ELLIPSIS, TRIMMING_PATH_ELLIPSIS
}
 

Enum used to specify trimming type.

More...
enum  TextFlag { TEXT_FLAGS_NONE = 0, TEXT_FLAGS_UNDERLINE = 1, TEXT_FLAGS_STRIKEOUT = 2, TEXT_FLAGS_WORDWRAP = 4 }
 

Enum used to specify text flags.

More...

Public Member Functions

 CairoGraphics (cairo_format_t format, int width, int height)
 ~CairoGraphics ()
cairo_t * GetContext ()
 Return a cairo context to the encapsulated surface.
cairo_t * GetInternalContext ()
 Return an internal cairo context to the encapsulated surface. Should not be destroyed.
cairo_surface_t * GetSurface ()
NBitmapDataGetBitmap ()
 Create a NBitmapData pointer to a 2D texture data.
int GetWidth () const
int GetHeight () const
bool PushState ()
bool PopState ()
bool ClearCanvas ()
bool ClearRect (double x, double y, double w, double h)
bool DrawLine (double x0, double y0, double x1, double y1, double width, const Color &c)
bool DrawFilledRect (double x, double y, double w, double h, const Color &c)
bool DrawCanvas (double x, double y, CairoGraphics *cg)
bool DrawRoundedRectangle (cairo_t *cr, double aspect, double x, double y, double cornerRadius, double width, double height, bool align=false)
bool BlurSurface (unsigned int radius, cairo_surface_t *surf=NULL)
bool IntersectRectClipRegion (double x, double y, double w, double h)
bool IntersectGeneralClipRegion (std::list< Rect > &region)

Detailed Description

A cairo graphics container.

CairoGraphics encapsulates a cairo surface and context.


Member Enumeration Documentation

Enum used to specify horizontal alignment.

Enumerator:
ALIGN_LEFT 
ALIGN_CENTER 
ALIGN_RIGHT 
ALIGN_JUSTIFY 

Enum used to specify text flags.

Enumerator:
TEXT_FLAGS_NONE 
TEXT_FLAGS_UNDERLINE 
TEXT_FLAGS_STRIKEOUT 
TEXT_FLAGS_WORDWRAP 

Enum used to specify trimming type.

Enumerator:
TRIMMING_NONE 
TRIMMING_CHARACTER 
TRIMMING_WORD 
TRIMMING_CHARACTER_ELLIPSIS 
TRIMMING_WORD_ELLIPSIS 
TRIMMING_PATH_ELLIPSIS 

Enum used to specify vertical alignment.

Enumerator:
VALIGN_TOP 
VALIGN_MIDDLE 
VALIGN_BOTTOM 

Constructor & Destructor Documentation

nux::CairoGraphics::CairoGraphics ( cairo_format_t  format,
int  width,
int  height 
)
nux::CairoGraphics::~CairoGraphics ( )

Member Function Documentation

bool nux::CairoGraphics::BlurSurface ( unsigned int  radius,
cairo_surface_t *  surf = NULL 
)
bool nux::CairoGraphics::ClearCanvas ( )
bool nux::CairoGraphics::ClearRect ( double  x,
double  y,
double  w,
double  h 
)
bool nux::CairoGraphics::DrawCanvas ( double  x,
double  y,
CairoGraphics cg 
)
bool nux::CairoGraphics::DrawFilledRect ( double  x,
double  y,
double  w,
double  h,
const Color c 
)
bool nux::CairoGraphics::DrawLine ( double  x0,
double  y0,
double  x1,
double  y1,
double  width,
const Color c 
)
bool nux::CairoGraphics::DrawRoundedRectangle ( cairo_t *  cr,
double  aspect,
double  x,
double  y,
double  cornerRadius,
double  width,
double  height,
bool  align = false 
)
NBitmapData* nux::CairoGraphics::GetBitmap ( )

Create a NBitmapData pointer to a 2D texture data.

The returned data must be destroyed with delete.

Returns:
A pointer to a 2D texture data.
cairo_t* nux::CairoGraphics::GetContext ( )

Return a cairo context to the encapsulated surface.

Return the cairo context of this object. Call cairo_destroy to destroy the context when you are done with it.

Returns:
A cairo context.
int nux::CairoGraphics::GetHeight ( ) const
cairo_t* nux::CairoGraphics::GetInternalContext ( )

Return an internal cairo context to the encapsulated surface. Should not be destroyed.

Return the cairo context of this object. This cairo context should not be destroyed with cairo_destroy.

Returns:
A cairo context.
cairo_surface_t* nux::CairoGraphics::GetSurface ( )
int nux::CairoGraphics::GetWidth ( ) const
bool nux::CairoGraphics::IntersectGeneralClipRegion ( std::list< Rect > &  region)
bool nux::CairoGraphics::IntersectRectClipRegion ( double  x,
double  y,
double  w,
double  h 
)
bool nux::CairoGraphics::PopState ( )
bool nux::CairoGraphics::PushState ( )

The documentation for this class was generated from the following file: