Documentation
¶
Overview ¶
Package pdf renders PDF documents.
doc, err := pdf.Open("file.pdf")
defer doc.Close()
p, err := doc.Page(0)
img, err := p.ImageDPI(150)
txt, err := p.Text()
A page also reads as structured text, as its links, as SVG and as HTML, and Page.Run draws it through a Device. The device interface and the devices behind it live in the gfx package and are aliased here, so that rendering a page needs one import.
A page composites in one color space throughout and converts once, at the public boundary, so a CMYK document renders to *image.CMYK.
A damaged file renders the part that could be read. What went wrong is collected in Document.Err rather than returned, unless Options.Strict asks for the first of them to be.
A Document may be rendered from several goroutines at once, one page each; a Page may not. Configuration belongs before they start.
Index ¶
- Constants
- Variables
- func RegisterImageDecoder(filter Name, dec ImageDecoder)
- type Array
- type BBoxDevice
- type BaseDevice
- type BlendMode
- type Bool
- type CMap
- type Char
- type ColorParams
- type ColorSpace
- type DefaultColorSpaces
- type Device
- type Dict
- type Document
- func Load(buf []byte, password string) (*Document, error)
- func New(f *syntax.File) *Document
- func NewReader(r io.ReaderAt, size int64) (*Document, error)
- func NewReaderPassword(r io.ReaderAt, size int64, password string) (*Document, error)
- func NewStream(r io.Reader) (*Document, error)
- func NewStreamPassword(r io.Reader, password string) (*Document, error)
- func Open(name string) (*Document, error)
- func OpenPassword(name, password string) (*Document, error)
- func (d *Document) Close() error
- func (d *Document) Err() []error
- func (d *Document) File() *syntax.File
- func (d *Document) Layers() []Layer
- func (d *Document) Metadata() Metadata
- func (d *Document) NumPages() int
- func (d *Document) Outline() []Outline
- func (d *Document) Page(i int) (*Page, error)
- func (d *Document) PageLabels() []string
- func (d *Document) SetLayers(layers []Layer)
- func (d *Document) SetSystemFonts(on bool)
- func (d *Document) SetUsage(u Usage)
- func (d *Document) Usage() Usage
- type DrawDevice
- type Font
- func (ft *Font) BaseFont() string
- func (ft *Font) Decode(s []byte) []Char
- func (ft *Font) EmBox() (ascent, descent float32)
- func (ft *Font) FontName() string
- func (ft *Font) Glyph(c Char) int
- func (ft *Font) GlyphFace(c Char, cur gfx.Font) (gfx.Font, int)
- func (ft *Font) GlyphName(code uint32) Name
- func (ft *Font) GlyphNameOf(c Char) string
- func (ft *Font) Program() *font.Font
- func (ft *Font) RunFace(cs []Char) gfx.Font
- func (ft *Font) RunGlyph(dev Device, code int, m raster.Matrix, cs *ColorSpace, col []float32, ...)
- func (ft *Font) Rune(c Char) rune
- func (ft *Font) Substituted() bool
- func (ft *Font) Text(c Char) string
- type Function
- type Image
- func (i *Image) ColorSpace() *ColorSpace
- func (i *Image) Dict() Dict
- func (i *Image) MaskImage() *Image
- func (i *Image) Pixels(cs *ColorSpace, shrink int) (*raster.Pixmap, error)
- func (i *Image) Pixmap() (*raster.Pixmap, error)
- func (i *Image) Size() (w, h int)
- func (i *Image) Smooth() bool
- func (i *Image) Stencil() bool
- type ImageDecoder
- type Integer
- type Kind
- type Layer
- type Link
- type ListDevice
- type Metadata
- type Name
- type Object
- type Options
- type Outline
- type Page
- func (p *Page) Bounds() raster.Rect
- func (p *Page) Contents() []byte
- func (p *Page) DeviceBounds(dpi float64) raster.Rect
- func (p *Page) Dict() Dict
- func (p *Page) HTML() (string, error)
- func (p *Page) Image() (*image.RGBA, error)
- func (p *Page) ImageDPI(dpi float64) (*image.RGBA, error)
- func (p *Page) ImageOptions(dpi float64, o *Options) (image.Image, error)
- func (p *Page) Links() []Link
- func (p *Page) Matrix(dpi float64) raster.Matrix
- func (p *Page) MediaBox() raster.Rect
- func (p *Page) Number() int
- func (p *Page) Render(ctm raster.Matrix, o *Options) (*raster.Pixmap, error)
- func (p *Page) RenderTo(dst draw.Image, ctm raster.Matrix, o *Options) error
- func (p *Page) Resources() Dict
- func (p *Page) Rotate() int
- func (p *Page) Run(dev Device, ctm raster.Matrix) error
- func (p *Page) RunAnnotations(dev Device, ctm raster.Matrix)
- func (p *Page) RunContents(dev Device, ctm raster.Matrix)
- func (p *Page) SVG() (string, error)
- func (p *Page) StructuredText() (*TextPage, error)
- func (p *Page) StructuredTextOptions(o *TextOptions) (*TextPage, error)
- func (p *Page) Text() (string, error)
- func (p *Page) UserUnit() float64
- func (p *Page) WriteHTML(w io.Writer) error
- func (p *Page) WriteSVG(w io.Writer) error
- type Quad
- type Real
- type Ref
- type Shade
- func (s *Shade) Bounds() raster.Rect
- func (s *Shade) ColorSpace() *ColorSpace
- func (s *Shade) Coord6() [6]float32
- func (s *Shade) Dict() Dict
- func (s *Shade) Domain4() [4]float32
- func (s *Shade) Shader(model raster.Model, ctm raster.Matrix, box raster.Rect) raster.Shader
- func (s *Shade) Transform() raster.Matrix
- type Stream
- type String
- type Text
- type TextBlock
- type TextChar
- type TextItem
- type TextLine
- type TextOptions
- type TextPage
- type TextSpan
- type TraceDevice
- func (d *TraceDevice) BeginGroup(area raster.Rect, cs *ColorSpace, isolated, knockout bool, blend BlendMode, ...)
- func (d *TraceDevice) BeginLayer(name string)
- func (d *TraceDevice) BeginMask(area raster.Rect, luminosity bool, cs *ColorSpace, backdrop []float32, ...)
- func (d *TraceDevice) BeginTile(area, view raster.Rect, xstep, ystep float32, ctm raster.Matrix) int
- func (d *TraceDevice) ClipImageMask(img gfx.Image, ctm raster.Matrix, scissor raster.Rect)
- func (d *TraceDevice) ClipPath(p *raster.Path, evenOdd bool, ctm raster.Matrix, scissor raster.Rect)
- func (d *TraceDevice) ClipStrokePath(p *raster.Path, s *raster.Stroke, ctm raster.Matrix, scissor raster.Rect)
- func (d *TraceDevice) ClipStrokeText(t *Text, s *raster.Stroke, ctm raster.Matrix, scissor raster.Rect)
- func (d *TraceDevice) ClipText(t *Text, ctm raster.Matrix, scissor raster.Rect)
- func (d *TraceDevice) Close() error
- func (d *TraceDevice) EndGroup()
- func (d *TraceDevice) EndLayer()
- func (d *TraceDevice) EndMask(transfer *[256]uint8)
- func (d *TraceDevice) EndTile()
- func (d *TraceDevice) FillImage(img gfx.Image, ctm raster.Matrix, alpha float32, cp ColorParams)
- func (d *TraceDevice) FillImageMask(img gfx.Image, ctm raster.Matrix, cs *ColorSpace, c []float32, alpha float32, ...)
- func (d *TraceDevice) FillPath(p *raster.Path, evenOdd bool, ctm raster.Matrix, cs *ColorSpace, c []float32, ...)
- func (d *TraceDevice) FillShade(shade gfx.Shade, ctm raster.Matrix, alpha float32, cp ColorParams)
- func (d *TraceDevice) FillText(t *Text, ctm raster.Matrix, cs *ColorSpace, c []float32, alpha float32, ...)
- func (d *TraceDevice) IgnoreText(t *Text, ctm raster.Matrix)
- func (d *TraceDevice) PopClip()
- func (d *TraceDevice) SetDefaultColorSpaces(cs *DefaultColorSpaces)
- func (d *TraceDevice) StrokePath(p *raster.Path, s *raster.Stroke, ctm raster.Matrix, cs *ColorSpace, ...)
- func (d *TraceDevice) StrokeText(t *Text, s *raster.Stroke, ctm raster.Matrix, cs *ColorSpace, c []float32, ...)
- type Usage
Constants ¶
const ( KindGray = gfx.KindGray KindRGB = gfx.KindRGB KindCMYK = gfx.KindCMYK KindLab = gfx.KindLab KindCalRGB = gfx.KindCalRGB KindCalGray = gfx.KindCalGray KindIndexed = gfx.KindIndexed KindSeparation = gfx.KindSeparation KindDeviceN = gfx.KindDeviceN KindPattern = gfx.KindPattern )
Color space families, ISO 32000-1 8.6.
const ( BlendNormal = gfx.BlendNormal BlendMultiply = gfx.BlendMultiply BlendScreen = gfx.BlendScreen BlendOverlay = gfx.BlendOverlay BlendDarken = gfx.BlendDarken BlendLighten = gfx.BlendLighten BlendColorDodge = gfx.BlendColorDodge BlendColorBurn = gfx.BlendColorBurn BlendHardLight = gfx.BlendHardLight BlendSoftLight = gfx.BlendSoftLight BlendDifference = gfx.BlendDifference BlendExclusion = gfx.BlendExclusion BlendHue = gfx.BlendHue BlendSaturation = gfx.BlendSaturation BlendColor = gfx.BlendColor BlendLuminosity = gfx.BlendLuminosity )
The separable blend modes, then the four non-separable ones.
const DefaultContentCacheOps = 1 << 18
DefaultContentCacheOps is how many operands of parsed content streams a document keeps when nothing says otherwise.
const DefaultImageCacheBytes = 1 << 26
DefaultImageCacheBytes is how much of a document's decoded images are kept when nothing says otherwise.
const DefaultPixelLimit = 1 << 28
DefaultPixelLimit is how many pixels a page may allocate when Options says nothing, the same number and the same name as in the sibling codecs.
Variables ¶
var ( DeviceGray = gfx.DeviceGray DeviceRGB = gfx.DeviceRGB DeviceCMYK = gfx.DeviceCMYK )
The device spaces, which every content stream can use without declaring.
var ( // ErrInvalid means the file is not a PDF, or is damaged past recovery. ErrInvalid = syntax.ErrInvalid // ErrUnsupported means the file is well formed but uses something this // package cannot handle. ErrUnsupported = syntax.ErrUnsupported // ErrPassword means the document is encrypted and the password is wrong. ErrPassword = syntax.ErrPassword )
Errors returned by this package. Anything a damaged file does that can be worked around is recorded in Document.Err instead.
var DefaultColorParams = gfx.DefaultColorParams
DefaultColorParams is what a page starts with.
Functions ¶
func RegisterImageDecoder ¶
func RegisterImageDecoder(filter Name, dec ImageDecoder)
RegisterImageDecoder installs a decoder for an image filter, taking precedence over the built in one. It is how a caller plugs in a JPEG decoder that reads what image/jpeg refuses, or a JPEG 2000 one.
Types ¶
type BBoxDevice ¶
type BBoxDevice = gfx.BBoxDevice
BBoxDevice accumulates the bounding box of everything drawn.
func NewBBoxDevice ¶
func NewBBoxDevice() *BBoxDevice
NewBBoxDevice returns a device that measures a page.
type CMap ¶
CMap maps byte codes to CIDs, ISO 32000-1 9.7.5. The same syntax is used by a ToUnicode CMap, where the values are Unicode rather than CIDs.
type Char ¶
type Char struct {
Code uint32
CID uint32
Bytes int
// Width is the glyph advance in text space units of the font size, so
// 1000 units per em has already been divided out for everything but a
// Type3 font, whose advance goes through its own font matrix.
Width float32
// Space is true for a single byte code 32, which is what the word spacing
// parameter applies to.
Space bool
}
Char is one character code decoded from a string.
type ColorParams ¶
type ColorParams = gfx.ColorParams
ColorParams are the rendering intent and the four flags that travel with every painting operation.
type DefaultColorSpaces ¶
type DefaultColorSpaces = gfx.DefaultColorSpaces
DefaultColorSpaces is what the three device spaces mean.
type Device ¶
Device receives the drawing operations an interpreted content stream produces. Embed BaseDevice to pick up no-op implementations.
type Document ¶
type Document struct {
// GlyphCacheBytes bounds the rendered glyph masks the document keeps,
// ImageCacheBytes the decoded images and ContentCacheOps the operands of
// parsed content streams. Zero is the default, negative is no cache at all.
GlyphCacheBytes int
ImageCacheBytes int
ContentCacheOps int
// contains filtered or unexported fields
}
Document is an open PDF file.
A Document may be rendered from several goroutines at once, a Page each. Configuration - SetLayers, SetUsage, GlyphCacheBytes, ImageCacheBytes and ContentCacheOps - happens before they start, and Close after the last ends.
func NewReaderPassword ¶
NewReaderPassword reads size bytes from r, decrypting with password.
func NewStream ¶ added in v0.2.0
NewStream reads a document from a stream that cannot be seeked, which means reading all of it into memory first. A caller with an untrusted source bounds it with io.LimitReader.
func NewStreamPassword ¶ added in v0.2.0
NewStreamPassword is NewStream for an encrypted document.
func OpenPassword ¶
OpenPassword reads the named file, which is encrypted with password.
func (*Document) Close ¶
Close releases the document and everything it has cached. It must not be called while a page is still rendering.
func (*Document) Err ¶
Err returns what has gone wrong so far, which a damaged file logs rather than fails on. It is safe to call while pages are rendering.
func (*Document) File ¶
File returns the object layer underneath, for callers that want to read the document structure directly.
func (*Document) Layers ¶
Layers returns the document's optional content groups and whether each is on, in the order the catalog lists them. It returns nothing for a document that has no optional content.
func (*Document) PageLabels ¶
PageLabels returns what a viewer numbers each page with, ISO 32000-1 12.4.2, and nil for a document with no labels.
func (*Document) SetLayers ¶
SetLayers turns optional content groups on and off. Only the On field of each layer is read, and only layers this document declared are used, so the slice Layers returned can be edited and passed back.
func (*Document) SetSystemFonts ¶
SetSystemFonts chooses whether a font the file does not embed may be substituted with one the machine has. It is on by default and has to be set before the first page is rendered.
type DrawDevice ¶
type DrawDevice = gfx.DrawDevice
DrawDevice renders into a raster.Pixmap.
func NewDrawDevice ¶
func NewDrawDevice(doc *Document, dst *raster.Pixmap) *DrawDevice
NewDrawDevice returns a device that renders a page of doc into dst. The document holds the glyph cache and the errors a damaged file records.
type Font ¶
type Font struct {
Name Name // /BaseFont, or /Name for a Type3 font
Dict Dict
Type0 bool
Type3 bool
WMode int
// Type3 fonts draw their glyphs with content streams.
FontMatrix raster.Matrix
CharProcs Dict
Resources Dict
// contains filtered or unexported fields
}
Font is a PDF font dictionary: what the interpreter needs to turn a string into positioned glyphs. The font program itself, and therefore the glyph outlines, arrive with the font engine.
func (*Font) EmBox ¶
EmBox is how far the font's em box reaches above and below the baseline, in text space. The descriptor is preferred over the program.
func (*Font) GlyphFace ¶
GlyphFace resolves a character to the glyph that draws it and the face it comes from, which is one the machine has when the character is outside what the stand in for a font the file did not embed can draw. cur is the face the run is already in, which keeps a space between two words of a script the stand in has no glyphs for from splitting the run in three.
func (*Font) GlyphNameOf ¶
GlyphNameOf returns what the font program calls the glyph a character selects, which is what a trace of the device calls it too.
func (*Font) RunFace ¶
RunFace is the face a whole shown string is drawn from: the one a character the stand in has no glyph for reaches for, so that a word is not half in one typeface and half in another. It is nil when the stand in covers the string.
func (*Font) RunGlyph ¶
func (ft *Font) RunGlyph(dev Device, code int, m raster.Matrix, cs *ColorSpace, col []float32, alpha float32, depth int)
RunGlyph draws one glyph of a Type3 font into dev, by interpreting the content stream the glyph is.
func (*Font) Rune ¶
Rune returns the character a code stands for, for text extraction. Codes that map to nothing, and mappings that land on a control character, become the replacement character, which is what MuPDF shows and what a text extractor can recognize.
func (*Font) Substituted ¶
Substituted reports a program standing in for a font the file left out.
type Function ¶
type Function struct {
Type int
Domain []float64
Range []float64
// contains filtered or unexported fields
}
Function is a PDF function, ISO 32000-1 7.10: sampled, exponential, stitching, or a PostScript calculator.
func (*Function) Eval ¶
Eval evaluates the function. The result is appended to out, which may be nil, so that a caller in a loop can reuse one buffer.
func (*Function) Eval1 ¶
Eval1 evaluates a function of one input into a float32 slice, which is what color conversion works in.
func (*Function) NumOutputs ¶
NumOutputs returns how many values Eval returns, or zero when the function only learns that from its own definition.
type Image ¶
type Image struct {
Width, Height int
BPC int
CS *ColorSpace
// Mask is true for a stencil mask, which paints the fill color through
// its one bit samples rather than carrying color of its own.
Mask bool
// Interpolate is the /Interpolate hint.
Interpolate bool
// Decode is the /Decode array, nil when the default applies.
Decode []float64
// SMask and StencilMask are the two ways an image carries transparency.
SMask *Image
StencilMask *Image
// ColorKey is the /Mask color key range, nil when there is none.
ColorKey []int
// contains filtered or unexported fields
}
Image is an image XObject or an inline image. The pixels are not decoded until a device asks for them.
func (*Image) ColorSpace ¶
func (i *Image) ColorSpace() *ColorSpace
ColorSpace returns the space the samples are in, nil for a stencil mask.
func (*Image) MaskImage ¶
MaskImage returns the image that supplies this one's transparency, whether it came from /SMask or from a stencil /Mask. Both are drawn the same way: the mask clips, the image fills.
func (*Image) Pixels ¶
Pixels decodes the image into cs, halved shrink times, through the document's cache. A nil cs asks for the coverage of a stencil.
type ImageDecoder ¶
ImageDecoder turns the data of an image filter into interleaved eight bit samples, and reports the size and the number of components it produced.
type Layer ¶
Layer is one optional content group: a part of a document that can be drawn or left out, with the name the file gives it.
type Link ¶
type Link struct {
// Rect is the area the link covers, in page space at 72 dots per inch.
Rect raster.Rect
// URI is where a link out of the document points.
URI string
// Page is the page a link inside the document goes to, and -1 otherwise.
Page int
// Point is where on that page it goes, in page space.
Point raster.Point
}
Link is a link annotation: the area it covers and where following it goes.
type ListDevice ¶
type ListDevice = gfx.ListDevice
ListDevice records what a page draws so that it can be drawn again.
type Metadata ¶
type Metadata struct {
Title string
Author string
Subject string
Keywords string
Creator string
Producer string
// Created and Modified are zero when the file gives no date.
Created time.Time
Modified time.Time
}
Metadata is what the document says about itself, ISO 32000-1 14.3.3.
type Object ¶
Object is a PDF object: Bool, Integer, Real, String, Name, Array, Dict, Ref or *Stream. A nil Object is null.
type Options ¶
type Options struct {
// ColorSpace is what the page composites in and what the result holds.
// Nil means DeviceRGB. It must have one, three or four components.
ColorSpace *ColorSpace
// Alpha adds an alpha channel, and the page starts transparent, not white.
Alpha bool
// PixelLimit bounds the area a page may allocate, in pixels. Zero means
// DefaultPixelLimit, negative means no limit.
PixelLimit int
// Strict turns the first error recorded while interpreting the page into
// an error returned by Render. Without it a damaged page returns the part
// that worked, and the errors are on the Document.
Strict bool
// Flatness is how far a flattened curve may stray from the true one, in
// device pixels. Zero means the default.
Flatness float32
// Threads is how many goroutines rasterize one page. Zero and one mean
// the page is drawn as it is interpreted; more means it is interpreted
// once into a display list and then drawn into that many horizontal
// bands at the same time. Negative means one for every processor.
//
// It is worth setting only for a page big enough that drawing it costs
// more than reading it. Rendering several pages at once, a goroutine
// each, scales better and needs nothing set here.
//
// A band clips what crosses its edge, and the crossing point rounds to
// the rasterizer's 1/256 of a pixel, so a banded page may differ from
// the same page drawn whole by one coverage unit along such an edge.
Threads int
}
Options control rendering. A nil *Options means the defaults: DeviceRGB, no alpha channel, and a page composited onto white.
type Outline ¶
type Outline struct {
Title string
// Page is the page the entry leads to, -1 otherwise, and Point where on it.
Page int
Point raster.Point
// URI is where an entry leading out of the document points.
URI string
// Open is whether the file asks for the entry to start expanded.
Open bool
// Children are the entries nested under this one.
Children []Outline
}
Outline is one entry of the document outline, ISO 32000-1 12.3.3.
type Page ¶
type Page struct {
// contains filtered or unexported fields
}
Page is one page of a document. Page is one page of a document, and is not safe for concurrent use: a goroutine that wants to render a page asks the Document for its own.
func (*Page) DeviceBounds ¶
DeviceBounds returns the page rectangle in device space at a resolution, which is where a raster of the page begins and ends.
func (*Page) Image ¶
Image renders the page at the resolution its own content is in. A page with no text whose largest image covers half of it is cropped to that image.
func (*Page) ImageOptions ¶
ImageOptions renders the page at a resolution, returning the standard library image type that matches the options: *image.Gray, *image.RGBA, *image.CMYK, or *image.RGBA for anything with an alpha channel.
func (*Page) Matrix ¶
Matrix returns the transform from PDF user space to device space at a given resolution: the y axis flips, the page rotation is applied, and the visible box moves to the origin. The order is the one MuPDF uses, so that traces taken from either carry the same numbers.
func (*Page) Render ¶
Render draws the page into a new pixmap, with ctm mapping page space to device space. The pixmap covers the page bounds under ctm, rounded out, and records where that is in its X and Y.
A page that fails part way still returns what was drawn; the errors are on the Document unless Options.Strict asks for the first one back.
func (*Page) RenderTo ¶
RenderTo draws the page into a destination the caller owns, with ctm mapping page space to the destination's coordinates.
func (*Page) Run ¶
Run interprets the page into a device, with ctm mapping page space to device space. Both the contents and the annotation appearances are drawn.
func (*Page) RunAnnotations ¶
RunAnnotations draws the appearance streams of the page annotations. The widgets come last, after everything else on the page, which is the order MuPDF draws them in and the one a form on top of its own background needs.
func (*Page) RunContents ¶
RunContents interprets the page content stream only.
func (*Page) StructuredText ¶
StructuredText returns the page's text with the box every character, line and block occupies, in page space at 72 dots per inch.
func (*Page) StructuredTextOptions ¶
func (p *Page) StructuredTextOptions(o *TextOptions) (*TextPage, error)
StructuredTextOptions is StructuredText with options.
type Shade ¶
type Shade struct {
Type int // 1 function, 2 axial, 3 radial, 4-7 mesh
CS *ColorSpace
// Matrix is the pattern matrix when the shading came from a pattern, and
// the identity when it came from sh.
Matrix raster.Matrix
// BBox is the shading's bounding box in its own space, empty for none.
BBox raster.Rect
Background []float64
Coords []float64
Domain []float64
Extend [2]bool
Function []*Function
// FuncMatrix, XDivs and YDivs describe a type 1 shading, whose function
// is sampled over a rectangle of its own space.
FuncMatrix raster.Matrix
XDivs, YDivs int
// contains filtered or unexported fields
}
Shade is a shading dictionary: the sh operator paints one directly, and a shading pattern paints one through a path.
func (*Shade) ColorSpace ¶
func (s *Shade) ColorSpace() *ColorSpace
ColorSpace returns the space the shading's colors are in.
func (*Shade) Coord6 ¶
Coord6 returns the /Coords of an axial or radial shading, padded to the six numbers those two types use.
type TextOptions ¶
type TextOptions = gfx.TextOptions
TextOptions configure what StructuredTextOptions collects.
type TraceDevice ¶
type TraceDevice struct {
BaseDevice
// contains filtered or unexported fields
}
TraceDevice writes every device call as XML, in the format mutool trace produces, so that the two can be compared without a rasterizer in the way.
func NewTraceDevice ¶
func NewTraceDevice(w io.Writer) *TraceDevice
NewTraceDevice returns a device that writes to w.
func (*TraceDevice) BeginGroup ¶
func (d *TraceDevice) BeginGroup(area raster.Rect, cs *ColorSpace, isolated, knockout bool, blend BlendMode, alpha float32)
BeginGroup implements Device.
func (*TraceDevice) BeginLayer ¶
func (d *TraceDevice) BeginLayer(name string)
BeginLayer implements Device.
func (*TraceDevice) BeginMask ¶
func (d *TraceDevice) BeginMask(area raster.Rect, luminosity bool, cs *ColorSpace, backdrop []float32, cp ColorParams)
BeginMask implements Device.
func (*TraceDevice) BeginTile ¶
func (d *TraceDevice) BeginTile(area, view raster.Rect, xstep, ystep float32, ctm raster.Matrix) int
BeginTile implements Device.
func (*TraceDevice) ClipImageMask ¶
ClipImageMask implements Device.
func (*TraceDevice) ClipPath ¶
func (d *TraceDevice) ClipPath(p *raster.Path, evenOdd bool, ctm raster.Matrix, scissor raster.Rect)
ClipPath implements Device.
func (*TraceDevice) ClipStrokePath ¶
func (d *TraceDevice) ClipStrokePath(p *raster.Path, s *raster.Stroke, ctm raster.Matrix, scissor raster.Rect)
ClipStrokePath implements Device.
func (*TraceDevice) ClipStrokeText ¶
func (d *TraceDevice) ClipStrokeText(t *Text, s *raster.Stroke, ctm raster.Matrix, scissor raster.Rect)
ClipStrokeText implements Device.
func (*TraceDevice) EndMask ¶
func (d *TraceDevice) EndMask(transfer *[256]uint8)
EndMask implements Device.
func (*TraceDevice) FillImage ¶
func (d *TraceDevice) FillImage(img gfx.Image, ctm raster.Matrix, alpha float32, cp ColorParams)
FillImage implements Device.
func (*TraceDevice) FillImageMask ¶
func (d *TraceDevice) FillImageMask(img gfx.Image, ctm raster.Matrix, cs *ColorSpace, c []float32, alpha float32, cp ColorParams)
FillImageMask implements Device.
func (*TraceDevice) FillPath ¶
func (d *TraceDevice) FillPath(p *raster.Path, evenOdd bool, ctm raster.Matrix, cs *ColorSpace, c []float32, alpha float32, cp ColorParams)
FillPath implements Device.
func (*TraceDevice) FillShade ¶
func (d *TraceDevice) FillShade(shade gfx.Shade, ctm raster.Matrix, alpha float32, cp ColorParams)
FillShade implements Device.
func (*TraceDevice) FillText ¶
func (d *TraceDevice) FillText(t *Text, ctm raster.Matrix, cs *ColorSpace, c []float32, alpha float32, cp ColorParams)
FillText implements Device.
func (*TraceDevice) IgnoreText ¶
func (d *TraceDevice) IgnoreText(t *Text, ctm raster.Matrix)
IgnoreText implements Device.
func (*TraceDevice) SetDefaultColorSpaces ¶
func (d *TraceDevice) SetDefaultColorSpaces(cs *DefaultColorSpaces)
SetDefaultColorSpaces implements Device.
func (*TraceDevice) StrokePath ¶
func (d *TraceDevice) StrokePath(p *raster.Path, s *raster.Stroke, ctm raster.Matrix, cs *ColorSpace, c []float32, alpha float32, cp ColorParams)
StrokePath implements Device.
func (*TraceDevice) StrokeText ¶
func (d *TraceDevice) StrokeText(t *Text, s *raster.Stroke, ctm raster.Matrix, cs *ColorSpace, c []float32, alpha float32, cp ColorParams)
StrokeText implements Device.