lines

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: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// MaxWidth is the display width of the reMArkable tablet.
	MaxWidth = 1404
	// MaxHeight is the display height of the reMArkable tablet.
	MaxHeight = 1872
)

Variables

This section is empty.

Functions

func WriteDrawing

func WriteDrawing(w io.Writer, d *Drawing) error

WriteDrawing writes the given drawing to the given writer.

Types

type BrushColor

type BrushColor uint32

BrushColor defines the color of the brush (black, gray, white).

const (
	Black BrushColor = 0
	Gray  BrushColor = 1
	White BrushColor = 2
)

type BrushSize

type BrushSize float32

BrushSize represents the base brush sizes.

const (
	Small  BrushSize = 1.875
	Medium BrushSize = 2.0
	Large  BrushSize = 2.125
)

These are the three sizes available in the UI. Other values are possible, e.g. through scaling.

type BrushType

type BrushType uint32

BrushType is one of the predefined brush types. The brush types are different between V3 and V5 of the rm format.

const (
	PaintBrush         BrushType = 0
	Pencil             BrushType = 1
	Ballpoint          BrushType = 2
	Marker             BrushType = 3
	Fineliner          BrushType = 4
	Highlighter        BrushType = 5
	Eraser             BrushType = 6
	MechanicalPencil   BrushType = 7
	EraseArea          BrushType = 8
	PaintBrushV5       BrushType = 12
	MechanicalPencilV5 BrushType = 13
	PencilV5           BrushType = 14
	BallpointV5        BrushType = 15
	MarkerV5           BrushType = 16
	FinelinerV5        BrushType = 17
	HighlighterV5      BrushType = 18
	CalligraphyV5      BrushType = 21
)

type Dot

type Dot struct {
	// X is the x-coordinate for this dot.
	X float32
	// Y is the -ycoordinate for this dot.
	Y float32
	// Speed is the speed with which the stylus moved across the screen.
	Speed float32
	// Tilt is the angle at which the stylus is positioned against
	// the screen. The angle is given in radians.
	Tilt float32
	// Width is the effective width of the brush.
	Width float32
	// Pressure is the amount of pressure applied to the stylus.
	// Value range is 0.0 trough 1.0
	Pressure float32
}

Dot is a single point from a stroke.

func (*Dot) Validate

func (d *Dot) Validate() error

Validate checks a dot for valid data. Returns an error if invalid data is found, nil if everything is fine.

type Drawing

type Drawing struct {
	Version Version
	Layers  []Layer
}

Drawing represents a single page with drawings.

func NewDrawing

func NewDrawing() *Drawing

NewDrawing creates an empty drawing.

func ReadDrawing

func ReadDrawing(r io.Reader) (*Drawing, error)

ReadDrawing creates a new reMarkable drawing from the given reader.

func (*Drawing) AddLayer

func (d *Drawing) AddLayer(name string)

AddLayer adds a new layer with the given name.

func (*Drawing) MarshalBinary

func (d *Drawing) MarshalBinary() ([]byte, error)

MarshalBinary returns the byte representation of the drawing.

func (*Drawing) NumLayers

func (d *Drawing) NumLayers() int

NumLayers returns the number of layers in the drawing.

func (*Drawing) UnmarshalBinary

func (d *Drawing) UnmarshalBinary(data []byte) error

UnmarshalBinary reads a reMarkable drawing from the given bytes.

func (*Drawing) Validate

func (d *Drawing) Validate() error

Validate checks this drawing and all layers, strokes and dots for valid data. Returns an error if invalid data is found, nil if everything is fine.

type Layer

type Layer struct {
	Strokes []Stroke
}

Layer is one layer in a drawing.

func (*Layer) Validate

func (l *Layer) Validate() error

Validate checks a layer and all associated strokes and dots for valid data. Returns an error if invalid data is found, nil if everything is fine.

type Stroke

type Stroke struct {
	// BrushType is one of the predefined pencil types, e.g. "Ballpoint" or "PaintBrush"
	BrushType BrushType
	// BrushColor is one of the three available colors.
	BrushColor BrushColor
	// Padding - we do not know what this means and it seems to be "0" all the time.
	Padding uint32
	// BrushSize is the base size of the Brush (small, medium, large)
	BrushSize BrushSize
	// Unknown is ...well: unkown.
	Unknown float32
	// Dots are the coordionate points that make up this stroke.
	Dots []Dot
}

Stroke is a single continous brush stroke.

func (*Stroke) Validate

func (s *Stroke) Validate() error

Validate checks a stroke and the associated dots for valid data. Returns an error if invalid data is found, nil if everything is fine.

type Version

type Version int

Version defines the version number of a remarkable note.

const (
	V3 Version = iota
	V5
)

Jump to

Keyboard shortcuts

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