| GIMP Application Reference Manual | ||||
|---|---|---|---|---|
GimpCanvas;
enum GimpCanvasStyle;
#define GIMP_CANVAS_NUM_STIPPLES
GtkWidget* gimp_canvas_new (GimpDisplayConfig *config);
void gimp_canvas_draw_cursor (GimpCanvas *canvas,
gint x,
gint y);
void gimp_canvas_draw_point (GimpCanvas *canvas,
GimpCanvasStyle style,
gint x,
gint y);
void gimp_canvas_draw_points (GimpCanvas *canvas,
GimpCanvasStyle style,
GdkPoint *points,
gint num_points);
void gimp_canvas_draw_line (GimpCanvas *canvas,
GimpCanvasStyle style,
gint x1,
gint y1,
gint x2,
gint y2);
void gimp_canvas_draw_lines (GimpCanvas *canvas,
GimpCanvasStyle style,
GdkPoint *points,
gint num_points);
void gimp_canvas_draw_rectangle (GimpCanvas *canvas,
GimpCanvasStyle style,
gboolean filled,
gint x,
gint y,
gint width,
gint height);
void gimp_canvas_draw_arc (GimpCanvas *canvas,
GimpCanvasStyle style,
gboolean filled,
gint x,
gint y,
gint width,
gint height,
gint angle1,
gint angle2);
void gimp_canvas_draw_polygon (GimpCanvas *canvas,
GimpCanvasStyle style,
gboolean filled,
GdkPoint *points,
gint num_points);
void gimp_canvas_draw_segments (GimpCanvas *canvas,
GimpCanvasStyle style,
GdkSegment *segments,
gint num_segments);
void gimp_canvas_draw_text (GimpCanvas *canvas,
GimpCanvasStyle style,
gint x,
gint y,
const gchar *format,
...);
void gimp_canvas_draw_rgb (GimpCanvas *canvas,
GimpCanvasStyle style,
gint x,
gint y,
gint width,
gint height,
guchar *rgb_buf,
gint rowstride,
gint xdith,
gint ydith);
void gimp_canvas_draw_drop_zone (GimpCanvas *canvas,
cairo_t *cr);
void gimp_canvas_set_clip_rect (GimpCanvas *canvas,
GimpCanvasStyle style,
GdkRectangle *rect);
void gimp_canvas_set_clip_region (GimpCanvas *canvas,
GimpCanvasStyle style,
GdkRegion *region);
void gimp_canvas_set_custom_gc (GimpCanvas *canvas,
GdkGC *gc);
void gimp_canvas_set_stipple_index (GimpCanvas *canvas,
GimpCanvasStyle style,
guint index);
void gimp_canvas_set_bg_color (GimpCanvas *canvas,
GimpRGB *color);
void gimp_canvas_scroll (GimpCanvas *canvas,
gint offset_x,
gint offset_y);
GObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GimpCanvas
typedef enum
{
GIMP_CANVAS_STYLE_BLACK,
GIMP_CANVAS_STYLE_WHITE,
GIMP_CANVAS_STYLE_RENDER,
GIMP_CANVAS_STYLE_XOR,
GIMP_CANVAS_STYLE_XOR_DASHED,
GIMP_CANVAS_STYLE_XOR_DOTTED,
GIMP_CANVAS_STYLE_SELECTION_IN,
GIMP_CANVAS_STYLE_SELECTION_OUT,
GIMP_CANVAS_STYLE_LAYER_BOUNDARY,
GIMP_CANVAS_STYLE_GUIDE_NORMAL,
GIMP_CANVAS_STYLE_GUIDE_ACTIVE,
GIMP_CANVAS_STYLE_SAMPLE_POINT_NORMAL,
GIMP_CANVAS_STYLE_SAMPLE_POINT_ACTIVE,
GIMP_CANVAS_STYLE_LAYER_MASK_ACTIVE,
GIMP_CANVAS_STYLE_CUSTOM,
GIMP_CANVAS_NUM_STYLES
} GimpCanvasStyle;
GtkWidget* gimp_canvas_new (GimpDisplayConfig *config);
Creates a new GimpCanvas widget.
The GimpCanvas widget is a GtkDrawingArea abstraction. It manages a set of graphic contexts for drawing on a GIMP display. If you draw using a GimpCanvasStyle, GimpCanvas makes sure that the associated GdkGC is created. All drawing on the canvas needs to happen by means of the GimpCanvas drawing functions. Besides from not needing a GdkGC pointer, the GimpCanvas drawing functions look and work like their GdkDrawable counterparts. GimpCanvas gracefully handles attempts to draw on the unrealized widget.
|
|
Returns : |
a new GimpCanvas widget |
void gimp_canvas_draw_cursor (GimpCanvas *canvas, gint x, gint y);
Draws a plus-shaped black and white cursor, centered at the point
x, y.
|
the GimpCanvas widget to draw on. |
|
x coordinate |
|
y coordinate |
void gimp_canvas_draw_point (GimpCanvas *canvas, GimpCanvasStyle style, gint x, gint y);
Draw a single pixel at the specified location in the specified style.
|
a GimpCanvas widget |
|
one of the enumerated GimpCanvasStyle's. |
|
x coordinate |
|
y coordinate |
void gimp_canvas_draw_points (GimpCanvas *canvas, GimpCanvasStyle style, GdkPoint *points, gint num_points);
Draws a set of one-pixel points at the locations given in the
points argument, in the specified style.
|
a GimpCanvas widget |
|
one of the enumerated GimpCanvasStyle's. |
|
an array of GdkPoint x-y pairs. |
|
the number of points in the array |
void gimp_canvas_draw_line (GimpCanvas *canvas, GimpCanvasStyle style, gint x1, gint y1, gint x2, gint y2);
Draw a line connecting the specified points, using the specified style.
|
a GimpCanvas widget |
|
one of the enumerated GimpCanvasStyle's. |
|
X coordinate of the first point |
|
Y coordinate of the first point |
|
X coordinate of the second point |
|
Y coordinate of the second point |
void gimp_canvas_draw_lines (GimpCanvas *canvas, GimpCanvasStyle style, GdkPoint *points, gint num_points);
Draws a set of lines connecting the specified points, in the specified style.
|
a GimpCanvas widget |
|
one of the enumerated GimpCanvasStyle's. |
|
a GdkPoint array. |
|
the number of points in the array. |
void gimp_canvas_draw_rectangle (GimpCanvas *canvas, GimpCanvasStyle style, gboolean filled, gint x, gint y, gint width, gint height);
Draws a rectangle in the specified style.
|
a GimpCanvas widget |
|
one of the enumerated GimpCanvasStyle's. |
|
TRUE if the rectangle is to be filled.
|
|
X coordinate of the upper left corner. |
|
Y coordinate of the upper left corner. |
|
width of the rectangle. |
|
height of the rectangle. |
void gimp_canvas_draw_arc (GimpCanvas *canvas, GimpCanvasStyle style, gboolean filled, gint x, gint y, gint width, gint height, gint angle1, gint angle2);
Draws an arc or pie slice, in the specified style.
|
a GimpCanvas widget |
|
one of the enumerated GimpCanvasStyle's. |
|
TRUE if the arc is to be filled, producing a 'pie slice'.
|
|
X coordinate of the left edge of the bounding rectangle. |
|
Y coordinate of the top edge of the bounding rectangle. |
|
width of the bounding rectangle. |
|
height of the bounding rectangle. |
|
the start angle of the arc. |
|
the end angle of the arc. |
void gimp_canvas_draw_polygon (GimpCanvas *canvas, GimpCanvasStyle style, gboolean filled, GdkPoint *points, gint num_points);
Draws a polygon connecting the specified points, in the specified style.
|
a GimpCanvas widget |
|
one of the enumerated GimpCanvasStyle's. |
|
if TRUE, fill the polygon.
|
|
a GdkPoint array. |
|
the number of points in the array. |
void gimp_canvas_draw_segments (GimpCanvas *canvas, GimpCanvasStyle style, GdkSegment *segments, gint num_segments);
Draws a set of line segments in the specified style.
|
a GimpCanvas widget |
|
one of the enumerated GimpCanvasStyle's. |
|
a GdkSegment array. |
|
the number of segments in the array. |
void gimp_canvas_draw_text (GimpCanvas *canvas, GimpCanvasStyle style, gint x, gint y, const gchar *format, ...);
Draws a layout, in the specified style.
|
a GimpCanvas widget |
|
one of the enumerated GimpCanvasStyle's. |
|
X coordinate of the left of the layout. |
|
Y coordinate of the top of the layout. |
|
a standard printf() format string.
|
|
the parameters to insert into the format string. |
void gimp_canvas_draw_rgb (GimpCanvas *canvas, GimpCanvasStyle style, gint x, gint y, gint width, gint height, guchar *rgb_buf, gint rowstride, gint xdith, gint ydith);
Draws an RGB image on the canvas in the specified style.
|
a GimpCanvas widget |
|
one of the enumerated GimpCanvasStyle's. |
|
X coordinate of the upper left corner. |
|
Y coordinate of the upper left corner. |
|
width of the rectangle to be drawn. |
|
height of the rectangle to be drawn. |
|
pixel data for the image to be drawn. |
|
the rowstride in rgb_buf.
|
|
x offset for dither alignment. |
|
y offset for dither alignment. |
void gimp_canvas_draw_drop_zone (GimpCanvas *canvas, cairo_t *cr);
|
|
|
void gimp_canvas_set_clip_rect (GimpCanvas *canvas, GimpCanvasStyle style, GdkRectangle *rect);
Sets a rectangular clipping area for the specified style.
|
a GimpCanvas widget |
|
one of the enumerated GimpCanvasStyle's. |
|
a GdkRectangle to set the bounds of the clipping area. |
void gimp_canvas_set_clip_region (GimpCanvas *canvas, GimpCanvasStyle style, GdkRegion *region);
Sets a clipping region for the specified style.
|
a GimpCanvas widget |
|
one of the enumerated GimpCanvasStyle's. |
|
a GdkRegion to set the bounds of the clipping area. |
void gimp_canvas_set_custom_gc (GimpCanvas *canvas, GdkGC *gc);
The GimpCanvas widget has an extra style for a custom GdkGC. This
function allows you to set the gc for the GIMP_CANVAS_STYLE_CUSTOM.
Drawing with the custom style only works if you set a GdkGC
earlier. Since the custom GdkGC can under certain circumstances
be destroyed by GimpCanvas, you should always set the custom gc
before calling a GimpCanvas drawing function with
GIMP_CANVAS_STYLE_CUSTOM.
|
a GimpCanvas widget |
|
a GdkGC; |
void gimp_canvas_set_stipple_index (GimpCanvas *canvas, GimpCanvasStyle style, guint index);
Some styles of the GimpCanvas do a stipple fill. GimpCanvas has a
set of GIMP_CANVAS_NUM_STIPPLES stipple bitmaps. This function
allows you to change the bitmap being used. This can be used to
implement a marching ants effect. An older implementation used to
use this feature and so it is included since it might be useful in
the future. All stipple bitmaps but the default one are created on
the fly.
|
a GimpCanvas widget |
|
the GimpCanvasStyle to alter |
|
the new stipple index |
void gimp_canvas_set_bg_color (GimpCanvas *canvas, GimpRGB *color);
Sets the background color of the canvas's window. This is the color the canvas is set to if it is cleared.
|
a GimpCanvas widget |
|
a color in GimpRGB format |
void gimp_canvas_scroll (GimpCanvas *canvas, gint offset_x, gint offset_y);
Scrolls the canvas using gdk_window_scroll() and makes sure the result
is displayed immediately by calling gdk_window_process_updates().
|
the GimpCanvas widget to scroll. |
|
the x scroll amount. |
|
the y scroll amount. |