Magnum::Ui::TextLayerStyleUniform struct new in Git master

TextLayer style uniform

See the TextLayer class documentation for information about setting up an instance of the text layer and using it.

Instances of this class together with TextLayerCommonStyleUniform contain style properties that are used by the TextLayer shaders to draw the layer data, packed in a form that allows direct usage in uniform buffers. Total count of styles is specified with the TextLayer::Shared::Configuration::Configuration() constructor, uniforms are then uploaded using TextLayer::Shared::setStyle(), style data that aren't used by the shader are passed to the function separately. If dynamic styles are enabled with TextLayer::Shared::Configuration::setDynamicStyleCount(), instances of this class are also passed to TextLayer::setDynamicStyle() and variants.

Constructors, destructors, conversion operators

TextLayerStyleUniform(DefaultInitT = DefaultInit) explicit constexpr noexcept
Construct with default values.
TextLayerStyleUniform(const Color4& color) constexpr
Construct for a regular rendering.
TextLayerStyleUniform(const Color4& color, const Color4& outlineColor, Float outlineWidth, Float edgeOffset, Float smoothness) constexpr
Construct for a distance field rendering.
TextLayerStyleUniform(NoInitT) explicit noexcept
Construct without initializing the contents.

Public variables

Color4 color
Color.
Color4 outlineColor
Outline color.
Float outlineWidth
Outline width.
Float edgeOffset
Edge offset.
Float smoothness
Edge smoothness radius.

Convenience setters

Provided to allow the use of method chaining for populating a structure in a single expression, otherwise equivalent to accessing the fields directly. Also guaranteed to provide backwards compatibility when packing of the actual fields changes.

auto setColor(const Color4& color) -> TextLayerStyleUniform& constexpr
Set the color field.
auto setOutlineColor(const Color4& color) -> TextLayerStyleUniform& constexpr
Set the outlineColor field.
auto setOutlineWidth(Float width) -> TextLayerStyleUniform& constexpr
Set the outlineWidth field.
auto setEdgeOffset(Float offset) -> TextLayerStyleUniform& constexpr
Set the edgeOffset field.
auto setSmoothness(Float smoothness) -> TextLayerStyleUniform& constexpr
Set the smoothness field.

Function documentation

Magnum::Ui::TextLayerStyleUniform::TextLayerStyleUniform(const Color4& color) constexpr

Construct for a regular rendering.

The outlineColor, outlineWidth, edgeOffset and smoothness are left at their default values.

TextLayerStyleUniform& Magnum::Ui::TextLayerStyleUniform::setColor(const Color4& color) constexpr

Set the color field.

Returns Reference to self (for method chaining)

TextLayerStyleUniform& Magnum::Ui::TextLayerStyleUniform::setOutlineColor(const Color4& color) constexpr

Set the outlineColor field.

Returns Reference to self (for method chaining)

TextLayerStyleUniform& Magnum::Ui::TextLayerStyleUniform::setOutlineWidth(Float width) constexpr

Set the outlineWidth field.

Returns Reference to self (for method chaining)

TextLayerStyleUniform& Magnum::Ui::TextLayerStyleUniform::setEdgeOffset(Float offset) constexpr

Set the edgeOffset field.

Returns Reference to self (for method chaining)

TextLayerStyleUniform& Magnum::Ui::TextLayerStyleUniform::setSmoothness(Float smoothness) constexpr

Set the smoothness field.

Returns Reference to self (for method chaining)

Variable documentation

Color4 Magnum::Ui::TextLayerStyleUniform::color

Color.

The color is expected to have premultiplied alpha. Default value is 0xffffffff_srgbaf. The color multiplies the glyph texture and is further multiplied with per-data value supplied with TextLayer::setColor() and node opacity coming from AbstractUserInterface::setNodeOpacity().

Color4 Magnum::Ui::TextLayerStyleUniform::outlineColor

Outline color.

Used only if the text layer is created with a distance field glyph cache, ignored otherwise. The color is expected to have premultiplied alpha. Default value is 0xffffffff_srgbaf. Visible only if outlineWidth is non-zero.

Unlike color, the outline color isn't multiplied with TextLayer::setColor(). Node opacity coming from AbstractUserInterface::setNodeOpacity() affects it however.

Float Magnum::Ui::TextLayerStyleUniform::outlineWidth

Outline width.

Used only if the text layer is created with a distance field glyph cache, ignored otherwise. In UI units, the actual outline width is clamped to what the distance field radius allows. Default value is 0.0f.

Float Magnum::Ui::TextLayerStyleUniform::edgeOffset

Edge offset.

Used only if the text layer is created with a distance field glyph cache, ignored otherwise. In UI units, positive values dilate the edges and negative values erode it, the actual offset is clamped to what the distance field radius allows. Default value is 0.0f.

Float Magnum::Ui::TextLayerStyleUniform::smoothness

Edge smoothness radius.

Used only if the text layer is created with a distance field glyph cache, ignored otherwise. Compared to TextLayerCommonStyleUniform::smoothness is in UI units instead of pixels. Default is 0.0f. Of the two, the larger value in pixels gets used.