Module piet_common::util

source ·
Expand description

utilities shared by various backends Code useful for multiple backends

Structs

A type backends can use to represent the default values for a TextLayout

Constants

The default point size for text in piet.
The default foreground text color.

Functions

Generate image for a blurred rect, writing it into the provided buffer.
returns utf8 text position (code unit offset) at the given utf-16 text position
Counts the number of utf-16 code units in the given string. from xi-editor
A heurstic for text direction; returns true if, while enumerating characters in this string, a character in the ‘R’ (strong right-to-left) category is encountered before any character in the ‘L’ (strong left-to-right) category is.
Returns the index of the line containing this utf8 position, or the last line index if the position is out of bounds.
Resolves a RangeBounds into a range in the range 0..len.
Calculate the size required paint a blurred rect.
If this string ends in a newline function (NLF) (5.8), return the length of the NLF in bytes.
If x is a single (non-alpha) channel of a premultiplied color and a is the alpha channel, returns the corresponding channel of the unpremultiplied version of the color.
Takes a buffer of premultiplied RGBA pixels and unpremultiplies them in place.