papyrus logo

Papyrus::Image Class Reference

The Image class is used to represent an image to be drawn into the canvas. More...

#include <image.h>

Inheritance diagram for Papyrus::Image:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 PAPYRUS_DRAWABLE (Image)
virtual ~Image ()
 Destructor.
Glib::ustring filename () const
void set_image (const Glib::ustring &filename)
void set_image (unsigned char *data, Cairo::Format format, int width, int height, int stride, bool convert_rgba=false)
void set_image (Cairo::Format format, int width, int height)
virtual bool inside (double x, double y)
void set_image (Cairo::RefPtr< Cairo::ImageSurface > img)
 The set_image method is used to replace the image with the image in a cairo image surface.
virtual void draw (Context &cairo) const
double width ()
double height ()
void width_height (double &width, double &height)

Static Public Member Functions

static pointer create ()
static pointer create (const Glib::ustring &filename)
static pointer create (unsigned char *data, Cairo::Format format, int width, int height, int stride, bool convert_rgba=false)
static pointer create (Cairo::Format format, int width, int height)
static pointer create (Cairo::RefPtr< Cairo::ImageSurface > img)
 The create class method is used to create a new instance from a Cairo image surface.
static pointer create (const Glib::ustring &id, const Glib::ustring &filename)
static pointer create (const Glib::ustring &id, unsigned char *data, Cairo::Format format, int width, int height, int stride, bool convert_rgba=false)
static pointer create (const Glib::ustring &id, Cairo::Format format, int width, int height)
static pointer create (const Glib::ustring &id, Cairo::RefPtr< Cairo::ImageSurface > img)

Protected Member Functions

 Image ()
 Image (const Glib::ustring &id, const Glib::ustring &filename)
 Image (const Glib::ustring &id, unsigned char *data, Cairo::Format format, int width, int height, int stride, bool convert_rgba=false)
 Image (const Glib::ustring &id, Cairo::Format format, int width, int height)
 Image (const Glib::ustring &id, Cairo::RefPtr< Cairo::ImageSurface > img)
 Constructor which sets the image to a cairo surface.
void on_image_changed ()
virtual Region calculate_extents (const Matrix &m=Matrix::Identity, ExtentsPerformance ep=EXTENTS_QUICK) const

Protected Attributes

Glib::ustring m_filename
double m_width
double m_height
Cairo::RefPtr
< Cairo::ImageSurface > 
m_image

Detailed Description

The Image class is used to represent an image to be drawn into the canvas.

It can be scaled and transformed just like any other drawable.

TODO add x & y parameter support

Author:
Rick L Vinyard Jr

Constructor & Destructor Documentation

Papyrus::Image::Image (  )  [protected]

Referenced by create().

Papyrus::Image::Image ( const Glib::ustring &  id,
const Glib::ustring &  filename 
) [protected]

References set_image().

Papyrus::Image::Image ( const Glib::ustring &  id,
unsigned char *  data,
Cairo::Format  format,
int  width,
int  height,
int  stride,
bool  convert_rgba = false 
) [protected]

References set_image().

Papyrus::Image::Image ( const Glib::ustring &  id,
Cairo::Format  format,
int  width,
int  height 
) [protected]

References set_image().

Papyrus::Image::Image ( const Glib::ustring &  id,
Cairo::RefPtr< Cairo::ImageSurface >  img 
) [protected]

Constructor which sets the image to a cairo surface.

Parameters:
img The Cairo image surface to be drawn into the canvas.

References set_image().

Papyrus::Image::~Image (  )  [virtual]

Destructor.


Member Function Documentation

Region Papyrus::Image::calculate_extents ( const Matrix m = Matrix::Identity,
ExtentsPerformance  ep = EXTENTS_QUICK 
) const [protected, virtual]

Reimplemented from Papyrus::Drawable.

References m_height, m_width, and Papyrus::Region::transform().

Image::pointer Papyrus::Image::create ( const Glib::ustring &  id,
Cairo::RefPtr< Cairo::ImageSurface >  img 
) [static]

References PAPYRUS_CREATE.

Image::pointer Papyrus::Image::create ( const Glib::ustring &  id,
Cairo::Format  format,
int  width,
int  height 
) [static]

References PAPYRUS_CREATE.

Image::pointer Papyrus::Image::create ( const Glib::ustring &  id,
unsigned char *  data,
Cairo::Format  format,
int  width,
int  height,
int  stride,
bool  convert_rgba = false 
) [static]

References PAPYRUS_CREATE.

Image::pointer Papyrus::Image::create ( const Glib::ustring &  id,
const Glib::ustring &  filename 
) [static]

References PAPYRUS_CREATE.

Image::pointer Papyrus::Image::create ( Cairo::RefPtr< Cairo::ImageSurface >  img  )  [static]

The create class method is used to create a new instance from a Cairo image surface.

Parameters:
img The cairo image surface containing the image.
Returns:
smart pointer to the new instance

References PAPYRUS_CREATE.

Image::pointer Papyrus::Image::create ( Cairo::Format  format,
int  width,
int  height 
) [static]

References PAPYRUS_CREATE.

Image::pointer Papyrus::Image::create ( unsigned char *  data,
Cairo::Format  format,
int  width,
int  height,
int  stride,
bool  convert_rgba = false 
) [static]

References PAPYRUS_CREATE.

Image::pointer Papyrus::Image::create ( const Glib::ustring &  filename  )  [static]

References PAPYRUS_CREATE.

Image::pointer Papyrus::Image::create (  )  [static]

References Image(), and PAPYRUS_CREATE.

Referenced by set_image().

void Papyrus::Image::draw ( Context cairo  )  const [virtual]

Implements Papyrus::Drawable.

References m_image, and Papyrus::Context::paint().

Glib::ustring Papyrus::Image::filename (  )  const

References m_filename.

double Papyrus::Image::height (  ) 

References m_height.

bool Papyrus::Image::inside ( double  x,
double  y 
) [virtual]
void Papyrus::Image::on_image_changed (  )  [protected]
Papyrus::Image::PAPYRUS_DRAWABLE ( Image   ) 
void Papyrus::Image::set_image ( Cairo::RefPtr< Cairo::ImageSurface >  img  ) 

The set_image method is used to replace the image with the image in a cairo image surface.

Parameters:
img The cairo image surface containing the image.

References m_filename, m_image, and on_image_changed().

void Papyrus::Image::set_image ( Cairo::Format  format,
int  width,
int  height 
)
void Papyrus::Image::set_image ( unsigned char *  data,
Cairo::Format  format,
int  width,
int  height,
int  stride,
bool  convert_rgba = false 
)
void Papyrus::Image::set_image ( const Glib::ustring &  filename  ) 

References m_filename, m_image, and on_image_changed().

Referenced by Image().

double Papyrus::Image::width (  ) 

References m_width.

void Papyrus::Image::width_height ( double &  width,
double &  height 
)

References m_height, and m_width.


Member Data Documentation

Glib::ustring Papyrus::Image::m_filename [protected]

Referenced by filename(), and set_image().

double Papyrus::Image::m_height [protected]
Cairo::RefPtr<Cairo::ImageSurface> Papyrus::Image::m_image [protected]

Referenced by draw(), on_image_changed(), and set_image().

double Papyrus::Image::m_width [protected]

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

Generated on Fri Apr 16 12:41:07 2010 for papyrus by doxygen 1.6.1