[cairo-commit]
goocanvas/src demo.c, 1.3, 1.4 goocanvasellipseview.c,
1.2, 1.3 goocanvasgroupview.c, 1.2, 1.3 goocanvasimageview.c,
1.2, 1.3 goocanvasitemview.c, 1.2, 1.3 goocanvasitemview.h,
1.2, 1.3 goocanvaspolylineview.c, 1.2, 1.3 goocanvasrectview.c,
1.2, 1.3 goocanvastextview.c, 1.3, 1.4 goocanvasview.c, 1.4,
1.5 goocanvasview.h, 1.2, 1.3
Damon Chaplin
commit at pdx.freedesktop.org
Fri Mar 24 08:55:47 PST 2006
Committed by: damon
Update of /cvs/cairo/goocanvas/src
In directory kemper:/tmp/cvs-serv29878/src
Modified Files:
demo.c goocanvasellipseview.c goocanvasgroupview.c
goocanvasimageview.c goocanvasitemview.c goocanvasitemview.h
goocanvaspolylineview.c goocanvasrectview.c
goocanvastextview.c goocanvasview.c goocanvasview.h
Log Message:
2006-03-24 Damon Chaplin <damon at gnome.org>
* src/goocanvasview.c (goo_canvas_view_render): new function to
render all or part of the canvas to a given cairo context.
* src/demo.c: added "Write PDF" test, that creates a pdf file
containing the main canvas.
* src/goocanvasview.[hc]: used a GooCanvasBounds rather than left,
right, top, bottom for the bounds. Also renamed "pixels_per_unit"
to "scale".
* src/goocanvasitemview.[hc]:
* src/goocanvastextview.c (goo_canvas_text_view_paint):
* src/goocanvasgroupview.c (goo_canvas_group_view_paint):
* src/goocanvasellipseview.c (goo_canvas_ellipse_view_paint):
* src/goocanvasimageview.c (goo_canvas_image_view_paint):
* src/goocanvaspolylineview.c (goo_canvas_polyline_view_paint): we
now just pass the effective scale to the paint function rather than the
GooCanvasView*, since when rendering to an arbitrary cairo_t we may not
want to use a different effective scale (to determine which items are
shown). (Also fixed some of the visibility checks.)
Index: demo.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/demo.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- demo.c 23 Mar 2006 16:58:48 -0000 1.3
+++ demo.c 24 Mar 2006 16:55:45 -0000 1.4
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <cairo-pdf.h>
#include "goocanvasmodelsimple.h"
#include "goocanvasview.h"
#include "goocanvasitemview.h"
@@ -33,6 +34,29 @@
static void
+write_pdf_clicked (GtkWidget *button, GooCanvasView *canvas_view)
+{
+ cairo_surface_t *surface;
+ cairo_t *cr;
+
+ g_print ("In write_pdf_clicked\n");
+
+ surface = cairo_pdf_surface_create ("demo.pdf", 9 * 72, 10 * 72);
+ cr = cairo_create (surface);
+
+ /* Place it in the middle of our 9x10 page. */
+ cairo_translate (cr, 20, 130);
+
+ goo_canvas_view_render (canvas_view, cr, NULL, 1.0);
+
+ cairo_show_page (cr);
+
+ cairo_surface_destroy (surface);
+ cairo_destroy (cr);
+}
+
+
+static void
zoom_changed (GtkAdjustment *adj, GooCanvasView *canvas_view)
{
goo_canvas_view_set_scale (canvas_view, adj->value);
@@ -446,6 +470,16 @@
canvas_view);
+ /* Create PDF */
+
+ w = gtk_button_new_with_label("Write PDF");
+ gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
+ gtk_widget_show (w);
+ g_signal_connect (w, "clicked",
+ (GtkSignalFunc) write_pdf_clicked,
+ canvas_view);
+
+
hbox = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
@@ -1048,20 +1082,43 @@
"visibility", GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD,
"visibility-threshold", 0.8,
NULL);
+ goo_canvas_rect_new (root, 410.5, 322.5, 180, 15,
+ "line-width", 1.0,
+ "visibility", GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD,
+ "visibility-threshold", 0.8,
+ NULL);
+
goo_canvas_text_new (root, "Visible above 1.5x", 500, 350, -1,
GTK_ANCHOR_CENTER,
"visibility", GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD,
"visibility-threshold", 1.5,
NULL);
+ goo_canvas_rect_new (root, 410.5, 342.5, 180, 15,
+ "line-width", 1.0,
+ "visibility", GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD,
+ "visibility-threshold", 1.5,
+ NULL);
+
goo_canvas_text_new (root, "Visible above 3.0x", 500, 370, -1,
GTK_ANCHOR_CENTER,
"visibility", GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD,
"visibility-threshold", 3.0,
NULL);
+ goo_canvas_rect_new (root, 410.5, 362.5, 180, 15,
+ "line-width", 1.0,
+ "visibility", GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD,
+ "visibility-threshold", 3.0,
+ NULL);
+
+ /* This should never be seen. */
goo_canvas_text_new (root, "Always Invisible", 500, 390, -1,
GTK_ANCHOR_CENTER,
"visibility", GOO_CANVAS_ITEM_INVISIBLE,
NULL);
+ goo_canvas_rect_new (root, 410.5, 350.5, 180, 15,
+ "line-width", 1.0,
+ "visibility", GOO_CANVAS_ITEM_INVISIBLE,
+ NULL);
}
Index: goocanvasellipseview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasellipseview.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvasellipseview.c 23 Mar 2006 16:58:48 -0000 1.2
+++ goocanvasellipseview.c 24 Mar 2006 16:55:45 -0000 1.3
@@ -189,9 +189,9 @@
static void
goo_canvas_ellipse_view_paint (GooCanvasItemView *view,
- GooCanvasView *canvas_view,
cairo_t *cr,
- GooCanvasBounds *bounds)
+ GooCanvasBounds *bounds,
+ gdouble effective_scale)
{
GooCanvasEllipseView *ellipse_view = (GooCanvasEllipseView*) view;
GooCanvasItemSimple *simple = (GooCanvasItemSimple*) ellipse_view->ellipse;
@@ -203,7 +203,7 @@
/* Check if the item should be visible. */
if (simple->visibility == GOO_CANVAS_ITEM_INVISIBLE
|| (simple->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
- && simple->visibility_threshold < canvas_view->pixels_per_unit))
+ && effective_scale < simple->visibility_threshold))
return;
cairo_save (cr);
Index: goocanvasgroupview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasgroupview.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvasgroupview.c 23 Mar 2006 16:58:48 -0000 1.2
+++ goocanvasgroupview.c 24 Mar 2006 16:55:45 -0000 1.3
@@ -348,9 +348,9 @@
static void
goo_canvas_group_view_paint (GooCanvasItemView *view,
- GooCanvasView *canvas_view,
cairo_t *cr,
- GooCanvasBounds *bounds)
+ GooCanvasBounds *bounds,
+ gdouble effective_scale)
{
GooCanvasGroupView *group_view = (GooCanvasGroupView*) view;
GooCanvasGroup *group = group_view->group;
@@ -365,7 +365,7 @@
/* Check if the item should be visible. */
if (group->visibility == GOO_CANVAS_ITEM_INVISIBLE
|| (group->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
- && group->visibility_threshold < canvas_view->pixels_per_unit))
+ && effective_scale < group->visibility_threshold))
return;
/* Paint all the items in the group. */
@@ -382,7 +382,7 @@
|| child_bounds->y1 > bounds->y2 || child_bounds->y2 < bounds->y1)
continue;
- goo_canvas_item_view_paint (child_view, canvas_view, cr, bounds);
+ goo_canvas_item_view_paint (child_view, cr, bounds, effective_scale);
}
cairo_restore (cr);
}
Index: goocanvasimageview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasimageview.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvasimageview.c 23 Mar 2006 16:58:48 -0000 1.2
+++ goocanvasimageview.c 24 Mar 2006 16:55:45 -0000 1.3
@@ -172,9 +172,9 @@
static void
goo_canvas_image_view_paint (GooCanvasItemView *view,
- GooCanvasView *canvas_view,
cairo_t *cr,
- GooCanvasBounds *bounds)
+ GooCanvasBounds *bounds,
+ gdouble effective_scale)
{
GooCanvasImageView *image_view = (GooCanvasImageView*) view;
GooCanvasImage *image = image_view->image;
@@ -191,7 +191,7 @@
/* Check if the item should be visible. */
if (simple->visibility == GOO_CANVAS_ITEM_INVISIBLE
|| (simple->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
- && simple->visibility_threshold < canvas_view->pixels_per_unit))
+ && effective_scale < simple->visibility_threshold))
return;
cairo_save (cr);
Index: goocanvasitemview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemview.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvasitemview.c 23 Mar 2006 16:58:48 -0000 1.2
+++ goocanvasitemview.c 24 Mar 2006 16:55:45 -0000 1.3
@@ -294,11 +294,11 @@
void
goo_canvas_item_view_paint (GooCanvasItemView *view,
- GooCanvasView *canvas_view,
cairo_t *cr,
- GooCanvasBounds *bounds)
+ GooCanvasBounds *bounds,
+ gdouble effective_scale)
{
GooCanvasItemViewIface *iface = GOO_CANVAS_ITEM_VIEW_GET_IFACE (view);
- iface->paint (view, canvas_view, cr, bounds);
+ iface->paint (view, cr, bounds, effective_scale);
}
Index: goocanvasitemview.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemview.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvasitemview.h 23 Mar 2006 16:58:48 -0000 1.2
+++ goocanvasitemview.h 24 Mar 2006 16:55:45 -0000 1.3
@@ -47,9 +47,9 @@
gboolean entire_tree,
cairo_t *cr);
void (* paint) (GooCanvasItemView *view,
- GooCanvasView *canvas_view,
cairo_t *cr,
- GooCanvasBounds *bounds);
+ GooCanvasBounds *bounds,
+ gdouble effective_scale);
/* Signals. */
gboolean (* enter_notify_event) (GooCanvasItemView *view,
@@ -110,9 +110,9 @@
gboolean entire_tree,
cairo_t *cr);
void goo_canvas_item_view_paint (GooCanvasItemView *view,
- GooCanvasView *canvas_view,
cairo_t *cr,
- GooCanvasBounds *bounds);
+ GooCanvasBounds *bounds,
+ gdouble effective_scale);
G_END_DECLS
Index: goocanvaspolylineview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvaspolylineview.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvaspolylineview.c 23 Mar 2006 16:58:48 -0000 1.2
+++ goocanvaspolylineview.c 24 Mar 2006 16:55:45 -0000 1.3
@@ -333,9 +333,9 @@
static void
goo_canvas_polyline_view_paint (GooCanvasItemView *view,
- GooCanvasView *canvas_view,
cairo_t *cr,
- GooCanvasBounds *bounds)
+ GooCanvasBounds *bounds,
+ gdouble effective_scale)
{
GooCanvasPolylineView *polyline_view = (GooCanvasPolylineView*) view;
GooCanvasPolyline *polyline = polyline_view->polyline;
@@ -351,7 +351,7 @@
/* Check if the item should be visible. */
if (simple->visibility == GOO_CANVAS_ITEM_INVISIBLE
|| (simple->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
- && simple->visibility_threshold < canvas_view->pixels_per_unit))
+ && effective_scale < simple->visibility_threshold))
return;
cairo_save (cr);
Index: goocanvasrectview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasrectview.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvasrectview.c 23 Mar 2006 16:58:48 -0000 1.2
+++ goocanvasrectview.c 24 Mar 2006 16:55:45 -0000 1.3
@@ -239,9 +239,9 @@
static void
goo_canvas_rect_view_paint (GooCanvasItemView *view,
- GooCanvasView *canvas_view,
cairo_t *cr,
- GooCanvasBounds *bounds)
+ GooCanvasBounds *bounds,
+ gdouble effective_scale)
{
GooCanvasRectView *rect_view = (GooCanvasRectView*) view;
GooCanvasRect *rect = rect_view->rect;
@@ -254,7 +254,7 @@
/* Check if the item should be visible. */
if (simple->visibility == GOO_CANVAS_ITEM_INVISIBLE
|| (simple->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
- && simple->visibility_threshold < canvas_view->pixels_per_unit))
+ && effective_scale < simple->visibility_threshold))
return;
cairo_save (cr);
Index: goocanvastextview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvastextview.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- goocanvastextview.c 23 Mar 2006 16:58:48 -0000 1.3
+++ goocanvastextview.c 24 Mar 2006 16:55:45 -0000 1.4
@@ -320,9 +320,9 @@
static void
goo_canvas_text_view_paint (GooCanvasItemView *view,
- GooCanvasView *canvas_view,
cairo_t *cr,
- GooCanvasBounds *bounds)
+ GooCanvasBounds *bounds,
+ gdouble effective_scale)
{
GooCanvasTextView *text_view = (GooCanvasTextView*) view;
GooCanvasText *text = text_view->text;
@@ -341,7 +341,7 @@
/* Check if the item should be visible. */
if (simple->visibility == GOO_CANVAS_ITEM_INVISIBLE
|| (simple->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
- && canvas_view->pixels_per_unit < simple->visibility_threshold))
+ && effective_scale < simple->visibility_threshold))
return;
cairo_save (cr);
Index: goocanvasview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasview.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- goocanvasview.c 23 Mar 2006 16:58:48 -0000 1.4
+++ goocanvasview.c 24 Mar 2006 16:55:45 -0000 1.5
@@ -119,7 +119,7 @@
static void
goo_canvas_view_init (GooCanvasView *canvas_view)
{
- canvas_view->pixels_per_unit = 1.0;
+ canvas_view->scale = 1.0;
canvas_view->need_update = TRUE;
canvas_view->crossing_event.type = GDK_LEAVE_NOTIFY;
canvas_view->anchor = GTK_ANCHOR_NORTH_WEST;
@@ -223,8 +223,8 @@
gdk_window_set_user_data (widget->window, widget);
/* We want to round the sizes up to the next pixel. */
- width_pixels = ((view->right - view->left) * view->pixels_per_unit) + 1;
- height_pixels = ((view->bottom - view->top) * view->pixels_per_unit) + 1;
+ width_pixels = ((view->bounds.x2 - view->bounds.x1) * view->scale) + 1;
+ height_pixels = ((view->bounds.y2 - view->bounds.y1) * view->scale) + 1;
attributes.x = view->hadjustment ? - view->hadjustment->value : 0,
attributes.y = view->vadjustment ? - view->vadjustment->value : 0;
@@ -412,8 +412,8 @@
/* This is the natural size of the canvas window in pixels, rounded up to
the next pixel. */
- width_pixels = ((view->right - view->left) * view->pixels_per_unit) + 1;
- height_pixels = ((view->bottom - view->top) * view->pixels_per_unit) + 1;
+ width_pixels = ((view->bounds.x2 - view->bounds.x1) * view->scale) + 1;
+ height_pixels = ((view->bounds.y2 - view->bounds.y1) * view->scale) + 1;
/* The actual window size is always at least as big as the widget's window.*/
window_width = MAX (width_pixels, widget->allocation.width);
@@ -655,10 +655,10 @@
gdouble right,
gdouble bottom)
{
- view->left = left;
- view->top = top;
- view->right = right;
- view->bottom = bottom;
+ view->bounds.x1 = left;
+ view->bounds.y1 = top;
+ view->bounds.x2 = right;
+ view->bounds.y2 = bottom;
reconfigure_canvas (view, TRUE);
}
@@ -700,7 +700,7 @@
void
goo_canvas_view_set_scale (GooCanvasView *view,
- gdouble pixels_per_unit)
+ gdouble scale)
{
gdouble x, y;
@@ -722,18 +722,18 @@
view->freeze_count++;
- view->pixels_per_unit = pixels_per_unit;
+ view->scale = scale;
reconfigure_canvas (view, FALSE);
/* Convert from the center point to the new desired top-left posision. */
#if 0
g_print ("Old center %g, %g new: %g, %g\n", x, y,
- x - view->hadjustment->page_size / view->pixels_per_unit / 2,
- y - view->vadjustment->page_size / view->pixels_per_unit / 2);
+ x - view->hadjustment->page_size / view->scale / 2,
+ y - view->vadjustment->page_size / view->scale / 2);
#endif
- x -= view->hadjustment->page_size / view->pixels_per_unit / 2;
- y -= view->vadjustment->page_size / view->pixels_per_unit / 2;
+ x -= view->hadjustment->page_size / view->scale / 2;
+ y -= view->vadjustment->page_size / view->scale / 2;
/* Now try to scroll to it. */
goo_canvas_view_scroll_to (view, x, y);
@@ -858,14 +858,14 @@
/* We subtract one from the left & top edges, in case anti-aliasing makes
the drawing use an extra pixel. */
- rect.x = (double) (bounds->x1 - view->left) * view->pixels_per_unit - 1;
- rect.y = (double) (bounds->y1 - view->top) * view->pixels_per_unit - 1;
+ rect.x = (double) (bounds->x1 - view->bounds.x1) * view->scale - 1;
+ rect.y = (double) (bounds->y1 - view->bounds.y1) * view->scale - 1;
/* We add an extra one here for the same reason. (The other extra one is to
round up to the next pixel.) And one for luck! */
- rect.width = (double) (bounds->x2 - view->left) * view->pixels_per_unit
+ rect.width = (double) (bounds->x2 - view->bounds.x1) * view->scale
- rect.x + 2 + 1;
- rect.height = (double) (bounds->y2 - view->top) * view->pixels_per_unit
+ rect.height = (double) (bounds->y2 - view->bounds.y1) * view->scale
- rect.y + 2 + 1;
rect.x += view->canvas_x_offset;
@@ -903,12 +903,12 @@
if (view->need_update)
goo_canvas_view_update (view, cr);
- bounds.x1 = ((event->area.x - view->canvas_x_offset) / view->pixels_per_unit)
- + view->left;
- bounds.y1 = ((event->area.y - view->canvas_y_offset) / view->pixels_per_unit)
- + view->top;
- bounds.x2 = (event->area.width / view->pixels_per_unit) + bounds.x1;
- bounds.y2 = (event->area.height / view->pixels_per_unit) + bounds.y1;
+ bounds.x1 = ((event->area.x - view->canvas_x_offset) / view->scale)
+ + view->bounds.x1;
+ bounds.y1 = ((event->area.y - view->canvas_y_offset) / view->scale)
+ + view->bounds.y1;
+ bounds.x2 = (event->area.width / view->scale) + bounds.x1;
+ bounds.y2 = (event->area.height / view->scale) + bounds.y1;
#if 0
g_print ("In expose_event pixels: %i, %i %i x %i -> bounds: %g, %g %g x %g\n",
@@ -927,12 +927,12 @@
cairo_translate (cr, view->canvas_x_offset, view->canvas_y_offset);
/* Scale it so we can use canvas coordinates. */
- cairo_scale (cr, view->pixels_per_unit, view->pixels_per_unit);
+ cairo_scale (cr, view->scale, view->scale);
/* Translate it so the top-left of the canvas becomes (0,0). */
- cairo_translate (cr, -view->left, -view->top);
+ cairo_translate (cr, -view->bounds.x1, -view->bounds.y1);
- goo_canvas_item_view_paint (view->root_view, view, cr, &bounds);
+ goo_canvas_item_view_paint (view->root_view, cr, &bounds, view->scale);
cairo_destroy (cr);
@@ -940,6 +940,29 @@
}
+/**
+ * goo_canvas_view_render:
+ * @view: a #GooCanvasView.
+ * @cr: a cairo context.
+ * @bounds: the area to render, or NULL to render the entire canvas.
+ *
+ * Renders all or part of a canvas to the given cairo context.
+ **/
+void
+goo_canvas_view_render (GooCanvasView *view,
+ cairo_t *cr,
+ GooCanvasBounds *bounds,
+ gdouble effective_scale)
+{
+ if (bounds)
+ goo_canvas_item_view_paint (view->root_view, cr, bounds,
+ effective_scale);
+ else
+ goo_canvas_item_view_paint (view->root_view, cr, &view->bounds,
+ effective_scale);
+}
+
+
/*
* Keyboard/Mouse Event & Grab Handling.
*/
@@ -1661,9 +1684,9 @@
gdouble *x,
gdouble *y)
{
- *x = ((*x - canvas_view->left) * canvas_view->pixels_per_unit)
+ *x = ((*x - canvas_view->bounds.x1) * canvas_view->scale)
+ canvas_view->canvas_x_offset;
- *y = ((*y - canvas_view->top) * canvas_view->pixels_per_unit)
+ *y = ((*y - canvas_view->bounds.y1) * canvas_view->scale)
+ canvas_view->canvas_y_offset;
}
@@ -1689,10 +1712,10 @@
gdouble *x,
gdouble *y)
{
- *x = ((*x - canvas_view->canvas_x_offset) / canvas_view->pixels_per_unit)
- + canvas_view->left;
- *y = ((*y - canvas_view->canvas_y_offset) / canvas_view->pixels_per_unit)
- + canvas_view->top;
+ *x = ((*x - canvas_view->canvas_x_offset) / canvas_view->scale)
+ + canvas_view->bounds.x1;
+ *y = ((*y - canvas_view->canvas_y_offset) / canvas_view->scale)
+ + canvas_view->bounds.y1;
}
Index: goocanvasview.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasview.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvasview.h 22 Mar 2006 23:49:44 -0000 1.2
+++ goocanvasview.h 24 Mar 2006 16:55:45 -0000 1.3
@@ -34,10 +34,10 @@
GooCanvasItemView *root_view;
/* The bounds of the canvas, in canvas units (not pixels). */
- gdouble left, top, right, bottom;
+ GooCanvasBounds bounds;
- /* The scale/zoom factor of the view. */
- gdouble pixels_per_unit;
+ /* The scale/zoom factor of the view, in pixels per device unit. */
+ gdouble scale;
/* Where the canvas is anchored (where it is displayed when it is smaller
than the entire window). */
@@ -137,17 +137,33 @@
gdouble left,
gdouble top);
-GooCanvasItemView* goo_canvas_view_create_item_view (GooCanvasView *view,
- GooCanvasItem *item,
- GooCanvasItemView *parent_view);
+void goo_canvas_view_grab_focus (GooCanvasView *canvas_view,
+ GooCanvasItemView *item_view);
-void goo_canvas_view_request_update (GooCanvasView *view);
-void goo_canvas_view_request_redraw (GooCanvasView *view,
- GooCanvasBounds *bounds);
+void goo_canvas_view_render (GooCanvasView *view,
+ cairo_t *cr,
+ GooCanvasBounds *bounds,
+ gdouble effective_scale);
+/*
+ * Coordinate conversion.
+ */
+void goo_canvas_view_convert_to_pixels (GooCanvasView *canvas_view,
+ gdouble *x,
+ gdouble *y);
+void goo_canvas_view_convert_from_pixels (GooCanvasView *canvas_view,
+ gdouble *x,
+ gdouble *y);
+
+void goo_canvas_view_convert_to_item_space (GooCanvasView *canvas_view,
+ GooCanvasItemView *item_view,
+ gdouble *x,
+ gdouble *y);
+void goo_canvas_view_convert_from_item_space (GooCanvasView *canvas_view,
+ GooCanvasItemView *item_view,
+ gdouble *x,
+ gdouble *y);
-void goo_canvas_view_grab_focus (GooCanvasView *canvas_view,
- GooCanvasItemView *item_view);
/*
* Pointer/keyboard grabbing & ungrabbing.
@@ -170,23 +186,14 @@
/*
- * Coordinate conversion.
+ * Internal functions, mainly for canvas subclasses and item implementations.
*/
-void goo_canvas_view_convert_to_pixels (GooCanvasView *canvas_view,
- gdouble *x,
- gdouble *y);
-void goo_canvas_view_convert_from_pixels (GooCanvasView *canvas_view,
- gdouble *x,
- gdouble *y);
-
-void goo_canvas_view_convert_to_item_space (GooCanvasView *canvas_view,
- GooCanvasItemView *item_view,
- gdouble *x,
- gdouble *y);
-void goo_canvas_view_convert_from_item_space (GooCanvasView *canvas_view,
- GooCanvasItemView *item_view,
- gdouble *x,
- gdouble *y);
+GooCanvasItemView* goo_canvas_view_create_item_view (GooCanvasView *view,
+ GooCanvasItem *item,
+ GooCanvasItemView *parent_view);
+void goo_canvas_view_request_update (GooCanvasView *view);
+void goo_canvas_view_request_redraw (GooCanvasView *view,
+ GooCanvasBounds *bounds);
G_END_DECLS
More information about the cairo-commit
mailing list