#include <canvas.h>
Public Member Functions | |
virtual | ~Canvas () |
GnomeCanvas * | gobj () |
Provides access to the underlying C GtkObject. | |
const GnomeCanvas * | gobj () const |
Provides access to the underlying C GtkObject. | |
Canvas () | |
Group * | root () const |
Queries the root group of a canvas. | |
void | set_scroll_region (double x1, double y1, double x2, double y2) |
Sets the scrolling region of a canvas to the specified rectangle. | |
void | get_scroll_region (double &x1, double &y1, double &x2, double &y2) const |
Queries the scrolling region of a canvas. | |
void | set_center_scroll_region (bool center) |
When the scrolling region of the canvas is smaller than the canvas window, e.g. the allocation of the canvas, it can be either centered on the window or simply made to be on the upper-left corner on the window. | |
bool | get_center_scroll_region () const |
Returns whether the canvas is set to center the scrolling region in the window if the former is smaller than the canvas' allocation. | |
void | set_pixels_per_unit (double n=1.0) |
Sets the zooming factor of a canvas by specifying the number of pixels that correspond to one canvas unit. | |
void | scroll_to (int x, int y) |
Makes a canvas scroll to the specified offsets, given in canvas pixel units. | |
void | get_scroll_offsets (int &cx, int &cy) const |
Queries the scrolling offsets of a canvas. | |
void | update_now () |
Forces an immediate update and redraw of a canvas. | |
Item * | get_item_at (double x, double y) const |
Looks for the item that is under the specified position, which must be specified in world coordinates. | |
void | request_redraw (int x1, int y1, int x2, int y2) |
Convenience function that informs a canvas that the specified rectangle needs to be repainted. | |
void | request_redraw (ArtUta *uta) |
Informs a canvas that the specified area, given as a microtile array, needs to be repainted. | |
Art::AffineTrans | w2c_affine () const |
void | w2c (double wx, double wy, int &cx, int &cy) const |
Converts world coordinates into canvas pixel coordinates. | |
void | w2c (double wx, double wy, double &cx, double &cy) const |
Converts world coordinates into canvas pixel coordinates. | |
void | c2w (int cx, int cy, double &wx, double &wy) const |
Converts canvas pixel coordinates to world coordinates. | |
void | window_to_world (double winx, double winy, double &worldx, double &worldy) const |
Converts window-relative coordinates into world coordinates. | |
void | world_to_window (double worldx, double worldy, double &winx, double &winy) const |
Converts world coordinates into window-relative coordinates. | |
bool | get_color (const Glib::ustring &spec, Gdk::Color &color) const |
gulong | get_color_pixel (guint rgba) const |
Allocates a color from the RGBA value passed into this function. | |
void | set_stipple_origin (const Glib::RefPtr< Gdk::GC > &gc) |
Sets the stipple origin of the specified GC as is appropriate for the canvas, so that it will be aligned with other stipple patterns used by canvas items. | |
void | set_dither (Gdk::RgbDither dither) |
Controls dithered rendering for antialiased canvases. | |
Gdk::RgbDither | get_dither () const |
Returns the type of dithering used to render an antialiased canvas. | |
void | update_svp (ArtSVP **p_svp, ArtSVP *new_svp) |
Sets the svp to the new value, requesting repaint on what's changed. | |
void | update_svp_clip (ArtSVP **p_svp, ArtSVP *new_svp, ArtSVP *clip_svp) |
Sets the svp to the new value, clipping if necessary, and requesting repaint on what's changed. | |
double | get_pixels_per_unit () const |
Glib::SignalProxy5< void, const Glib::RefPtr < Gdk::Drawable > &, int, int, int, int > | signal_draw_background () |
Glib::SignalProxy1< void, GnomeCanvasBuf * > | signal_render_background () |
virtual void | request_update_vfunc () |
Glib::PropertyProxy_ReadOnly < bool > | property_aa () const |
The antialiasing mode of the canvas. | |
Protected Member Functions | |
virtual void | on_draw_background (const Glib::RefPtr< Gdk::Drawable > &drawable, int x, int y, int width, int height) |
virtual void | on_render_background (GnomeCanvasBuf *buf) |
Related Functions | |
(Note that these are not member functions.) | |
Gnome::Canvas::Canvas * | wrap (GnomeCanvas *object, bool take_copy=false) |
A Glib::wrap() method for this object. |
There are functions to transform from one to the other.
virtual Gnome::Canvas::Canvas::~Canvas | ( | ) | [virtual] |
Gnome::Canvas::Canvas::Canvas | ( | ) |
void Gnome::Canvas::Canvas::c2w | ( | int | cx, | |
int | cy, | |||
double & | wx, | |||
double & | wy | |||
) | const |
bool Gnome::Canvas::Canvas::get_center_scroll_region | ( | ) | const |
Returns whether the canvas is set to center the scrolling region in the window if the former is smaller than the canvas' allocation.
bool Gnome::Canvas::Canvas::get_color | ( | const Glib::ustring & | spec, | |
Gdk::Color & | color | |||
) | const |
gulong Gnome::Canvas::Canvas::get_color_pixel | ( | guint | rgba | ) | const |
Allocates a color from the RGBA value passed into this function.
The alpha opacity value is discarded, since normal X colors do not support it.
rgba | RGBA color specification. |
Gdk::RgbDither Gnome::Canvas::Canvas::get_dither | ( | ) | const |
Returns the type of dithering used to render an antialiased canvas.
Item* Gnome::Canvas::Canvas::get_item_at | ( | double | x, | |
double | y | |||
) | const |
Looks for the item that is under the specified position, which must be specified in world coordinates.
x | X position in world coordinates. | |
y | Y position in world coordinates. |
0
if no item is at the specified coordinates. double Gnome::Canvas::Canvas::get_pixels_per_unit | ( | ) | const |
void Gnome::Canvas::Canvas::get_scroll_offsets | ( | int & | cx, | |
int & | cy | |||
) | const |
Queries the scrolling offsets of a canvas.
The values are returned in canvas pixel units.
cx | Horizontal scrolling offset (return value). | |
cy | Vertical scrolling offset (return value). |
void Gnome::Canvas::Canvas::get_scroll_region | ( | double & | x1, | |
double & | y1, | |||
double & | x2, | |||
double & | y2 | |||
) | const |
Queries the scrolling region of a canvas.
x1 | Leftmost limit of the scrolling region (return value). | |
y1 | Upper limit of the scrolling region (return value). | |
x2 | Rightmost limit of the scrolling region (return value). | |
y2 | Lower limit of the scrolling region (return value). |
const GnomeCanvas* Gnome::Canvas::Canvas::gobj | ( | ) | const [inline] |
Provides access to the underlying C GtkObject.
GnomeCanvas* Gnome::Canvas::Canvas::gobj | ( | ) | [inline] |
Provides access to the underlying C GtkObject.
virtual void Gnome::Canvas::Canvas::on_draw_background | ( | const Glib::RefPtr< Gdk::Drawable > & | drawable, | |
int | x, | |||
int | y, | |||
int | width, | |||
int | height | |||
) | [protected, virtual] |
virtual void Gnome::Canvas::Canvas::on_render_background | ( | GnomeCanvasBuf * | buf | ) | [protected, virtual] |
Glib::PropertyProxy_ReadOnly<bool> Gnome::Canvas::Canvas::property_aa | ( | ) | const |
The antialiasing mode of the canvas.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
void Gnome::Canvas::Canvas::request_redraw | ( | ArtUta * | uta | ) |
Informs a canvas that the specified area, given as a microtile array, needs to be repainted.
To be used only by item implementations.
uta | Microtile array that specifies the area to be redrawn. It will be freed by this function, so the argument you pass will be invalid after you call this function. |
void Gnome::Canvas::Canvas::request_redraw | ( | int | x1, | |
int | y1, | |||
int | x2, | |||
int | y2 | |||
) |
Convenience function that informs a canvas that the specified rectangle needs to be repainted.
This function converts the rectangle to a microtile array and feeds it to request_redraw_uta(). The rectangle includes x1 and y1, but not x2 and y2. To be used only by item implementations.
x1 | Leftmost coordinate of the rectangle to be redrawn. | |
y1 | Upper coordinate of the rectangle to be redrawn. | |
x2 | Rightmost coordinate of the rectangle to be redrawn, plus 1. | |
y2 | Lower coordinate of the rectangle to be redrawn, plus 1. |
virtual void Gnome::Canvas::Canvas::request_update_vfunc | ( | ) | [virtual] |
Group* Gnome::Canvas::Canvas::root | ( | ) | const |
Queries the root group of a canvas.
void Gnome::Canvas::Canvas::scroll_to | ( | int | x, | |
int | y | |||
) |
Makes a canvas scroll to the specified offsets, given in canvas pixel units.
The canvas will adjust the view so that it is not outside the scrolling region. This function is typically not used, as it is better to hook scrollbars to the canvas layout's scrolling adjusments.
cx | Horizontal scrolling offset in canvas pixel units. | |
cy | Vertical scrolling offset in canvas pixel units. |
void Gnome::Canvas::Canvas::set_center_scroll_region | ( | bool | center | ) |
When the scrolling region of the canvas is smaller than the canvas window, e.g. the allocation of the canvas, it can be either centered on the window or simply made to be on the upper-left corner on the window.
This function lets you configure this property.
center_scroll_region | Whether to center the scrolling region in the canvas window when it is smaller than the canvas' allocation. |
void Gnome::Canvas::Canvas::set_dither | ( | Gdk::RgbDither | dither | ) |
Controls dithered rendering for antialiased canvases.
The value of dither should be Gdk::RGB_DITHER_NONE, Gdk::RGB_DITHER_NORMAL, or Gdk::RGB_DITHER_MAX. The default canvas setting is Gdk::RGB_DITHER_NORMAL.
dither | Type of dithering used to render an antialiased canvas. |
void Gnome::Canvas::Canvas::set_pixels_per_unit | ( | double | n = 1.0 |
) |
Sets the zooming factor of a canvas by specifying the number of pixels that correspond to one canvas unit.
The anchor point for zooming, i.e. the point that stays fixed and all others zoom inwards or outwards from it, depends on whether the canvas is set to center the scrolling region or not. You can control this using the set_center_scroll_region() function. If the canvas is set to center the scroll region, then the center of the canvas window is used as the anchor point for zooming. Otherwise, the upper-left corner of the canvas window is used as the anchor point.
n | The number of pixels that correspond to one canvas unit. |
void Gnome::Canvas::Canvas::set_scroll_region | ( | double | x1, | |
double | y1, | |||
double | x2, | |||
double | y2 | |||
) |
Sets the scrolling region of a canvas to the specified rectangle.
The canvas will then be able to scroll only within this region. The view of the canvas is adjusted as appropriate to display as much of the new region as possible.
x1 | Leftmost limit of the scrolling region. | |
y1 | Upper limit of the scrolling region. | |
x2 | Rightmost limit of the scrolling region. | |
y2 | Lower limit of the scrolling region. |
void Gnome::Canvas::Canvas::set_stipple_origin | ( | const Glib::RefPtr< Gdk::GC > & | gc | ) |
Sets the stipple origin of the specified GC as is appropriate for the canvas, so that it will be aligned with other stipple patterns used by canvas items.
This is typically only needed by item implementations.
gc | GC on which to set the stipple origin. |
Glib::SignalProxy5< void,const Glib::RefPtr<Gdk::Drawable>&,int,int,int,int > Gnome::Canvas::Canvas::signal_draw_background | ( | ) |
void on_my_draw_background(const Glib::RefPtr<Gdk::Drawable>& drawable, int x, int y, int width, int height)
Glib::SignalProxy1< void,GnomeCanvasBuf* > Gnome::Canvas::Canvas::signal_render_background | ( | ) |
void on_my_render_background(GnomeCanvasBuf* buf)
void Gnome::Canvas::Canvas::update_now | ( | ) |
Forces an immediate update and redraw of a canvas.
If the canvas does not have any pending update or redraw requests, then no action is taken. This is typically only used by applications that need explicit control of when the display is updated, like games. It is not needed by normal applications.
void Gnome::Canvas::Canvas::update_svp | ( | ArtSVP ** | p_svp, | |
ArtSVP * | new_svp | |||
) |
Sets the svp to the new value, requesting repaint on what's changed.
This function takes responsibility for freeing new_svp.
p_svp | A pointer to the existing svp. | |
new_svp | The new svp. |
void Gnome::Canvas::Canvas::update_svp_clip | ( | ArtSVP ** | p_svp, | |
ArtSVP * | new_svp, | |||
ArtSVP * | clip_svp | |||
) |
Sets the svp to the new value, clipping if necessary, and requesting repaint on what's changed.
This function takes responsibility for freeing new_svp.
p_svp | A pointer to the existing svp. | |
new_svp | The new svp. | |
clip_svp | A clip path, if non-null. |
void Gnome::Canvas::Canvas::w2c | ( | double | wx, | |
double | wy, | |||
double & | cx, | |||
double & | cy | |||
) | const |
Converts world coordinates into canvas pixel coordinates.
This version
wx | World X coordinate. | |
wy | World Y coordinate. | |
cx | X pixel coordinate (return value). | |
cy | Y pixel coordinate (return value). |
void Gnome::Canvas::Canvas::w2c | ( | double | wx, | |
double | wy, | |||
int & | cx, | |||
int & | cy | |||
) | const |
Converts world coordinates into canvas pixel coordinates.
wx | World X coordinate. | |
wy | World Y coordinate. | |
cx | X pixel coordinate (return value). | |
cy | Y pixel coordinate (return value). |
Art::AffineTrans Gnome::Canvas::Canvas::w2c_affine | ( | ) | const |
void Gnome::Canvas::Canvas::window_to_world | ( | double | winx, | |
double | winy, | |||
double & | worldx, | |||
double & | worldy | |||
) | const |
Converts window-relative coordinates into world coordinates.
You can use this when you need to convert mouse coordinates into world coordinates, for example.
winx | Window-relative X coordinate. | |
winy | Window-relative Y coordinate. | |
worldx | X world coordinate (return value). | |
worldy | Y world coordinate (return value). |
void Gnome::Canvas::Canvas::world_to_window | ( | double | worldx, | |
double | worldy, | |||
double & | winx, | |||
double & | winy | |||
) | const |
Converts world coordinates into window-relative coordinates.
worldx | World X coordinate. | |
worldy | World Y coordinate. | |
winx | X window-relative coordinate. | |
winy | Y window-relative coordinate. |
Gnome::Canvas::Canvas * wrap | ( | GnomeCanvas * | object, | |
bool | take_copy = false | |||
) | [related] |
A Glib::wrap() method for this object.
object | The C instance. | |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |