rasterizer

package
v0.0.0-...-c077e1a Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BMPWriter

func BMPWriter(resolution canvas.Resolution) canvas.Writer

BMPWriter writes the canvas as a BMP file. DEPRECATED

func Draw

func Draw(c *canvas.Canvas, resolution canvas.Resolution, colorSpace canvas.ColorSpace) *image.RGBA

Draw draws the canvas on a new image with given resolution (in dots-per-millimeter). Higher resolution will result in larger images.

func GIFWriter

func GIFWriter(resolution canvas.Resolution, opts *gif.Options) canvas.Writer

GIFWriter writes the canvas as a GIF file. DEPRECATED

func JPGWriter

func JPGWriter(resolution canvas.Resolution, opts *jpeg.Options) canvas.Writer

JPGWriter writes the canvas as a JPG file. DEPRECATED

func PNGWriter

func PNGWriter(resolution canvas.Resolution) canvas.Writer

PNGWriter writes the canvas as a PNG file. DEPRECATED

func TIFFWriter

func TIFFWriter(resolution canvas.Resolution, opts *tiff.Options) canvas.Writer

TIFFWriter writes the canvas as a TIFF file. DEPRECATED

Types

type Rasterizer

type Rasterizer struct {
	draw.Image

	ColorSpace canvas.ColorSpace
	// contains filtered or unexported fields
}

Rasterizer is a rasterizing renderer.

func FromImage

func FromImage(img draw.Image, resolution canvas.Resolution, colorSpace canvas.ColorSpace) *Rasterizer

FromImage returns a renderer that draws to an existing image.

func New

func New(width, height float64, resolution canvas.Resolution, colorSpace canvas.ColorSpace) *Rasterizer

New returns a renderer that draws to a rasterized image. By default the linear color space is used, which assumes input and output colors are in linearRGB. If the sRGB color space is used for drawing with an average of gamma=2.2, the input and output colors are assumed to be in sRGB and blending happens in linearRGB. Be aware that for text this results in thin stems for black-on-white (but wide stems for white-on-black).

func (*Rasterizer) Close

func (r *Rasterizer) Close()

func (*Rasterizer) RenderImage

func (r *Rasterizer) RenderImage(img image.Image, m canvas.Matrix)

RenderImage renders an image to the canvas using a transformation matrix.

func (*Rasterizer) RenderPath

func (r *Rasterizer) RenderPath(path *canvas.Path, style canvas.Style, m canvas.Matrix)

RenderPath renders a path to the canvas using a style and a transformation matrix.

func (*Rasterizer) RenderText

func (r *Rasterizer) RenderText(text *canvas.Text, m canvas.Matrix)

RenderText renders a text object to the canvas using a transformation matrix.

func (*Rasterizer) Size

func (r *Rasterizer) Size() (float64, float64)

Size returns the size of the canvas in millimeters.

Jump to

Keyboard shortcuts

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