importer

package
v0.0.0-...-d4e01be Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arc

type Arc struct {
	Center     Point
	Radius     float64
	StartAngle float64 // radians
	EndAngle   float64 // radians
}

type Entity

type Entity struct {
	Paths   []Path
	Arcs    []Arc
	Circles []Arc
}

Entity groups all geometry types a file can produce.

func ParseDXF

func ParseDXF(filename string) (*Entity, error)

func ParseSVG

func ParseSVG(filename string) (*Entity, error)

func (*Entity) Bounds

func (e *Entity) Bounds() (min, max Point)

Bounds returns the bounding box of an entity set.

type GrayImage

type GrayImage struct {
	Width  int
	Height int
	Pixels []uint8 // row-major, 0=black 255=white
	DPI    float64
}

GrayImage holds a grayscale representation of an imported image.

func ParseImage

func ParseImage(filename string, dpi float64) (*GrayImage, error)

ParseImage loads a PNG or JPEG and converts to 8-bit grayscale.

func (*GrayImage) At

func (g *GrayImage) At(x, y int) uint8

At returns the grayscale value at pixel (x, y). Returns 255 if out of bounds.

func (*GrayImage) HeightMM

func (g *GrayImage) HeightMM() float64

HeightMM returns the image height in millimeters at the configured DPI.

func (*GrayImage) WidthMM

func (g *GrayImage) WidthMM() float64

WidthMM returns the image width in millimeters at the configured DPI.

type Path

type Path struct {
	Points []Point
	Closed bool
	Layer  string
}

Path is a sequence of points forming an open or closed polyline.

type Point

type Point struct {
	X, Y float64
}

type Segment

type Segment struct {
	From, To Point
}

Jump to

Keyboard shortcuts

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