From 66d121d298b34ca3f27b7fd5cf8379e5d0517c45 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Sat, 13 Apr 2013 11:24:58 -0700 Subject: [PATCH] Fix Gtk doc xrefs. Add cairo-move-to, cairo-new-sub-path. --- doc/gtk/gtk.texinfo | 39 ++++++++++++++++++++++++++++++++---- src/gtk/Includes/cairo.cdecl | 2 ++ src/gtk/cairo.scm | 10 +++++++++ src/gtk/gtk.pkg | 2 ++ 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/doc/gtk/gtk.texinfo b/doc/gtk/gtk.texinfo index ff7889301..e4838d417 100644 --- a/doc/gtk/gtk.texinfo +++ b/doc/gtk/gtk.texinfo @@ -215,11 +215,11 @@ the reference manual (@uref{mit-scheme-ref/Graphics.html,, here}). @end ifhtml With the Gtk option loaded and running on a display, -@bref{enumerate-graphics-types} will include the symbol @code{gtk}. +@code{enumerate-graphics-types} will include the symbol @code{gtk}. A graphics device for Gtk is created by passing the symbol @code{gtk} as the graphics device type name to -@bref{make-graphics-device}: +@code{make-graphics-device}: @example (make-graphics-device 'gtk #!optional @var{width} @var{height} @var{no-window?}) @@ -249,7 +249,7 @@ Draws a circle centered at (@var{x}, @var{y}) with @var{radius}. @deffn Procedure gtk-graphics/draw-text device x y string Draws @var{string} at (@var{x}, @var{y}). This was intended to -implement the @bref{graphics-draw-text} operation (upright, left to +implement the @code{graphics-draw-text} operation (upright, left to right, at @var{x}) but it may be drawing text at @var{y}, not @var{y}-baseline. @end deffn @@ -1134,6 +1134,27 @@ Modifies the current transformation matrix of @var{cairo} by scaling the X and Y user-space axes by @var{sx} and @var{sy} respectively. @end deffn +@anchor{cairo-move-to} +@deffn Procedure cairo-move-to cairo x y +Begin a new sub-path. After this call @var{cairo}'s current point +will be (@var{x}, @var{y}). +@end deffn + +@anchor{cairo-new-sub-path} +@deffn Procedure cairo-new-sub-path cairo +Begins a new sub-path. Note that @var{cairo}'s existing path is not +affected. After this call there will be no current point. + +In many cases, this call is not needed since new sub-paths are +frequently started with @bref{cairo-move-to}. + +A call to @bref{cairo-new-sub-path} is particularly useful when +beginning a new sub-path with one of the @bref{cairo-arc} calls. This +makes things easier as it is no longer necessary to manually compute +the arc's initial coordinates for a call to @bref{cairo-move-to}. +@end deffn + +@anchor{cairo-arc} @deffn Procedure cairo-arc cairo x y radius start end Adds a circular arc to the current path. The arc is centered at (@var{x}, @var{y}), has @var{radius}, begins at @var{start} and @@ -1182,6 +1203,7 @@ em-square is 1 unit by 1 unit) to user space. @var{Matrix} should be created using @bref{cairo-matrix}. @end deffn +@anchor{cairo-matrix} @deffn Procedure cairo-matrix xx yx x0 xy yy y0 Creates a Cairo transformation matrix. A point @code{(x,y)} is transformed by this matrix into @code{(xx * x + xy * y + x0, yx * x + @@ -1200,11 +1222,18 @@ collected. The Scheme object is an alien of type Creates a Cairo image surface @var{width}x@var{height} pixels. @end deffn +@anchor{cairo-surface-write-to-png} +@deffn Procedure cairo-surface-write-to-png surface filename +Writes @var{surface} to a new file @var{filename} as a PNG image. +@end deffn + +@anchor{cairo-surface-flush} @deffn Procedure cairo-surface-flush surface Does any pending drawing for @var{surface}. Also restores any temporary modifications Cairo has made to the surface's state. @end deffn +@anchor{cairo-surface-destroy} @deffn Procedure cairo-surface-destroy surface De-references a cairo @var{surface} object. Further operations on @var{surface} will produce an error. @@ -1233,6 +1262,7 @@ a number of color stops should be defined using @bref{cairo-pattern-add-color-stop}. @end deffn +@anchor{cairo-pattern-add-color-stop} @deffn Procedure cairo-pattern-add-color-stop pattern offset color Adds a color stop to a gradient @var{pattern}. @var{Offset} specifies the location along the gradient's control vector. @var{Color} should @@ -1248,7 +1278,7 @@ De-references a cairo @var{pattern} object. Further operations on @var{pattern} will produce an error. @end deffn -@node Gtk Adjustment, Gtk Widget, Cairo Patter, API Reference +@node Gtk Adjustment, Gtk Widget, Cairo Pattern, API Reference @section Gtk Adjustment @deffn Class @@ -2814,6 +2844,7 @@ Set the position of @var{image} to (@var{x}, @var{y}). A fix-ink rendered by a Cairo image surface. +@anchor{} @deffn Class A direct subclass of fix-ink. @end deffn diff --git a/src/gtk/Includes/cairo.cdecl b/src/gtk/Includes/cairo.cdecl index 71f02a2df..316c517dc 100644 --- a/src/gtk/Includes/cairo.cdecl +++ b/src/gtk/Includes/cairo.cdecl @@ -106,6 +106,8 @@ cairo/cairo.h |# (extern void cairo_move_to (cr (* cairo_t)) (x double) (y double)) +(extern void cairo_new_sub_path (cr (* cairo_t))) + (extern void cairo_line_to (cr (* cairo_t)) (x double) (y double)) (extern void cairo_arc (cr (* cairo_t)) diff --git a/src/gtk/cairo.scm b/src/gtk/cairo.scm index 0c3bbb007..5bc3e2c2a 100644 --- a/src/gtk/cairo.scm +++ b/src/gtk/cairo.scm @@ -212,6 +212,16 @@ USA. (free doubles) (receiver x1. y1. x2. y2.))))) +(define (cairo-move-to cairo x y) + (guarantee-cairo cairo 'cairo-new-sub-path) + (let ((x (->flonum x)) + (y (->flonum y))) + (C-call "cairo_move_to" cairo x y))) + +(define (cairo-new-sub-path cairo) + (guarantee-cairo cairo 'cairo-new-sub-path) + (C-call "cairo_new_sub_path" cairo)) + (define (cairo-arc cairo xc yc radius start-angle end-angle) (guarantee-cairo cairo 'cairo-set-source) (C-call "cairo_arc" cairo (->flonum xc) (->flonum yc) (->flonum radius) diff --git a/src/gtk/gtk.pkg b/src/gtk/gtk.pkg index afdf27086..0c33b3268 100644 --- a/src/gtk/gtk.pkg +++ b/src/gtk/gtk.pkg @@ -148,6 +148,8 @@ USA. cairo-set-source-color cairo-set-source cairo-clip-extents + cairo-move-to + cairo-new-sub-path cairo-arc cairo-paint cairo-fill -- 2.25.1