[cairo-commit] pycairo ChangeLog, 1.119, 1.120 configure.ac, 1.22,
1.23 NOTES, 1.4, 1.5
Steve Chaplin
commit at pdx.freedesktop.org
Fri May 20 01:57:46 PDT 2005
- Previous message: [cairo-commit]
pycairo/examples/svg svg2png.py, 1.3, 1.4 svgview.py, 1.5, 1.6
- Next message: [cairo-commit] pycairo/cairo cairomodule.c, 1.35, 1.36 pycairo.h,
1.33, 1.34 cairosvgmodule.c, 1.7, 1.8 pycairo-font.c, 1.21,
1.22 pycairo-matrix.c, 1.20, 1.21 pycairo-pattern.c, 1.23,
1.24 pycairo-private.h, 1.26, 1.27 pycairo-surface.c, 1.42, 1.43
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: stevech1097
Update of /cvs/cairo/pycairo
In directory gabe:/tmp/cvs-serv17784
Modified Files:
ChangeLog configure.ac NOTES
Log Message:
SC
Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/pycairo/ChangeLog,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- ChangeLog 19 May 2005 04:47:56 -0000 1.119
+++ ChangeLog 20 May 2005 08:57:44 -0000 1.120
@@ -1,3 +1,43 @@
+2005-05-20 Steve Chaplin <steve1097 at yahoo.com.au>
+
+ * examples/svg/svg2png.py:
+ * examples/svg/svgview.py :
+ update to new API
+
+ * cairo/cairomodule.c (init_cairo):
+ * cairo/pycairo.h :
+ rename cairo.pycairo_CAPI to cairo.CAPI
+
+ * cairo/cairosvgmodule.c : add cairo.svg.Error exception.
+ change .size attribute to .get_size() method
+
+ * examples/Makefile.am (EXTRA_DIST): list new examples
+
+ * configure.ac: increase version to 0.5.0
+
+ * cairo/pycairo-font.c (scaled_font_extents): change from an attribute
+ to a method to be consistent to C API
+
+ * cairo/pycairo-matrix.c : tidy up
+
+ * cairo/pycairo-pattern.c :
+ (pattern_add_color_stop_rgb): fix error with number of arguments
+
+ * examples/cairo_snippets/snippets_ps.py: new file
+ * examples/cairo_snippets/snippets_gtk.py : update to new API
+
+ * cairo/cairomodule.c:
+ * cairo/pycairo.h:
+ * cairo/pycairo-private.h:
+ * cairo/pycairo-surface.c:
+ Restore support for PSSurface
+
+ * cairo/pycairo-font.c :
+ * cairo/pycairo-surface.c: move object construction from __init__
+ to __new__.
+
+ * NOTES: update
+
2005-05-19 Steve Chaplin <steve1097 at yahoo.com.au>
* cairo/cairogtkmodule.c (_gdk_cairo_create): update for new
Index: configure.ac
===================================================================
RCS file: /cvs/cairo/pycairo/configure.ac,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- configure.ac 16 May 2005 01:04:34 -0000 1.22
+++ configure.ac 20 May 2005 08:57:44 -0000 1.23
@@ -3,7 +3,7 @@
# the pycairo version number
m4_define(pycairo_major_version, 0)
-m4_define(pycairo_minor_version, 4)
+m4_define(pycairo_minor_version, 5)
m4_define(pycairo_micro_version, 0)
m4_define(pycairo_version, pycairo_major_version.pycairo_minor_version.pycairo_micro_version)
Index: NOTES
===================================================================
RCS file: /cvs/cairo/pycairo/NOTES,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- NOTES 9 May 2005 09:12:31 -0000 1.4
+++ NOTES 20 May 2005 08:57:44 -0000 1.5
@@ -1,14 +1,18 @@
-Some features of the Pycairo bindings:
+Design of Pycairo bindings
+--------------------------
+The Pycairo bindings are designed to match the cairo C API as closely as
+possible, and to deviate only in cases which are clearly better implemented in
+a more 'Pythonic' way. Subsequently the cairo C API documentation can be used
+as a reference for writing Pycairo programs. Any differences to the C API are
+listed below.
-* provides an OO interface to cairo, using Python 2.2 new style classes.
-* cairo_status() is called to check the status of cairo_t operations, and
-raise exceptions as appropriate.
+Features of the Pycairo bindings
+--------------------------------
+* Provides an OO interface to cairo, using Python 2.2 new style classes.
-* Surfaces are implemented in a class hierarchy
- Surface - base class, contains methods applicable to all surfaces
- ImageSurface
- PDFSurface
+* Pycairo_Check_Status() is called to check the status of cairo_t operations,
+and raise exceptions as appropriate.
* Includes the cairo.gtk module - a simple extension with functions for
creating cairo objects from GdkDrawables or GdkPixbufs. This makes it
@@ -16,3 +20,125 @@
* Provides a C API that can be used by other Python extensions. Will be
important when wrapping other libraries that depend on cairo
+
+
+Constants
+---------
+The C API has many constant/enumeration values that are translated into
+Python as follows:
+C Python
+CAIRO_FORMAT_ARGB32 cairo.FORMAT_ARGB32
+
+
+Pycairo classes
+---------------
+C functions which take a cairo object, for example
+ cairo_fill_preserve (cairo_t *cr);
+become methods of the corresponding pycairo object, for example
+ Context.fill_preserve (self)
+
+cairo_reference(), cairo_destroy(), cairo_surface_reference(),
+cairo_surface_destroy() etc are not required - Pycairo handles cairo object
+construction and destruction.
+
+The Pycairo classes are listed below showing just the differences to the C API.
+Use the cairo docs to get a full listing of available functions.
+See the 'examples' directory for Pycairo examples
+
+
+cairo.Context
+-------------
+C : cr = cairo_create (surface);
+Py:ctx = cairo.Context (surface)
+
+C : cairo_set_dash (cairo_t *cr, double *dashes, int ndash, double offset);
+Py:ctx.set_dash (dash_sequence, offset)
+
+Methods supporting default argument values:
+ctx.mask_surface(surface, x=0.0, y=0.0)
+ctx.select_font_face(family, slant=cairo.FONT_SLANT_NORMAL)
+ weight=cairo.FONT_WEIGHT_NORMAL)
+ctx.set_source_surface(surface, x=0.0, y=0.0)
+
+
+cairo.FontFace
+--------------
+ff = cairo.FontFace() # does not work, FontFace cannot be instantiated
+ # directly, instead use
+ff = Context.get_font_face()
+
+
+cairo.Matrix
+------------
+C : cairo_matrix_init (cairo_matrix_t *matrix, xx, yx, xy, yy, x0, y0);
+ cairo_matrix_init_identity (cairo_matrix_t *matrix);
+ cairo_matrix_init_translate (cairo_matrix_t *matrix, tx, ty);
+ cairo_matrix_init_scale (cairo_matrix_t *matrix, sx, sy);
+ cairo_matrix_init_rotate (cairo_matrix_t *matrix, radians);
+ cairo_matrix_multiply (result, matrix1, matrix2)
+
+Py: matrix = cairo.Matrix (xx, yx, xy, yy, x0, y0)
+ matrix = cairo.Matrix ()
+ matrix = cairo.Matrix (x0=tx, y0=ty)
+ matrix = cairo.Matrix (xx=sy, yy=sy)
+ matrix = cairo.Matrix.init_rotate (radians)
+ result = matrix1 * matrix2
+
+To compare Matrix values:
+matrix1 == matrix2
+matrix1 != matrix2
+
+Methods supporting default argument values:
+matrix = cairo.Matrix (xx=1.0, yx=0.0, xy=0.0, yy=1.0, x0=0.0, y0=0.0)
+
+
+cairo.Path
+----------
+path = cairo.Path() # does not work, Path cannot be instantiated directly,
+ # instead use
+path = ctx.copy_path() # or
+path = ctx.copy_path_flat()
+
+Path is an iterator, see examples/warpedtext.py for example usage
+
+
+cairo.Pattern
+-------------
+pat = cairo.Pattern() # does not work, Pattern cannot be instantiated directly,
+ # instead use
+pat = cairo.Pattern.create_for_surface (surface)
+pat = cairo.Pattern.create_linear (x0, y0, x1, y1)
+pat = cairo.Pattern.create_radial (cx0, cy0, radius0, cx1, cy1, radius1)
+
+
+cairo.ScaledFont
+----------------
+
+
+cairo.Surface
+-------------
+Surfaces are implemented in a class hierarchy:
+ Surface - base class, contains methods applicable to all surfaces
+ ImageSurface
+ PDFSurface
+ PSSurface
+
+gtk ...
+
+C : surface = cairo_image_surface_create (format, width, height);
+ surface = cairo_image_surface_create_from_png (filename);
+ not available
+
+Py: surface = cairo.ImageSurface (format, width, height)
+ surface = cairo.ImageSurface.create_from_png (filename)
+ surface = cairo.ImageSurface.create_for_array (array)
+ # create a surface from a Numerical Python array
+
+
+C: surface = cairo_pdf_surface_create (filename, width_in_points,
+ height_in_points);
+ surface = cairo_ps_surface_create (filename, width_in_points,
+ height_in_points);
+
+Py: surface = cairo.PDFSurface (filename, width_in_points, height_in_points)
+ surface = cairo.PSSurface (filename, width_in_points, height_in_points)
- Previous message: [cairo-commit]
pycairo/examples/svg svg2png.py, 1.3, 1.4 svgview.py, 1.5, 1.6
- Next message: [cairo-commit] pycairo/cairo cairomodule.c, 1.35, 1.36 pycairo.h,
1.33, 1.34 cairosvgmodule.c, 1.7, 1.8 pycairo-font.c, 1.21,
1.22 pycairo-matrix.c, 1.20, 1.21 pycairo-pattern.c, 1.23,
1.24 pycairo-private.h, 1.26, 1.27 pycairo-surface.c, 1.42, 1.43
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list