[cairo-commit] pycairo/doc/reference surfaces.rst,1.8,1.9
Steve Chaplin
commit at pdx.freedesktop.org
Sun Jun 21 07:51:03 PDT 2009
Committed by: stevech1097
Update of /cvs/cairo/pycairo/doc/reference
In directory kemper:/tmp/cvs-serv27940/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.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- surfaces.rst 21 Jun 2009 06:23:18 -0000 1.8
+++ surfaces.rst 21 Jun 2009 14:51:01 -0000 1.9
@@ -255,13 +255,16 @@
color or alpha channel belonging to format will be 0. The contents of bits
within a pixel, but not belonging to the given format are undefined).
- .. classmethod:: create_for_data(data, format, width, height, stride)
+ .. classmethod:: create_for_data(data, format, width, height[, stride])
:param data: a writable Python buffer object
- :param format: the :ref:`FORMAT <constants_FORMAT>` of pixels in the buffer
+ :param format: the :ref:`FORMAT <constants_FORMAT>` of pixels in the
+ buffer
:param width: the width of the image to be stored in the buffer
:param height: the height of the image to be stored in the buffer
- :param stride: the number of bytes between the start of rows in the buffer as allocated. This value should always be computed by :meth:`.format_stride_for_width` before allocating the data buffer.
+ :param stride: the number of bytes between the start of rows in the
+ buffer as allocated. If not given the value from
+ ``format_stride_for_width(format, width)`` is used.
:returns: a new *ImageSurface*
:raises: *MemoryError* in case of no memory.
@@ -284,21 +287,23 @@
.. classmethod:: create_from_png(fobj)
:param fobj: a filename, file, or file-like object of the PNG to load.
- :returns: a new *ImageSurface* initialized the contents to the given PNG file.
+ :returns: a new *ImageSurface* initialized the contents to the given
+ PNG file.
- .. method:: format_stride_for_width(format, width)
+ .. staticmethod:: format_stride_for_width(format, width)
:param format: a cairo :ref:`FORMAT <constants_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.
+ :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.
+ :rtype: int
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)
+ stride = cairo.ImageSurface.format_stride_for_width (format, width)
+ surface = cairo.ImageSurface.create_for_data (data, format, width, height, stride)
.. versionadded:: 1.6
More information about the cairo-commit
mailing list