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)
- func RegisterRowDecoder(filter Name, dec RowDecoder)
- 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) PixelRows(dst *ColorSpace, shrink int) (*gfx.PixelRows, bool)
- 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 ImageRows
- 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) ImageBands(dpi float64, rows int, fn func(*image.RGBA) error) 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) NaturalDPI() float64
- func (p *Page) Number() int
- func (p *Page) Render(ctm raster.Matrix, o *Options) (*raster.Pixmap, error)
- func (p *Page) RenderBands(ctm raster.Matrix, o *Options, rows int, fn func(*raster.Pixmap) error) 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 RowDecoder
- 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 the default bound, in operands, of a document's parsed content cache.
const DefaultImageCacheBytes = 1 << 26
DefaultImageCacheBytes is the default size of a document's decoded image cache.
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.
func RegisterRowDecoder ¶ added in v0.3.0
func RegisterRowDecoder(filter Name, dec RowDecoder)
RegisterRowDecoder installs a row decoder for an image filter, taking precedence over a whole one. Only DCTDecode is read through it: an image is then decoded a band of rows at a time, whole or in bands.
pdf.RegisterRowDecoder("DCTDecode", func(b []byte, _ pdf.Dict) (pdf.ImageRows, error) {
r, err := jpegn.NewRowReader(b)
if err != nil {
return nil, err
}
return r, nil
})
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, or for a ToUnicode CMap to text, ISO 32000-1 9.7.5.
type Char ¶
type Char struct {
Code uint32
CID uint32
Bytes int
// Width is the glyph advance in text space units of the font size.
Width float32
// Space is true for a single byte code 32.
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, ImageCacheBytes and ContentCacheOps bound the document's
// caches; zero is the default, negative is no cache.
GlyphCacheBytes int
ImageCacheBytes int
ContentCacheOps int
// contains filtered or unexported fields
}
Document is an open PDF file, safe to render from several goroutines at once.
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, all of it into memory.
func NewStreamPassword ¶ added in v0.2.0
NewStreamPassword is NewStream for an encrypted document.
func OpenPassword ¶
OpenPassword reads the named file, decrypting with password.
func (*Document) Layers ¶
Layers returns the document's optional content groups in catalog order and whether each is on.
func (*Document) PageLabels ¶
PageLabels returns the label of each page, ISO 32000-1 12.4.2, or nil for none.
func (*Document) SetLayers ¶
SetLayers turns optional content groups on and off by the On field of each layer.
func (*Document) SetSystemFonts ¶
SetSystemFonts chooses whether a font the file does not embed may be substituted with a system font.
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, read for turning a string into positioned glyphs.
func (*Font) EmBox ¶
EmBox returns the reach of the font's em box above and below the baseline, in text space.
func (*Font) GlyphFace ¶
GlyphFace resolves a character to the glyph that draws it and the face it comes from, preferring cur, the face the run is already in.
func (*Font) GlyphNameOf ¶
GlyphNameOf returns the font program's name for the glyph a character selects.
func (*Font) RunFace ¶
RunFace returns the fallback face a whole shown string is drawn from, or nil.
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.
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) NumOutputs ¶
NumOutputs returns how many values Eval returns, or zero when only the definition says.
type Image ¶
type Image struct {
Width, Height int
BPC int
CS *ColorSpace
// Mask is true for a stencil mask.
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, decoded on demand.
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 /SMask or stencil /Mask image that supplies this one's transparency.
func (*Image) PixelRows ¶ added in v0.3.0
PixelRows implements gfx.RowImage: the pixmap Pixels builds, handed out a row at a time, for an image with no mask or color key whose samples source can read.
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 ImageRows ¶ added in v0.3.0
type ImageRows interface {
Width() int
Height() int
ColorModel() stdcolor.Model
Next() ([]byte, int, error)
Close()
}
ImageRows hands out the rows of a decoded image a band at a time, top first, RowBytes apart: Gray, RGBA or CMYK, as jpegn's RowReader does.
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 the document information, 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 the target of an entry leading out of the document.
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, not safe for concurrent use.
func (*Page) DeviceBounds ¶
DeviceBounds returns the page rectangle in device space at a resolution.
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) ImageBands ¶ added in v0.3.0
ImageBands renders the page as ImageDPI does, rows at a time, and hands each band to fn in order from the top. A band's Rect is its place in the image ImageDPI returns, valid only until fn returns, and a dpi of zero or less is the resolution and the crop of Image. The pixel limit bounds a band, not the page. An error from fn stops the render and is returned.
func (*Page) ImageOptions ¶
ImageOptions renders the page at a resolution into the standard library image type that matches the options.
func (*Page) Matrix ¶
Matrix returns the transform from PDF user space to device space at a given resolution, with the y axis flipped, the rotation applied and the box at the origin.
func (*Page) NaturalDPI ¶ added in v0.2.8
NaturalDPI is the resolution Image renders the page at.
func (*Page) Render ¶
Render draws the page into a new pixmap covering the page bounds under ctm, with ctm mapping page space to device space.
func (*Page) RenderBands ¶ added in v0.3.0
func (p *Page) RenderBands(ctm raster.Matrix, o *Options, rows int, fn func(*raster.Pixmap) error) error
RenderBands draws the page as Render does, rows at a time, and hands each band to fn in order from the top: a pixmap whose X and Y are its place in device space, valid only until fn returns. The pixel limit bounds a band, not the page, and rows of zero or less is as many as it allows. An error from fn stops the render and is returned.
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 contents and annotation appearances into a device, with ctm mapping page space to device space.
func (*Page) RunAnnotations ¶
RunAnnotations draws the appearance streams of the page annotations, widgets last as MuPDF does.
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 RowDecoder ¶ added in v0.3.0
RowDecoder starts decoding the data of an image filter a band of rows at a time.
type Shade ¶
type Shade struct {
Type int // 1 function, 2 axial, 3 radial, 4-7 mesh
CS *ColorSpace
// Matrix is the pattern matrix, the identity for 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.
FuncMatrix raster.Matrix
XDivs, YDivs int
// contains filtered or unexported fields
}
Shade is a shading dictionary, painted by the sh operator or a shading pattern.
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 six numbers.
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.