Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes

gfxASurface Class Reference

A surface is something you can draw on. More...

#include <gfxASurface.h>

Inheritance diagram for gfxASurface:
Collaboration diagram for gfxASurface:

List of all members.

Public Types

enum  gfxImageFormat {
  ImageFormatARGB32, ImageFormatRGB24, ImageFormatA8, ImageFormatA1,
  ImageFormatRGB16_565, ImageFormatUnknown
}
 

The format for an image surface.

More...
enum  gfxSurfaceType {
  SurfaceTypeImage, SurfaceTypePDF, SurfaceTypePS, SurfaceTypeXlib,
  SurfaceTypeXcb, SurfaceTypeGlitz, SurfaceTypeQuartz, SurfaceTypeWin32,
  SurfaceTypeBeOS, SurfaceTypeDirectFB, SurfaceTypeSVG, SurfaceTypeOS2,
  SurfaceTypeWin32Printing, SurfaceTypeQuartzImage, SurfaceTypeScript, SurfaceTypeQPainter,
  SurfaceTypeRecording, SurfaceTypeVG, SurfaceTypeGL, SurfaceTypeDRM,
  SurfaceTypeTee, SurfaceTypeXML, SurfaceTypeSkia, SurfaceTypeD2D,
  SurfaceTypeMax
}
enum  gfxContentType { CONTENT_COLOR = 0x1000, CONTENT_ALPHA = 0x2000, CONTENT_COLOR_ALPHA = 0x3000 }

Public Member Functions

nsrefcnt AddRef (void)
nsrefcnt Release (void)
cairo_surface_tCairoSurface ()
gfxSurfaceType GetType () const
gfxContentType GetContentType () const
void SetDeviceOffset (const gfxPoint &offset)
gfxPoint GetDeviceOffset () const
void Flush () const
void MarkDirty ()
void MarkDirty (const gfxRect &r)
virtual nsresult BeginPrinting (const nsAString &aTitle, const nsAString &aPrintToFileName)
virtual nsresult EndPrinting ()
virtual nsresult AbortPrinting ()
virtual nsresult BeginPage ()
virtual nsresult EndPage ()
void SetData (const cairo_user_data_key_t *key, void *user_data, thebes_destroy_func_t destroy)
void * GetData (const cairo_user_data_key_t *key)
virtual void Finish ()
virtual already_AddRefed
< gfxASurface
CreateSimilarSurface (gfxContentType aType, const gfxIntSize &aSize)
 Create an offscreen surface that can be efficiently copied into this surface (at least if tiling is not involved).
virtual already_AddRefed
< gfxImageSurface
GetAsImageSurface ()
 Returns an image surface for this surface, or nsnull if not supported.
int CairoStatus ()
virtual PRInt32 GetDefaultContextFlags () const
void SetSubpixelAntialiasingEnabled (PRBool aEnabled)
PRBool GetSubpixelAntialiasingEnabled ()
void RecordMemoryUsed (PRInt32 aBytes)
 Same as above, but use current surface type as returned by GetType().
void RecordMemoryFreed ()
PRInt32 KnownMemoryUsed ()
virtual const gfxIntSize GetSize () const
void SetOpaqueRect (const gfxRect &aRect)
const gfxRectGetOpaqueRect ()
virtual PRBool SupportsSelfCopy ()
void SetAllowUseAsSource (PRBool aAllow)
 Mark the surface as being allowed/not allowed to be used as a source.
PRBool GetAllowUseAsSource ()

Static Public Member Functions

static already_AddRefed
< gfxASurface
Wrap (cairo_surface_t *csurf)
 Wrap the given cairo surface and return a gfxASurface for it.
static PRBool CheckSurfaceSize (const gfxIntSize &sz, PRInt32 limit=0)
static gfxContentType ContentFromFormat (gfxImageFormat format)
static gfxImageFormat FormatFromContent (gfxContentType format)
static void RecordMemoryUsedForSurfaceType (gfxASurface::gfxSurfaceType aType, PRInt32 aBytes)
 Record number of bytes for given surface type.
