renderers

package
v0.0.0-...-d5a04e3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 26 Imported by: 45

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BMP

func BMP(opts ...interface{}) canvas.Writer

func EPS

func EPS(opts ...interface{}) canvas.Writer

func GIF

func GIF(opts ...interface{}) canvas.Writer

func JPEG

func JPEG(opts ...interface{}) canvas.Writer

func NewGoChart

func NewGoChart(writer canvas.Writer) func(int, int) (chart.Renderer, error)

NewGoChart returns a new github.com/wcharczuk/go-chart renderer.

func NewGonumPlot

func NewGonumPlot(r canvas.Renderer) draw.Canvas

NewGonumPlot returns a new github.com/gonum/plot/vg renderer.

func PDF

func PDF(opts ...interface{}) canvas.Writer

func PNG

func PNG(opts ...interface{}) canvas.Writer

func PS

func PS(opts ...interface{}) canvas.Writer

func SVG

func SVG(opts ...interface{}) canvas.Writer

func SVGZ

func SVGZ(opts ...interface{}) canvas.Writer

func TIFF

func TIFF(opts ...interface{}) canvas.Writer

func TeX

func TeX(opts ...interface{}) canvas.Writer

func Write

func Write(filename string, c *canvas.Canvas, opts ...interface{}) error

Types

type GoChart

type GoChart struct {
	// contains filtered or unexported fields
}

GoChart is a github.com/wcharczuk/go-chart renderer.

func (*GoChart) ArcTo

func (r *GoChart) ArcTo(cx, cy int, rx, ry, startAngle, delta float64)

ArcTo draws an arc with a given center (cx,cy) a given set of radii (rx,ry), a startAngle and delta (in radians).

func (*GoChart) Circle

func (r *GoChart) Circle(radius float64, x, y int)

Circle draws a circle at the given coords with a given radius.

func (*GoChart) ClearTextRotation

func (r *GoChart) ClearTextRotation()

ClearTextRotation clears rotation.

func (*GoChart) Close

func (r *GoChart) Close()

Close finalizes a shape as drawn by LineTo.

func (*GoChart) Fill

func (r *GoChart) Fill()

Fill fills the path, but does not stroke.

func (*GoChart) FillStroke

func (r *GoChart) FillStroke()

FillStroke fills and strokes a path.

func (*GoChart) GetDPI

func (r *GoChart) GetDPI() float64

GetDPI gets the DPI for the renderer.

func (*GoChart) LineTo

func (r *GoChart) LineTo(x, y int)

LineTo both starts a shape and draws a line to a given point from the previous point.

func (*GoChart) MeasureText

func (r *GoChart) MeasureText(body string) chart.Box

MeasureText measures text.

func (*GoChart) MoveTo

func (r *GoChart) MoveTo(x, y int)

MoveTo moves the cursor to a given point.

func (*GoChart) QuadCurveTo

func (r *GoChart) QuadCurveTo(cx, cy, x, y int)

QuadCurveTo draws a quad curve. cx and cy represent the Bézier control points.

func (*GoChart) ResetStyle

func (r *GoChart) ResetStyle()

ResetStyle resets any style related settings of the renderer.

func (*GoChart) Save

func (r *GoChart) Save(w io.Writer) error

Save writes the image to the given writer.

func (*GoChart) SetClassName

func (r *GoChart) SetClassName(name string)

SetClassName sets the current class name.

func (*GoChart) SetDPI

func (r *GoChart) SetDPI(dpi float64)

SetDPI sets the DPI for the renderer.

func (*GoChart) SetFillColor

func (r *GoChart) SetFillColor(col drawing.Color)

SetFillColor sets the current fill color.

func (*GoChart) SetFont

func (r *GoChart) SetFont(f *truetype.Font)

SetFont sets a font for a text field.

func (*GoChart) SetFontColor

func (r *GoChart) SetFontColor(col drawing.Color)

SetFontColor sets a font's color.

func (*GoChart) SetFontSize

func (r *GoChart) SetFontSize(size float64)

SetFontSize sets the font size for a text field.

func (*GoChart) SetStrokeColor

func (r *GoChart) SetStrokeColor(col drawing.Color)

SetStrokeColor sets the current stroke color.

func (*GoChart) SetStrokeDashArray

func (r *GoChart) SetStrokeDashArray(dashArray []float64)

SetStrokeDashArray sets the stroke dash array.

func (*GoChart) SetStrokeWidth

func (r *GoChart) SetStrokeWidth(width float64)

SetStrokeWidth sets the stroke width.

func (*GoChart) SetTextRotation

func (r *GoChart) SetTextRotation(radian float64)

SetTextRotation sets a rotation for drawing elements.

func (*GoChart) Stroke

func (r *GoChart) Stroke()

Stroke strokes the path.

func (*GoChart) Text

func (r *GoChart) Text(body string, x, y int)

Text draws a text blob.

type GonumPlot

type GonumPlot struct {
	// contains filtered or unexported fields
}

GonumPlot is a github.com/gonum/plot/vg renderer.

func (*GonumPlot) DrawImage

func (r *GonumPlot) DrawImage(rect vg.Rectangle, img image.Image)

DrawImage draws the image, scaled to fit the destination rectangle.

func (*GonumPlot) Fill

func (r *GonumPlot) Fill(path vg.Path)

Fill fills the given path.

func (*GonumPlot) FillString

func (r *GonumPlot) FillString(f gonumFont.Face, pt vg.Point, text string)

FillString fills in text at the specified location using the given font. If the font size is zero, the text is not drawn.

func (*GonumPlot) Pop

func (r *GonumPlot) Pop()

Pop restores the context saved by the corresponding call to Push().

func (*GonumPlot) Push

func (r *GonumPlot) Push()

Push saves the current line width, the current dash pattern, the current transforms, and the current color onto a stack so that the state can later be restored by calling Pop().

func (*GonumPlot) Rotate

func (r *GonumPlot) Rotate(rad float64)

Rotate applies a rotation transform to the context. The parameter is specified in radians.

func (*GonumPlot) Scale

func (r *GonumPlot) Scale(x, y float64)

Scale applies a scaling transform to the context

func (*GonumPlot) SetColor

func (r *GonumPlot) SetColor(col color.Color)

SetColor sets the current drawing color. Note that fill color and stroke color are the same, so if you want different fill and stroke colors then you must set a color, draw fills, set a new color and then draw lines.

The initial color is black. If SetColor is called with a nil color then black is used.

func (*GonumPlot) SetLineDash

func (r *GonumPlot) SetLineDash(pattern []vg.Length, offset vg.Length)

SetLineDash sets the dash pattern for lines. The pattern slice specifies the lengths of alternating dashes and gaps, and the offset specifies the distance into the dash pattern to start the dash.

The initial dash pattern is a solid line.

func (*GonumPlot) SetLineWidth

func (r *GonumPlot) SetLineWidth(length vg.Length)

SetLineWidth sets the width of stroked paths. If the width is not positive then stroked lines are not drawn.

The initial line width is 1 point.

func (*GonumPlot) Size

func (r *GonumPlot) Size() (vg.Length, vg.Length)

Size returns the width and height of the canvas.

func (*GonumPlot) Stroke

func (r *GonumPlot) Stroke(path vg.Path)

Stroke strokes the given path.

func (*GonumPlot) Translate

func (r *GonumPlot) Translate(pt vg.Point)

Translate applies a translational transform to the context.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL