[cairo-commit] pycairo/doc/reference surfaces.rst,1.5,1.6
Steve Chaplin
commit at pdx.freedesktop.org
Thu Mar 19 01:26:55 PDT 2009
- Previous message: [cairo-commit] pycairo ChangeLog,1.299,1.300
- Next message: [cairo-commit] pycairo ChangeLog, 1.300, 1.301 RELEASING, 1.27, 1.28 configure.ac, 1.79, 1.80 NEWS, 1.25, 1.26 setup.py, 1.32, 1.33
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: stevech1097
Update of /cvs/cairo/pycairo/doc/reference
In directory kemper:/tmp/cvs-serv14540/doc/reference
Modified Files:
surfaces.rst
Log Message:
'SC'
Index: surfaces.rst
===================================================================
RCS file: /cvs/cairo/pycairo/doc/reference/surfaces.rst,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- surfaces.rst 3 Mar 2009 12:40:24 -0000 1.5
+++ surfaces.rst 19 Mar 2009 08:26:52 -0000 1.6
@@ -254,21 +254,35 @@
data and to create the *ImageSurface*. See
:meth:`.format_stride_for_width` for example code.
+ .. method:: create_from_png(fobj)
- .. method:: create_from_png()
- .. comment
- surface = cairo_image_surface_create_from_png (filename);
- surface = cairo_image_surface_create_from_png_stream (read_func, closure);
+ :param fobj: a filename, file, or file-like object of the PNG to load.
- surface = cairo.ImageSurface.create_from_png (f)
- where 'f' is a filename, a file object, or a file-like object
- ..
+ Creates a new *ImageSurface* and initializes the contents to the given
+ PNG file.
+ .. method:: format_stride_for_width(format, width)
- .. method:: format_stride_for_width()
+ :param format: a cairo :ref:`format <mattributes_format>` value
+ :param width: the desired width of an *ImageSurface* to be created.
+ :returns: the appropriate stride to use given the desired format and width, or -1 if either the format is invalid or the width too large.
+
+ This method provides a stride value that will respect all alignment
+ requirements of the accelerated image-rendering code within
+ cairo. Typical usage will be of the form::
+
+ stride = cairo.ImageSurface.stride_for_width (format, width)
+ surface = cairo.ImageSurface.create_for_data (data, format,
+ width, height, stride)
+
+ .. versionadded:: 1.6
.. method:: get_data()
+ :returns: a Python buffer object for the data of the *ImageSurface*, for direct inspection or modification.
+
+ .. versionadded:: 1.2
+
.. method:: get_format()
.. method:: get_height()
- Previous message: [cairo-commit] pycairo ChangeLog,1.299,1.300
- Next message: [cairo-commit] pycairo ChangeLog, 1.300, 1.301 RELEASING, 1.27, 1.28 configure.ac, 1.79, 1.80 NEWS, 1.25, 1.26 setup.py, 1.32, 1.33
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list