[][src]Module sixtyfps_corelib::graphics

Graphics Abstractions.

This module contains the abstractions and convenience types to allow the runtime library to instruct different graphics backends to render the tree of items.

The entry trait is GraphicsBackend.

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

Structs

Color

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:

GraphicsWindow

GraphicsWindow is an implementation of the GenericWindow trait. This is typically instantiated by entry factory functions of the different graphics backends.

PathArcTo

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.

PathArcToFieldsOffsets

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

PathDataIterator

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

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

PathLineToFieldsOffsets

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

RgbaColor

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.

TextCursorBlinkerFieldsOffsets

Helper struct containing the offsets of the fields of the struct TextCursorBlinker

TrackingRenderingPrimitive

Holds a GraphicBackend's rendering primitive as well as a PropertyTracker that allows lazily re-creating the primitive if the properties needed to create it have changed.

WindowPropertiesFieldsOffsets

Helper struct containing the offsets of the fields of the struct WindowProperties

Enums

HighLevelRenderingPrimitive

The run-time library uses this enum to instruct the GraphicsBackend to render SixtyFPS graphics items. The different variants of this enum closely resemble the properties found in the .60 mark-up language for various items. More specifically this enum typically holds the properties that usually require for the allocation and uploading of GPU side data, such as vertex buffers or textures. Other properties such as colors not part of the enum but are provided to the back-end using RenderingVariable. That means that certain variants of this enum relate to a sequence of rendering variables.

PathData

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

PathElement

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

PathEvent

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.

RenderingVariable

This enum is used to affect various aspects of the rendering of GraphicsBackend::LowLevelRenderingPrimitive without the need to re-create them. See the documentation of HighLevelRenderingPrimitive about which variables are supported in which order.

Resource

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.

Traits

Frame

Frame is used to render previously created GraphicsBackend::LowLevelRenderingPrimitive instances to the back-buffer of the window.

GraphicsBackend

GraphicsBackend is the trait that the the SixtyFPS run-time uses to convert HighLevelRenderingPrimitive to an internal representation that is optimal for the backend, in order to render it later. The internal representation is opaque but must be provided via the GraphicsBackend::LowLevelRenderingPrimitive associated type.

RenderingPrimitivesBuilder

RenderingPrimitivesBuilder is used to convert instances of HighLevelRenderingPrimitive to the back-end specific GraphicsBackend::LowLevelRenderingPrimitive, giving the backend a way to determin the optimal representation for rendering later. For example this may involve uploading textures for images to GPU memory, pre-rendering glyphs or allocating vertex buffers.

Type Definitions

IntRect

2D Rectangle with integer coordinates

Point

2D Point

Rect

2D Rectangle

RenderingCache

The RenderingCache is used by the run-time library to avoid storing the typed GraphicsBackend::LowLevelRenderingPrimitive instances created for Items. Instead it allows mapping them to a usize handle, and it also allows tracking whenever any of the properties used to create the primitive changed.

Size

2D Size