The Image class is used to represent an image to be drawn into the canvas. More...
#include <image.h>
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 |
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
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.
img | The Cairo image surface to be drawn into the canvas. |
References set_image().
Papyrus::Image::~Image | ( | ) | [virtual] |
Destructor.
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.
img | The cairo image surface containing the image. |
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] |
Reimplemented from Papyrus::Drawable.
References Papyrus::Drawable::extents(), and Papyrus::Region::is_inside().
void Papyrus::Image::on_image_changed | ( | ) | [protected] |
References Papyrus::Drawable::freeze(), Papyrus::Drawable::invalidate_extents(), m_height, m_image, m_width, Papyrus::Drawable::set_centroid(), and Papyrus::Drawable::thaw().
Referenced by set_image().
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.
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 | |||
) |
References create(), m_filename, m_image, and on_image_changed().
void Papyrus::Image::set_image | ( | unsigned char * | data, | |
Cairo::Format | format, | |||
int | width, | |||
int | height, | |||
int | stride, | |||
bool | convert_rgba = false | |||
) |
References Papyrus::Drawable::alpha(), create(), m_filename, m_image, and on_image_changed().
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 | |||
) |
Glib::ustring Papyrus::Image::m_filename [protected] |
Referenced by filename(), and set_image().
double Papyrus::Image::m_height [protected] |
Referenced by calculate_extents(), height(), on_image_changed(), and width_height().
Cairo::RefPtr<Cairo::ImageSurface> Papyrus::Image::m_image [protected] |
Referenced by draw(), on_image_changed(), and set_image().
double Papyrus::Image::m_width [protected] |
Referenced by calculate_extents(), on_image_changed(), width(), and width_height().