rmparse

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Header = "reMarkable .lines file, version=6         "

Header is an rm file header

Functions

This section is empty.

Types

type HeaderLayers

type HeaderLayers struct {
	Header [43]byte
	Layers uint32
}

HeaderLayers is the header and number of layers format <{}sI

func HeaderParse

func HeaderParse(f fs.File) (HeaderLayers, error)

HeaderParse starts parsing an .rm file, returning the header and number of layers

type MaxCoordinates

type MaxCoordinates struct {
	X float32
	Y float32
}

MaxCoordinates stores the maximum and minimum path segments

type Path

type Path struct {
	Pen    uint32
	Colour uint32

	Width float32

	NumSegments uint32
	// contains filtered or unexported fields
}

Path describes a path format <IIIfII

func ParsePath

func ParsePath(f fs.File) (Path, error)

ParsePath returns the path for each path in the layer.paths

type Paths

type Paths struct {
	Number uint32
}

Paths is the number of paths in this layer format <I

func ParseLayers

func ParseLayers(f fs.File) (Paths, error)

ParseLayers returns the number of paths for each layer in the .rm file

type RMFile

type RMFile struct {
	File           fs.File
	Header         [43]byte
	LayerNo        uint32
	ThisLayer      uint32
	PathNo         uint32
	ThisPath       uint32
	Path           RMPath
	MaxCoordinates MaxCoordinates
	Verbose        bool
}

RMFile is the reMarkable .rm file File parser metadata base structure

func RMParse

func RMParse(f fs.File) (*RMFile, error)

RMParse instantiates a parser by registering a file to parse and initialising the header, layer count and related counters. Continue parsing using the "Parse()" iterator-type function.

func (*RMFile) Parse

func (rm *RMFile) Parse() bool

Parse an .rm file, returning an RMPath data structure until depleted. The Parse() function collects all the segments in a path and collects it in an RMFile.Path struct, stored in RMFile.Path. The Parse function is based loosely on bufio.Scan() so it may be called using "for" as follows:

rm := rmparse.RMParse(filename)
for rm.Parse() {
    path = rm.Path
}

Catching io.ErrUnexpectedEOF errors is necessary because it is possible to have corrupt .rm files which, for example, report layers but do not have any content.

type RMPath

type RMPath struct {
	Layer    uint32
	Path     Path
	Segments []Segment
}

RMPath is the reMarkable parsed data structure, returned by Parse()

type Segment

type Segment struct {
	X        float32
	Y        float32
	Pressure float32
	Tilt     float32
	// contains filtered or unexported fields
}

Segment describes a path segment format <ffffff

func ParseSegment

func ParseSegment(f fs.File) (Segment, error)

ParseSegment returns the segment for each segment in a path

Jump to

Keyboard shortcuts

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