summaryrefslogtreecommitdiff
path: root/doc/reference
diff options
context:
space:
mode:
authorSteve Chaplin <>2012-08-04 12:29:32 +0800
committerSteve Chaplin <>2012-08-04 12:29:32 +0800
commitc55e63970befc87120ceacae5fc9ffba0881d33d (patch)
treed5c01141dd136e0cdec1a92134dc44079febc068 /doc/reference
parent9576b3d77034d91f456a5b199a9fc9cc2fde3c08 (diff)
downloadpycairo-c55e63970befc87120ceacae5fc9ffba0881d33d.tar.gz
New methods added:
cairo_in_clip cairo_surface_create_for_rectangle cairo_pdf_surface_restrict_to_version cairo_pdf_version_to_string New constants added: cairo.PDF_VERSION_1_4 cairo.PDF_VERSION_1_5
Diffstat (limited to 'doc/reference')
-rw-r--r--doc/reference/constants.rst17
-rw-r--r--doc/reference/context.rst14
-rw-r--r--doc/reference/surfaces.rst57
3 files changed, 88 insertions, 0 deletions
diff --git a/doc/reference/constants.rst b/doc/reference/constants.rst
index 19c0993..a1fef62 100644
--- a/doc/reference/constants.rst
+++ b/doc/reference/constants.rst
@@ -483,6 +483,23 @@ represented as a :class:`Path`.
A close-path operation
+.. _constants_PDF_VERSION:
+
+cairo.PDF_VERSION
+-----------------
+These constants are used to describe the version number of the PDF
+specification that a generated PDF file will conform to. Note: the constants
+are only defined when cairo has been compiled with PDF support enabled.
+
+.. data:: CAIRO_PDF_VERSION_1_4
+
+ The version 1.4 of the PDF specification.
+
+.. data:: CAIRO_PDF_VERSION_1_5
+
+ The version 1.5 of the PDF specification.
+
+
.. _constants_PS_LEVEL:
cairo.PS_LEVEL
diff --git a/doc/reference/context.rst b/doc/reference/context.rst
index 4a2f17f..9e48113 100644
--- a/doc/reference/context.rst
+++ b/doc/reference/context.rst
@@ -557,6 +557,20 @@ safely be changed, without loosing the current state. Use
axes will be aligned and one user-space unit will transform to one
device-space unit.
+ .. method:: in_clip(x, y)
+
+ :param x: X coordinate of the point to test
+ :type x: float
+ :param y: Y coordinate of the point to test
+ :type y: float
+ :returns: True iff the given point is inside the area that would be
+ visible through the current clip, i.e. the area that would be filled
+ by a :meth:`Context.paint` operation.
+
+ See :meth:`Context.clip`, :meth:`Context.clip_preserve`.
+
+ .. versionadded:: 1.10.2
+
.. method:: in_fill(x, y)
:param x: X coordinate of the point to test
diff --git a/doc/reference/surfaces.rst b/doc/reference/surfaces.rst
index 949b05e..8a0e13d 100644
--- a/doc/reference/surfaces.rst
+++ b/doc/reference/surfaces.rst
@@ -80,6 +80,36 @@ class Surface()
Initially the surface contents are all 0 (transparent if contents have
transparency, black otherwise.)
+ .. method:: create_for_rectangle(x, y, width, height)
+
+ :param x: the x-origin of the sub-surface from the top-left of the
+ target surface (in device-space units)
+ :type x: float
+ :param y: the y-origin of the sub-surface from the top-left of the
+ target surface (in device-space units)
+ :type y: float
+ :param width: width of the sub-surface, (in device-space units)
+ :type width: float
+ :param height: height of the sub-surface (in device-space units)
+ :type width: float
+
+ :returns: a newly allocated *Surface*.
+
+ Create a new surface that is a rectangle within the target surface. All
+ operations drawn to this surface are then clipped and translated onto
+ the target surface. Nothing drawn via this sub-surface outside of its
+ bounds is drawn onto the target surface, making this a useful method for
+ passing constrained child surfaces to library routines that draw
+ directly onto the parent surface, i.e. with no further backend
+ allocations, double buffering or copies.
+
+ Note: The semantics of subsurfaces have not been finalized yet unless
+ the rectangle is in full device units, is contained within the extents
+ of the target surface, and the target or subsurface's device transforms
+ are not changed.
+
+ .. versionadded:: 1.10.2
+
.. method:: finish()
This method finishes the *Surface* and drops all references to external
@@ -354,6 +384,33 @@ multi-page vector surface backend.
.. versionadded:: 1.2
+ .. staticmethod:: pdf_version_to_string(level)
+
+ :param level: a :ref:`PDF_VERSION <constants_PDF_VERSION>`
+ :returns: the string associated to given version.
+ :rtype: str
+ :raises: :exc:`cairo.Error` if *version* isn't valid.
+
+ Get the string representation of the given *version*. See
+ :meth:`.pdf_get_versions` for a way to get the list of valid level
+ ids.
+
+ .. versionadded:: 1.10.2
+
+ .. method:: restrict_to_version(version)
+
+ :param version: a :ref:`PDF_VERSION <constants_PDF_VERSION>`
+
+ Restricts the generated PDF file to *version*. See
+ :meth:`.pdf_get_versions` for a list of available version values that can
+ be used here.
+
+ This function should only be called before any drawing operations have
+ been performed on the given surface. The simplest way to do this is to
+ call this function immediately after creating the surface.
+
+ .. versionadded:: 1.10.2
+
.. method:: set_size()
:param width_in_points: new surface width, in points