Documentation
¶
Index ¶
- Constants
- Variables
- func RenderRMToSVG(rmBytes []byte, opts ...SVGOption) (string, error)
- func RenderToSVG(blocks []Block, opts ...SVGOption) string
- func Scale(unit float64) float64
- func ValidateHeader(r io.Reader) error
- func ValidateHeaderBytes(data []byte) error
- type AuthorIdsBlock
- type Ballpoint
- func (p *Ballpoint) BaseColor() Color
- func (p *Ballpoint) BaseWidth() float64
- func (p *Ballpoint) Name() string
- func (p *Ballpoint) SegmentColor(speed, direction, width, pressure, lastWidth float64) string
- func (p *Ballpoint) SegmentLength() int
- func (p *Ballpoint) SegmentOpacity(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Ballpoint) SegmentWidth(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Ballpoint) StrokeLinecap() string
- type Block
- type Brush
- func (p *Brush) BaseColor() Color
- func (p *Brush) BaseWidth() float64
- func (p *Brush) Name() string
- func (p *Brush) SegmentColor(speed, direction, width, pressure, lastWidth float64) string
- func (p *Brush) SegmentLength() int
- func (p *Brush) SegmentOpacity(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Brush) SegmentWidth(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Brush) StrokeLinecap() string
- type Calligraphy
- func (p *Calligraphy) BaseColor() Color
- func (p *Calligraphy) BaseWidth() float64
- func (p *Calligraphy) Name() string
- func (p *Calligraphy) SegmentColor(speed, direction, width, pressure, lastWidth float64) string
- func (p *Calligraphy) SegmentLength() int
- func (p *Calligraphy) SegmentOpacity(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Calligraphy) SegmentWidth(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Calligraphy) StrokeLinecap() string
- type Color
- type CrdtId
- type DataStream
- func (s *DataStream) CheckTag(expectedIndex int, expectedType TagType) bool
- func (s *DataStream) ReadBool() (bool, error)
- func (s *DataStream) ReadBytes(n int) ([]byte, error)
- func (s *DataStream) ReadCrdtId() (CrdtId, error)
- func (s *DataStream) ReadFloat32() (float32, error)
- func (s *DataStream) ReadFloat64() (float64, error)
- func (s *DataStream) ReadId(index int) (CrdtId, error)
- func (s *DataStream) ReadLwwBool(index int) (LwwValue[bool], error)
- func (s *DataStream) ReadLwwByte(index int) (LwwValue[uint8], error)
- func (s *DataStream) ReadLwwFloat(index int) (LwwValue[float32], error)
- func (s *DataStream) ReadLwwId(index int) (LwwValue[CrdtId], error)
- func (s *DataStream) ReadLwwString(index int) (LwwValue[string], error)
- func (s *DataStream) ReadString(index int) (string, error)
- func (s *DataStream) ReadTag(expectedIndex int, expectedType TagType) (int, TagType, error)
- func (s *DataStream) ReadTagValues() (int, TagType, error)
- func (s *DataStream) ReadTaggedBool(index int) (bool, error)
- func (s *DataStream) ReadTaggedByte(index int) (uint8, error)
- func (s *DataStream) ReadTaggedDouble(index int) (float64, error)
- func (s *DataStream) ReadTaggedFloat(index int) (float32, error)
- func (s *DataStream) ReadTaggedInt(index int) (uint32, error)
- func (s *DataStream) ReadUint8() (uint8, error)
- func (s *DataStream) ReadUint16() (uint16, error)
- func (s *DataStream) ReadUint32() (uint32, error)
- func (s *DataStream) ReadVarUint() (uint64, error)
- func (s *DataStream) Seek(offset int64, whence int) (int64, error)
- func (s *DataStream) Tell() int64
- type DataWriter
- func (w *DataWriter) WriteBlock(blockType, minVersion, currentVersion uint8, ...) error
- func (w *DataWriter) WriteBool(v bool) error
- func (w *DataWriter) WriteBytes(b []byte) error
- func (w *DataWriter) WriteCrdtId(id CrdtId) error
- func (w *DataWriter) WriteFloat32(v float32) error
- func (w *DataWriter) WriteFloat64(v float64) error
- func (w *DataWriter) WriteHeader() error
- func (w *DataWriter) WriteId(index int, id CrdtId) error
- func (w *DataWriter) WriteLine(line *Line, version uint8) error
- func (w *DataWriter) WriteLwwBool(index int, ts CrdtId, val bool) error
- func (w *DataWriter) WriteLwwByte(index int, ts CrdtId, val uint8) error
- func (w *DataWriter) WriteLwwFloat(index int, ts CrdtId, val float32) error
- func (w *DataWriter) WriteLwwId(index int, ts CrdtId, val CrdtId) error
- func (w *DataWriter) WriteLwwString(index int, ts CrdtId, val string) error
- func (w *DataWriter) WritePoint(p Point, version uint8) error
- func (w *DataWriter) WriteSceneLineItemBlock(block *SceneLineItemBlock, version uint8) error
- func (w *DataWriter) WriteString(index int, s string) error
- func (w *DataWriter) WriteSubblock(index int, writeFn func(sw *DataWriter) error) error
- func (w *DataWriter) WriteTag(index int, tagType TagType) error
- func (w *DataWriter) WriteTaggedBool(index int, v bool) error
- func (w *DataWriter) WriteTaggedByte(index int, v uint8) error
- func (w *DataWriter) WriteTaggedDouble(index int, v float64) error
- func (w *DataWriter) WriteTaggedFloat(index int, v float32) error
- func (w *DataWriter) WriteTaggedInt(index int, v uint32) error
- func (w *DataWriter) WriteUint8(v uint8) error
- func (w *DataWriter) WriteUint16(v uint16) error
- func (w *DataWriter) WriteUint32(v uint32) error
- func (w *DataWriter) WriteVarUint(v uint64) error
- type EraseArea
- func (p *EraseArea) BaseColor() Color
- func (p *EraseArea) BaseWidth() float64
- func (p *EraseArea) Name() string
- func (p *EraseArea) SegmentColor(speed, direction, width, pressure, lastWidth float64) string
- func (p *EraseArea) SegmentLength() int
- func (p *EraseArea) SegmentOpacity(speed, direction, width, pressure, lastWidth float64) float64
- func (p *EraseArea) SegmentWidth(speed, direction, width, pressure, lastWidth float64) float64
- func (p *EraseArea) StrokeLinecap() string
- type Eraser
- func (p *Eraser) BaseColor() Color
- func (p *Eraser) BaseWidth() float64
- func (p *Eraser) Name() string
- func (p *Eraser) SegmentColor(speed, direction, width, pressure, lastWidth float64) string
- func (p *Eraser) SegmentLength() int
- func (p *Eraser) SegmentOpacity(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Eraser) SegmentWidth(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Eraser) StrokeLinecap() string
- type Fineliner
- func (p *Fineliner) BaseColor() Color
- func (p *Fineliner) BaseWidth() float64
- func (p *Fineliner) Name() string
- func (p *Fineliner) SegmentColor(speed, direction, width, pressure, lastWidth float64) string
- func (p *Fineliner) SegmentLength() int
- func (p *Fineliner) SegmentOpacity(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Fineliner) SegmentWidth(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Fineliner) StrokeLinecap() string
- type Group
- type Highlighter
- func (p *Highlighter) BaseColor() Color
- func (p *Highlighter) BaseWidth() float64
- func (p *Highlighter) Name() string
- func (p *Highlighter) SegmentColor(speed, direction, width, pressure, lastWidth float64) string
- func (p *Highlighter) SegmentLength() int
- func (p *Highlighter) SegmentOpacity(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Highlighter) SegmentWidth(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Highlighter) StrokeLinecap() string
- type Item
- type Line
- type LwwValue
- type MainBlockInfo
- type Marker
- func (p *Marker) BaseColor() Color
- func (p *Marker) BaseWidth() float64
- func (p *Marker) Name() string
- func (p *Marker) SegmentColor(speed, direction, width, pressure, lastWidth float64) string
- func (p *Marker) SegmentLength() int
- func (p *Marker) SegmentOpacity(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Marker) SegmentWidth(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Marker) StrokeLinecap() string
- type MechanicalPencil
- func (p *MechanicalPencil) BaseColor() Color
- func (p *MechanicalPencil) BaseWidth() float64
- func (p *MechanicalPencil) Name() string
- func (p *MechanicalPencil) SegmentColor(speed, direction, width, pressure, lastWidth float64) string
- func (p *MechanicalPencil) SegmentLength() int
- func (p *MechanicalPencil) SegmentOpacity(speed, direction, width, pressure, lastWidth float64) float64
- func (p *MechanicalPencil) SegmentWidth(speed, direction, width, pressure, lastWidth float64) float64
- func (p *MechanicalPencil) StrokeLinecap() string
- type MigrationInfoBlock
- type PageInfoBlock
- type Pen
- type PenColor
- type PenTool
- type Pencil
- func (p *Pencil) BaseColor() Color
- func (p *Pencil) BaseWidth() float64
- func (p *Pencil) Name() string
- func (p *Pencil) SegmentColor(speed, direction, width, pressure, lastWidth float64) string
- func (p *Pencil) SegmentLength() int
- func (p *Pencil) SegmentOpacity(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Pencil) SegmentWidth(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Pencil) StrokeLinecap() string
- type Point
- type SVGOption
- type SVGOptions
- type Scene
- type SceneGroupItemBlock
- type SceneInfoBlock
- type SceneLineItemBlock
- type SceneTreeBlock
- type Shader
- func (p *Shader) BaseColor() Color
- func (p *Shader) BaseWidth() float64
- func (p *Shader) Name() string
- func (p *Shader) SegmentColor(speed, direction, width, pressure, lastWidth float64) string
- func (p *Shader) SegmentLength() int
- func (p *Shader) SegmentOpacity(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Shader) SegmentWidth(speed, direction, width, pressure, lastWidth float64) float64
- func (p *Shader) StrokeLinecap() string
- type SubBlockInfo
- type TagType
- type TreeNodeBlock
- type UnknownBlock
Constants ¶
const ( BlockTypeMigrationInfo = 0x00 BlockTypeSceneTree = 0x01 BlockTypeTreeNode = 0x02 BlockTypeSceneGlyph = 0x03 BlockTypeSceneGroup = 0x04 BlockTypeSceneLine = 0x05 BlockTypeSceneText = 0x06 BlockTypeRootText = 0x07 BlockTypeSceneTombstone = 0x08 BlockTypeAuthorIds = 0x09 BlockTypePageInfo = 0x0A BlockTypeSceneInfo = 0x0D )
const ( // DefaultWidthPt is the standard reMarkable A5 portrait width in points. DefaultWidthPt = 447.874 // DefaultHeightPt is the standard reMarkable A5 portrait height in points. DefaultHeightPt = 595.275 // DefaultHighlighterOpacity is the standard stroke opacity for highlighter ink. DefaultHighlighterOpacity = 0.45 // DefaultHighlighterWidth is the standard stroke width for highlighters. DefaultHighlighterWidth = 10.0 // ScreenDPI is the hardware screen DPI of the reMarkable tablet (226 DPI). ScreenDPI = 226.0 // ScaleFactor converts tablet screen units to standard 72 DPI points (72 / 226). ScaleFactor = 72.0 / ScreenDPI )
const HeaderLength = len(HeaderV6)
HeaderLength is the required length of the header in bytes (43 bytes).
const HeaderV6 = "reMarkable .lines file, version=6 "
HeaderV6 is the expected 43-byte magic header for reMarkable version 6 .rm files.
Variables ¶
var ( // ErrInvalidHeader is returned when the file header does not match HeaderV6. ErrInvalidHeader = errors.New("invalid reMarkable v6 header") // ErrUnexpectedEOF is returned when the stream ends unexpectedly. ErrUnexpectedEOF = errors.New("unexpected EOF") )
var ( // ErrBlockOverflow is returned when reading exceeds the declared block size. ErrBlockOverflow = errors.New("block overflow: read past declared block size") // ErrUnexpectedTag is returned when a tag does not match the expected index or type. ErrUnexpectedTag = errors.New("unexpected tag in block stream") )
var DefaultHighlighterColor = Color{R: 255, G: 235, B: 59}
DefaultHighlighterColor is standard highlighter yellow (255, 235, 59).
var DefaultPalette = map[PenColor]Color{
PenColorBlack: {R: 0, G: 0, B: 0},
PenColorGray: {R: 144, G: 144, B: 144},
PenColorWhite: {R: 255, G: 255, B: 255},
PenColorYellow: {R: 251, G: 247, B: 25},
PenColorGreen: {R: 0, G: 255, B: 0},
PenColorPink: {R: 255, G: 192, B: 203},
PenColorBlue: {R: 78, G: 105, B: 201},
PenColorRed: {R: 179, G: 62, B: 57},
PenColorGrayOverlap: {R: 125, G: 125, B: 125},
PenColorHighlight: {R: 251, G: 247, B: 25},
PenColorGreen2: {R: 161, G: 216, B: 125},
PenColorCyan: {R: 139, G: 208, B: 229},
PenColorMagenta: {R: 242, G: 158, B: 255},
PenColorYellow2: {R: 247, G: 232, B: 81},
}
DefaultPalette maps PenColor enum values to their standard display RGB colors. Values incorporate Paper Pro color palette definitions.
Functions ¶
func RenderRMToSVG ¶
RenderRMToSVG parses raw .rm file bytes and exports an SVG string directly.
func RenderToSVG ¶
RenderToSVG parses the provided blocks and exports a layered SVG string.
Highlighters are rendered in painter's order underneath pen strokes with true Paper Pro RGB colors, stroke-opacity="0.45", and square linecaps. Pen strokes are rendered on top with their individual segment dynamic widths and colors.
func ValidateHeader ¶
ValidateHeader reads HeaderLength bytes from r and returns nil if it matches HeaderV6.
func ValidateHeaderBytes ¶
ValidateHeaderBytes verifies that the provided byte slice starts with HeaderV6.
Types ¶
type AuthorIdsBlock ¶
type AuthorIdsBlock struct {
Authors map[uint16][]byte `json:"authors"`
// contains filtered or unexported fields
}
AuthorIdsBlock maps author UUIDs to numerical IDs (BlockType 0x09).
func (*AuthorIdsBlock) BlockType ¶
func (b *AuthorIdsBlock) BlockType() uint8
func (*AuthorIdsBlock) ExtraData ¶
func (b *AuthorIdsBlock) ExtraData() []byte
type Ballpoint ¶
type Ballpoint struct {
// contains filtered or unexported fields
}
Ballpoint pen implementation with dynamic width and ink pressure variation.
func NewBallpoint ¶
func (*Ballpoint) SegmentColor ¶
func (*Ballpoint) SegmentLength ¶
func (p *Ballpoint) SegmentLength() int
func (*Ballpoint) SegmentOpacity ¶
func (*Ballpoint) SegmentWidth ¶
func (*Ballpoint) StrokeLinecap ¶
func (p *Ballpoint) StrokeLinecap() string
type Block ¶
Block is the common interface for top-level tagged blocks in a v6 .rm file.
func ReadBlock ¶
func ReadBlock(s *DataStream) (Block, error)
ReadBlock parses the next top-level block from stream. Returns io.EOF when no more blocks remain.
type Brush ¶
type Brush struct {
// contains filtered or unexported fields
}
Brush (Paintbrush) implementation with pressure-sensitive color and width.
func (*Brush) SegmentColor ¶
func (*Brush) SegmentLength ¶
func (p *Brush) SegmentLength() int
func (*Brush) SegmentOpacity ¶
func (*Brush) SegmentWidth ¶
func (*Brush) StrokeLinecap ¶
func (p *Brush) StrokeLinecap() string
type Calligraphy ¶
type Calligraphy struct {
// contains filtered or unexported fields
}
Calligraphy pen implementation.
func NewCalligraphy ¶
func NewCalligraphy(width float64, color Color) *Calligraphy
func (*Calligraphy) SegmentColor ¶
func (*Calligraphy) SegmentLength ¶
func (p *Calligraphy) SegmentLength() int
func (*Calligraphy) SegmentOpacity ¶
func (*Calligraphy) SegmentWidth ¶
func (p *Calligraphy) SegmentWidth(speed, direction, width, pressure, lastWidth float64) float64
func (*Calligraphy) StrokeLinecap ¶
func (p *Calligraphy) StrokeLinecap() string
type Color ¶
type Color struct {
R uint8 `json:"r"`
G uint8 `json:"g"`
B uint8 `json:"b"`
Alpha float64 `json:"alpha,omitempty"`
}
Color represents an RGB color with optional alpha transparency.
func ExtractHighlighterColor ¶
ExtractHighlighterColor extracts a 24-bit RGB color from Paper Pro extra_value_data.
Paper Pro stores color in little-endian BGRA format following tag 0x84 0x01 (tag index 8, type Byte4). Defaults to standard highlighter yellow (255, 235, 59) if tag 0x84 0x01 is absent or malformed.
func ExtractHighlighterColorWithFallback ¶
ExtractHighlighterColorWithFallback extracts a 24-bit RGB color from Paper Pro extra_value_data, returning fallback if tag 0x84 0x01 is absent or malformed.
func GetColor ¶
GetColor returns the RGB color for a given PenColor, falling back to black if unknown.
type DataStream ¶
type DataStream struct {
// contains filtered or unexported fields
}
DataStream wraps an io.ReadSeeker to provide primitives for reading reMarkable v6 binary data.
func NewDataStream ¶
func NewDataStream(r io.ReadSeeker) *DataStream
NewDataStream creates a new DataStream from an io.ReadSeeker.
func (*DataStream) CheckTag ¶
func (s *DataStream) CheckTag(expectedIndex int, expectedType TagType) bool
CheckTag checks whether the next tag matches expectedIndex and expectedType without advancing the stream.
func (*DataStream) ReadBool ¶
func (s *DataStream) ReadBool() (bool, error)
ReadBool reads a single boolean byte.
func (*DataStream) ReadBytes ¶
func (s *DataStream) ReadBytes(n int) ([]byte, error)
ReadBytes reads exactly n bytes from the stream.
func (*DataStream) ReadCrdtId ¶
func (s *DataStream) ReadCrdtId() (CrdtId, error)
ReadCrdtId reads a CRDT identifier (uint8 part1 followed by varuint part2).
func (*DataStream) ReadFloat32 ¶
func (s *DataStream) ReadFloat32() (float32, error)
ReadFloat32 reads a 32-bit little-endian IEEE-754 float.
func (*DataStream) ReadFloat64 ¶
func (s *DataStream) ReadFloat64() (float64, error)
ReadFloat64 reads a 64-bit little-endian IEEE-754 double.
func (*DataStream) ReadId ¶
func (s *DataStream) ReadId(index int) (CrdtId, error)
ReadId reads a tagged CRDT ID with TagType ID.
func (*DataStream) ReadLwwBool ¶
func (s *DataStream) ReadLwwBool(index int) (LwwValue[bool], error)
ReadLwwBool reads a LWW bool subblock at the given index.
func (*DataStream) ReadLwwByte ¶
func (s *DataStream) ReadLwwByte(index int) (LwwValue[uint8], error)
ReadLwwByte reads a LWW byte subblock at the given index.
func (*DataStream) ReadLwwFloat ¶
func (s *DataStream) ReadLwwFloat(index int) (LwwValue[float32], error)
ReadLwwFloat reads a LWW float subblock at the given index.
func (*DataStream) ReadLwwId ¶
func (s *DataStream) ReadLwwId(index int) (LwwValue[CrdtId], error)
ReadLwwId reads a LWW CRDT ID subblock at the given index.
func (*DataStream) ReadLwwString ¶
func (s *DataStream) ReadLwwString(index int) (LwwValue[string], error)
ReadLwwString reads a LWW string subblock at the given index.
func (*DataStream) ReadString ¶
func (s *DataStream) ReadString(index int) (string, error)
ReadString reads a string subblock at the given tag index.
func (*DataStream) ReadTag ¶
ReadTag reads and validates that the next tag matches expectedIndex and expectedType. If it does not match, the stream is rewound to the position before the tag.
func (*DataStream) ReadTagValues ¶
func (s *DataStream) ReadTagValues() (int, TagType, error)
ReadTagValues decodes the next varuint tag into (index, tagType).
func (*DataStream) ReadTaggedBool ¶
func (s *DataStream) ReadTaggedBool(index int) (bool, error)
ReadTaggedBool reads a tagged bool with TagType Byte1.
func (*DataStream) ReadTaggedByte ¶
func (s *DataStream) ReadTaggedByte(index int) (uint8, error)
ReadTaggedByte reads a tagged byte with TagType Byte1.
func (*DataStream) ReadTaggedDouble ¶
func (s *DataStream) ReadTaggedDouble(index int) (float64, error)
ReadTaggedDouble reads a tagged 8-byte double with TagType Byte8.
func (*DataStream) ReadTaggedFloat ¶
func (s *DataStream) ReadTaggedFloat(index int) (float32, error)
ReadTaggedFloat reads a tagged 4-byte float with TagType Byte4.
func (*DataStream) ReadTaggedInt ¶
func (s *DataStream) ReadTaggedInt(index int) (uint32, error)
ReadTaggedInt reads a tagged 4-byte unsigned integer with TagType Byte4.
func (*DataStream) ReadUint8 ¶
func (s *DataStream) ReadUint8() (uint8, error)
ReadUint8 reads a single 8-bit unsigned integer.
func (*DataStream) ReadUint16 ¶
func (s *DataStream) ReadUint16() (uint16, error)
ReadUint16 reads a 16-bit little-endian unsigned integer.
func (*DataStream) ReadUint32 ¶
func (s *DataStream) ReadUint32() (uint32, error)
ReadUint32 reads a 32-bit little-endian unsigned integer.
func (*DataStream) ReadVarUint ¶
func (s *DataStream) ReadVarUint() (uint64, error)
ReadVarUint reads an unsigned LEB128 variable-length integer.
func (*DataStream) Seek ¶
func (s *DataStream) Seek(offset int64, whence int) (int64, error)
Seek seeks to offset relative to whence.
func (*DataStream) Tell ¶
func (s *DataStream) Tell() int64
Tell returns the current byte position in the stream.
type DataWriter ¶
type DataWriter struct {
// contains filtered or unexported fields
}
DataWriter wraps an io.Writer to serialize reMarkable v6 binary structures.
func NewDataWriter ¶
func NewDataWriter(w io.Writer) *DataWriter
NewDataWriter creates a new DataWriter.
func (*DataWriter) WriteBlock ¶
func (w *DataWriter) WriteBlock(blockType, minVersion, currentVersion uint8, writeFn func(bw *DataWriter) error) error
WriteBlock writes a top-level block with 8-byte header and payload.
func (*DataWriter) WriteBool ¶
func (w *DataWriter) WriteBool(v bool) error
WriteBool writes a single boolean byte.
func (*DataWriter) WriteBytes ¶
func (w *DataWriter) WriteBytes(b []byte) error
WriteBytes writes raw bytes to the stream.
func (*DataWriter) WriteCrdtId ¶
func (w *DataWriter) WriteCrdtId(id CrdtId) error
WriteCrdtId writes a CrdtId (part1 uint8 + part2 varuint).
func (*DataWriter) WriteFloat32 ¶
func (w *DataWriter) WriteFloat32(v float32) error
WriteFloat32 writes a 32-bit little-endian float.
func (*DataWriter) WriteFloat64 ¶
func (w *DataWriter) WriteFloat64(v float64) error
WriteFloat64 writes a 64-bit little-endian double.
func (*DataWriter) WriteHeader ¶
func (w *DataWriter) WriteHeader() error
WriteHeader writes the 43-byte magic header.
func (*DataWriter) WriteId ¶
func (w *DataWriter) WriteId(index int, id CrdtId) error
WriteId writes a tagged CrdtId.
func (*DataWriter) WriteLine ¶
func (w *DataWriter) WriteLine(line *Line, version uint8) error
WriteLine writes a Line structure inside a subblock.
func (*DataWriter) WriteLwwBool ¶
func (w *DataWriter) WriteLwwBool(index int, ts CrdtId, val bool) error
WriteLwwBool writes a tagged LwwValue[bool].
func (*DataWriter) WriteLwwByte ¶
func (w *DataWriter) WriteLwwByte(index int, ts CrdtId, val uint8) error
WriteLwwByte writes a tagged LwwValue[uint8].
func (*DataWriter) WriteLwwFloat ¶
func (w *DataWriter) WriteLwwFloat(index int, ts CrdtId, val float32) error
WriteLwwFloat writes a tagged LwwValue[float32].
func (*DataWriter) WriteLwwId ¶
func (w *DataWriter) WriteLwwId(index int, ts CrdtId, val CrdtId) error
WriteLwwId writes a tagged LwwValue[CrdtId].
func (*DataWriter) WriteLwwString ¶
func (w *DataWriter) WriteLwwString(index int, ts CrdtId, val string) error
WriteLwwString writes a tagged LwwValue[string].
func (*DataWriter) WritePoint ¶
func (w *DataWriter) WritePoint(p Point, version uint8) error
WritePoint writes a Point in version 2 format (14 bytes) or version 1 format (24 bytes).
func (*DataWriter) WriteSceneLineItemBlock ¶
func (w *DataWriter) WriteSceneLineItemBlock(block *SceneLineItemBlock, version uint8) error
WriteSceneLineItemBlock writes a complete SceneLineItemBlock.
func (*DataWriter) WriteString ¶
func (w *DataWriter) WriteString(index int, s string) error
WriteString writes a tagged string subblock.
func (*DataWriter) WriteSubblock ¶
func (w *DataWriter) WriteSubblock(index int, writeFn func(sw *DataWriter) error) error
WriteSubblock writes a subblock prefixed with tag index and length.
func (*DataWriter) WriteTag ¶
func (w *DataWriter) WriteTag(index int, tagType TagType) error
WriteTag writes a tag with the given index and TagType.
func (*DataWriter) WriteTaggedBool ¶
func (w *DataWriter) WriteTaggedBool(index int, v bool) error
WriteTaggedBool writes a tagged bool (TagByte1).
func (*DataWriter) WriteTaggedByte ¶
func (w *DataWriter) WriteTaggedByte(index int, v uint8) error
WriteTaggedByte writes a tagged uint8 (TagByte1).
func (*DataWriter) WriteTaggedDouble ¶
func (w *DataWriter) WriteTaggedDouble(index int, v float64) error
WriteTaggedDouble writes a tagged float64 (TagByte8).
func (*DataWriter) WriteTaggedFloat ¶
func (w *DataWriter) WriteTaggedFloat(index int, v float32) error
WriteTaggedFloat writes a tagged float32 (TagByte4).
func (*DataWriter) WriteTaggedInt ¶
func (w *DataWriter) WriteTaggedInt(index int, v uint32) error
WriteTaggedInt writes a tagged uint32 (TagByte4).
func (*DataWriter) WriteUint8 ¶
func (w *DataWriter) WriteUint8(v uint8) error
WriteUint8 writes a single uint8.
func (*DataWriter) WriteUint16 ¶
func (w *DataWriter) WriteUint16(v uint16) error
WriteUint16 writes a 16-bit little-endian integer.
func (*DataWriter) WriteUint32 ¶
func (w *DataWriter) WriteUint32(v uint32) error
WriteUint32 writes a 32-bit little-endian integer.
func (*DataWriter) WriteVarUint ¶
func (w *DataWriter) WriteVarUint(v uint64) error
WriteVarUint writes an unsigned LEB128 variable-length integer.
type EraseArea ¶
type EraseArea struct {
// contains filtered or unexported fields
}
EraseArea implementation.
func NewEraseArea ¶
func (*EraseArea) SegmentColor ¶
func (*EraseArea) SegmentLength ¶
func (p *EraseArea) SegmentLength() int
func (*EraseArea) SegmentOpacity ¶
func (*EraseArea) SegmentWidth ¶
func (*EraseArea) StrokeLinecap ¶
func (p *EraseArea) StrokeLinecap() string
type Eraser ¶
type Eraser struct {
// contains filtered or unexported fields
}
Eraser implementation.
func (*Eraser) SegmentColor ¶
func (*Eraser) SegmentLength ¶
func (p *Eraser) SegmentLength() int
func (*Eraser) SegmentOpacity ¶
func (*Eraser) SegmentWidth ¶
func (*Eraser) StrokeLinecap ¶
func (p *Eraser) StrokeLinecap() string
type Fineliner ¶
type Fineliner struct {
// contains filtered or unexported fields
}
Fineliner pen implementation.
func NewFineliner ¶
func (*Fineliner) SegmentColor ¶
func (*Fineliner) SegmentLength ¶
func (p *Fineliner) SegmentLength() int
func (*Fineliner) SegmentOpacity ¶
func (*Fineliner) SegmentWidth ¶
func (*Fineliner) StrokeLinecap ¶
func (p *Fineliner) StrokeLinecap() string
type Group ¶
type Group struct {
NodeID CrdtId `json:"node_id"`
Label string `json:"label"`
Visible bool `json:"visible"`
AnchorID *CrdtId `json:"anchor_id,omitempty"`
AnchorType *uint8 `json:"anchor_type,omitempty"`
AnchorThreshold *float32 `json:"anchor_threshold,omitempty"`
AnchorOriginX *float32 `json:"anchor_origin_x,omitempty"`
}
Group represents a scene tree group node (e.g. layer).
type Highlighter ¶
type Highlighter struct {
// contains filtered or unexported fields
}
Highlighter implementation.
func NewHighlighter ¶
func NewHighlighter(width float64, color Color) *Highlighter
func (*Highlighter) SegmentColor ¶
func (*Highlighter) SegmentLength ¶
func (p *Highlighter) SegmentLength() int
func (*Highlighter) SegmentOpacity ¶
func (*Highlighter) SegmentWidth ¶
func (*Highlighter) StrokeLinecap ¶
func (p *Highlighter) StrokeLinecap() string
type Item ¶
type Item[T any] struct { ItemID CrdtId `json:"item_id"` LeftID CrdtId `json:"left_id"` RightID CrdtId `json:"right_id"` DeletedLength uint32 `json:"deleted_length"` Value T `json:"value"` }
Item represents a CRDT sequence item wrapping a value.
type Line ¶
type Line struct {
Color PenColor `json:"color"`
Tool PenTool `json:"tool"`
Points []Point `json:"points"`
ThicknessScale float64 `json:"thickness_scale"`
StartingLength float32 `json:"starting_length"`
MoveID *CrdtId `json:"move_id,omitempty"`
}
Line represents a single stroke on the tablet.
type MainBlockInfo ¶
type MainBlockInfo struct {
Offset int64
Size uint32
Unknown uint8
MinVersion uint8
CurrentVersion uint8
BlockType uint8
ExtraData []byte
}
MainBlockInfo holds metadata about a top-level block.
type Marker ¶
type Marker struct {
// contains filtered or unexported fields
}
Marker pen implementation with tilt-sensitive width.
func (*Marker) SegmentColor ¶
func (*Marker) SegmentLength ¶
func (p *Marker) SegmentLength() int
func (*Marker) SegmentOpacity ¶
func (*Marker) SegmentWidth ¶
func (*Marker) StrokeLinecap ¶
func (p *Marker) StrokeLinecap() string
type MechanicalPencil ¶
type MechanicalPencil struct {
// contains filtered or unexported fields
}
MechanicalPencil implementation.
func NewMechanicalPencil ¶
func NewMechanicalPencil(width float64, color Color) *MechanicalPencil
func (*MechanicalPencil) SegmentColor ¶
func (*MechanicalPencil) SegmentLength ¶
func (p *MechanicalPencil) SegmentLength() int
func (*MechanicalPencil) SegmentOpacity ¶
func (*MechanicalPencil) SegmentWidth ¶
func (*MechanicalPencil) StrokeLinecap ¶
func (p *MechanicalPencil) StrokeLinecap() string
type MigrationInfoBlock ¶
type MigrationInfoBlock struct {
MigrationID CrdtId `json:"migration_id"`
IsDevice bool `json:"is_device"`
Unknown bool `json:"unknown,omitempty"`
// contains filtered or unexported fields
}
MigrationInfoBlock represents migration metadata (BlockType 0x00).
func (*MigrationInfoBlock) BlockType ¶
func (b *MigrationInfoBlock) BlockType() uint8
func (*MigrationInfoBlock) ExtraData ¶
func (b *MigrationInfoBlock) ExtraData() []byte
type PageInfoBlock ¶
type PageInfoBlock struct {
LoadsCount uint32 `json:"loads_count"`
MergesCount uint32 `json:"merges_count"`
TextCharsCount uint32 `json:"text_chars_count"`
TextLinesCount uint32 `json:"text_lines_count"`
TypeFolioUseCount uint32 `json:"type_folio_use_count,omitempty"`
// contains filtered or unexported fields
}
PageInfoBlock holds document page statistics (BlockType 0x0A).
func (*PageInfoBlock) BlockType ¶
func (b *PageInfoBlock) BlockType() uint8
func (*PageInfoBlock) ExtraData ¶
func (b *PageInfoBlock) ExtraData() []byte
type Pen ¶
type Pen interface {
Name() string
SegmentLength() int
StrokeLinecap() string
BaseWidth() float64
BaseColor() Color
SegmentWidth(speed, direction, width, pressure, lastWidth float64) float64
SegmentColor(speed, direction, width, pressure, lastWidth float64) string
SegmentOpacity(speed, direction, width, pressure, lastWidth float64) float64
}
Pen is the interface implemented by all writing and drawing tools.
type PenColor ¶
type PenColor int
PenColor represents the palette color index stored in the stroke line.
const ( PenColorBlack PenColor = 0 PenColorGray PenColor = 1 PenColorWhite PenColor = 2 PenColorYellow PenColor = 3 PenColorGreen PenColor = 4 PenColorPink PenColor = 5 PenColorBlue PenColor = 6 PenColorRed PenColor = 7 PenColorGrayOverlap PenColor = 8 PenColorHighlight PenColor = 9 PenColorGreen2 PenColor = 10 PenColorCyan PenColor = 11 PenColorMagenta PenColor = 12 PenColorYellow2 PenColor = 13 )
type PenTool ¶
type PenTool int
PenTool represents the writing or drawing instrument used for a stroke.
const ( PenToolPaintbrush1 PenTool = 0 PenToolPencil1 PenTool = 1 PenToolBallpoint1 PenTool = 2 PenToolMarker1 PenTool = 3 PenToolFineliner1 PenTool = 4 PenToolHighlighter1 PenTool = 5 PenToolEraser PenTool = 6 PenToolMechanicalPencil1 PenTool = 7 PenToolEraserArea PenTool = 8 PenToolPaintbrush2 PenTool = 12 PenToolMechanicalPencil2 PenTool = 13 PenToolPencil2 PenTool = 14 PenToolBallpoint2 PenTool = 15 PenToolMarker2 PenTool = 16 PenToolFineliner2 PenTool = 17 PenToolHighlighter2 PenTool = 18 PenToolCalligraphy PenTool = 21 PenToolShader PenTool = 23 )
func (PenTool) IsHighlighter ¶
IsHighlighter returns true if the tool is any variation of the highlighter or shader wash.
type Pencil ¶
type Pencil struct {
// contains filtered or unexported fields
}
Pencil implementation with pressure, tilt and speed curves.
func (*Pencil) SegmentColor ¶
func (*Pencil) SegmentLength ¶
func (p *Pencil) SegmentLength() int
func (*Pencil) SegmentOpacity ¶
func (*Pencil) SegmentWidth ¶
func (*Pencil) StrokeLinecap ¶
func (p *Pencil) StrokeLinecap() string
type Point ¶
type Point struct {
X float32 `json:"x"`
Y float32 `json:"y"`
Speed uint16 `json:"speed"`
Direction uint8 `json:"direction"`
Width uint16 `json:"width"`
Pressure uint8 `json:"pressure"`
}
Point represents a single point in a stroke with location and stylus telemetry.
type SVGOption ¶
type SVGOption func(*SVGOptions)
SVGOption is a functional option for configuring SVG output.
func WithDimensions ¶
WithDimensions sets explicit SVG width and height in points.
func WithHighlighterOpacity ¶
WithHighlighterOpacity configures the opacity used for highlighter strokes.
func WithHighlighterWidth ¶
WithHighlighterWidth configures the stroke width used for highlighters.
func WithViewBox ¶
WithViewBox sets an explicit viewBox attribute on the root SVG element.
type SVGOptions ¶
type SVGOptions struct {
WidthPt float64
HeightPt float64
ViewBox string
HighlighterOpacity float64
HighlighterWidth float64
}
SVGOptions configures the SVG exporter output.
type Scene ¶
type Scene struct {
Blocks []Block
}
Scene represents a parsed reMarkable .rm v6 scene file.
func ParseReader ¶
ParseReader parses a reMarkable v6 .rm binary stream from an io.Reader.
func (*Scene) Highlighters ¶
Highlighters returns all highlighter strokes in the scene.
type SceneGroupItemBlock ¶
type SceneGroupItemBlock struct {
ParentID CrdtId `json:"parent_id"`
Item Item[CrdtId] `json:"item"`
// contains filtered or unexported fields
}
SceneGroupItemBlock represents a scene group item block (BlockType 0x04).
func (*SceneGroupItemBlock) BlockType ¶
func (b *SceneGroupItemBlock) BlockType() uint8
func (*SceneGroupItemBlock) ExtraData ¶
func (b *SceneGroupItemBlock) ExtraData() []byte
type SceneInfoBlock ¶
type SceneInfoBlock struct {
CurrentLayer LwwValue[CrdtId] `json:"current_layer"`
BackgroundVisible LwwValue[bool] `json:"background_visible"`
RootDocumentVisible LwwValue[bool] `json:"root_document_visible"`
// contains filtered or unexported fields
}
SceneInfoBlock holds root scene visibility and active layer info (BlockType 0x0D).
func (*SceneInfoBlock) BlockType ¶
func (b *SceneInfoBlock) BlockType() uint8
func (*SceneInfoBlock) ExtraData ¶
func (b *SceneInfoBlock) ExtraData() []byte
type SceneLineItemBlock ¶
type SceneLineItemBlock struct {
ParentID CrdtId `json:"parent_id"`
Item Item[*Line] `json:"item"`
ExtraValueData []byte `json:"extra_value_data,omitempty"`
// contains filtered or unexported fields
}
SceneLineItemBlock represents a stroke line item block (BlockType 0x05).
func (*SceneLineItemBlock) BlockType ¶
func (b *SceneLineItemBlock) BlockType() uint8
func (*SceneLineItemBlock) ExtraData ¶
func (b *SceneLineItemBlock) ExtraData() []byte
type SceneTreeBlock ¶
type SceneTreeBlock struct {
TreeID CrdtId `json:"tree_id"`
NodeID CrdtId `json:"node_id"`
IsUpdate bool `json:"is_update"`
ParentID CrdtId `json:"parent_id"`
// contains filtered or unexported fields
}
SceneTreeBlock represents a hierarchy link in the scene tree (BlockType 0x01).
func (*SceneTreeBlock) BlockType ¶
func (b *SceneTreeBlock) BlockType() uint8
func (*SceneTreeBlock) ExtraData ¶
func (b *SceneTreeBlock) ExtraData() []byte
type Shader ¶
type Shader struct {
// contains filtered or unexported fields
}
Shader implementation.
func (*Shader) SegmentColor ¶
func (*Shader) SegmentLength ¶
func (p *Shader) SegmentLength() int
func (*Shader) SegmentOpacity ¶
func (*Shader) SegmentWidth ¶
func (*Shader) StrokeLinecap ¶
func (p *Shader) StrokeLinecap() string
type SubBlockInfo ¶
SubBlockInfo holds metadata about a subblock.
type TagType ¶
type TagType uint8
TagType represents the data type following a tag in the binary format.
type TreeNodeBlock ¶
type TreeNodeBlock struct {
Group Group `json:"group"`
// contains filtered or unexported fields
}
TreeNodeBlock represents a layer or tree node block (BlockType 0x02).
func (*TreeNodeBlock) BlockType ¶
func (b *TreeNodeBlock) BlockType() uint8
func (*TreeNodeBlock) ExtraData ¶
func (b *TreeNodeBlock) ExtraData() []byte
type UnknownBlock ¶
type UnknownBlock struct {
Type uint8 `json:"block_type"`
Info MainBlockInfo `json:"info"`
Data []byte `json:"data"`
// contains filtered or unexported fields
}
UnknownBlock captures unhandled or forward-compatible block types safely.
func (*UnknownBlock) BlockType ¶
func (b *UnknownBlock) BlockType() uint8
func (*UnknownBlock) ExtraData ¶
func (b *UnknownBlock) ExtraData() []byte