Module sixtyfps_corelib::graphics[][src]

Expand description

Graphics Abstractions.

This module contains the abstractions and convenience types used for rendering.

The run-time library also makes use of RenderingCache to store the rendering primitives created by the backend in a type-erased manner.

Structs

CachedGraphicsData allows the graphics backend to store an arbitrary piece of data associated with an item, which is typically computed by accessing properties. The dependency_tracker is used to allow for a lazy computation. Typically backends store either compute intensive data or handles that refer to data that’s stored in GPU memory.

Color represents a color in the SixtyFPS run-time, represented using 8-bit channels for red, green, blue and the alpha (opacity). It can be conveniently constructed and destructured using the to_ and from_ (a)rgb helper functions:

FontRequest collects all the developer-configurable properties for fonts, such as family, weight, etc. It is submitted as a request to the platform font system (i.e. CoreText on macOS) and in exchange the backend returns a Box.

GradientStop describes a single color stop in a gradient. The colors between multiple stops are interpolated.

An image type that can be displayed by the Image element

The LinearGradientBrush describes a way of filling a shape with different colors, which are interpolated between different stops. The colors are aligned with a line that’s rotated by the LinearGradient’s angle.

Error generated if an image cannot be loaded for any reasons.

PathArcTo describes the event of moving the cursor on the path across an arc to the specified x/y coordinates, with the specified x/y radius and additional properties.

Helper struct containing the offsets of the fields of the struct PathArcTo

PathCubicTo describes a smooth Bézier curve from the path’s current position to the specified x/y location, using two control points.

Helper struct containing the offsets of the fields of the struct PathCubicTo

PathDataIterator is a data structure that acts as starting point for iterating through the low-level events of a path. If the path was constructed from said events, then it is a very thin abstraction. If the path was created from higher-level elements, then an intermediate lyon path is required/built.

PathLineTo describes the event of moving the cursor on the path to the specified location along a straight line.

Helper struct containing the offsets of the fields of the struct PathLineTo

PathMoveTo describes the event of setting the cursor on the path to use as starting point for sub-sequent events, such as LineTo. Moving the cursor also implicitly closes sub-paths and therefore beings a new sub-path.

Helper struct containing the offsets of the fields of the struct PathMoveTo

PathCubicTo describes a smooth Bézier curve from the path’s current position to the specified x/y location, using one control points.

Helper struct containing the offsets of the fields of the struct PathQuadraticTo

The RenderingCache, in combination with CachedGraphicsData, allows backends to store data that’s either intensive to compute or has bad CPU locality. Backends typically keep a RenderingCache instance and use the item’s cached_rendering_data() integer as index in the vec_arena::Arena.

RgbaColor stores the red, green, blue and alpha components of a color with the precision of the generic parameter T. For example if T is f32, the values are normalized between 0 and 1. If T is u8, they values range is 0 to 255. This is merely a helper class for use with Color.

Enums

A brush is a data structure that is used to describe how a shape, such as a rectangle, path or even text, shall be filled. A brush can also be applied to the outline of a shape, that means the fill of the outline itself.

A resource is a reference to binary data, for example images. They can be accessible on the file system or embedded in the resulting binary. Or they might be URLs to a web server and a downloaded is necessary before they can be used.

PathData represents a path described by either high-level elements or low-level events and coordinates.

PathElement describes a single element on a path, such as move-to, line-to, etc.

PathEvent is a low-level data structure describing the composition of a path. Typically it is generated at compile time from a higher-level description, such as SVG commands.

Traits

The FontMetrics trait is constructed from a FontRequest by the graphics backend and supplied to text related items in order to measure text.

Functions

Returns the start / end points of a gradient within the [-0.5; 0.5] unit square, based on the angle (in degree).

Type Definitions

2D Rectangle with integer coordinates

2D Point

2D Rectangle

2D Size

2D Transform