bitmap

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package bitmap is the bitmap of the text and shape rasterizer (SDD-004 section 5): the pixels the Rust renderer draws for a plan.BitmapSpec, and the metrics the compositors place them with. It has no behaviour besides the PNG encoding, so the hosts of the renderer and its users can share the type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitmap

type Bitmap struct {
	// Pix is RGBA, 8 bits per channel, straight (non-premultiplied) alpha,
	// Width*Height*4 bytes. It is shared by the cache: do not modify it.
	Pix           []byte
	Width, Height int
	// NaturalW and NaturalH are the size of the bitmap at PixelScale 1, in
	// frame pixels.
	NaturalW, NaturalH float64
	// CenterDX and CenterDY are the offset, at PixelScale 1, from the centre
	// of the bitmap to the centre of the text block (or shape). The item's
	// position names the centre of the block, so a shadow that reaches further
	// on one side moves the bitmap, not the block.
	CenterDX, CenterDY float64
	// WordBoxes is the box of each word of a caption at PixelScale 1, in the
	// coordinates of the bitmap, for the lint and the UI.
	WordBoxes []plan.Rect
}

Bitmap is a rendered bitmap and its metrics.

func (Bitmap) PNG

func (b Bitmap) PNG() ([]byte, error)

PNG encodes the bitmap as a PNG with straight alpha. The encoding is deterministic, so a PNG can be cached and compared by hash.

Jump to

Keyboard shortcuts

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