flatten

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package flatten draws as pictures what a vector format without transparency cannot draw (PostScript, vector/psbdf): the rectangles of a page where something is drawn with alpha, a blend mode, a group or a soft mask, a shadow or a filter are collected, merged until none overlap, and drawn by the image renderer with all that the page draws there. The rest of the page stays vectors, under a clip that leaves the rectangles out.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Picture

func Picture(rd *imagebdf.Renderer, v *bdf.View, page int, box [4]float64, dpi float64) (*image.RGBA, error)

Picture draws a rectangle (x0, y0, x1, y1) of a page of a view at a resolution (dots per unit of 1/72 inch × 72).

Types

type Regions

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

Regions collects the rectangles of a page that are drawn as pictures.

func (*Regions) Add

func (r *Regions) Add(b [4]float64)

Add adds a box (x0, y0, x1, y1) in the units of the page; boxes that are empty or not numbers are left out.

func (*Regions) Empty

func (r *Regions) Empty() bool

Empty reports whether no box was added.

func (*Regions) Merge

func (r *Regions) Merge(w, h, margin float64) [][4]float64

Merge returns the rectangles of a page of w × h: the boxes grown to whole units and by margin (for the edges a renderer smooths), cut to the page, and merged with those they overlap or come within margin of, until none do. Too many of them, or too much of the page, is the whole page.

Jump to

Keyboard shortcuts

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