static PRInt32 BytePerPixelFromFormat (gfxImageFormat format)

Protected Member Functions

 gfxASurface ()
void Init (cairo_surface_t *surface, PRBool existingSurface=0)
virtual ~gfxASurface ()

Static Protected Member Functions

static gfxASurfaceGetSurfaceWrapper (cairo_surface_t *csurf)
static void SetSurfaceWrapper (cairo_surface_t *csurf, gfxASurface *asurf)

Protected Attributes

cairo_surface_tmSurface
nsAutoPtr< gfxRectmOpaqueRect
PRPackedBool mSurfaceValid
PRPackedBool mAllowUseAsSource

Detailed Description

A surface is something you can draw on.

Instantiate a subclass of this abstract class, and use gfxContext to draw on this surface.


Member Enumeration Documentation

Enumerator:
CONTENT_COLOR 
CONTENT_ALPHA 
CONTENT_COLOR_ALPHA 

The format for an image surface.

For all formats with alpha data, 0 means transparent, 1 or 255 means fully opaque.

Enumerator:
ImageFormatARGB32 

ARGB data in native endianness, using premultiplied alpha.

ImageFormatRGB24 

xRGB data in native endianness

ImageFormatA8 

Only an alpha channel.

ImageFormatA1 

Packed transparency information (one byte refers to 8 pixels).

ImageFormatRGB16_565 

RGB_565 data in native endianness.

ImageFormatUnknown 
Enumerator:
SurfaceTypeImage 
SurfaceTypePDF 
SurfaceTypePS 
SurfaceTypeXlib 
SurfaceTypeXcb 
SurfaceTypeGlitz 
SurfaceTypeQuartz 
SurfaceTypeWin32 
SurfaceTypeBeOS 
SurfaceTypeDirectFB 
SurfaceTypeSVG 
SurfaceTypeOS2 
SurfaceTypeWin32Printing 
SurfaceTypeQuartzImage 
SurfaceTypeScript 
SurfaceTypeQPainter 
SurfaceTypeRecording 
SurfaceTypeVG 
SurfaceTypeGL 
SurfaceTypeDRM 
SurfaceTypeTee 
SurfaceTypeXML 
SurfaceTypeSkia 
SurfaceTypeD2D 
SurfaceTypeMax 

Constructor & Destructor Documentation

gfxASurface::gfxASurface (  )  [inline, protected]
virtual gfxASurface::~gfxASurface (  )  [inline, protected, virtual]

Member Function Documentation

virtual nsresult gfxASurface::AbortPrinting (  )  [virtual]

Reimplemented in gfxPDFSurface, and gfxPSSurface.

nsrefcnt gfxASurface::AddRef ( void   ) 
virtual nsresult gfxASurface::BeginPage (  )  [virtual]

Reimplemented in gfxPDFSurface, and gfxPSSurface.

virtual nsresult gfxASurface::BeginPrinting ( const nsAString aTitle,
const nsAString aPrintToFileName 
) [virtual]

Reimplemented in gfxPDFSurface, and gfxPSSurface.

static PRInt32 gfxASurface::BytePerPixelFromFormat ( gfxImageFormat  format  )  [static]
int gfxASurface::CairoStatus (  ) 
cairo_surface_t* gfxASurface::CairoSurface (  )  [inline]
static PRBool gfxASurface::CheckSurfaceSize ( const gfxIntSize sz,
PRInt32  limit = 0 
) [static]
static gfxContentType gfxASurface::ContentFromFormat ( gfxImageFormat  format  )  [static]
virtual already_AddRefed<gfxASurface> gfxASurface::CreateSimilarSurface ( gfxContentType  aType,
const gfxIntSize aSize 
) [virtual]

Create an offscreen surface that can be efficiently copied into this surface (at least if tiling is not involved).

Returns null on error.

Reimplemented in gfxXlibSurface.

virtual nsresult gfxASurface::EndPage (  )  [virtual]

Reimplemented in gfxPDFSurface, and gfxPSSurface.

virtual nsresult gfxASurface::EndPrinting (  )  [virtual]

Reimplemented in gfxPDFSurface, and gfxPSSurface.

virtual void gfxASurface::Finish (  )  [virtual]

Reimplemented in gfxPDFSurface, and gfxPSSurface.

void gfxASurface::Flush (  )  const
static gfxImageFormat gfxASurface::FormatFromContent ( gfxContentType  format  )  [static]
PRBool gfxASurface::GetAllowUseAsSource (  )  [inline]
virtual already_AddRefed<gfxImageSurface> gfxASurface::GetAsImageSurface (  )  [inline, virtual]

Returns an image surface for this surface, or nsnull if not supported.

This will not copy image data, just wraps an image surface around pixel data already available in memory.

Reimplemented in gfxImageSurface.

gfxContentType gfxASurface::GetContentType (  )  const
void* gfxASurface::GetData ( const cairo_user_data_key_t key  ) 
virtual PRInt32 gfxASurface::GetDefaultContextFlags (  )  const [inline, virtual]

Reimplemented in gfxPDFSurface, and gfxPSSurface.

gfxPoint gfxASurface::GetDeviceOffset (  )  const
const gfxRect& gfxASurface::GetOpaqueRect (  )  [inline]
virtual const gfxIntSize gfxASurface::GetSize (  )  const [inline, virtual]
PRBool gfxASurface::GetSubpixelAntialiasingEnabled (  ) 
static gfxASurface* gfxASurface::GetSurfaceWrapper ( cairo_surface_t csurf  )  [static, protected]
gfxSurfaceType gfxASurface::GetType (  )  const
void gfxASurface::Init ( cairo_surface_t surface,
PRBool  existingSurface = 0 
) [protected]
PRInt32 gfxASurface::KnownMemoryUsed (  )  [inline]
void gfxASurface::MarkDirty ( const gfxRect r  ) 
void gfxASurface::MarkDirty (  ) 
void gfxASurface::RecordMemoryFreed (  ) 
void gfxASurface::RecordMemoryUsed ( PRInt32  aBytes  ) 

Same as above, but use current surface type as returned by GetType().

The bytes will be accumulated until RecordMemoryFreed is called, in which case the value that was recorded for this surface will be freed.

static void gfxASurface::RecordMemoryUsedForSurfaceType ( gfxASurface::gfxSurfaceType  aType,
PRInt32  aBytes 
) [static]

Record number of bytes for given surface type.

Use positive bytes for allocations and negative bytes for deallocations.

nsrefcnt gfxASurface::Release ( void   ) 
void gfxASurface::SetAllowUseAsSource ( PRBool  aAllow  )  [inline]

Mark the surface as being allowed/not allowed to be used as a source.

void gfxASurface::SetData ( const cairo_user_data_key_t key,
void *  user_data,
thebes_destroy_func_t  destroy 
)
void gfxASurface::SetDeviceOffset ( const gfxPoint offset  ) 
void gfxASurface::SetOpaqueRect ( const gfxRect aRect  )  [inline]
void gfxASurface::SetSubpixelAntialiasingEnabled ( PRBool  aEnabled  ) 
static void gfxASurface::SetSurfaceWrapper ( cairo_surface_t csurf,
gfxASurface asurf 
) [static, protected]
virtual PRBool gfxASurface::SupportsSelfCopy (  )  [inline, virtual]

Reimplemented in gfxImageSurface.

static already_AddRefed<gfxASurface> gfxASurface::Wrap ( cairo_surface_t csurf  )  [static]

Wrap the given cairo surface and return a gfxASurface for it.

This adds a reference to csurf (owned by the returned gfxASurface).


Member Data Documentation


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