Skip to content

Color and geometry API

Declared by <huxerui/color.h> and <huxerui/geometry.h>.

Linear component value with public red, green, blue, and alpha floats. Rgb(int, int, int, float alpha = 1) converts 8-bit RGB; Transparent(), Black(), and White() provide constants. Equality compares components.

Horizontal or Vertical.

Point{x, y} and Size{width, height} are logical-coordinate values with equality.

Public x, y, width, and height; Contains, IsEmpty, Intersects, and Intersection query geometry. Equality compares fields.

Public top_left, top_right, bottom_right, and bottom_left. Construct uniformly or per corner; Top(value) rounds top corners and IsUniform() tests equality.

Affine matrix fields m11, m12, m21, m22, translate_x, and translate_y. IsIdentity, Apply, and fallible Inverse operate on points.

Public top, right, bottom, and left. All and Symmetric(horizontal, vertical) construct common values; Horizontal() and Vertical() sum axes.

Public min/max width and height. Methods: Constrain, ConstrainWidth, ConstrainHeight, HasBoundedWidth, HasBoundedHeight, Loose, LooseWidth, LooseHeight, TightWidth, TightHeight, and Deflate.

Shared geometry uses logical units. Platform adapters convert device pixels, screen coordinates, and DPI at their boundaries. Negative or inverted values are not normalized implicitly; constructors and methods document the few operations that clamp or return an empty intersection. Transform2D::Inverse() returns an empty optional for a singular transform.

Use EdgeInsets for resolved geometry and the Padding modifier for a declarative view property. Use CornerRadii when corners may differ and CornerRadius(float) only for the uniform modifier shorthand.