Graphics module¶
CapStyle
enum¶
enum class CapStyle : uint8_t
Enum representing different cap styles for strokes.
Flat
enumerator¶
Flat cap style.
Square
enumerator¶
Square cap style.
Round
enumerator¶
Round cap style.
ColorConversionMode
enum¶
enum class ColorConversionMode
ColorConversionModeDefines the modes for adjusting colors after conversion.
This enum class provides different strategies for handling colors that may fall outside the valid range of a given color space during conversion.
None
enumerator¶
No adjustment to the color.
The color is returned as-is, even if its values are out of the acceptable range for the current color space.
Clamp
enumerator¶
Clamps the color to the valid range.
The color is adjusted by clamping each component to the nearest boundary of the valid range for the current color space.
Nearest
enumerator¶
Adjusts the color to the nearest valid value by reducing chroma.
The color is adjusted by reducing its chroma (saturation) to bring it within the valid range of the color space.
ColorSpace
enum¶
enum class ColorSpace
ColorSpaceDefines a set of color spaces.
This enum class represents various color spaces, each of which operates within a defined range of values for its components. These color spaces are used to represent and manipulate colors in different formats, including both linear and gamma-corrected forms, as well as different color representation systems like CIELAB, LMS, etc.
sRGBLinear
enumerator¶
sRGB color space in linear format.
The sRGBLinear color space operates in the linear range, where all components (R, G, B) have values between 0 and 1.
sRGBGamma
enumerator¶
sRGB color space in gamma-corrected format.
The sRGBGamma color space operates in a gamma-corrected range, where all components (R, G, B) are also between 0 and 1, but corrected for gamma.
DisplayP3Linear
enumerator¶
Display P3 color space in linear format.
The DisplayP3Linear color space is used with displays supporting P3 gamut, with all components (R, G, B) having values between 0 and 1 in a linear format.
DisplayP3Gamma
enumerator¶
Display P3 color space in gamma-corrected format.
The DisplayP3Gamma color space is gamma-corrected, where the P3 display color components (R, G, B) have values between 0 and 1.
CIEXYZ
enumerator¶
CIE XYZ color space.
The CIEXYZ color space represents color based on the CIE 1931 XYZ color model. The X, Y, and Z components have ranges between 0 and 100.
CIELAB
enumerator¶
CIE LAB color space.
The CIELAB color space is used to approximate human vision, with the L component ranging from 0 to 100, and the a and b components ranging from -200 to +200.
CIELCH
enumerator¶
CIE LCH color space.
The CIELCH color space is based on the cylindrical representation of the CIELAB color model. The L component ranges from 0 to 100, the C component from 0 to 100, and the H component from 0 to 360 degrees.
OKLAB
enumerator¶
OKLAB color space.
The OKLAB color space is another perceptually uniform color model, with the L component ranging from 0 to 100, and the a and b components ranging from -200 to +200.
OKLCH
enumerator¶
OKLCH color space.
The OKLCH color space is a cylindrical version of the OKLAB model. The L component ranges from 0 to 100, the C component from 0 to 100, and the H component from 0 to 360 degrees.
LMS
enumerator¶
LMS color space.
The LMS color space is based on the response of the human eye's long, medium, and short-wavelength cones. All components (L, M, S) have values between 0 and 1.
ColorStop
class¶
ColorStop
Represents a color stop in a gradient.
position
variable¶
float position
The position of the color stop within the gradient, ranging from 0.0 to 1.0.
color
variable¶
ColorF color
The color associated with this color stop.
ColorStopArray
typedef¶
ColorStopArray = SmallVector<ColorStop, 3>
A small vector type for storing an array of color stops.
ColorSubsampling
enum¶
enum class ColorSubsampling
Enum representing color subsampling methods for images.
S444
enumerator¶
4:4:4 color subsampling (no subsampling)
S422
enumerator¶
4:2:2 color subsampling (horizontal subsampling)
S420
enumerator¶
4:2:0 color subsampling (both horizontal and vertical subsampling)
Corners
typedef¶
Corners = CornersOf<int32_t>
Type alias for corners using 32-bit integers.
CornersF
typedef¶
CornersF = CornersOf<float>
Type alias for corners using single-precision floating-point numbers.
CornersOf
class¶
template <typename T> CornersOf
A structure representing the corners of a rectangle or bounding box in 2D space.
This structure defines four corner points of a rectangle using two-dimensional coordinates:
(x1y1) for the top-left corner, (x2y1) for the top-right corner,
(x1y2) for the bottom-left corner, and (x2y2) for the bottom-right corner. It provides methods for
constructing, accessing, and manipulating these corners.
Template param T
The type of the corner coordinates (e.g., int, float).
template <typename T> CornersOf
A structure representing the corners of a rectangle or bounding box in 2D space.
This structure defines four corner points of a rectangle using two-dimensional coordinates:
(x1y1) for the top-left corner, (x2y1) for the top-right corner,
(x1y2) for the bottom-left corner, and (x2y2) for the bottom-right corner. It provides methods for
constructing, accessing, and manipulating these corners.
Template param T
The type of the corner coordinates (e.g., int, float).
CornersOf<T>
function¶
constexpr CornersOf() noexcept : x1y1
Default constructor that initializes corners to zero.
constexpr CornersOf(T value) noexcept
: x1y1(value), x2y1(value), x1y2(value), x2y2(value)
Constructor that initializes all corners to a specific value.
Param value
The value to initialize all corner coordinates.
template <std::convertible_to<T> U>
constexpr CornersOf(U v) : CornersOf(static_cast<T>(v))
Constructor that initializes corners from a convertible type.
Template param U
The type to convert from.
Param v
The value to convert and initialize corners.
constexpr CornersOf(T x1y1, T x2y1, T x1y2, T x2y2) noexcept
: x1y1(x1y1), x2y1(x2y1), x1y2(x1y2), x2y2(x2y2)
Constructor that initializes corners with specified coordinates.
Param x1y1
The coordinate of the top-left corner.
Param x2y1
The coordinate of the top-right corner.
Param x1y2
The coordinate of the bottom-left corner.
Param x2y2
The coordinate of the bottom-right corner.
constexpr CornersOf(const CornersOf &b) noexcept = default
Copy constructor.
Param b
The CornersOf instance to copy from.
operator[]
function¶
T operator[](size_t i) const noexcept
Access operator for retrieving corner coordinate by index.
Param i
The index of the coordinate (0 for x1y1, 1 for x2y1, 2 for x1y2, 3 for x2y2).
Returns The coordinate value at index i.
T &operator[](size_t i) noexcept
Access operator for modifying corner coordinate by index.
Param i
The index of the coordinate (0 for x1y1, 1 for x2y1, 2 for x1y2, 3 for x2y2).
Returns A reference to the coordinate value at index i.
operator==
function¶
constexpr bool operator==(const CornersOf &c) const noexcept
Checks if two CornersOf instances are equal.
Param c
The CornersOf instance to compare against.
Returns True if both instances are equal; otherwise false.
components
variable¶
T components[4]
An array to access the corner coordinates directly.
x1y1
variable¶
T x1y1
The coordinate of the bottom-left corner.
x2y1
variable¶
T x2y1
The coordinate of the bottom-right corner.
x1y2
variable¶
T x1y2
The coordinate of the top-left corner.
x2y2
variable¶
T x2y2
The coordinate of the top-right corner.
CornersOf
class¶
template <SIMDCompatible T> CornersOf
A specialized CornersOf structure for SIMD-compatible types.
This specialization leverages SIMD operations for better performance when working with corners.
It allows for various arithmetic and utility operations using SIMD vectors.
Template param T
The SIMD-compatible type of the corner coordinates.
CornersOf<type-parameter-0-0>
function¶
constexpr CornersOf() noexcept : v()
Default constructor that initializes corners to zero.
constexpr CornersOf(T value) noexcept : v(value)
Constructor that initializes all corners to a specific value.
Param value
The value to initialize all corner coordinates.
template <std::convertible_to<T> U>
constexpr CornersOf(U v) : CornersOf(static_cast<T>(v))
Constructor that initializes corners from a convertible type.
Template param U
The type to convert from.
Param v
The value to convert and initialize corners.
constexpr CornersOf(T x1y1, T x2y1, T x1y2, T x2y2) noexcept
: v(x1y1, x2y1, x1y2, x2y2)
Constructor that initializes corners with specified coordinates.
Param x1y1
The coordinate of the top-left corner.
Param x2y1
The coordinate of the top-right corner.
Param x1y2
The coordinate of the bottom-left corner.
Param x2y2
The coordinate of the bottom-right corner.
constexpr CornersOf(const CornersOf &b) noexcept = default
Copy constructor.
Param b
The CornersOf instance to copy from.
operator CornersOf<type-parameter-1-0>
function¶
template <typename U> operator CornersOf<U>() const noexcept
Conversion operator to a different CornersOf type.
Template param U
The type to convert to.
Returns A new CornersOf instance of type U.
operator[]
function¶
T operator[](size_t i) const noexcept
Access operator for retrieving corner coordinate by index.
Param i
The index of the coordinate (0 for x1y1, 1 for x2y1, 2 for x1y2, 3 for x2y2).
Returns The coordinate value at index i.
T &operator[](size_t i) noexcept
Access operator for modifying corner coordinate by index.
Param i
The index of the coordinate (0 for x1y1, 1 for x2y1, 2 for x1y2, 3 for x2y2).
Returns A reference to the coordinate value at index i.
operator==
function¶
constexpr bool operator==(const CornersOf &c) const noexcept
Checks if two CornersOf instances are equal.
Param c
The CornersOf instance to compare against.
Returns True if both instances are equal; otherwise false.
min
function¶
T min() const noexcept
Gets the minimum coordinate among the corners.
Returns The minimum corner coordinate.
max
function¶
T max() const noexcept
Gets the maximum coordinate among the corners.
Returns The maximum corner coordinate.
empty
function¶
bool empty() const noexcept
Checks if the corners are empty.
Returns True if the sum of corner coordinates is zero; otherwise false.
v
variable¶
SIMD<T, 4> v
The SIMD vector representing the corners.
components
variable¶
T components[4]
An array to access the corner coordinates directly.
x1y1
variable¶
T x1y1
The coordinate of the bottom-left corner.
x2y1
variable¶
T x2y1
The coordinate of the bottom-right corner.
x1y2
variable¶
T x1y2
The coordinate of the top-left corner.
x2y2
variable¶
T x2y2
The coordinate of the top-right corner.
Edges
typedef¶
Edges = EdgesOf<int32_t>
Type alias for edges using 32-bit integers.
EdgesF
typedef¶
EdgesF = EdgesOf<float>
Type alias for edges using single-precision floating-point numbers.
EdgesOf
class¶
template <typename T> EdgesOf
A structure representing the edges of a rectangle or bounding box in 2D space.
This structure defines the edges using four coordinates: (x1, y1) for one corner
and (x2, y2) for the opposite corner. It provides methods for constructing, accessing,
and manipulating these edges.
Template param T
The type of the edge coordinates (e.g., int, float).
template <typename T> EdgesOf
A structure representing the edges of a rectangle or bounding box in 2D space.
This structure defines the edges using four coordinates: (x1, y1) for one corner
and (x2, y2) for the opposite corner. It provides methods for constructing, accessing,
and manipulating these edges.
Template param T
The type of the edge coordinates (e.g., int, float).
EdgesOf<T>
function¶
constexpr EdgesOf() noexcept : x1
Default constructor that initializes edges to (0, 0, 0, 0).
constexpr EdgesOf(T value) noexcept
: x1(value), y1(value), x2(value), y2(value)
Constructor that initializes all edges to a specific value.
Param value
The value to initialize all edge coordinates.
template <std::convertible_to<T> U>
constexpr EdgesOf(U v) : EdgesOf(static_cast<T>(v))
Constructor that initializes edges from a convertible type.
Template param U
The type to convert from.
Param v
The value to convert and initialize edges.
constexpr EdgesOf(T h, T v) noexcept
: x1(h), y1(v), x2(h), y2(v)
Constructor that initializes edges with specified horizontal and vertical values.
Param h
The horizontal value for x1 and x2.
Param v
The vertical value for y1 and y2.
constexpr EdgesOf(T x1, T y1, T x2, T y2) noexcept
: x1(x1), y1(y1), x2(x2), y2(y2)
Constructor that initializes edges with four specified coordinates.
Param x1
The x-coordinate of the first edge.
Param y1
The y-coordinate of the first edge.
Param x2
The x-coordinate of the second edge.
Param y2
The y-coordinate of the second edge.
constexpr EdgesOf(const EdgesOf &b) noexcept = default
Copy constructor.
Param b
The EdgesOf instance to copy from.
operator[]
function¶
T operator[](size_t i) const noexcept
Access operator for retrieving edge coordinate by index.
Param i
The index of the coordinate (0 for x1, 1 for y1, 2 for x2, 3 for y2).
Returns The coordinate value at index i.
T &operator[](size_t i) noexcept
Access operator for modifying edge coordinate by index.
Param i
The index of the coordinate (0 for x1, 1 for y1, 2 for x2, 3 for y2).
Returns A reference to the coordinate value at index i.
operator==
function¶
constexpr bool operator==(const EdgesOf &c) const noexcept
Checks if two EdgesOf instances are equal.
Param c
The EdgesOf instance to compare against.
Returns True if both instances are equal; otherwise false.
operator!=
function¶
constexpr bool operator!=(const EdgesOf &c) const noexcept
Checks if two EdgesOf instances are not equal.
Param c
The EdgesOf instance to compare against.
Returns True if both instances are not equal; otherwise false.
components
variable¶
T components[4]
An array to access the edge coordinates directly.
x1
variable¶
T x1
The x-coordinate of the first edge.
y1
variable¶
T y1
The y-coordinate of the first edge.
x2
variable¶
T x2
The x-coordinate of the second edge.
y2
variable¶
T y2
The y-coordinate of the second edge.
EdgesOf
class¶
template <SIMDCompatible T> EdgesOf
A specialized EdgesOf structure for SIMD-compatible types.
This specialization leverages SIMD operations for better performance
when working with edges. It allows for various arithmetic and utility
operations using SIMD vectors.
Template param T
The SIMD-compatible type of the edge coordinates.
EdgesOf<type-parameter-0-0>
function¶
constexpr EdgesOf() noexcept : v()
Default constructor that initializes edges to (0, 0, 0, 0).
constexpr explicit EdgesOf(T value) noexcept : v(value)
Constructor that initializes all edges to a specific value.
Param value
The value to initialize all edge coordinates.
constexpr EdgesOf(T h, T v) noexcept : v(h, v, h, v)
Constructor that initializes edges with specified horizontal and vertical values.
Param h
The horizontal value for x1 and x2.
Param v
The vertical value for y1 and y2.
constexpr EdgesOf(T x1, T y1, T x2, T y2) noexcept
: v(x1, y1, x2, y2)
Constructor that initializes edges with four specified coordinates.
Param x1
The x-coordinate of the first edge.
Param y1
The y-coordinate of the first edge.
Param x2
The x-coordinate of the second edge.
Param y2
The y-coordinate of the second edge.
constexpr explicit EdgesOf(const SIMD<T, 4> &v) noexcept
: v(v)
Constructor that initializes from a SIMD vector.
Param v
The SIMD vector to initialize edges from.
constexpr EdgesOf(const EdgesOf &b) noexcept = default
Copy constructor.
Param b
The EdgesOf instance to copy from.
operator EdgesOf<type-parameter-1-0>
function¶
template <typename U> operator EdgesOf<U>() const noexcept
Conversion operator to a different EdgesOf type.
Template param U
The type to convert to.
Returns A new EdgesOf instance of type U.
round
function¶
constexpr EdgesOf round() const noexcept
Rounds the edge coordinates to the nearest integer.
Returns A new EdgesOf instance with rounded coordinates.
floor
function¶
constexpr EdgesOf floor() const noexcept
Floors the edge coordinates to the nearest lower integer.
Returns A new EdgesOf instance with floored coordinates.
ceil
function¶
constexpr EdgesOf ceil() const noexcept
Ceils the edge coordinates to the nearest higher integer.
Returns A new EdgesOf instance with ceiled coordinates.
trunc
function¶
constexpr EdgesOf trunc() const noexcept
Truncates the edge coordinates towards zero.
Returns A new EdgesOf instance with truncated coordinates.
size
function¶
SizeOf<T> size() const noexcept
Returns the size of the edges as a SizeOf instance.
Returns A SizeOf instance representing the total width and height.
operator*
function¶
EdgesOf operator*(T value) const noexcept
Multiplies the edges by a scalar value.
Param value
The scalar value to multiply.
Returns A new EdgesOf instance with multiplied edges.
operator+
function¶
EdgesOf operator+(T value) const noexcept
Adds a scalar value to the edges.
Param value
The scalar value to add.
Returns A new EdgesOf instance with added edges.
operator-
function¶
EdgesOf operator-(T value) const noexcept
Subtracts a scalar value from the edges.
Param value
The scalar value to subtract.
Returns A new EdgesOf instance with subtracted edges.
horizontal
function¶
T horizontal() const noexcept
Gets the horizontal size of the edges.
Returns The width of the edges.
vertical
function¶
T vertical() const noexcept
Gets the vertical size of the edges.
Returns The height of the edges.
empty
function¶
bool empty() const noexcept
Checks if the edges are empty.
Returns True if the sum of horizontal dimensions is zero; otherwise false.
min
function¶
T min() const noexcept
Gets the minimum coordinate among the edges.
Returns The minimum edge coordinate.
max
function¶
T max() const noexcept
Gets the maximum coordinate among the edges.
Returns The maximum edge coordinate.
leading
function¶
PointOf<T> leading() const noexcept
Returns the leading edge point.
Returns A PointOf instance representing the leading edge.
trailing
function¶
PointOf<T> trailing() const noexcept
Returns the trailing edge point.
Returns A PointOf instance representing the trailing edge.
operator[]
function¶
T operator[](size_t i) const noexcept
Access operator for retrieving edge coordinate by index.
Param i
The index of the coordinate (0 for x1, 1 for y1, 2 for x2, 3 for y2).
Returns The coordinate value at index i.
T &operator[](size_t i) noexcept
Access operator for modifying edge coordinate by index.
Param i
The index of the coordinate (0 for x1, 1 for y1, 2 for x2, 3 for y2).
Returns A reference to the coordinate value at index i.
operator==
function¶
constexpr bool operator==(const EdgesOf &c) const noexcept
Checks if two EdgesOf instances are equal.
Param c
The EdgesOf instance to compare against.
Returns True if both instances are equal; otherwise false.
operator!=
function¶
constexpr bool operator!=(const EdgesOf &c) const noexcept
Checks if two EdgesOf instances are not equal.
Param c
The EdgesOf instance to compare against.
Returns True if both instances are not equal; otherwise false.
v
variable¶
SIMD<T, 4> v
The SIMD vector representing the edges.
components
variable¶
T components[4]
An array to access the edge coordinates directly.
x1
variable¶
T x1
The x-coordinate of the first edge.
y1
variable¶
T y1
The y-coordinate of the first edge.
x2
variable¶
T x2
The x-coordinate of the second edge.
y2
variable¶
T y2
The y-coordinate of the second edge.
FillOrStrokeParams
typedef¶
FillOrStrokeParams = std::variant<FillParams, StrokeParams>
A type alias for fill or stroke parameters, using std::variant.
FillParams
class¶
FillParams
Structure representing fill parameters.
fillRule
variable¶
FillRule fillRule
The fill rule to be used.
FillRule
enum¶
enum class FillRule : uint8_t
Enum representing the fill rules for paths.
EvenOdd
enumerator¶
Even-Odd fill rule.
Winding
enumerator¶
Winding fill rule.
Font
class¶
Font
Represents font properties and settings for text rendering.
Font
Represents font properties and settings for text rendering.
fontFamily
variable¶
FontFamily fontFamily = FontFamily::Default
The font family.
fontSize
variable¶
float fontSize = 10.f
The size of the font in points.
style
variable¶
FontStyle style = FontStyle::Normal
The style of the font (e.g., normal, italic).
weight
variable¶
FontWeight weight = FontWeight::Regular
The weight of the font (e.g., regular, bold).
textDecoration
variable¶
TextDecoration textDecoration = TextDecoration::None
Text decoration (e.g., underline, none).
lineHeight
variable¶
float lineHeight = 1.2f
Line height as a multiplier.
tabWidth
variable¶
float tabWidth = 8.f
Tab width in space units.
letterSpacing
variable¶
float letterSpacing = 0.f
Additional space between letters.
wordSpacing
variable¶
float wordSpacing = 0.f
Additional space between words.
verticalAlign
variable¶
float verticalAlign = 0.f
Vertical alignment offset.
features
variable¶
OpenTypeFeatureFlags features
OpenType features for advanced text styling.
operator()
function¶
Font operator()(FontFamily fontFamily) const
Creates a copy of the font with a new font family.
Param fontFamily
The new font family.
Returns Font A copy with the updated font family.
Font operator()(float fontSize) const
Creates a copy of the font with a new font size.
Param fontSize
The new font size.
Returns Font A copy with the updated font size.
Font operator()(FontStyle style) const
Creates a copy of the font with a new style.
Param style
The new font style.
Returns Font A copy with the updated font style.
Font operator()(FontWeight weight) const
Creates a copy of the font with a new weight.
Param weight
The new font weight.
Returns Font A copy with the updated font weight.
operator==
function¶
bool operator==(const Font &b) const noexcept = default
Compares two fonts for equality.
FontMetrics
class¶
FontMetrics
FontMetricsRepresents metrics for a font, providing details about its dimensions and spacing.
size
variable¶
float size
The size of the font in points.
ascender
variable¶
float ascender
The ascender height, always positive and points upwards.
descender
variable¶
float descender
The descender height, always negative and points downwards.
height
variable¶
float height
The total height of the font, including ascender, descender, and line gap.
spaceAdvanceX
variable¶
float spaceAdvanceX
The horizontal advance width for a space character.
lineThickness
variable¶
float lineThickness
The thickness of lines, such as for underline or strikethrough.
xHeight
variable¶
float xHeight
The height of the lowercase 'x' character.
capitalHeight
variable¶
float capitalHeight
The height of uppercase characters.
linegap
function¶
float linegap() const noexcept
Computes the line gap, the vertical space between lines of text.
Returns The line gap value.
vertBounds
function¶
float vertBounds() const noexcept
Computes the vertical bounds of the font.
Returns The total vertical bounds (ascender - descender).
underlineOffset
function¶
float underlineOffset() const noexcept
Computes the offset for an underline relative to the baseline.
Returns The underline offset.
overlineOffset
function¶
float overlineOffset() const noexcept
Computes the offset for an overline relative to the baseline.
Returns The overline offset.
lineThroughOffset
function¶
float lineThroughOffset() const noexcept
Computes the offset for a line through the text.
Returns The line-through offset.
operator==
function¶
bool operator==(const FontMetrics &b) const noexcept =
default
Compares two FontMetrics objects for equality.
Param b
The FontMetrics object to compare against.
Returns True if the objects are equal, false otherwise.
FontStyleAndWeight
class¶
FontStyleAndWeight
Combines font style and weight for simplified handling.
style
variable¶
FontStyle style = FontStyle::Normal
The font style (e.g., normal, italic).
weight
variable¶
FontWeight weight = FontWeight::Regular
The font weight (e.g., regular, bold).
operator==
function¶
bool operator==(
const FontStyleAndWeight &b) const noexcept = default
Compares two FontStyleAndWeight objects for equality.
Glyph
class¶
Glyph
Represents an individual glyph with its properties and positioning information.
glyph
variable¶
uint32_t glyph = UINT32_MAX
The glyph ID, identifying the specific glyph in the font.
codepoint
variable¶
char32_t codepoint = UINT32_MAX
The Unicode codepoint represented by this glyph.
pos
variable¶
PointF pos
Position of the glyph relative to its parent context.
left_caret
variable¶
float left_caret = -1.f
The position of the left caret for the glyph.
right_caret
variable¶
float right_caret = -1.f
The position of the right caret for the glyph.
begin_char
variable¶
uint32_t begin_char = UINT32_MAX
The index of the first character in the cluster associated with the glyph.
end_char
variable¶
uint32_t end_char = UINT32_MAX
The index of the first character after the cluster associated with the glyph. This marks the position immediately following the last character in the cluster.
dir
variable¶
TextDirection dir = TextDirection::LTR
The text direction for this glyph (e.g., left-to-right or right-to-left).
flags
variable¶
GlyphFlags flags = GlyphFlags::None
Flags providing additional properties or states of the glyph.
caretForDirection
function¶
float caretForDirection(bool inverse) const
Computes the caret position for the glyph based on the text direction.
Param inverse
If true, calculates the caret in the opposite direction.
Returns float The computed caret position.
Note This is an internal method and should not be used directly.
load
function¶
optional<GlyphData> load(const GlyphRun &run) const
Loads and renders the glyph into SpriteResource
.
Param run
The glyph run containing this glyph.
Returns optional<GlyphData> The loaded glyph data if available, or an empty value otherwise.
Note This is an internal method and should not be used directly.
GlyphData
class¶
GlyphData
Contains detailed data about a single glyph, including its metrics and rendered sprite.
GlyphData
Contains detailed data about a single glyph, including its metrics and rendered sprite.
size
variable¶
Size size
The size of the glyph in its rendered form.
sprite
variable¶
RC<SpriteResource> sprite
A reference-counted resource pointing to the sprite used to render the glyph.
offset_x
variable¶
float offset_x
The horizontal offset from the glyph's origin to the start of its shape.
Known as the "left bearing," this value determines the space between the glyph's origin and the leftmost edge of its bounding box.
offset_y
variable¶
int offset_y
The vertical offset from the glyph's origin to the top of its shape.
Known as the "top bearing," this value is positive for upwards Y-coordinates and determines the space between the glyph's baseline and the topmost edge of its bounding box.
advance_x
variable¶
float advance_x
The horizontal distance to advance to the next glyph's origin.
This is the space the glyph occupies horizontally, including the glyph itself and any trailing whitespace.
GlyphFlags
enum¶
enum class GlyphFlags : uint8_t
GlyphFlagsFlags used to define various properties of glyphs.
This enum class defines a set of flags used to represent different characteristics of glyphs, which are typically used in text rendering or processing.
None
enumerator¶
No special properties.
The glyph has no special attributes or flags.
SafeToBreak
enumerator¶
Glyph can be safely broken across lines.
Indicates that this glyph can be safely broken when wrapping text across multiple lines.
AtLineBreak
enumerator¶
Glyph is at a line break position.
Marks this glyph as occurring at a line break (e.g., the glyph is at the end of a line or paragraph).
IsControl
enumerator¶
Glyph represents a control character.
This flag indicates that the glyph is a control character, such as a non-printing character used for text formatting or control.
IsPrintable
enumerator¶
Glyph is printable.
Indicates that this glyph is part of the visible text and can be printed or displayed on screen.
IsCompactedWhitespace
enumerator¶
Glyph is compacted whitespace.
Denotes that the glyph represents whitespace at a line break which doesn't extend the visual line bounds. This is commonly used to indicate collapsed or compacted whitespace characters.
GlyphRun
class¶
GlyphRun
Represents a sequence of glyphs along with their associated properties.
The GlyphRun
struct encapsulates the properties and operations of a run of glyphs,
including positioning, font information, and range calculations.
GlyphRun
Represents a sequence of glyphs along with their associated properties.
The GlyphRun
struct encapsulates the properties and operations of a run of glyphs,
including positioning, font information, and range calculations.
glyphs
variable¶
Internal::GlyphList glyphs
List of glyphs contained in this run in visual order (left-to-right).
face
variable¶
Internal::FontFace *face
Pointer to the font face associated with the glyph run.
fontSize
variable¶
float fontSize = 0
Font size of the glyph run.
metrics
variable¶
FontMetrics metrics
Metrics of the font used in the glyph run.
decoration
variable¶
TextDecoration decoration = TextDecoration::None
Text decoration applied to the glyph run (e.g., underline, strikethrough).
direction
variable¶
TextDirection direction
Text direction of the glyph run (left-to-right or right-to-left).
rangesValid
variable¶
mutable bool rangesValid = false
Indicates whether the horizontal ranges are valid and up-to-date.
textHRange
variable¶
mutable InclusiveRange<float> textHRange
Horizontal range of all glyphs in the run.
alignmentHRange
variable¶
mutable InclusiveRange<float> alignmentHRange
Horizontal range of glyphs, excluding whitespace at line breaks.
printableHRange
variable¶
mutable InclusiveRange<float> printableHRange
Horizontal range of printable glyphs in the run.
visualOrder
variable¶
int32_t visualOrder
Visual order of the glyph run within the text.
verticalAlign
variable¶
float verticalAlign
Vertical offset of the glyph run relative to the text baseline.
position
variable¶
PointF position
Position of the left-most point of the glyph run at the text baseline.
bounds
function¶
RectangleF bounds(GlyphRunBounds boundsType) const
Returns the bounds of the glyph run.
Param boundsType
Specifies the type of bounds to compute.
Returns RectangleF The computed bounds of the glyph run.
size
function¶
SizeF size(GlyphRunBounds boundsType) const
Returns the size of the glyph run.
Param boundsType
Specifies the type of bounds to consider for size calculation.
Returns SizeF The size of the glyph run.
invalidateRanges
function¶
void invalidateRanges()
Marks the horizontal ranges of the glyph run as invalid.
Call this function whenever glyph modifications require recalculating ranges.
updateRanges
function¶
void updateRanges() const
Updates the horizontal ranges of the glyph run.
Ensures the ranges (e.g., textHRange
, alignmentHRange
, printableHRange
)
are valid and accurate.
breakAt
function¶
GlyphRun breakAt(float width, bool allowEmpty,
bool wrapAnywhere) &
Returns the widest glyph run that fits within the specified width and removes those glyphs.
Param width
The maximum width available for the glyph run.
Param allowEmpty
A boolean flag that determines whether an empty glyph run is allowed as a result.
Returns GlyphRun The widest glyph run that fits within the specified width.
flags
function¶
Internal::GlyphFlags flags() const
Retrieves the glyph flags associated with the glyph run.
Returns Internal::GlyphFlags The flags indicating properties or states of the glyphs.
charRange
function¶
Range<uint32_t> charRange() const
Retrieves the character range covered by the glyph run.
Returns Range<uint32_t> The range of characters covered by this glyph run.
GlyphRunBounds
enum¶
enum class GlyphRunBounds
Specifies the types of bounds that can be calculated for a glyph run.
Text
enumerator¶
Bounds that consider all glyphs in the run, including whitespace.
Alignment
enumerator¶
Bounds that exclude whitespace at line breaks.
Printable
enumerator¶
Bounds that consider only printable glyphs in the run.
Gradient
class¶
Gradient
Represents a gradient for rendering.
Gradient
Represents a gradient for rendering.
explicit Gradient(GradientType type)
Constructs a gradient of a specified type.
Param type
The type of the gradient.
explicit Gradient(GradientType type, PointF startPoint,
PointF endPoint)
Constructs a gradient of a specified type between two points.
Param type
The type of the gradient.
Param startPoint
The starting point of the gradient.
Param endPoint
The ending point of the gradient.
getStartPoint
function¶
PointF getStartPoint() const
Gets the starting point of the gradient.
Returns The starting point of the gradient.
setStartPoint
function¶
void setStartPoint(PointF pt)
Sets the starting point of the gradient.
Param pt
The new starting point.
getEndPoint
function¶
PointF getEndPoint() const
Gets the ending point of the gradient.
Returns The ending point of the gradient.
setEndPoint
function¶
void setEndPoint(PointF pt)
Sets the ending point of the gradient.
Param pt
The new ending point.
addStop
function¶
void addStop(float position, ColorF color)
Adds a color stop to the gradient.
Param position
The position of the color stop (between 0.0 and 1.0).
Param color
The color of the stop.
colorStops
function¶
const ColorStopArray &colorStops() const
Gets the array of color stops defined in the gradient.
Returns A reference to the array of color stops.
rasterize
function¶
RC<GradientResource> rasterize() const
Rasterizes the gradient into a GradientResource.
Returns A reference-counted pointer to the rasterized gradient resource.
m_type
variable¶
GradientType m_type
The type of the gradient.
m_startPoint
variable¶
PointF m_startPoint
The starting point of the gradient.
m_endPoint
variable¶
PointF m_endPoint
The ending point of the gradient.
m_colorStops
variable¶
ColorStopArray m_colorStops
The color stops for the gradient.
GradientData
class¶
GradientData
Struct for storing gradient data.
explicit GradientData(const Gradient &gradient)
Constructs GradientData from a Gradient object.
Param gradient
The gradient from which to construct the data.
explicit GradientData(const function<ColorF(float)> &func)
Constructs GradientData from a function mapping float to ColorF.
Param func
The function to map positions to colors.
explicit GradientData(const std::vector<ColorF> &list,
float gamma)
Constructs GradientData from a vector of colors and a gamma correction factor.
Param list
A vector of colors to use in the gradient.
Param gamma
The gamma correction factor to apply.
operator()
function¶
ColorF operator()(float x) const
Gets the color at a specified position.
Param x
The position (between 0.0 and 1.0) to query.
Returns The color at the specified position in the gradient.
GradientResource
class¶
GradientResource
Represents a resource associated with a gradient.
id
variable¶
uint64_t id
Unique identifier for the gradient resource.
data
variable¶
GradientData data
The gradient data.
GradientType
enum¶
enum class GradientType : int
Enumeration for different types of gradients.
Linear
enumerator¶
A linear gradient.
Radial
enumerator¶
A radial gradient.
Angle
enumerator¶
An angular gradient.
Reflected
enumerator¶
A reflected gradient.
Diamond
enumerator¶
A diamond gradient.
InsideOutside
enumerator¶
An inside-outside gradient.
ImageCodec
enum¶
enum class ImageCodec
Enum representing the various image codecs supported for encoding and decoding.
PNG
enumerator¶
Portable Network Graphics
BMP
enumerator¶
Bitmap Image File
JPEG
enumerator¶
Joint Photographic Experts Group
WEBP
enumerator¶
WebP Image Format
ImageIOError
enum¶
enum class ImageIOError
Enum representing potential image I/O errors.
CodecError
enumerator¶
Error related to codec processing
InvalidFormat
enumerator¶
Error due to an invalid image format
JoinStyle
enum¶
enum class JoinStyle : uint8_t
Enum representing different join styles for strokes.
Miter
enumerator¶
Miter join style.
Bevel
enumerator¶
Bevel join style.
Round
enumerator¶
Round join style.
MatrixOf
class¶
template <typename T> MatrixOf
Represents a 2D matrix of floating point values.
This template class provides a 2D transformation matrix implementation with
support for translation, scaling, rotation, reflection, and skewing. It
works on any floating-point type (e.g., float, double).
Template param T
The type of floating-point values (e.g., float or double).
v
variable¶
vec_type v
Array of SIMD vectors for efficient storage.
a
variable¶
T a
Individual matrix coefficients.
b
variable¶
T a, b
Individual matrix coefficients.
c
variable¶
T a, b, c
Individual matrix coefficients.
d
variable¶
T a, b, c, d
Individual matrix coefficients.
e
variable¶
T a, b, c, d, e
Individual matrix coefficients.
f
variable¶
T a, b, c, d, e, f
Individual matrix coefficients.
MatrixOf<T>
function¶
constexpr MatrixOf() : MatrixOf(1, 0, 0, 1, 0, 0)
Constructs an identity matrix.
constexpr MatrixOf(T a, T b, T c, T d, T e, T f) : v
Constructs a matrix with specified coefficients.
Param a
Matrix coefficient at position (0,0).
Param b
Matrix coefficient at position (0,1).
Param c
Matrix coefficient at position (1,0).
Param d
Matrix coefficient at position (1,1).
Param e
Matrix translation component along the x-axis.
Param f
Matrix translation component along the y-axis.
coefficients
function¶
constexpr std::array<T, 6> coefficients() const
Returns the matrix coefficients as an array.
Returns std::array<T, 6> The array of coefficients {a, b, c, d, e, f}.
MatrixOf<T>
function¶
constexpr explicit MatrixOf(const vec_type &v) : v(v)
Constructs a matrix from a given vector type.
Param v
The vector type representing the matrix.
translate
function¶
constexpr MatrixOf translate(PointOf<T> offset) const
Translates the matrix by a given point offset.
Param offset
The point by which to translate.
Returns MatrixOf The translated matrix.
constexpr MatrixOf translate(T x, T y) const
Translates the matrix by given x and y offsets.
Param x
The x-axis translation.
Param y
The y-axis translation.
Returns MatrixOf The translated matrix.
scale
function¶
constexpr MatrixOf scale(T x, T y) const
Scales the matrix by the given x and y scaling factors.
Param x
The x-axis scaling factor.
Param y
The y-axis scaling factor.
Returns MatrixOf The scaled matrix.
constexpr MatrixOf scale(T x, T y, PointOf<T> origin) const
Scales the matrix by the given x and y scaling factors with respect to an origin point.
Param x
The x-axis scaling factor.
Param y
The y-axis scaling factor.
Param origin
The origin point.
Returns MatrixOf The scaled matrix.
constexpr MatrixOf scale(T x, T y, T originx,
T originy) const
Scales the matrix by the given x and y scaling factors with respect to a specified origin.
Param x
The x-axis scaling factor.
Param y
The y-axis scaling factor.
Param originx
The x-coordinate of the origin.
Param originy
The y-coordinate of the origin.
Returns MatrixOf The scaled matrix.
skew
function¶
constexpr MatrixOf skew(T x, T y) const
Skews the matrix by the given x and y skewness coefficients.
Param x
The x-axis skew coefficient.
Param y
The y-axis skew coefficient.
Returns MatrixOf The skewed matrix.
constexpr MatrixOf skew(T x, T y, PointOf<T> origin) const
Skews the matrix by the given x and y skewness coefficients with respect to an origin point.
Param x
The x-axis skew coefficient.
Param y
The y-axis skew coefficient.
Param origin
The origin point.
Returns MatrixOf The skewed matrix.
constexpr MatrixOf skew(T x, T y, T originx,
T originy) const
Skews the matrix by the given x and y skewness coefficients with respect to a specified origin.
Param x
The x-axis skew coefficient.
Param y
The y-axis skew coefficient.
Param originx
The x-coordinate of the origin.
Param originy
The y-coordinate of the origin.
Returns MatrixOf The skewed matrix.
rotate
function¶
constexpr MatrixOf rotate(T angle) const
Rotates the matrix by the given angle (in degrees).
Param angle
The angle in degrees.
Returns MatrixOf The rotated matrix.
constexpr MatrixOf rotate(T angle, PointOf<T> origin) const
Rotates the matrix by the given angle (in degrees) with respect to an origin point.
Param angle
The angle in degrees.
Param origin
The origin point for rotation.
Returns MatrixOf The rotated matrix.
constexpr MatrixOf rotate(T angle, T originx,
T originy) const
Rotates the matrix by the given angle (in degrees) with respect to a specified origin.
Param angle
The angle in degrees.
Param originx
The x-coordinate of the origin.
Param originy
The y-coordinate of the origin.
Returns MatrixOf The rotated matrix.
rotate90
function¶
constexpr MatrixOf rotate90(int angle) const
Rotates the matrix by a multiple of 90 degrees.
Param angle
The multiple of 90 degrees to rotate (e.g., 90, 180, 270).
Returns MatrixOf The rotated matrix.
constexpr MatrixOf rotate90(int angle,
PointOf<T> origin) const
Rotates the matrix by a multiple of 90 degrees with respect to a point.
Param angle
The multiple of 90 degrees to rotate (e.g., 90, 180, 270).
Param origin
The origin point for rotation.
Returns MatrixOf The rotated matrix.
constexpr MatrixOf rotate90(int angle, T originx,
T originy) const
Rotates the matrix by a multiple of 90 degrees with respect to an origin.
Param angle
The multiple of 90 degrees to rotate (e.g., 90, 180, 270).
Param originx
The x-coordinate of the origin.
Param originy
The y-coordinate of the origin.
Returns MatrixOf The rotated matrix.
reflect
function¶
constexpr MatrixOf reflect(FlipAxis axis) const
Reflects the matrix over the specified axis.
Param axis
The axis of reflection (X, Y, or Both).
Returns MatrixOf The reflected matrix.
constexpr MatrixOf reflect(FlipAxis axis,
PointOf<T> origin) const
Reflects the matrix over the specified axis with respect to a point.
Param axis
The axis of reflection (X, Y, or Both).
Param origin
The origin point for the reflection.
Returns MatrixOf The reflected matrix.
constexpr MatrixOf reflect(FlipAxis axis, T originx,
T originy) const
Reflects the matrix over the specified axis with respect to an origin.
Param axis
The axis of reflection (X, Y, or Both).
Param originx
The x-coordinate of the origin.
Param originy
The y-coordinate of the origin.
Returns MatrixOf The reflected matrix.
translation
function¶
static constexpr MatrixOf translation(T x, T y)
Creates a translation matrix.
Param x
Translation along the x-axis.
Param y
Translation along the y-axis.
Returns MatrixOf The translation matrix.
scaling
function¶
static constexpr MatrixOf scaling(T x, T y)
Creates a scaling matrix.
Param x
Scaling factor along the x-axis.
Param y
Scaling factor along the y-axis.
Returns MatrixOf The scaling matrix.
rotation
function¶
static constexpr MatrixOf rotation(T angle)
Creates a rotation matrix.
Param angle
The rotation angle in degrees.
Returns MatrixOf The rotation matrix.
rotation90
function¶
static constexpr MatrixOf rotation90(int angle)
Creates a 90-degree rotation matrix.
Param angle
The multiple of 90 degrees (0, 90, 180, or 270).
Returns MatrixOf The 90-degree rotation matrix.
reflection
function¶
static constexpr MatrixOf reflection(FlipAxis axis)
Creates a reflection matrix over the specified axis.
Param axis
The axis of reflection (X, Y, or Both).
Returns MatrixOf The reflection matrix.
skewness
function¶
static constexpr MatrixOf skewness(T x, T y)
Creates a skewness matrix.
Param x
The x-axis skew factor.
Param y
The y-axis skew factor.
Returns MatrixOf The skewness matrix.
flatten
function¶
constexpr SIMD<T, 6> flatten() const noexcept
Flattens the matrix coefficients into a SIMD array.
Returns SIMD<T, 6> The flattened matrix.
operator==
function¶
constexpr bool operator==(const MatrixOf<T> &m) const
Checks if two matrices are equal.
Param m
The matrix to compare with.
Returns true if the matrices are equal, false otherwise.
operator!=
function¶
constexpr bool operator!=(const MatrixOf<T> &m) const
Checks if two matrices are not equal.
Param m
The matrix to compare with.
Returns true if the matrices are not equal, false otherwise.
transform
function¶
constexpr RectangleOf<T> transform(RectangleOf<T> pt) const
Transforms a rectangle using the matrix.
Param pt
The rectangle to transform.
Returns RectangleOf<T> The transformed rectangle.
estimateScale
function¶
constexpr T estimateScale() const
Estimates the average scaling factor of the matrix.
This method calculates an average scale by computing the hypotenuse of
the matrix's first two columns and averaging them.
Returns T The estimated scaling factor.
transform
function¶
constexpr PointOf<T> transform(PointOf<T> pt) const
Transforms a point using the matrix.
Applies a 2D transformation to a given point using the current matrix.
The transformation follows the formula: \(x' = x \cdot a + y \cdot c + e\) \(y' = x \cdot b + y \cdot d + f\)
Param pt
The point to transform.
Returns PointOf<T> The transformed point.
constexpr void transform(std::span<PointOf<T>> points) const
Transforms a collection of points using the matrix.
Applies a 2D transformation to a span of points in an optimized SIMD
approach, processing multiple points in parallel when possible.
Param points
The span of points to transform.
invert
function¶
std::optional<MatrixOf> invert() const
Inverts the matrix, if possible.
Returns std::optional<MatrixOf> The inverse of the matrix if it is invertible, or std::nullopt
if
the matrix is singular (non-invertible).
OpenTypeFeatureFlags
typedef¶
OpenTypeFeatureFlags = inline_vector<OpenTypeFeatureFlag, 7>
A collection of OpenType feature flags.
Path
class¶
Path
Represents a geometric path that can be rasterized for rendering.
Path
Represents a geometric path that can be rasterized for rendering.
CCW
enumerator¶
Enum for the direction of the path.
CW
enumerator¶
Enum for the direction of the path.
MoveTo
enumerator¶
Enum for the elements of the path.
LineTo
enumerator¶
Enum for the elements of the path.
CubicTo
enumerator¶
Enum for the elements of the path.
Close
enumerator¶
Enum for the elements of the path.
empty
function¶
bool empty() const
Checks if the path is empty.
Returns true if the path is empty, false otherwise.
moveTo
function¶
void moveTo(PointF p)
Moves the current point to a specified point.
Param p
The point to move to.
void moveTo(float x, float y)
Moves the current point to specified coordinates.
Param x
The x-coordinate to move to.
Param y
The y-coordinate to move to.
lineTo
function¶
void lineTo(PointF p)
Draws a line to a specified point.
Param p
The point to draw to.
void lineTo(float x, float y)
Draws a line to specified coordinates.
Param x
The x-coordinate to draw to.
Param y
The y-coordinate to draw to.
quadraticTo
function¶
void quadraticTo(PointF c1, PointF e)
Draws a quadratic Bézier curve to a specified endpoint using a control point.
Param c1
The control point.
Param e
The endpoint.
void quadraticTo(float c1x, float c1y, float ex, float ey)
Draws a quadratic Bézier curve to specified coordinates using control point coordinates.
Param c1x
The x-coordinate of the control point.
Param c1y
The y-coordinate of the control point.
Param ex
The x-coordinate of the endpoint.
Param ey
The y-coordinate of the endpoint.
cubicTo
function¶
void cubicTo(PointF c1, PointF c2, PointF e)
Draws a cubic Bézier curve to a specified endpoint using two control points.
Param c1
The first control point.
Param c2
The second control point.
Param e
The endpoint.
void cubicTo(float c1x, float c1y, float c2x, float c2y,
float ex, float ey)
Draws a cubic Bézier curve to specified coordinates using two control point coordinates.
Param c1x
The x-coordinate of the first control point.
Param c1y
The y-coordinate of the first control point.
Param c2x
The x-coordinate of the second control point.
Param c2y
The y-coordinate of the second control point.
Param ex
The x-coordinate of the endpoint.
Param ey
The y-coordinate of the endpoint.
arcTo
function¶
void arcTo(RectangleF rect, float startAngle,
float sweepLength, bool forceMoveTo)
Draws an arc to a specified rectangle defined by its start angle and sweep length.
Param rect
The rectangle defining the arc.
Param startAngle
The starting angle of the arc.
Param sweepLength
The angle of the arc's sweep.
Param forceMoveTo
If true, moves to the endpoint of the arc.
close
function¶
void close()
Closes the current sub-path by drawing a line back to the starting point.
reset
function¶
void reset()
Resets the path to an empty state.
addCircle
function¶
void addCircle(float cx, float cy, float radius,
Direction dir = Direction::CW)
Adds a circle to the path.
Param cx
The x-coordinate of the center of the circle.
Param cy
The y-coordinate of the center of the circle.
Param radius
The radius of the circle.
Param dir
The direction in which the circle is added (default is clockwise).
addEllipse
function¶
void addEllipse(RectangleF rect,
Direction dir = Direction::CW)
Adds an ellipse to the path.
Param rect
The rectangle that bounds the ellipse.
Param dir
The direction in which the ellipse is added (default is clockwise).
addRoundRect
function¶
void addRoundRect(RectangleF rect, float rx, float ry,
Direction dir = Direction::CW)
Adds a rounded rectangle to the path.
Param rect
The rectangle that defines the bounds of the rounded rectangle.
Param rx
The radius of the horizontal corners.
Param ry
The radius of the vertical corners.
Param dir
The direction in which the rectangle is added (default is clockwise).
void addRoundRect(RectangleF rect, float roundness,
Direction dir = Direction::CW)
Adds a rounded rectangle to the path with uniform corner rounding.
Param rect
The rectangle that defines the bounds of the rounded rectangle.
Param roundness
The uniform rounding radius for all corners.
Param dir
The direction in which the rectangle is added (default is clockwise).
addRect
function¶
void addRect(RectangleF rect, Direction dir = Direction::CW)
Adds a rectangle to the path.
Param rect
The rectangle to add.
Param dir
The direction in which the rectangle is added (default is clockwise).
addPolystar
function¶
void addPolystar(float points, float innerRadius,
float outerRadius, float innerRoundness,
float outerRoundness, float startAngle,
float cx, float cy,
Direction dir = Direction::CW)
Adds a polystar shape to the path.
Param points
The number of points in the star.
Param innerRadius
The inner radius of the star.
Param outerRadius
The outer radius of the star.
Param innerRoundness
The roundness of the inner points.
Param outerRoundness
The roundness of the outer points.
Param startAngle
The starting angle for the star.
Param cx
The x-coordinate of the center of the star.
Param cy
The y-coordinate of the center of the star.
Param dir
The direction in which the polystar is added (default is clockwise).
addPolygon
function¶
void addPolygon(float points, float radius, float roundness,
float startAngle, float cx, float cy,
Direction dir = Direction::CW)
Adds a polygon to the path.
Param points
The number of points in the polygon.
Param radius
The radius of the polygon.
Param roundness
The roundness of the corners.
Param startAngle
The starting angle for the polygon.
Param cx
The x-coordinate of the center of the polygon.
Param cy
The y-coordinate of the center of the polygon.
Param dir
The direction in which the polygon is added (default is clockwise).
addPath
function¶
void addPath(const Path &path)
Adds another path to this path.
Param path
The path to add.
void addPath(const Path &path, const Matrix &m)
Adds another path to this path with a transformation matrix.
Param path
The path to add.
Param m
The transformation matrix to apply.
transform
function¶
void transform(const Matrix &m)
Transforms the path using a transformation matrix.
Param m
The transformation matrix to apply to the path.
transformed
function¶
Path transformed(const Matrix &m) const
Returns a new path that is a transformed version of this path.
Param m
The transformation matrix to apply.
Returns Path The transformed path.
length
function¶
float length() const
Calculates the length of the path.
Returns float The length of the path.
dashed
function¶
Path dashed(std::span<const float> pattern,
float offset) const
Creates a dashed version of the path based on a pattern.
Param pattern
A span of floats defining the dash pattern.
Param offset
The starting offset into the pattern.
Returns Path The dashed path.
clone
function¶
Path clone() const
Creates a copy of this path.
Returns Path A clone of the current path.
boundingBoxApprox
function¶
RectangleF boundingBoxApprox() const
Calculates an approximate bounding box of the path.
Returns RectangleF The approximate bounding box.
rasterize
function¶
RasterizedPath rasterize(const FillParams &fill,
Rectangle clipRect)
Rasterizes the path for filling.
Param fill
Fill parameters.
Param clipRect
Clipping rectangle. Pass noClipRect to disable clipping.
RasterizedPath rasterize(const StrokeParams &stroke,
Rectangle clipRect)
Rasterizes the path for stroking.
Param stroke
Stroke parameters.
Param clipRect
Clipping rectangle. Pass noClipRect to disable clipping.
impl
variable¶
void *impl
Pointer to implementation details.
Point
typedef¶
Point = PointOf<int32_t>
Type alias for a point using 32-bit integers.
PointF
typedef¶
PointF = PointOf<float>
Type alias for a point using single-precision floating-point numbers.
PointOf
class¶
template <typename T> PointOf
A template struct representing a point in 2D Cartesian coordinates.
The struct holds the x and y coordinates of a point. It provides various constructors,
operator overloads, and utility functions for manipulating points in a Cartesian coordinate system.
Template param T
The type of the coordinates, typically a numeric type such as float or double.
template <typename T> PointOf
A template struct representing a point in 2D Cartesian coordinates.
The struct holds the x and y coordinates of a point. It provides various constructors,
operator overloads, and utility functions for manipulating points in a Cartesian coordinate system.
Template param T
The type of the coordinates, typically a numeric type such as float or double.
PointOf<T>
function¶
constexpr PointOf() noexcept : x(), y()
Default constructor.
Initializes the coordinates to zero.
constexpr PointOf(T x, T y) noexcept : x(x), y(y)
Parameterized constructor.
Initializes the coordinates with the given values.
Param x
The x-coordinate.
Param y
The y-coordinate.
constexpr PointOf(const PointOf &p) noexcept = default
Copy constructor.
Initializes a new PointOf instance by copying the given point.
Param p
The PointOf instance to copy.
operator==
function¶
constexpr bool operator==(const PointOf &c) const noexcept
Equality operator.
Compares two PointOf instances for equality based on their coordinates.
Param c
The PointOf instance to compare against.
Returns true if the points are equal, false otherwise.
operator!=
function¶
constexpr bool operator!=(const PointOf &c) const noexcept
Inequality operator.
Compares two PointOf instances for inequality.
Param c
The PointOf instance to compare against.
Returns true if the points are not equal, false otherwise.
flipped
function¶
constexpr PointOf flipped() const noexcept
Flips the point coordinates.
Swaps the x and y coordinates of the point.
Returns A new PointOf instance with flipped coordinates.
flippedIf
function¶
constexpr PointOf flippedIf(bool flip) const noexcept
Conditionally flips the point coordinates.
If the flip parameter is true, the coordinates are flipped; otherwise, the original point is returned.
Param flip
A boolean indicating whether to flip the coordinates.
Returns A new PointOf instance, either flipped or unchanged.
operator[]
function¶
T operator[](size_t i) const noexcept
Access operator for point components.
Provides read access to the point's components via index.
Param i
The index of the component (0 for x, 1 for y).
Returns The component at the specified index.
T &operator[](size_t i) noexcept
Access operator for point components.
Provides write access to the point's components via index.
Param i
The index of the component (0 for x, 1 for y).
Returns A reference to the component at the specified index.
components
variable¶
T components[2]
Array of components for indexed access.
x
variable¶
T x
The x-coordinate.
y
variable¶
T y
The y-coordinate.
Reflection
variable¶
constexpr static std::tuple Reflection
Reflection data for introspection.
This static member provides reflection information about the PointOf struct, including its fields and their corresponding names.
PointOf
class¶
template <SIMDCompatible T> PointOf
A specialized template struct for SIMD-compatible points in 2D Cartesian coordinates.
This version of PointOf uses SIMD (Single Instruction, Multiple Data) types for efficient
vectorized computations.
Template param T
The SIMD type representing the point coordinates, must be SIMD compatible.
PointOf<type-parameter-0-0>
function¶
constexpr PointOf() noexcept : v()
Default constructor.
Initializes the SIMD vector to zero.
constexpr explicit PointOf(const SIMD<T, 2> &v) noexcept
: v(v)
Parameterized constructor from a SIMD vector.
Initializes the point with the given SIMD vector.
Param v
The SIMD vector representing the point.
constexpr PointOf(T x, T y) noexcept : v(x, y)
Parameterized constructor from two coordinates.
Initializes the point with the specified x and y values.
Param x
The x-coordinate.
Param y
The y-coordinate.
constexpr PointOf(const SizeOf<T> &sz) noexcept : v(sz.v)
Constructor from a SizeOf object.
Initializes the point using the size vector from a SizeOf object.
Param sz
The SizeOf object from which to initialize the point.
constexpr PointOf(const PointOf &p) noexcept = default
Copy constructor.
Initializes a new PointOf instance by copying the given point.
Param p
The PointOf instance to copy.
operator PointOf<type-parameter-1-0>
function¶
template <typename U> operator PointOf<U>() const noexcept
Conversion operator to a PointOf<U>.
Converts this PointOf instance to another type PointOf<U>.
Template param U
The target type for conversion.
Returns A PointOf<U> instance.
operator==
function¶
constexpr bool operator==(const PointOf &c) const noexcept
Equality operator.
Compares two PointOf instances for equality based on their SIMD vector.
Param c
The PointOf instance to compare against.
Returns true if the points are equal, false otherwise.
operator!=
function¶
constexpr bool operator!=(const PointOf &c) const noexcept
Inequality operator.
Compares two PointOf instances for inequality.
Param c
The PointOf instance to compare against.
Returns true if the points are not equal, false otherwise.
PointOf<type-parameter-0-0>
function¶
constexpr PointOf(const PolarOf<T> &p) noexcept
Constructor from a PolarOf<T>.
Converts a polar coordinate to Cartesian coordinates.
Param p
The PolarOf instance to convert.
operator PolarOf<type-parameter-0-0>
function¶
constexpr operator PolarOf<T>() noexcept
Conversion operator to PolarOf<T>.
Converts this Cartesian point to a polar coordinate representation.
Returns A PolarOf<T> instance representing the polar coordinates.
operator+=
function¶
constexpr PointOf &operator+=(const PointOf &p2) noexcept
Compound addition assignment operator.
Adds another PointOf instance to this one and returns the updated instance.
Param p2
The PointOf instance to add.
Returns A reference to the updated PointOf instance.
operator-=
function¶
constexpr PointOf &operator-=(const PointOf &p2) noexcept
Compound subtraction assignment operator.
Subtracts another PointOf instance from this one and returns the updated instance.
Param p2
The PointOf instance to subtract.
Returns A reference to the updated PointOf instance.
operator*=
function¶
constexpr PointOf &operator*=(const PointOf &p2) noexcept
Compound multiplication assignment operator.
Multiplies this PointOf instance by another and returns the updated instance.
Param p2
The PointOf instance to multiply by.
Returns A reference to the updated PointOf instance.
operator/=
function¶
constexpr PointOf &operator/=(const PointOf &p2) noexcept
Compound division assignment operator.
Divides this PointOf instance by another and returns the updated instance.
Param p2
The PointOf instance to divide by.
Returns A reference to the updated PointOf instance.
operator+=
function¶
constexpr PointOf &operator+=(T v2) noexcept
Compound addition assignment operator for scalar.
Adds a scalar value to this PointOf instance and returns the updated instance.
Param v2
The scalar value to add.
Returns A reference to the updated PointOf instance.
operator-=
function¶
constexpr PointOf &operator-=(T v2) noexcept
Compound subtraction assignment operator for scalar.
Subtracts a scalar value from this PointOf instance and returns the updated instance.
Param v2
The scalar value to subtract.
Returns A reference to the updated PointOf instance.
operator*=
function¶
constexpr PointOf &operator*=(T v2) noexcept
Compound multiplication assignment operator for scalar.
Multiplies this PointOf instance by a scalar value and returns the updated instance.
Param v2
The scalar value to multiply by.
Returns A reference to the updated PointOf instance.
operator/=
function¶
constexpr PointOf &operator/=(T v2) noexcept
Compound division assignment operator for scalar.
Divides this PointOf instance by a scalar value and returns the updated instance.
Param v2
The scalar value to divide by.
Returns A reference to the updated PointOf instance.
flipped
function¶
constexpr PointOf flipped() const noexcept
Flips the point coordinates.
Swaps the x and y coordinates of the point.
Returns A new PointOf instance with flipped coordinates.
flippedIf
function¶
constexpr PointOf flippedIf(bool flip) const noexcept
Conditionally flips the point coordinates.
If the flip parameter is true, the coordinates are flipped; otherwise, the original point is returned.
Param flip
A boolean indicating whether to flip the coordinates.
Returns A new PointOf instance, either flipped or unchanged.
distance
function¶
T distance(const PointOf &pt) const noexcept
Calculates the Euclidean distance to another point.
Computes the distance from this point to the specified point.
Param pt
The PointOf instance to calculate the distance to.
Returns The Euclidean distance to the other point.
distanceManhattan
function¶
T distanceManhattan(const PointOf &pt) const noexcept
Calculates the Manhattan distance to another point.
Computes the Manhattan distance from this point to the specified point.
Param pt
The PointOf instance to calculate the distance to.
Returns The Manhattan distance to the other point.
operator[]
function¶
T operator[](size_t i) const noexcept
Access operator for point components.
Provides read access to the point's components via index.
Param i
The index of the component (0 for x, 1 for y).
Returns The component at the specified index.
T &operator[](size_t i) noexcept
Access operator for point components.
Provides write access to the point's components via index.
Param i
The index of the component (0 for x, 1 for y).
Returns A reference to the component at the specified index.
alignedRect
function¶
RectangleOf<T>
alignedRect(const SizeOf<T> &innerSize,
const PointOf<Tfloat> &alignment) const noexcept
Creates an aligned rectangle around the point.
Generates a rectangle centered around the point with specified dimensions and alignment.
Param innerSize
The size of the rectangle.
Param alignment
The alignment of the rectangle.
Returns A RectangleOf instance representing the aligned rectangle.
RectangleOf<T> alignedRect(T width, T height, Tfloat alignX,
Tfloat alignY) const noexcept
Creates an aligned rectangle around the point with specified dimensions.
Generates a rectangle centered around the point with specified width, height, and alignment.
Param width
The width of the rectangle.
Param height
The height of the rectangle.
Param alignX
The alignment factor in the X direction.
Param alignY
The alignment factor in the Y direction.
Returns A RectangleOf instance representing the aligned rectangle.
round
function¶
constexpr PointOf round() const noexcept
Rounds the point components.
Applies rounding to the x and y components of the point.
Returns A new PointOf instance with rounded components.
floor
function¶
constexpr PointOf floor() const noexcept
Applies floor to the point components.
Computes the largest integer values less than or equal to the x and y components of the point.
Returns A new PointOf instance with floored components.
ceil
function¶
constexpr PointOf ceil() const noexcept
Applies ceil to the point components.
Computes the smallest integer values greater than or equal to the x and y components of the point.
Returns A new PointOf instance with ceiled components.
trunc
function¶
constexpr PointOf trunc() const noexcept
Applies truncation to the point components.
Computes the integer part of the x and y components of the point.
Returns A new PointOf instance with truncated components.
vec_type
typedef¶
vec_type = SIMD<T, 2>
Type representing the SIMD vector type.
v
variable¶
vec_type v
SIMD vector representation of the point.
components
variable¶
T components[2]
Array of components for direct access.
x
variable¶
T x
X component of the point.
y
variable¶
T y
Y component of the point.
Reflection
variable¶
constexpr static std::tuple Reflection
Reflection metadata for the PointOf struct.
PolarOf
class¶
template <typename T> PolarOf
A template struct representing a point in polar coordinates.
This struct holds the radius and angle of a point in a polar coordinate system.
The radius
represents the distance from the origin, while the angle
represents
the direction of the point in radians.
Template param T
The type of the radius and angle, typically a numeric type such as float or double.
radius
variable¶
T radius
The radius of the polar coordinate.
This value represents the distance from the origin (0, 0).
angle
variable¶
T angle
The angle of the polar coordinate.
This value represents the angle in radians.
operator==
function¶
constexpr bool
operator==(const PolarOf &c) const noexcept = default
Equality operator for comparing two PolarOf objects.
operator!=
function¶
constexpr bool
operator!=(const PolarOf &c) const noexcept = default
Inequality operator for comparing two PolarOf objects.
PreparedText
class¶
PreparedText
Represents text that has been processed and prepared for rendering or layout.
The PreparedText
struct manages glyph runs, logical and visual orders, grapheme boundaries,
caret positions, and alignment for efficient text layout and rendering.
runs
variable¶
GlyphRuns runs
The glyph runs associated with the text, stored in logical order.
visualOrder
variable¶
std::vector<uint32_t> visualOrder
The visual order of the glyph runs.
Each entry corresponds to an index in runs
, and visualOrder.size()
must equal runs.size()
.
options
variable¶
LayoutOptions options = LayoutOptions::Default
Layout options applied during text preparation.
graphemeBoundaries
variable¶
std::vector<uint32_t> graphemeBoundaries
Caret offsets (grapheme boundaries) within the text.
Each entry indicates the a grapheme boundary, providing a mapping between graphemes and characters.
caretPositions
variable¶
std::vector<float> caretPositions
The caret positions for each grapheme boundary.
This vector is populated by updateCaretData
and contains one entry per grapheme boundary.
ranges
variable¶
std::vector<InclusiveRange<float>> ranges
The ranges of horizontal positions for each grapheme.
This vector is populated by updateCaretData
and contains one entry per grapheme.
GlyphLine
class¶
GlyphLine
Represents a line of glyphs, including its range and metrics.
runRange
variable¶
Range<uint32_t> runRange
Range of runs (sequence of glyphs sharing the same style) in the line.
This range is empty if the line contains no runs.
graphemeRange
variable¶
Range<uint32_t> graphemeRange
Range of grapheme boundaries (caret positions) in the line.
This range is always non-empty, even if the line contains no visible content.
ascDesc
variable¶
AscenderDescender ascDesc
The ascender and descender metrics for the line.
Contains the maximum ascender and descender values for the glyphs in the line.
baseline
variable¶
float baseline = 0.f
The baseline position for the line.
Represents the vertical offset between this line's baseline and the baseline of the first line.
empty
function¶
bool empty() const noexcept
Checks if the line is empty.
A line is considered empty if it contains no runs.
Returns true
if the line is empty, false
otherwise.
lines
variable¶
std::vector<GlyphLine> lines
A collection of GlyphLine objects, representing multiple lines of text.
updateCaretData
function¶
void updateCaretData()
Updates the caret positions and horizontal ranges for graphemes.
This function calculates and fills the caretPositions
and ranges
fields based on the current text
properties.
caretToGrapheme
function¶
uint32_t caretToGrapheme(PointF pt) const
Maps a point to the nearest grapheme boundary.
Determines the grapheme boundary index corresponding to the provided point in text layout space.
Param pt
The point in text layout space.
Returns uint32_t The index of the nearest grapheme boundary.
graphemeToCaret
function¶
PointF graphemeToCaret(uint32_t graphemeIndex) const
Maps a grapheme boundary index to its caret position.
Calculates the position of the caret corresponding to the given grapheme boundary in text layout space.
Param graphemeIndex
The index of the grapheme boundary.
Returns PointF The caret position for the specified grapheme.
yToLine
function¶
int32_t yToLine(float y) const
Maps a vertical position to the nearest text line.
Determines the line index corresponding to the given vertical position in text layout space.
Param y
The vertical position in text layout space.
Returns int32_t The index of the nearest line, or -1 if the position is outside the layout.
runVisual
function¶
const GlyphRun &runVisual(uint32_t index) const
Retrieves a glyph run in visual order.
Param index
The index in visual order to retrieve.
Returns const GlyphRun& The glyph run at the specified visual order index.
GlyphRun &runVisual(uint32_t index)
Retrieves a modifiable glyph run in visual order.
Param index
The index in visual order to retrieve.
Returns GlyphRun& The modifiable glyph run at the specified visual order index.
bounds
function¶
RectangleF bounds(GlyphRunBounds boundsType =
GlyphRunBounds::Alignment) const
Calculates the bounds of the text based on the specified bounds type.
Param boundsType
The type of bounds to calculate (e.g., text, alignment, printable).
Returns RectangleF The calculated bounds of the text.
wrap
function¶
PreparedText wrap(float maxWidth,
bool wrapAnywhere = false) &&
Wraps text to fit within the given width, modifying the current object.
Wraps lines of text to fit within the specified maxWidth
. If wrapAnywhere
is true,
the text can break between any graphemes. Otherwise, breaks occur at word boundaries.
Param maxWidth
Maximum allowed width for the text.
Param wrapAnywhere
If true, allows breaking between any graphemes; otherwise, breaks at word
boundaries.
Returns PreparedText The modified object with wrapped lines.
PreparedText wrap(float maxWidth,
bool wrapAnywhere = false) const &
Wraps text to fit within the given width, returning a copy.
Wraps lines of text so that they fit within the specified maxWidth
. If wrapAnywhere
is true,
the text can break between any graphemes. Otherwise, breaks occur at word boundaries.
Param maxWidth
Maximum allowed width for the text.
Param wrapAnywhere
If true, allows breaking between any graphemes; otherwise, breaks at word
boundaries.
Returns PreparedText A copy with wrapped lines.
alignLines
function¶
PointF alignLines(float alignment_x,
float alignment_y = 0.f)
Aligns text lines horizontally and vertically.
Adjusts the horizontal offsets of each line based on alignment_x
and returns a PointF with overall
horizontal and vertical offsets. Apply the returned offset when painting PreparedText for proper
vertical alignment.
Param alignment_x
Horizontal alignment factor (0: left, 0.5: center, 1: right).
Param alignment_y
Vertical alignment factor (0: top, 0.5: center, 1: bottom).
Returns PointF Offsets for alignment.
characterToGrapheme
function¶
uint32_t characterToGrapheme(uint32_t charIndex) const
Converts a character index to its corresponding grapheme index.
Param charIndex
The character index to convert.
Returns uint32_t The corresponding grapheme index.
graphemeToCharacter
function¶
uint32_t graphemeToCharacter(uint32_t graphemeIndex) const
Converts a grapheme index to its corresponding character index.
Param graphemeIndex
The grapheme index to convert.
Returns uint32_t The corresponding character index.
graphemeToCharacters
function¶
Range<uint32_t>
graphemeToCharacters(uint32_t graphemeIndex) const
Retrieves the range of characters corresponding to a grapheme index.
Param graphemeIndex
The grapheme index to query.
Returns Range<uint32_t> The range of character indices covered by the grapheme.
RasterizedPath
class¶
RasterizedPath
Represents a rasterized path with a sprite and bounding rectangle.
sprite
variable¶
RC<SpriteResource> sprite
The sprite resource associated with the rasterized path.
bounds
variable¶
Rectangle bounds
The bounding rectangle of the rasterized path.
Rectangle
typedef¶
Rectangle = RectangleOf<int32_t>
Type alias for a rectangle using 32-bit integers.
RectangleF
typedef¶
RectangleF = RectangleOf<float>
Type alias for a rectangle using single-precision floating-point numbers.
RectangleOf
class¶
template <typename T> RectangleOf
A template structure representing a rectangle in a 2D space.
This structure provides methods for manipulating and querying a rectangle's properties
defined by two corner points (x1, y1) and (x2, y2), where (x1, y1) is the top-left
corner and (x2, y2) is the bottom-right corner.
Template param T
The data type for the coordinates.
template <typename T> RectangleOf
A template structure representing a rectangle in a 2D space.
This structure provides methods for manipulating and querying a rectangle's properties
defined by two corner points (x1, y1) and (x2, y2), where (x1, y1) is the top-left
corner and (x2, y2) is the bottom-right corner.
Template param T
The data type for the coordinates.
RectangleOf<T>
function¶
constexpr RectangleOf(T x1, T y1, T x2, T y2) noexcept
: v(x1, y1, x2, y2)
Constructs a rectangle using the given corner coordinates.
Param x1
The x-coordinate of the top-left corner.
Param y1
The y-coordinate of the top-left corner.
Param x2
The x-coordinate of the bottom-right corner.
Param y2
The y-coordinate of the bottom-right corner.
constexpr explicit RectangleOf(const SIMD<T, 4> &v) noexcept
: v(v)
Constructs a rectangle from a SIMD vector.
Param v
A SIMD vector representing the rectangle's corners.
constexpr RectangleOf(const RectangleOf &r) noexcept =
default
Copy constructor for the rectangle.
Param r
The rectangle to copy from.
operator RectangleOf<type-parameter-1-0>
function¶
template <typename U>
operator RectangleOf<U>() const noexcept
Converts this rectangle to a rectangle of a different type.
Template param U
The type to convert to.
Returns A new rectangle of type U.
RectangleOf<T>
function¶
constexpr RectangleOf(const PointOf<T> &point,
const SizeOf<T> &size) noexcept
: v(concat(point.v, point.v + size.v))
Constructs a rectangle from a point and size.
Param point
The starting point of the rectangle.
Param size
The size of the rectangle.
constexpr RectangleOf(const PointOf<T> &point1,
const PointOf<T> &point2) noexcept
: v(concat(point1.v, point2.v))
Constructs a rectangle from two corner points.
Param point1
The first corner point of the rectangle.
Param point2
The second corner point of the rectangle.
constexpr RectangleOf(
const PointOf<T> &base, const SizeOf<T> &dim,
const PointOf<Tfloat> &alignment) noexcept
: RectangleOf(base.alignedRect(dim, alignment))
Constructs an aligned rectangle given a base point, size, and alignment.
Param base
The base point of the rectangle.
Param dim
The size of the rectangle.
Param alignment
The alignment for the rectangle.
constexpr RectangleOf() noexcept : v()
Default constructor for the rectangle.
empty
function¶
constexpr bool empty() const noexcept
Checks if the rectangle is empty.
Returns True if the rectangle is empty, false otherwise.
size
function¶
constexpr SizeOf<T> size() const noexcept
Gets the size of the rectangle.
Returns The size of the rectangle as a SizeOf<T> object.
area
function¶
constexpr T area() const noexcept
Calculates the area of the rectangle.
Returns The area of the rectangle.
width
function¶
constexpr T width() const noexcept
Calculates the width of the rectangle.
Returns The width of the rectangle.
height
function¶
constexpr T height() const noexcept
Calculates the height of the rectangle.
Returns The height of the rectangle.
shortestSide
function¶
constexpr T shortestSide() const noexcept
Gets the shortest side length of the rectangle.
Returns The length of the shortest side.
longestSide
function¶
constexpr T longestSide() const noexcept
Gets the longest side length of the rectangle.
Returns The length of the longest side.
orientation
function¶
Orientation orientation() const noexcept
Determines the orientation of the rectangle.
Returns The orientation (Horizontal or Vertical).
slice
function¶
RectangleOf slice(Orientation orientation, Tfloat start,
Tfloat stop) const noexcept
Creates a slice of the rectangle based on the given orientation.
Param orientation
The orientation of the slice.
Param start
The normalized start coordinate.
Param stop
The normalized stop coordinate.
Returns A new RectangleOf that represents the slice.
center
function¶
PointOf<T> center() const noexcept
Gets the center point of the rectangle.
Returns The center point as a PointOf<T>.
toNormCoord
function¶
PointOf<Tfloat>
toNormCoord(const PointOf<T> &pt) const noexcept
Converts a point to normalized coordinates based on the rectangle.
Param pt
The point to normalize.
Returns The normalized coordinates as a PointOf<Tfloat>.
PointOf<Tfloat>
toNormCoord(const PointOf<T> &pt,
const PointOf<T> &ifoutside) const noexcept
Converts a point to normalized coordinates with a fallback point if outside.
Param pt
The point to normalize.
Param ifoutside
The fallback point if the original point is outside the rectangle.
Returns The normalized coordinates or the fallback point.
split
function¶
RectangleOf split(const PointOf<Tfloat> &point1,
const SizeOf<Tfloat> &size) const noexcept
Splits the rectangle based on a point and size.
Param point1
The starting point of the split.
Param size
The size of the split rectangle.
Returns A new RectangleOf representing the split area.
RectangleOf split(Tfloat x, Tfloat y, Tfloat w,
Tfloat h) const noexcept
Splits the rectangle based on individual coordinates.
Param x
The x-coordinate of the top-left corner of the split rectangle.
Param y
The y-coordinate of the top-left corner of the split rectangle.
Param w
The width of the split rectangle.
Param h
The height of the split rectangle.
Returns A new RectangleOf representing the split area.
at
function¶
PointOf<T> at(const PointOf<Tfloat> &pt) const noexcept
Gets the point at a normalized coordinate within the rectangle.
Param pt
The normalized coordinates.
Returns The point as a PointOf<T>.
PointOf<T> at(Tfloat x, Tfloat y) const noexcept
Gets the point at a normalized coordinate within the rectangle.
Param x
The normalized x-coordinate.
Param y
The normalized y-coordinate.
Returns The point as a PointOf<T>.
applyStart
function¶
void applyStart(const PointOf<T> &p) noexcept
Applies a new starting point to the rectangle.
Param p
The new starting point.
void applyStart(T x, T y) noexcept
Applies a new starting point using individual coordinates.
Param x
The x-coordinate of the new starting point.
Param y
The y-coordinate of the new starting point.
applySize
function¶
void applySize(const SizeOf<T> &s) noexcept
Applies a new size to the rectangle.
Param s
The new size.
void applySize(T w, T h) noexcept
Applies a new size using individual dimensions.
Param w
The new width.
Param h
The new height.
applyWidth
function¶
void applyWidth(T w) noexcept
Applies a new width to the rectangle, keeping the height unchanged.
Param w
The new width.
applyHeight
function¶
void applyHeight(T h) noexcept
Applies a new height to the rectangle, keeping the width unchanged.
Param h
The new height.
applyOffset
function¶
void applyOffset(T x, T y) noexcept
Applies an offset to the rectangle's position.
Param x
The x offset.
Param y
The y offset.
void applyOffset(const PointOf<T> &p) noexcept
Applies an offset using a point.
Param p
The point to offset by.
applyScale
function¶
void applyScale(T x, T y) noexcept
Applies a scale factor to the rectangle.
Param x
The x scale factor.
Param y
The y scale factor.
applyMargin
function¶
void applyMargin(T h, T v) noexcept
Applies a margin to the rectangle.
Param h
The horizontal margin.
Param v
The vertical margin.
applyPadding
function¶
void applyPadding(T h, T v) noexcept
Applies padding to the rectangle.
Param h
The horizontal padding.
Param v
The vertical padding.
applyMargin
function¶
void applyMargin(T m) noexcept
Applies a uniform margin to the rectangle.
Param m
The margin value.
applyPadding
function¶
void applyPadding(T p) noexcept
Applies a uniform padding to the rectangle.
Param p
The padding value.
applyMargin
function¶
void applyMargin(const EdgesOf<T> &m) noexcept
Applies a margin defined by edges to the rectangle.
Param m
The margin edges.
applyPadding
function¶
void applyPadding(const EdgesOf<T> &p) noexcept
Applies padding defined by edges to the rectangle.
Param p
The padding edges.
void applyPadding(T x1, T y1, T x2, T y2) noexcept
Applies padding to the rectangle using individual dimensions.
Param x1
The left padding.
Param y1
The top padding.
Param x2
The right padding.
Param y2
The bottom padding.
alignedRect
function¶
RectangleOf
alignedRect(const SizeOf<T> &innerSize,
const PointOf<Tfloat> &alignment) const noexcept
Creates an aligned rectangle with specified inner size and alignment.
Param innerSize
The inner size of the rectangle.
Param alignment
The alignment for the rectangle.
Returns A new aligned RectangleOf.
RectangleOf alignedRect(T width, T height, Tfloat alignX,
Tfloat alignY) const noexcept
Creates an aligned rectangle using width, height, and alignment factors.
Param width
The width of the rectangle.
Param height
The height of the rectangle.
Param alignX
The horizontal alignment factor.
Param alignY
The vertical alignment factor.
Returns A new aligned RectangleOf.
withStart
function¶
constexpr RectangleOf
withStart(const PointOf<T> &p) const noexcept
Creates a new rectangle with a specified starting point.
Param p
The new starting point.
Returns A new RectangleOf with the specified starting point.
constexpr RectangleOf withStart(T x, T y) const noexcept
Creates a new rectangle with a specified starting point using coordinates.
Param x
The x-coordinate of the new starting point.
Param y
The y-coordinate of the new starting point.
Returns A new RectangleOf with the specified starting point.
withSize
function¶
constexpr RectangleOf
withSize(const SizeOf<T> &s) const noexcept
Creates a new rectangle with a specified size.
Param s
The new size.
Returns A new RectangleOf with the specified size.
constexpr RectangleOf withSize(T w, T h) const noexcept
Creates a new rectangle with a specified size using dimensions.
Param w
The new width.
Param h
The new height.
Returns A new RectangleOf with the specified size.
withWidth
function¶
constexpr RectangleOf withWidth(T w) const noexcept
Creates a new rectangle with a specified width.
Param w
The new width.
Returns A new RectangleOf with the specified width.
withHeight
function¶
constexpr RectangleOf withHeight(T h) const noexcept
Creates a new rectangle with a specified height.
Param h
The new height.
Returns A new RectangleOf with the specified height.
withOffset
function¶
constexpr RectangleOf
withOffset(const PointOf<T> &p) const noexcept
Creates a new rectangle with a specified offset.
Param p
The point to offset by.
Returns A new RectangleOf with the specified offset.
constexpr RectangleOf withOffset(T x, T y) const noexcept
Creates a new rectangle with a specified offset using coordinates.
Param x
The x offset.
Param y
The y offset.
Returns A new RectangleOf with the specified offset.
withScale
function¶
constexpr RectangleOf withScale(T x, T y) const noexcept
Creates a new rectangle with applied scaling factors.
Param x
The x scaling factor.
Param y
The y scaling factor.
Returns A new RectangleOf with the applied scaling factors.
withMargin
function¶
constexpr RectangleOf withMargin(T h, T v) const noexcept
Creates a new rectangle with applied margin.
Param h
The horizontal margin.
Param v
The vertical margin.
Returns A new RectangleOf with the applied margin.
withPadding
function¶
constexpr RectangleOf withPadding(T h, T v) const noexcept
Creates a new rectangle with applied padding.
Param h
The horizontal padding.
Param v
The vertical padding.
Returns A new RectangleOf with the applied padding.
constexpr RectangleOf withPadding(T x1, T y1, T x2,
T y2) const noexcept
Creates a new rectangle with applied padding using dimensions.
Param x1
The left padding.
Param y1
The top padding.
Param x2
The right padding.
Param y2
The bottom padding.
Returns A new RectangleOf with the applied padding.
withMargin
function¶
constexpr RectangleOf withMargin(T m) const noexcept
Creates a new rectangle with applied margin.
Param m
The margin value.
Returns A new RectangleOf with the applied margin.
withPadding
function¶
constexpr RectangleOf withPadding(T p) const noexcept
Creates a new rectangle with applied padding.
Param p
The padding value.
Returns A new RectangleOf with the applied padding.
constexpr RectangleOf
withPadding(const EdgesOf<T> &p) const noexcept
Creates a new rectangle with applied padding defined by edges.
Param p
The padding edges.
Returns A new RectangleOf with the applied padding.
withMargin
function¶
constexpr RectangleOf
withMargin(const EdgesOf<T> &m) const noexcept
Creates a new rectangle with applied margin defined by edges.
Param m
The margin edges.
Returns A new RectangleOf with the applied margin.
flipped
function¶
constexpr RectangleOf flipped() const noexcept
Creates a new rectangle that is flipped horizontally.
Returns A new RectangleOf that is flipped.
flippedIf
function¶
constexpr RectangleOf flippedIf(bool flip) const noexcept
Creates a new rectangle that is conditionally flipped.
Param flip
A flag indicating whether to flip the rectangle.
Returns A new RectangleOf that is flipped or the original.
round
function¶
constexpr RectangleOf round() const noexcept
Rounds the rectangle's coordinates.
Returns A new RectangleOf with rounded coordinates.
floor
function¶
constexpr RectangleOf floor() const noexcept
Floors the rectangle's coordinates.
Returns A new RectangleOf with floored coordinates.
ceil
function¶
constexpr RectangleOf ceil() const noexcept
Ceils the rectangle's coordinates.
Returns A new RectangleOf with ceiled coordinates.
trunc
function¶
constexpr RectangleOf trunc() const noexcept
Truncates the rectangle's coordinates.
Returns A new RectangleOf with truncated coordinates.
contains
function¶
bool contains(const PointOf<T> &pt) const noexcept
Checks if a point is contained within the rectangle.
Param pt
The point to check.
Returns True if the point is contained; otherwise, false.
operator<<
function¶
bool operator<<(const PointOf<T> &pt) const noexcept
Checks if a point is contained within the rectangle using the << operator.
Param pt
The point to check.
Returns True if the point is contained; otherwise, false.
operator==
function¶
constexpr bool
operator==(const RectangleOf &c) const noexcept
Compares two rectangles for equality.
Param c
The rectangle to compare against.
Returns True if both rectangles are equal; otherwise, false.
operator!=
function¶
constexpr bool
operator!=(const RectangleOf &c) const noexcept
Compares two rectangles for inequality.
Param c
The rectangle to compare against.
Returns True if the rectangles are not equal; otherwise, false.
union_
function¶
constexpr RectangleOf
union_(const RectangleOf &c) const noexcept
Creates a new rectangle that is the union of this rectangle and another.
Param c
The other rectangle.
Returns A new RectangleOf that is the union of both rectangles.
intersection
function¶
constexpr RectangleOf
intersection(const RectangleOf &c) const noexcept
Creates a new rectangle that is the intersection of this rectangle and another.
Param c
The other rectangle.
Returns A new RectangleOf that is the intersection of both rectangles.
operator[]
function¶
T operator[](size_t i) const noexcept
Accesses a specific component of the rectangle.
Param i
The index of the component (0: x1, 1: y1, 2: x2, 3: y2).
Returns The component at the specified index.
T &operator[](size_t i) noexcept
Accesses a specific component of the rectangle.
Param i
The index of the component (0: x1, 1: y1, 2: x2, 3: y2).
Returns A reference to the component at the specified index.
v
variable¶
SIMD<T, 4> v
SIMD representation of the rectangle.
components
variable¶
T components[4]
Array representation of the rectangle components.
x1
variable¶
T x1
The x-coordinate of the top-left corner.
y1
variable¶
T y1
The y-coordinate of the top-left corner.
x2
variable¶
T x2
The x-coordinate of the bottom-right corner.
y2
variable¶
T y2
The y-coordinate of the bottom-right corner.
p1
variable¶
PointOf<T> p1
The top-left corner point.
p2
variable¶
PointOf<T> p2
The bottom-right corner point.
Size
typedef¶
Size = SizeOf<int32_t>
Type alias for a size using 32-bit integers.
SizeF
typedef¶
SizeF = SizeOf<float>
Type alias for a size using single-precision floating-point numbers.
SizeOf
class¶
template <typename T> SizeOf
A structure representing a 2D size with width and height.
This structure allows operations on sizes, such as addition, subtraction,
and comparison. It can also represent the size as a union of its components
for easy access.
Template param T
The type of the components (e.g., float, int).
template <typename T> SizeOf
A structure representing a 2D size with width and height.
This structure allows operations on sizes, such as addition, subtraction,
and comparison. It can also represent the size as a union of its components
for easy access.
Template param T
The type of the components (e.g., float, int).
SizeOf<T>
function¶
constexpr SizeOf() noexcept : x
Default constructor that initializes size to (0, 0).
constexpr SizeOf(T x, T y) noexcept : x(x), y(y)
Constructor that initializes size with specific values.
Param x
The width component.
Param y
The height component.
constexpr SizeOf(T xy) noexcept : x(xy), y(xy)
Constructor that initializes width and height to the same value.
Param xy
The value for both width and height.
template <std::convertible_to<T> U>
constexpr SizeOf(U v) : SizeOf(static_cast<T>(v))
Constructor that converts from a type convertible to T.
Template param U
The type to convert from.
Param v
The value to convert and initialize.
constexpr SizeOf(const SizeOf &s) noexcept = default
Copy constructor.
Param s
The SizeOf instance to copy from.
operator[]
function¶
T operator[](size_t i) const noexcept
Access operator for retrieving component by index.
Param i
The index of the component (0 for x, 1 for y).
Returns The component value at index i.
T &operator[](size_t i) noexcept
Access operator for modifying component by index.
Param i
The index of the component (0 for x, 1 for y).
Returns A reference to the component value at index i.
flipped
function¶
constexpr SizeOf flipped() const noexcept
Returns a new SizeOf instance with x and y flipped.
Returns A SizeOf instance with flipped dimensions.
flippedIf
function¶
constexpr SizeOf flippedIf(bool flip) const noexcept
Conditionally flips the dimensions based on the provided flag.
Param flip
If true, dimensions are flipped; otherwise, unchanged.
Returns A SizeOf instance that is either flipped or unchanged.
operator==
function¶
constexpr bool operator==(const SizeOf &c) const noexcept
Checks if two SizeOf instances are equal.
Param c
The SizeOf instance to compare against.
Returns True if both instances are equal; otherwise false.
operator!=
function¶
constexpr bool operator!=(const SizeOf &c) const noexcept
Checks if two SizeOf instances are not equal.
Param c
The SizeOf instance to compare against.
Returns True if both instances are not equal; otherwise false.
components
variable¶
T components[2]
An array to access the components directly.
(anonymous)
class¶
(anonymous struct at / src / include / brisk / graphics /
Geometry.hpp : 816 : 9)
Struct for accessing components as x and y.
x
variable¶
T x
The width component.
y
variable¶
T y
The height component.
(anonymous)
class¶
(anonymous struct at / src / include / brisk / graphics /
Geometry.hpp : 822 : 9)
Struct for accessing components as width and height.
width
variable¶
T width
The width component.
height
variable¶
T height
The height component.
SizeOf
class¶
template <SIMDCompatible T> SizeOf
A specialized SizeOf structure for SIMD-compatible types.
This specialization leverages SIMD operations for better performance
on two-dimensional sizes. It allows for various arithmetic and utility
operations using SIMD vectors.
Template param T
The SIMD-compatible type of the components.
SizeOf<type-parameter-0-0>
function¶
constexpr SizeOf() noexcept : x
Default constructor that initializes size to (0, 0).
constexpr SizeOf(T x, T y) noexcept : x(x), y(y)
Constructor that initializes size with specific values.
Param x
The width component.
Param y
The height component.
constexpr explicit SizeOf(T xy) noexcept : x(xy), y(xy)
Constructor that initializes width and height to the same value.
Param xy
The value for both width and height.
SizeOf(const SIMD<T, 2> &v) noexcept : v(v)
Constructor that initializes from a SIMD vector.
Param v
The SIMD vector to initialize from.
constexpr SizeOf(const SizeOf &s) noexcept = default
Copy constructor.
Param s
The SizeOf instance to copy from.
operator SizeOf<type-parameter-1-0>
function¶
template <typename U> operator SizeOf<U>() const noexcept
Conversion operator to a different SizeOf type.
Template param U
The type to convert to.
Returns A new SizeOf instance of type U.
empty
function¶
constexpr bool empty() const noexcept
Checks if the size is empty (both components <= 0).
Returns True if the size is empty; otherwise false.
shortestSide
function¶
constexpr T shortestSide() const noexcept
Gets the length of the shortest side.
Returns The value of the shortest side.
longestSide
function¶
constexpr T longestSide() const noexcept
Gets the length of the longest side.
Returns The value of the longest side.
round
function¶
constexpr SizeOf round() const noexcept
Rounds the dimensions to the nearest integer.
Returns A SizeOf instance with rounded dimensions.
floor
function¶
constexpr SizeOf floor() const noexcept
Floors the dimensions to the nearest lower integer.
Returns A SizeOf instance with floored dimensions.
ceil
function¶
constexpr SizeOf ceil() const noexcept
Ceils the dimensions to the nearest higher integer.
Returns A SizeOf instance with ceiled dimensions.
trunc
function¶
constexpr SizeOf trunc() const noexcept
Truncates the dimensions towards zero.
Returns A SizeOf instance with truncated dimensions.
flipped
function¶
constexpr SizeOf flipped() const noexcept
Returns a new SizeOf instance with dimensions flipped.
Returns A SizeOf instance with flipped dimensions.
flippedIf
function¶
constexpr SizeOf flippedIf(bool flip) const noexcept
Conditionally flips dimensions based on a provided flag.
Param flip
If true, dimensions are flipped; otherwise, unchanged.
Returns A SizeOf instance that is either flipped or unchanged.
area
function¶
constexpr T area() const noexcept
Calculates the area of the size.
Returns The area as the product of width and height.
operator[]
function¶
T operator[](size_t i) const noexcept
Access operator for retrieving component by index.
Param i
The index of the component (0 for x, 1 for y).
Returns The component value at index i.
T &operator[](size_t i) noexcept
Access operator for modifying component by index.
Param i
The index of the component (0 for x, 1 for y).
Returns A reference to the component value at index i.
operator==
function¶
constexpr bool operator==(const SizeOf &c) const noexcept
Checks if two SizeOf instances are equal.
Param c
The SizeOf instance to compare against.
Returns True if both instances are equal; otherwise false.
operator!=
function¶
constexpr bool operator!=(const SizeOf &c) const noexcept
Checks if two SizeOf instances are not equal.
Param c
The SizeOf instance to compare against.
Returns True if both instances are not equal; otherwise false.
v
variable¶
vec_type v
The SIMD vector representing size.
components
variable¶
T components[2]
An array to access the components directly.
x
variable¶
T x
The width component.
y
variable¶
T y
The height component.
width
variable¶
T width
The width component.
height
variable¶
T height
The height component.
StrokeParams
class¶
StrokeParams
Structure representing stroke parameters.
joinStyle
variable¶
JoinStyle joinStyle
The join style of the stroke.
capStyle
variable¶
CapStyle capStyle
The cap style of the stroke.
strokeWidth
variable¶
float strokeWidth
The width of the stroke.
miterLimit
variable¶
float miterLimit
The limit for miter joins.
TextRun
class¶
TextRun
Represents a segment of text with uniform properties such as direction and font face.
TextRun
Represents a segment of text with uniform properties such as direction and font face.
direction
variable¶
TextDirection direction
The direction of the text in this run (e.g., left-to-right or right-to-left).
begin
variable¶
int32_t begin
The starting index of the text run within the text.
end
variable¶
int32_t end
The ending index of the text run within the text.
visualOrder
variable¶
int32_t visualOrder
The visual order of the text run.
This indicates the position of the run when rendered visually.
face
variable¶
FontFace *face
Pointer to the font face associated with the text run.
operator==
function¶
bool operator==(const TextRun &) const noexcept = default
Equality comparison operator for TextRun
.
blurDirections
variable¶
int blurDirections = 3
0 - disable, 1 - H, 2 - V, 3 - H&V
blurRadius
variable¶
float blurRadius = 0.f
bmpDecode
function¶
expected<RC<Image>, ImageIOError>
bmpDecode(bytes_view bytes,
ImageFormat format = ImageFormat::Unknown)
Decodes a BMP image from the provided byte data.
Param bytes
A view of the byte data representing a BMP image.
Param format
Optional image format to use for decoding (returns original format if not specified).
Returns An expected result containing a reference-counted pointer to the decoded image or an ImageIOError.
bmpEncode
function¶
bytes bmpEncode(RC<Image> image)
Encodes an image to BMP format.
Param image
A reference-counted pointer to the image to be encoded.
Returns A byte vector containing the encoded BMP image data.
coordMatrix
variable¶
Matrix coordMatrix
data_offset
variable¶
int data_offset = 0
Offset in data4 for current operation (multiply by 4 to get offset in data1)
data_size
variable¶
int data_size = 0
Data size in floats
defaultColorSubsampling
variable¶
inline ColorSubsampling defaultColorSubsampling =
ColorSubsampling::S420
Default color subsampling method.
defaultImageQuality
variable¶
inline int defaultImageQuality = 98
Default image quality for encoding.
This value is used as the default quality setting when encoding images, with a typical range of 0 (lowest quality) to 100 (highest quality).
fill_color1
variable¶
ColorF fill_color1
Fill (brush) color for gradient at 0%
fill_color2
variable¶
ColorF fill_color2
Fill (brush) color for gradient at 100%
gradientResolution
variable¶
constexpr inline size_t gradientResolution = 1024
The resolution for the gradient, used in shader calculations.
Note Must match the value in Shader
gradient_point1
variable¶
PointF gradient_point1
0% Gradient point
gradient_point2
variable¶
PointF gradient_point2
100% Gradient point
guessImageCodec
function¶
optional<ImageCodec> guessImageCodec(bytes_view bytes)
Guesses the image codec based on the provided byte data.
Param bytes
A view of the byte data to analyze for codec detection.
Returns An optional ImageCodec if the codec can be guessed; otherwise, an empty optional.
icuAvailable
variable¶
extern bool icuAvailable
Indicates whether the ICU library is available for full Unicode support.
When icuAvailable
is true
, the font functions will have full Unicode support
for Bidirectional (BiDi) text processing (using splitTextRuns) and grapheme/line
breaking functionality (textBreakPositions).
imageDecode
function¶
expected<RC<Image>, ImageIOError>
imageDecode(ImageCodec codec, bytes_view bytes,
ImageFormat format = ImageFormat::Unknown)
Decodes an image from the provided byte data using the specified codec.
Param codec
The image codec to use for decoding.
Param bytes
A view of the byte data representing the image.
Param format
Optional image format to use for decoding (returns original format if not specified).
Returns An expected result containing a reference-counted pointer to the decoded image or an ImageIOError.
imageEncode
function¶
bytes imageEncode(ImageCodec codec, RC<Image> image,
optional<int> quality = nullopt,
optional<ColorSubsampling> ss = nullopt)
Encodes an image to the specified format using the provided codec.
Param codec
The image codec to use for encoding.
Param image
A reference-counted pointer to the image to be encoded.
Param quality
Optional quality parameter for encoding (default is nullopt).
Param ss
Optional color subsampling parameter (default is nullopt).
Returns A byte vector containing the encoded image data.
instances
variable¶
int instances = 1
Number of quads to render
jpegDecode
function¶
expected<RC<Image>, ImageIOError>
jpegDecode(bytes_view bytes,
ImageFormat format = ImageFormat::Unknown)
Decodes a JPEG image from the provided byte data.
Param bytes
A view of the byte data representing a JPEG image.
Param format
Optional image format to use for decoding (returns original format if not specified).
Returns An expected result containing a reference-counted pointer to the decoded image or an ImageIOError.
jpegEncode
function¶
bytes jpegEncode(RC<Image> image,
optional<int> quality = nullopt,
optional<ColorSubsampling> ss = nullopt)
Encodes an image to JPEG format.
Param image
A reference-counted pointer to the image to be encoded.
Param quality
Optional quality parameter for encoding (default is nullopt, which uses default quality).
Param ss
Optional color subsampling parameter (default is nullopt).
Returns A byte vector containing the encoded JPEG image data.
makeGradient
function¶
inline RC<GradientResource>
makeGradient(const GradientData &data)
Creates a new gradient resource.
Param data
The gradient data to associate with the resource.
Returns A reference-counted pointer to the newly created GradientResource.
max
function¶
template <typename T>
PointOf<T> max(const PointOf<T> &a,
const PointOf<T> &b) noexcept
Computes the maximum point from two PointOf instances.
Template param T
The type of the point components.
Param a
The first PointOf instance.
Param b
The second PointOf instance.
Returns A new PointOf instance representing the maximum point.
template <typename T>
SizeOf<T> max(const SizeOf<T> &a,
const SizeOf<T> &b) noexcept
Computes the element-wise maximum of two SizeOf instances .
Template param T
The type of the components.
Param a
The first SizeOf instance.
Param b
The second SizeOf instance.
Returns A SizeOf instance representing the maximum size.
template <typename T>
EdgesOf<T> max(const EdgesOf<T> &a,
const EdgesOf<T> &b) noexcept
Computes the element-wise maximum of two EdgesOf instances.
Template param T
The type of the edge coordinates.
Param a
The first EdgesOf instance.
Param b
The second EdgesOf instance.
Returns A new EdgesOf instance representing the maximum edges.
min
function¶
template <typename T>
PointOf<T> min(const PointOf<T> &a,
const PointOf<T> &b) noexcept
Computes the minimum point from two PointOf instances.
Template param T
The type of the point components.
Param a
The first PointOf instance.
Param b
The second PointOf instance.
Returns A new PointOf instance representing the minimum point.
template <typename T>
SizeOf<T> min(const SizeOf<T> &a,
const SizeOf<T> &b) noexcept
Computes the element-wise minimum of two SizeOf instances.
Template param T
The type of the components.
Param a
The first SizeOf instance.
Param b
The second SizeOf instance.
Returns A SizeOf instance representing the minimum size.
template <typename T>
EdgesOf<T> min(const EdgesOf<T> &a,
const EdgesOf<T> &b) noexcept
Computes the element-wise minimum of two EdgesOf instances.
Template param T
The type of the edge coordinates.
Param a
The first EdgesOf instance.
Param b
The second EdgesOf instance.
Returns A new EdgesOf instance representing the minimum edges.
multigradient
variable¶
int32_t multigradient = -1
Gradient (-1 - disabled)
noClipRect
variable¶
const inline Rectangle noClipRect
A constant rectangle that represents no clipping area.
opacity
variable¶
float opacity = 1.f
Opacity. Defaults to 1
pngDecode
function¶
expected<RC<Image>, ImageIOError>
pngDecode(bytes_view bytes,
ImageFormat format = ImageFormat::Unknown)
Decodes a PNG image from the provided byte data.
Param bytes
A view of the byte data representing a PNG image.
Param format
Optional image format to use for decoding (returns original format if not specified).
Returns An expected result containing a reference-counted pointer to the decoded image or an ImageIOError.
pngEncode
function¶
bytes pngEncode(RC<Image> image)
Encodes an image to PNG format.
Param image
A reference-counted pointer to the image to be encoded.
Returns A byte vector containing the encoded PNG image data.
rasterizePath
function¶
RasterizedPath
rasterizePath(Path path, const FillOrStrokeParams ¶ms,
Rectangle clipRect)
Rasterizes the given path with specified parameters and clipping rectangle.
Param path
The path to rasterize.
Param params
The fill or stroke parameters.
Param clipRect
The clipping rectangle. Use noClipRect to disable clipping.
Returns RasterizedPath The resulting rasterized path.
samplerMode
variable¶
SamplerMode samplerMode = SamplerMode::Clamp
scissor
variable¶
RectangleF scissor
Clip area in screen space
scissors_borderRadius
variable¶
float scissors_borderRadius = 0.f
scissors_corners
variable¶
int scissors_corners = 0
shader
variable¶
ShaderType shader = ShaderType::Rectangles
Type of geometry to generate
splitTextRuns
function¶
std::vector<TextRun>
splitTextRuns(std::u32string_view text,
TextDirection defaultDirection,
bool visualOrder)
Splits a string of text into multiple TextRun
objects based on directionality.
This function analyzes the given text and segments it into runs of uniform properties. It takes into
account the specified default text direction and optionally applies visual order for bidirectional text.
Param text
The text to be split into text runs.
Param defaultDirection
The default text direction to use if no explicit directionality is detected.
Param visualOrder
If true
, the resulting text runs will be reordered to match the visual order of the
text.
Returns std::vector<TextRun> A vector of TextRun
objects representing the segmented text.
srgbGammaToLinear
function¶
template <typename T, size_t N>
constexpr SIMD<T, N> srgbGammaToLinear(SIMD<T, N> x)
//////////////////////////
strokeWidth
variable¶
float strokeWidth = 1.f
Stroke or shadow width. Defaults to 1. Set to 0 to disable
stroke_color1
variable¶
ColorF stroke_color1
Stroke (pen) color for gradient at 0%
stroke_color2
variable¶
ColorF stroke_color2
Stroke (pen) color for gradient at 100%
textureChannel
variable¶
int textureChannel = 0
texture_id
variable¶
TextureId texture_id = textureIdNone
texture_matrix
variable¶
Matrix texture_matrix
webpDecode
function¶
expected<RC<Image>, ImageIOError>
webpDecode(bytes_view bytes,
ImageFormat format = ImageFormat::Unknown)
Decodes a WEBP image from the provided byte data.
Param bytes
A view of the byte data representing a WEBP image.
Param format
Optional image format to use for decoding (returns original format if not specified).
Returns An expected result containing a reference-counted pointer to the decoded image or an ImageIOError.
webpEncode
function¶
bytes webpEncode(RC<Image> image,
optional<float> quality = nullopt,
bool lossless = false)
Encodes an image to WEBP format.
Param image
A reference-counted pointer to the image to be encoded.
Param quality
Optional quality parameter for encoding (default is nullopt).
Param lossless
Flag indicating whether to use lossless encoding (default is false).
Returns A byte vector containing the encoded WEBP image data.
Auto-generated from sources, Revision , https://github.com/brisklib/brisk/blob//include/brisk/