render

package
v0.0.0-...-18a76ad Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2021 License: MIT Imports: 23 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Page

func Page(doc *rmtool.Document, pageID string, w io.Writer) error

Page renders the page from the given document and writes the result to the given writer.

Unlike RenderDrawing, this includes the page's background template.

func Pdf

func Pdf(d *rmtool.Document, w io.Writer) error

Pdf renders all pages of the given document to a PDF file.

The result is written to the given writer.

func PdfPage

func PdfPage(c *Context, d *rmtool.Document, pageID string, w io.Writer) error

PdfPage renders a single drawing into a single one-page PDF.

Types

type Ballpoint

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

The Ballpoint pen has some sensitivity for pressure

func (*Ballpoint) RenderStroke

func (b *Ballpoint) RenderStroke(dst draw.Image, s lines.Stroke)

type BasePen

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

func (*BasePen) RenderStroke

func (b *BasePen) RenderStroke(dst draw.Image, s lines.Stroke)

type Brush

type Brush interface {
	RenderStroke(dst draw.Image, s lines.Stroke)
}

type Context

type Context struct {
	DataDir string
	// contains filtered or unexported fields
}

Context holds parameters and cached data for rendering operations.

If multiple drawings are rendered, they should use the same Context.

func DefaultContext

func DefaultContext() *Context

DefaultContext creates a new rendering context with default settings.

func NewContext

func NewContext(dataDir string, p *Palette) *Context

NewContext sets up a new rendering context.

dataDir should point to a directory with a spritesheet for the brushes and a subdirectory 'templates' with page backgrounds.

func (*Context) Page

func (c *Context) Page(doc *rmtool.Document, pageID string, w io.Writer) error

Page draws a single page to a PNG and writes it to the given writer.

func (*Context) Pdf

func (c *Context) Pdf(doc *rmtool.Document, w io.Writer) error

Pdf renders all pages from a document to a PDF file.

The resulting PDF document is written to the given writer.

type Fineliner

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

Fineliner has no sensitivity to pressure or tilt.

func (*Fineliner) RenderStroke

func (f *Fineliner) RenderStroke(dst draw.Image, s lines.Stroke)

type Highlighter

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

func (*Highlighter) RenderStroke

func (h *Highlighter) RenderStroke(dst draw.Image, s lines.Stroke)

type Marker

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

func (*Marker) RenderStroke

func (m *Marker) RenderStroke(dst draw.Image, s lines.Stroke)

type MechanicalPencil

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

func (*MechanicalPencil) RenderStroke

func (m *MechanicalPencil) RenderStroke(dst draw.Image, s lines.Stroke)

type Paintbrush

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

func (*Paintbrush) RenderStroke

func (p *Paintbrush) RenderStroke(dst draw.Image, s lines.Stroke)

type Palette

type Palette struct {
	Background  color.Color
	Highlighter color.Color
	// contains filtered or unexported fields
}

Palette holds the colors used for rendering.

You can use a palette to map from the default colors of the reMarkable tablet (black, gray, white) ro another color scheme.

func NewPalette

func NewPalette(bg color.Color, highlighter color.Color, brushColors map[lines.BrushColor]color.Color) *Palette

NewPalette creates a new palette with the given color scheme.

func (*Palette) Color

func (p *Palette) Color(bc lines.BrushColor) color.Color

Color is used by the renderer to retrieve the color value to use for a specific Brush Color.

type Pencil

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

func (*Pencil) RenderStroke

func (p *Pencil) RenderStroke(dst draw.Image, s lines.Stroke)

Jump to

Keyboard shortcuts

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