Canola
0.8.D001
|
#include <image.h>
Public Types | |
typedef boost::shared_ptr< image > | pointer |
Public Member Functions | |
virtual | ~image () |
virtual const char * | type_name (void) const =0 |
void | copy (const image::pointer &src) |
void | copy (const image::pointer &src, int ox, int oy) |
void | overlay (const image::pointer &src, int ox, int oy) |
virtual void | get_pixel (int x, int y, icon_pixel &value) const =0 |
icon_pixel | get_pixel (int x, int y) const |
virtual void | set_pixel (int x, int y, const icon_pixel &value)=0 |
void | set_pixel (int x, int y) |
virtual void | overlay_pixel (int x, int y, const icon_pixel &value) |
virtual void | overlay_pixel (int x, int y) |
virtual unsigned | get_width (void) const =0 |
virtual unsigned | get_height (void) const =0 |
virtual void | save_to_file (const std::string &filename) const =0 |
void | get_pen_position (int &x, int &y) |
void | set_pen_position (int x, int y) |
void | set_pen_color (const icon_pixel &clr) |
void | draw_rectangle (int x, int y, int w, int h) |
void | draw_rectangle (int x, int y, int w, int h, const icon_pixel &clr) |
bool | same (const image::pointer &rhs) const |
icon_pixel | average (void) const |
Static Public Member Functions | |
static pointer | create_from_file (const std::string &filename) |
static bool | known_file_extension (const std::string &ext) |
static pointer | create_blank_from_file (const std::string &filename, int width, int height) |
Protected Member Functions | |
image () | |
Private Member Functions | |
image (const image &) | |
image & | operator= (const image &) |
Private Attributes | |
int | pen_x |
int | pen_y |
icon_pixel | pen_clr |
typedef boost::shared_ptr<image> image::pointer |
The pointer type is to be sed to point at any image instance.
Reimplemented in image_threshold.
image::~image | ( | ) | [virtual] |
image::image | ( | ) | [protected] |
image::image | ( | const image & | ) | [private] |
The copy constructor. Do not use.
icon_pixel image::average | ( | void | ) | const |
The average method may be used to calculate the average pixel color of an image. It understands transparency.
Definition at line 22 of file average.cc.
void image::copy | ( | const image::pointer & | src | ) |
The copy method is used to copy the contents of another image into this image.
The copy is range checked. If the other image is too small, only the portion of this image covered by the other image will be over-written. If the other image is too large, only the portion of the other image which covers this image will be used.
src | The image to copy. |
void image::copy | ( | const image::pointer & | src, |
int | ox, | ||
int | oy | ||
) |
The copy method is used to copy the contents of another image into this image.
The copy is range checked. If the other image is too small, only the portion of this image covered by the other image will be over-written. If the other image is too large, only the portion of the other image which covers this image will be used.
src | The image to copy. |
ox | The X coordinate to start copying TO |
oy | The Y coordinate to start copying TO |
image::pointer image::create_blank_from_file | ( | const std::string & | filename, |
int | width, | ||
int | height | ||
) | [static] |
The create_blank_from_file class method is used to examine the file's extension and create a new image capable of writing that format. The file is not written now, you will have to call the save_to_file method for that.
filename | The name of the file to be written, eventually. |
width | The width of the image in pixels. |
height | The height of the image in pixels. |
Definition at line 74 of file create_from_file.cc.
image::pointer image::create_from_file | ( | const std::string & | filename | ) | [static] |
The create_from_file class method is used to read a file and create a new image by reading a file.
filename | The name of the file to be read |
Definition at line 54 of file create_from_file.cc.
void image::draw_rectangle | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) |
The draw_rectangle method is used to draw a simple aligned rectangle on the image.
x | The left edge of the rectangle, in pixels |
y | The top edge of the rectangle, in pixels |
w | The width of the rectangle, in pixels |
h | The height of the ractangle, in pixels |
Definition at line 22 of file rectangle.cc.
void image::draw_rectangle | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
const icon_pixel & | clr | ||
) |
The draw_rectangle method is used to draw a simple aligned rectangle on the image.
x | The left edge of the rectangle, in pixels |
y | The top edge of the rectangle, in pixels |
w | The width of the rectangle, in pixels |
h | The height of the ractangle, in pixels |
clr | The color to draw the rectangle |
Definition at line 29 of file rectangle.cc.
virtual unsigned image::get_height | ( | void | ) | const [pure virtual] |
The get_height method may be used to obtain the height of the image, in pixels.
Implemented in image_threshold, image_monochrome, image_invert, and image_format.
void image::get_pen_position | ( | int & | x, |
int & | y | ||
) | [inline] |
virtual void image::get_pixel | ( | int | x, |
int | y, | ||
icon_pixel & | value | ||
) | const [pure virtual] |
The get_pixel method may be used to obtain the value of the pixel at the given location.
x | The X cordinate of the pixel |
y | The Y cordinate of the pixel |
value | The place where the pixel value is to be stored on return. |
Implemented in image_threshold, image_monochrome, image_invert, and image_format.
icon_pixel image::get_pixel | ( | int | x, |
int | y | ||
) | const [inline] |
virtual unsigned image::get_width | ( | void | ) | const [pure virtual] |
The get_width method may be used to obtain the width of the image, in pixels.
Implemented in image_threshold, image_monochrome, image_invert, and image_format.
bool image::known_file_extension | ( | const std::string & | ext | ) | [static] |
The known_file_extension class method may be used to determine whether or not the given file extension is a known image type.
ext | The file extension, without the dot. |
Definition at line 95 of file create_from_file.cc.
void image::overlay | ( | const image::pointer & | src, |
int | ox, | ||
int | oy | ||
) |
The overlay method is used to copy the contents of another image into this image, taking the alpha channel of the other image into account.
The operation is range checked. If the other image is too small, only the portion of this image covered by the other image will be over-written. If the other image is too large, only the portion of the other image which covers this image will be used.
src | The image to copy. |
ox | The X coordinate to start copying TO |
oy | The Y coordinate to start copying TO |
void image::overlay_pixel | ( | int | x, |
int | y, | ||
const icon_pixel & | value | ||
) | [virtual] |
The overlay_pixel method may be used to set the value of the pixel at the given location. Transparency is taken into account if the value has alpha of less than 255.
x | The X coordinate of the pixel to be set |
y | The Y coordinate of the pixel to be set |
value | The value of the pixel to be set. |
Definition at line 29 of file overlay_pixel.cc.
void image::overlay_pixel | ( | int | x, |
int | y | ||
) | [virtual] |
The overlay_pixel method may be used to set the value of the pixel at the given location. The pen_clr is used. Transparency is taken into account if pen_clr has alpha of less than 255.
x | The X coordinate of the pixel to be set |
y | The Y coordinate of the pixel to be set |
Definition at line 22 of file overlay_pixel.cc.
bool image::same | ( | const image::pointer & | rhs | ) | const |
The same method is used to determine if two images are the same as each other. This is a size comparison, and only a pixel-by-pixel comparison if the sizes are identical.
virtual void image::save_to_file | ( | const std::string & | filename | ) | const [pure virtual] |
The save_to_file method is used to store the image data into a file on disk.
filename | The name of the file to be written. |
Implemented in image_format, image_threshold, image_monochrome, image_format_jpeg, image_invert, and image_format_png.
void image::set_pen_color | ( | const icon_pixel & | clr | ) | [inline] |
void image::set_pen_position | ( | int | x, |
int | y | ||
) | [inline] |
virtual void image::set_pixel | ( | int | x, |
int | y, | ||
const icon_pixel & | value | ||
) | [pure virtual] |
The set_pixel method may be used to set the value of the pixel at the given location. Transparency is ignored, the pixel becomes exactly as given; if you want transparentcy taken into account, use overlay_pixel. The pen_clr tracks the given value.
x | The X coordinate of the pixel to be set |
y | The Y coordinate of the pixel to be set |
value | The value of the pixel to be set. |
Implemented in image_threshold, image_monochrome, image_invert, and image_format.
void image::set_pixel | ( | int | x, |
int | y | ||
) |
The set_pixel method may be used to set the value of the pixel at the given location. Transparency is ignored, the pixel becomes exactly as given; if you want transparentcy taken into account, use overlay_pixel. The pen_clr tracks the given value.
x | The X coordinate of the pixel to be set |
y | The Y coordinate of the pixel to be set |
virtual const char* image::type_name | ( | void | ) | const [pure virtual] |
The type_name method is used to obtain the name of the type of this image format.
Implemented in image_format_jpeg, image_format_png, image_threshold, image_monochrome, and image_invert.
icon_pixel image::pen_clr [private] |
int image::pen_x [private] |
int image::pen_y [private] |