Documentation ¶
Overview ¶
Package mimepattern creates patterns from images that, when possible, directly embed the uncompressed image data into the target surface.
Direct embedding is only possible when:
- The surface supports embedding (PDF, PS, SVG, and Win32 Printing)
- The particular variant of the uncompressed image data is not supported by that surface. (That is, a surface may support a mime type but not a particular compression method or extension used in that file).
- The pattern is being applied in a way that the surface cannot directly use the data, such as a compositing operation not natively supported by that surface.
If direct embedding is not possible, the pattern still works as expected, but the image data will be re-encoded. If the image is being stored in a lossy format such as JPEG this could result in degradation of image quality.
For SVG surfaces, there is the special case. Instead of embedding the uncompressed image contents, a url to the image is embedded in the document.
Index ¶
Constants ¶
const ( //PNG is the Portable Network Graphics image file format (ISO/IEC 15948). // //Originally CAIRO_MIME_TYPE_PNG. PNG mime = "image/png" //JPEG is the Joint Photographic Experts Group (JPEG) image coding standard //(ISO/IEC 10918-1). // //Originally CAIRO_MIME_TYPE_JPEG. JPEG mime = "image/jpeg" //JP2 is the Joint Photographic Experts Group (JPEG) 2000 image coding standard //(ISO/IEC 15444-1). // //Originally CAIRO_MIME_TYPE_JP2. JP2 mime = "image/jp2" )
These are the MIME types libcairo supports for embedding.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New creates a pattern of the image data in r of type mime.
The returned pattern is essentially a SurfacePattern but the underlying surface is irrecoverable as any modification will lead to corruption.
New will fail if there is not an image decoder for the relevant mime type installed with the image package. See the image package documentation for more information. It is up to you to ensure that the image data in r is of the mime type specified by mime.
Originally cairo_surface_set_mime_data.
Types ¶
This section is empty.