Documentation ¶
Overview ¶
Package vgpdf implements the vg.Canvas interface using pdfwriter. Unlike the PDF driver supplied by gonum.org/v1/plot/vg, which only supports creating a PDF with a single plot, this driver supports creating multiple plots in the PDF. These plots can either be on individual pages, or interspersed with text and other elements.
Index ¶
- type Canvas
- func (c *Canvas) DrawImage(rect vg.Rectangle, img image.Image)
- func (c *Canvas) Fill(p vg.Path)
- func (c *Canvas) FillString(fnt vg.Font, pt vg.Point, str string)
- func (c *Canvas) Pop()
- func (c *Canvas) Push()
- func (c *Canvas) Rotate(r float64)
- func (c *Canvas) Scale(x float64, y float64)
- func (c *Canvas) SetColor(clr color.Color)
- func (c *Canvas) SetLineDash(dashes []vg.Length, offs vg.Length)
- func (c *Canvas) SetLineWidth(w vg.Length)
- func (c *Canvas) Size() (w, h vg.Length)
- func (c *Canvas) Stroke(p vg.Path)
- func (c *Canvas) Translate(pt vg.Point)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
Canvas represents a page, or a section of a page, used for drawing 2D graphics, and which supports the interface gonum.org/v1/plot/vg.Canvas. Using this type, users can create plots using gonum.org/v1/plot, and output those plots into a PDF document.
func New ¶
func New(doc *pdf.PDF, pos pdf.Point, size pdf.Size) *Canvas
New creates a new canvas where drawing operations will occur in a specified region of the current page. The graphics state will be modified, so users will need to manage their graphics state using Push, Pop, or WithState, if they want to resume drawing after plotting.
func NewPage ¶
func NewPage(doc *pdf.PDF, size pdf.Size) *Canvas
NewPage creates a new canvas where drawing operations will occur on a new page in the PDF document.
func (*Canvas) FillString ¶
FillString supports the interface gonum.org/v1/plot/vg.Canvas.
func (*Canvas) Push ¶
func (c *Canvas) Push()
Push supports the interface gonum.org/v1/plot/vg.Canvas.
func (*Canvas) SetLineDash ¶
SetLineDash supports the interface gonum.org/v1/plot/vg.Canvas.
func (*Canvas) SetLineWidth ¶
SetLineWidth supports the interface gonum.org/v1/plot/vg.Canvas.
func (*Canvas) Size ¶
Size returns the size of the canvas. This method supports the interface gonum.org/v1/plot/vg.CanvaSizer.