gnome-sharp2.20.0.0Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details.Main canvas widget
The is an engine for structured graphics that
offers a rich imaging model, high performance rendering, and a
powerful, high level API. It offers a choice of two rendering
back-ends, one based on Xlib for extremely fast display, and
another based on Libart, a sophisticated, antialiased,
alpha-compositing engine. This widget can be used for flexible
display of graphics and for creating interactive user
interface elements.
To create a new GnomeCanvas widget call
or
for an anti-aliased mode canvas.
A widget contains one or more
objects. Items consist of graphing elements like lines,
ellipses, polygons, images, text, and curves. These items are
organized using objects, which are themselves
derived from . Since a group is an item it can
be contained within other groups, forming a tree of canvas
items. Certain operations, like translating and scaling, can
be performed on all items in a group.
There is a special root group created by a GnomeCanvas. This
is the top level group under which all items in a canvas are
contained. To get the root group from a canvas, use
property.
There are several different coordinate systems used by
widgets. The primary system is a logical, abstract
coordinate space called world coordinates. World coordinates
are expressed as unbounded double floating point numbers. When
it comes to rendering to a screen the canvas pixel coordinate
system (also referred to as just canvas coordinates) is
used. This system uses integers to specify screen pixel
positions. A user defined scaling factor and offset are used
to convert between world coordinates and canvas
coordinates. Each item in a canvas has its own coordinate
system called item coordinates. This system is specified in
world coordinates but they are relative to an item (0.0, 0.0
would be the top left corner of the item). The final
coordinate system of interest is window coordinates. These are
like canvas coordinates but are offsets from within a window a
canvas is displayed in. This last system is rarely used, but
is useful when manually handling GDK events (such as drag and
drop) which are specified in window coordinates (the events
processed by the canvas are already converted for you).
Along with different coordinate systems comes functions
to convert between them. converts world to
canvas pixel coordinates and from
canvas to world. is like
but returns the pixel coordinates as
doubles which is useful to avoid precision loss from integer
rounding. To get the affine transform matrix for converting
from world coordinates to canvas coordinates call
.
converts from window to world coordinates and
converts in the other
direction. There are no functions for converting between
canvas and window coordinates, since this is just a matter of
subtracting the canvas scrolling offset. To convert to/from
item coordinates use the functions defined for
objects.
To set the canvas zoom factor (canvas pixels per world unit,
the scaling factor) use the
property, setting this to 1.0 will cause the two coordinate systems to
correspond (e.g., [5, 6] in pixel units would be [5.0, 6.0] in
world units).
Defining the scrollable area of a canvas widget is done by
calling and to get the
current region can be
used. If the window is larger than the canvas scrolling region
it can optionally be centered in the window. Use the
property to enable or disable
this behavior. To scroll to a particular canvas pixel
coordinate use (typically not used
since scrollbars are usually set up to handle the scrolling),
and to get the current canvas pixel scroll offset call
.
Gtk.LayoutMethodSystem.VoidSets the bounding box to the new value, requesting full repaint.
The canvas item needing update
Left coordinate of the new bounding box
Top coordinate of the new bounding box
Right coordinate of the new bounding box
Bottom coordinate of the new bounding box
MethodSystem.VoidComputes the butt points of a line segment.
X coordinate of first point in the line
Y cooordinate of first point in the line
X coordinate of second point (endpoint) of the line
Y coordinate of second point (endpoint) of the line
Width of the line
Whether the butt points should project out by width/2 distance
Return value of the X coordinate of first butt point
Return value of the Y coordinate of first butt point
Return value of the X coordinate of second butt point
Return value of the Y coordinate of second butt point
MethodSystem.Boolean
Given three points forming an angle, computes the
coordinates of the inside and outside points of the mitered
corner formed by a line of a given width at that
angle.
X coordinate of the first point
Y coordinate of the first point
X coordinate of the second (angle) point
Y coordinate of the second (angle) point
X coordinate of the third point
Y coordinate of the third point
Width of the line
The return value of the X coordinate of the first miter point
The return value of the Y coordinate of the first miter point
The return value of the X coordinate of the second miter point
The return value of the Y coordinate of the second miter point
if the angle is less than 11
degrees (this is the same threshold as X uses. If this
occurs, the return points are not modified. Otherwise,
returns .
MethodArt.PathStrokeJoinTypeConvert from GDK line join specifier to libart.
a join type, represented in GDK format
The line join specifier in libart format.MethodSystem.Void
Render the over the .
the canvas buffer to render over
the vector path to render
the rgba color to render
MethodArt.PathStrokeCapTypeConvert from GDK line cap specifier to the libart format.
a cap type, represented in GDK format
The line cap specifier in libart format.MethodGnome.Canvas
Creates a new empty canvas in antialiased mode. You should
push the visual and colormap before calling this
functions, and they can be popped afterwards.
A newly-created antialiased canvas.MethodSystem.BooleanAllocates a color based on the specified X color specification.
X color specification, or
for"transparent".
Return value the allocated color.
if spec is non-NULL and the color is
allocated. If spec is , then returns
.
To be addedMethodSystem.VoidSets the svp to the new value, requesting repaint on what has changed.
The existing svp
The new svp
MethodGnome.CanvasItemLooks for the item that is under the specified position.
X position in world coordinates.
Y position in world coordinates.
The requested item, or if no item is at the specified coordinates.MethodGnome.CanvasGroupQueries the root group of a canvas.The root group of the specified canvas.MethodSystem.Void
Sets the svp to the new value, clipping if necessary, and
requesting repaint on what has changed.
the existing svp
the new svp
a clip path
MethodSystem.VoidConvenience function that informs a canvas that the specified rectangle needs to be repainted.
Leftmost coordinate of the rectangle to be redrawn.
Upper coordinate of the rectangle to be redrawn.
Rightmost coordinate of the rectangle to be redrawn, plus 1.
Lower coordinate of the rectangle to be redrawn, plus 1.
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 . The rectangle
includes and ,
but not and . To be used only by
item implementations.
MethodSystem.VoidQueries the scrolling offsets of a canvas. The values are returned in canvas pixel units.
Return value for the horizontal scrolling offset
Return value for the vertical scrolling offset
MethodSystem.VoidForces an immediate update and redraw of a canvas.
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.
MethodSystem.Void
Converts world coordinates into canvas pixel
coordinates. This version returns coordinates in floating
point coordinates, for greater precision.
World X coordinate.
World Y coordinate.
Return value for the X pixel coordinate
Return value for the Y pixel coordinate
MethodSystem.VoidSets the scrolling region of a canvas to the specified rectangle.
Leftmost limit of the scrolling region.
Upper limit of the scrolling region.
Rightmost limit of the scrolling region.
Lower limit of the scrolling region.
To be addedMethodSystem.Void
Informs a canvas that the specified area, given as a
microtile array, needs to be repainted. To be used only by
item implementations.
Microtile array that specifies the area to be redrawn.
MethodSystem.VoidConverts world coordinates into window-relative coordinates.
World X coordinate.
World Y coordinate.
Return value for the X window-relative coordinate.
Return value for the Y window-relative coordinate.
MethodSystem.VoidConverts world coordinates into canvas pixel coordinates.
World X coordinate.
World Y coordinate.
Return value for the X pixel coordinate
Return value for the Y pixel coordinate
MethodSystem.VoidMakes a canvas scroll to the specified offsets, given in canvas pixel units.
Horizontal scrolling offset in canvas pixel units.
Vertical scrolling offset in canvas pixel units.
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.
MethodSystem.UInt64Allocates a color from the RGBA value passed into this function.
RGBA color specification.
Allocated pixel value corresponding to the specified color.
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.
MethodSystem.VoidConverts canvas pixel coordinates to world coordinates.
Canvas pixel X coordinate.
Canvas pixel Y coordinate.
Return value for the X world coordinate
Return value for the Y world coordinate
ConstructorInternal constructor
Pointer to the C object.
This is an internal constructor, and should not be used by user code.ConstructorCreates a new empty canvas in non-antialiased mode.
Creates a new empty canvas in non-antialiased mode. If you
wish to use the item inside this canvas,
then you must push the gdk_imlib visual and colormap
before calling this function, and they can be popped
afterwards.
PropertyGdk.RgbDitherThe type of dithering used to render an antialiased canvas.The type of dithering used to render an antialiased canvas.PropertySystem.Boolean
Whether the canvas is set to center the scrolling region in
the window if the former is smaller than the canvas'
allocation.
Whether the scroll region is being centered in the canvas window.
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.
PropertyGdk.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.To be added.PropertySystem.BooleanWhether to enable anti-aliasing mode to enable anti-aliasing
Note that this parameter can only be set at the time of
object construction. The same effect can be achieved by
calling to create new non-aa canvas or
for an anti-aliased canvas.
GLib.Property("aa")EventGnome.DrawBackgroundHandler
Emitted to draw the background for non-antialiased mode
canvas widgets. The default method uses the canvas widget's
style to draw the background.
GLib.Signal("draw_background")EventGnome.RenderBackgroundHandler
This signal is emitted for antialiased mode canvas widgets
to render the background. The buf data structure contains
both a pointer to a packed 24-bit RGB array and the
coordinates.
GLib.Signal("render_background")MethodSystem.VoidQueries the scrolling region of a canvas.
Return value for the leftmost limit of the scrolling region
Return value for the upper limit of the scrolling region
Return value for the rightmost limit of the scrolling region
Return value for the lower limit of the scrolling region
MethodSystem.VoidConverts world coordinates into window-relative coordinates.
World X coordinate.
World Y coordinate.
Return value for the X window-relative coordinate.
Return value for the Y window-relative coordinate.
PropertyGLib.GTypeGType Property.a Returns the native value for .MethodSystem.VoidDefault handler for the event.
a
a
a
a
a Override this method in a subclass to provide a default handler for the event.ConstructorProtected Constructor.
a Chain to this constructor if you have manually registered a native value for your subclass.System.ObsoletePropertySystem.DoubleGets or Sets the number of pixels that correspond to one canvas unit.a
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
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.
MethodSystem.Void
To be added.
To be added.To be added.MethodSystem.Void
To be added.
Default handler for the event.Override this method in a subclass to provide a default handler for the event.Constructor if an antialiased canvas should be created.
Constructs a canvas with or without antialiasing.PropertyGLib.Property("focused_item")Gnome.CanvasItemTo be added.To be added.To be added.