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

gfxImageSurface Class Reference

A raw image buffer. More...

#include <gfxImageSurface.h>

Inheritance diagram for gfxImageSurface:
Collaboration diagram for gfxImageSurface:

List of all members.

Public Member Functions

 gfxImageSurface (unsigned char *aData, const gfxIntSize &aSize, long aStride, gfxImageFormat aFormat)
 Construct an image surface around an existing buffer of image data.
 gfxImageSurface (const gfxIntSize &size, gfxImageFormat format)
 Construct an image surface.
 gfxImageSurface (cairo_surface_t *csurf)
virtual ~gfxImageSurface ()
gfxImageFormat Format () const
virtual const gfxIntSize GetSize () const
PRInt32 Width () const
PRInt32 Height () const
PRInt32 Stride () const
 Distance in bytes between the start of a line and the start of the next line.
unsigned char * Data () const
 Returns a pointer for the image data.
PRInt32 GetDataSize () const
 Returns the total size of the image data.
PRBool CopyFrom (gfxImageSurface *other)
already_AddRefed
< gfxSubimageSurface
GetSubimage (const gfxRect &aRect)
virtual already_AddRefed
< gfxImageSurface
GetAsImageSurface ()
 Returns an image surface for this surface, or nsnull if not supported.
virtual PRBool SupportsSelfCopy ()

Protected Member Functions

 gfxImageSurface ()
void InitWithData (unsigned char *aData, const gfxIntSize &aSize, long aStride, gfxImageFormat aFormat)
void InitFromSurface (cairo_surface_t *csurf)
long ComputeStride () const

Static Protected Member Functions

static long ComputeStride (const gfxIntSize &, gfxImageFormat)

Protected Attributes

gfxIntSize mSize
PRBool mOwnsData
unsigned char * mData
gfxImageFormat mFormat
long mStride

Detailed Description

A raw image buffer.

The format can be set in the constructor. Its main purpose is for storing read-only images and using it as a source surface, but it can also be drawn to.


Constructor & Destructor Documentation

gfxImageSurface::gfxImageSurface ( unsigned char *  aData,
const gfxIntSize aSize,
long  aStride,
gfxImageFormat  aFormat 
)

Construct an image surface around an existing buffer of image data.

Parameters:
aData A buffer containing the image data
aSize The size of the buffer
aStride The stride of the buffer
format Format of the data
See also:
gfxImageFormat
gfxImageSurface::gfxImageSurface ( const gfxIntSize size,
gfxImageFormat  format 
)

Construct an image surface.

Parameters:
aSize The size of the buffer
format Format of the data
See also:
gfxImageFormat
gfxImageSurface::gfxImageSurface ( cairo_surface_t csurf  ) 
virtual gfxImageSurface::~gfxImageSurface (  )  [virtual]
gfxImageSurface::gfxImageSurface (  )  [protected]

Member Function Documentation

long gfxImageSurface::ComputeStride (  )  const [inline, protected]
static long gfxImageSurface::ComputeStride ( const gfxIntSize ,
gfxImageFormat   
) [static, protected]
PRBool gfxImageSurface::CopyFrom ( gfxImageSurface other  ) 
unsigned char* gfxImageSurface::Data (  )  const [inline]

Returns a pointer for the image data.

Users of this function can write to it, but must not attempt to free the buffer.

gfxImageFormat gfxImageSurface::Format (  )  const [inline]
virtual already_AddRefed<gfxImageSurface> gfxImageSurface::GetAsImageSurface (  )  [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 from gfxASurface.

PRInt32 gfxImageSurface::GetDataSize (  )  const [inline]

Returns the total size of the image data.

virtual const gfxIntSize gfxImageSurface::GetSize (  )  const [inline, virtual]

Reimplemented from gfxASurface.

already_AddRefed<gfxSubimageSurface> gfxImageSurface::GetSubimage ( const gfxRect aRect  ) 
PRInt32 gfxImageSurface::Height (  )  const [inline]
void gfxImageSurface::InitFromSurface ( cairo_surface_t csurf  )  [protected]
void gfxImageSurface::InitWithData ( unsigned char *  aData,
const gfxIntSize aSize,
long  aStride,
gfxImageFormat  aFormat 
) [protected]
PRInt32 gfxImageSurface::Stride (  )  const [inline]

Distance in bytes between the start of a line and the start of the next line.

virtual PRBool gfxImageSurface::SupportsSelfCopy (  )  [inline, virtual]

Reimplemented from gfxASurface.

PRInt32 gfxImageSurface::Width (  )  const [inline]

Member Data Documentation

unsigned char* gfxImageSurface::mData [protected]
long gfxImageSurface::mStride [protected]

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