Class PSSurface

The PostScript surface is used to render cairo graphics to Adobe PostScript files and is a multi-page vector surface backend.

Inherits from

Constructors

Name Description
this Create a PSSurface from a existing cairo_surface_t*. PSSurface is a garbage collected class. It will call cairo_surface_destroy when it gets collected by the GC or when dispose() is called.
this Creates a PostScript surface of the specified size in points to be written to filename.
this Creates a PostScript surface of the specified size in points.This will generate a PSSurface that may be queried and used as a source, without generating a temporary file.

Properties

Name Type Description
deviceOffset [get, set] Point!(double) Convenience property function
fallbackResolution [get, set] Resolution Convenience property function

Methods

Name Description
dscBeginPageSetup This function indicates that subsequent calls to dscComment() should direct comments to the PageSetup section of the PostScript output.
dscBeginSetup This function indicates that subsequent calls to dscComment() should direct comments to the Setup section of the PostScript output.
dscComment See http://cairographics.org/manual/cairo-PostScript-Surfaces.html#cairo-ps-surface-dsc-comment
getEPS Check whether the PostScript surface will output Encapsulated PostScript.
restrictToLevel Restricts the generated PostSript file to level. See getPSLevels() for a list of available level values that can be used here.
setEPS If eps is true, the PostScript surface will output Encapsulated PostScript.
setSize hanges the size of a PostScript surface for the current (and subsequent) pages.
copyPage Emits the current page for backends that support multiple pages, but doesn't clear it, so that the contents of the current page will be retained for the next page. Use Surface.showPage() if you want to get an empty page after the emission.
createForRectangle 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.
createFromNative The createFromNative method for the Surface classes. See https://github.com/jpf91/cairoD/wiki/Memory-Management#createFromNative for more information.
createSimilar Create a new surface that is as compatible as possible with an existing surface. For example the new surface will have the same fallback resolution and font options as other. Generally, the new surface will also use the same backend as other, unless that is not possible for some reason. The type of the returned surface may be examined with Surface.getType().
finish This function finishes the surface and drops all references to external resources. For example, for the Xlib backend it means that cairo will no longer access the drawable, which can be freed. After calling Surface.finish() the only valid operations on a surface are getting and setting user, referencing and destroying, and flushing and finishing it.
flush Do any pending drawing for the surface and also restore any temporary modifications cairo has made to the surface's state. This function must be called before switching from drawing on the surface with cairo to drawing on it directly with native APIs. If the surface doesn't support direct access, then this function does nothing.
getContent This function returns the content type of surface which indicates whether the surface contains color and/or alpha information. See Content.
getDevice This function returns the device for a surface. See Device.
getDeviceOffset This function returns the previous device offset set by Surface.setDeviceOffset().
getFallbackResolution This function returns the previous fallback resolution set by setFallbackResolution(), or default fallback resolution if never set.
getFontOptions Retrieves the default font rendering options for the surface. This allows display surfaces to report the correct subpixel order for rendering on them, print surfaces to disable hinting of metrics and so forth. The result can then be used with ScaledFont().
getMimeData Return mime data previously attached to surface using the specified mime type. If no data has been attached with the given mime type, data is set null.
getType This function returns the C type of a Surface. See SurfaceType for available types.
hasShowTextGlyphs Returns whether the surface supports sophisticated showTextGlyphs() operations. That is, whether it actually uses the provided text and cluster data to a showTextGlyphs() call.
markDirty Tells cairo that drawing has been done to surface using means other than cairo, and that cairo should reread any cached areas. Note that you must call Surface.flush() before doing such drawing.
markDirtyRectangle Like Surface.markDirty(), but drawing has been done only to the specified rectangle, so that cairo can retain cached contents for other parts of the surface.
setDeviceOffset Sets an offset that is added to the device coordinates determined by the CTM when drawing to surface. One use case for this function is when we want to create a Surface that redirects drawing for a portion of an onscreen surface to an offscreen surface in a way that is completely invisible to the user of the cairo API. Setting a transformation via Context.translate() isn't sufficient to do this, since functions like Context.deviceToUser() will expose the hidden offset.
setFallbackResolution Set the horizontal and vertical resolution for image fallbacks.
setMimeData Attach an image in the format mime_type to surface. To remove the data from a surface, call this function with same mime type and NULL for data.
showPage Emits and clears the current page for backends that support multiple pages. Use Surface.copyPage() if you don't want to clear the page.
checkError Method for use in subclasses. Calls cairo_surface_status(nativePointer) and throws an exception if the status isn't CAIRO_STATUS_SUCCESS

Aliases

Name Description
content Convenience alias
device Convenience alias
fontOptions Convenience alias
type convenience alias

Templates

Name Description
CairoCountedClass!(cairo_surface_t*, "cairo_surface_")

Authors

Johannes Pfau cairoD
cairo team cairo

Copyright

License

cairoD wrapper/bindings Boost License 1.0
cairo LGPL 2.1 / MPL 1.1