TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::GUIRenderer Class Referenceabstract

#include <gui_core/graphics/gui_renderer.h>

Inheritance diagram for tachyon::GUIRenderer:

Classes

struct  GlyphInstance
 One glyph of RenderGlyphs: RenderGlyph's arguments, its position relative. More...

Public Member Functions

virtual ~GUIRenderer ()
virtual void Reset ()=0
virtual void SetTransform (tachyon::float3x2 transformation)=0
virtual void SetOpacity (float)
 How opaque what is drawn from now on is, 0 to 1 (1 until set).
virtual void RenderBox (tachyon::IntRect rect, tachyon::IntRect clipRect, const StyleBlend &styles, tachyon::VisualColorStyleIndex colorStyleIndex={}, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid, tachyon::IntRect snappedPx={})=0
 Draws a styled box, styles mixed.
void RenderBox (tachyon::IntRect rect, tachyon::IntRect clipRect, uint32_t fromStyleIndex, uint32_t toStyleIndex, float blendT, tachyon::VisualColorStyleIndex colorStyleIndex={}, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid, tachyon::IntRect snappedPx={})
 As above, blended from fromStyleIndex to toStyleIndex (flat GPU style indices) by blendT in [0, 1].
void RenderBox (tachyon::IntRect rect, tachyon::IntRect clipRect, VisualBoxStyleIndex boxStyleIndex, tachyon::ElementState state, tachyon::VisualColorStyleIndex colorStyleIndex={}, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid, tachyon::IntRect snappedPx={})
void RenderBox (tachyon::IntRect rect, tachyon::IntRect clipRect, VisualBoxStyleIndex boxStyleIndex, tachyon::VisualColorStyleIndex colorStyleIndex={}, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid, tachyon::IntRect snappedPx={})
virtual void RenderLine (tachyon::int2 p0, tachyon::int2 p1, tachyon::int2 p2, tachyon::int2 p3, tachyon::IntRect clipRect, const LineStyle &lineStyle)=0
void RenderLine (tachyon::int2 p0, tachyon::int2 p1, tachyon::IntRect clipRect, const LineStyle &lineStyle)
virtual void RenderCircle (tachyon::float2 center, float radius, tachyon::IntRect clipRect, const LineStyle &lineStyle)=0
 A circle outline lineStyle.lineWidth wide, exactly round.
virtual void RenderDot (tachyon::float2 pos, tachyon::IntRect clipRect, float size, tachyon::color4f color)=0
virtual void RenderDots (std::span< const tachyon::float2 > positions, tachyon::IntRect clipRect, float size, tachyon::color4f color)
 RenderDot at each of positions, in order, all alike.
virtual void RenderTriangle (tachyon::float2 p0, tachyon::float2 p1, tachyon::float2 p2, tachyon::IntRect clipRect, tachyon::VisualColorStyleIndex colorStyleIndex, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid, TriangleEdges hardEdges=TriangleEdges::None)=0
 A filled triangle.
virtual void RenderQuad (tachyon::IntRect rect, tachyon::IntRect clipRect, tachyon::VisualColorStyleIndex colorStyleIndex, float cornerRadius=0.0f, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid, const tachyon::UVRect &uv={}, const tachyon::ImageDisplay &display={})=0
 Draws a filled, optionally rounded and textured rect: a box without borders, style blending or element state.
virtual void RenderShadow (tachyon::IntRect rect, tachyon::IntRect clipRect, tachyon::VisualColorStyleIndex colorStyleIndex, float cornerRadius, int blur)=0
 A box shadow: rect is the shadow's shape, which fades out over blur pixels on either side of its edge (Gaussian, sigma = blur / 2, as CSS).
virtual void RenderOccluder (tachyon::IntRect, tachyon::IntRect)
 Draws nothing: marks rect as covered by opaque content drawn after this call, so what was drawn before it there is skipped on the GPU.
virtual void RenderGlyph (tachyon::float2 pos, tachyon::float2 size, tachyon::float2 uvMin, tachyon::float2 uvMax, float scale, int bpp, int mode, VisualColorStyleIndex textColorIndex, tachyon::IntRect clipRect, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid, float shadowBlur=-1.0f)=0
 A glyph from the text atlas.
virtual void RenderGlyphs (std::span< const GlyphInstance > glyphs, tachyon::float2 offset, tachyon::IntRect clipRect)
 RenderGlyph for each of glyphs, moved by offset, in order: a text's glyphs at once.
void RenderFilledPolygon (std::span< const tachyon::float2 > points, tachyon::IntRect clipRect, VisualColorStyleIndex colorIndex, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid)
 Convex polygon, fan-triangulated from points[0]; needs at least 3 points.
void RenderPolyline (std::span< const tachyon::int2 > points, bool closed, tachyon::IntRect clipRect, const LineStyle &style)
 Outlined polyline; closed adds a segment from the last point back to the first.
void RenderArc (tachyon::float2 center, float radius, float width, float startTurns, float sweepTurns, tachyon::IntRect clipRect, VisualColorStyleIndex colorIndex)
 Part of a ring width wide, centred on the circle of radius around center, with round ends.
virtual bool StartResizing (ID id)=0
virtual void StopResizing ()=0
virtual bool BeginWindow (ID id)=0
virtual void EndWindow ()=0
virtual bool DrawsChanged (ID) const
 Whether the window's draws this frame differ from its last frame's (as of its EndWindow); true when the renderer can't tell.
virtual void BeginScopeCapture (ID)
 Starts recording primitives under scopeId, replacing its previous capture.
virtual void EndScopeCapture (ID)
 Ends the capture of scopeId and draws it into the current window.
virtual bool ReplayScopeCapture (ID, tachyon::int2)
 Draws the capture of scopeId again, moved by delta pixels; false if there is none.
virtual bool HasScopeCapture (ID) const
 True when scopeId has a non-empty capture.
virtual void InvalidateScopeCapture (ID)
 Drops the capture of scopeId.
virtual void ClearScopeCaptures ()
 Drops every capture.

Static Public Member Functions

static uint32_t StyleIndex (VisualBoxStyleIndex boxStyleIndex, tachyon::ElementState state)
 The flat GPU style index of boxStyleIndex in state, as RenderBox takes it.

Constructor & Destructor Documentation

◆ ~GUIRenderer()

virtual tachyon::GUIRenderer::~GUIRenderer ( )
inlinevirtual

Member Function Documentation

◆ Reset()

virtual void tachyon::GUIRenderer::Reset ( )
pure virtual

Implemented in tachyon::PrimitiveRenderer.

◆ SetTransform()

virtual void tachyon::GUIRenderer::SetTransform ( tachyon::float3x2 transformation)
pure virtual

Implemented in tachyon::PrimitiveRenderer.

◆ SetOpacity()

virtual void tachyon::GUIRenderer::SetOpacity ( float )
inlinevirtual

How opaque what is drawn from now on is, 0 to 1 (1 until set).

Below 1, occluders are dropped: what is under the drawing shows through it.

Reimplemented in tachyon::PrimitiveRenderer.

◆ RenderBox() [1/4]

virtual void tachyon::GUIRenderer::RenderBox ( tachyon::IntRect rect,
tachyon::IntRect clipRect,
const StyleBlend & styles,
tachyon::VisualColorStyleIndex colorStyleIndex = {},
tachyon::ImageIndex textureIndex = tachyon::ImageIndex::Invalid,
tachyon::IntRect snappedPx = {} )
pure virtual

Draws a styled box, styles mixed.

colorStyleIndex overrides the background (Invalid: none). snappedPx is the box in window pixels snapped relative to its parent (SnapToParent); empty snaps the transformed rect to the pixel grid.

Implemented in tachyon::PrimitiveRenderer.

◆ RenderBox() [2/4]

void tachyon::GUIRenderer::RenderBox ( tachyon::IntRect rect,
tachyon::IntRect clipRect,
uint32_t fromStyleIndex,
uint32_t toStyleIndex,
float blendT,
tachyon::VisualColorStyleIndex colorStyleIndex = {},
tachyon::ImageIndex textureIndex = tachyon::ImageIndex::Invalid,
tachyon::IntRect snappedPx = {} )
inline

As above, blended from fromStyleIndex to toStyleIndex (flat GPU style indices) by blendT in [0, 1].

◆ StyleIndex()

uint32_t tachyon::GUIRenderer::StyleIndex ( VisualBoxStyleIndex boxStyleIndex,
tachyon::ElementState state )
static

The flat GPU style index of boxStyleIndex in state, as RenderBox takes it.

◆ RenderBox() [3/4]

void tachyon::GUIRenderer::RenderBox ( tachyon::IntRect rect,
tachyon::IntRect clipRect,
VisualBoxStyleIndex boxStyleIndex,
tachyon::ElementState state,
tachyon::VisualColorStyleIndex colorStyleIndex = {},
tachyon::ImageIndex textureIndex = tachyon::ImageIndex::Invalid,
tachyon::IntRect snappedPx = {} )

◆ RenderBox() [4/4]

void tachyon::GUIRenderer::RenderBox ( tachyon::IntRect rect,
tachyon::IntRect clipRect,
VisualBoxStyleIndex boxStyleIndex,
tachyon::VisualColorStyleIndex colorStyleIndex = {},
tachyon::ImageIndex textureIndex = tachyon::ImageIndex::Invalid,
tachyon::IntRect snappedPx = {} )

◆ RenderLine() [1/2]

virtual void tachyon::GUIRenderer::RenderLine ( tachyon::int2 p0,
tachyon::int2 p1,
tachyon::int2 p2,
tachyon::int2 p3,
tachyon::IntRect clipRect,
const LineStyle & lineStyle )
pure virtual

Implemented in tachyon::PrimitiveRenderer.

◆ RenderLine() [2/2]

void tachyon::GUIRenderer::RenderLine ( tachyon::int2 p0,
tachyon::int2 p1,
tachyon::IntRect clipRect,
const LineStyle & lineStyle )
inline

◆ RenderCircle()

virtual void tachyon::GUIRenderer::RenderCircle ( tachyon::float2 center,
float radius,
tachyon::IntRect clipRect,
const LineStyle & lineStyle )
pure virtual

A circle outline lineStyle.lineWidth wide, exactly round.

A gradient and dashes run clockwise from the right (+x towards +y); gradientOffset / gradientScale pick the part of the gradient that goes once around.

Implemented in tachyon::PrimitiveRenderer.

◆ RenderDot()

virtual void tachyon::GUIRenderer::RenderDot ( tachyon::float2 pos,
tachyon::IntRect clipRect,
float size,
tachyon::color4f color )
pure virtual

Implemented in tachyon::PrimitiveRenderer.

◆ RenderDots()

virtual void tachyon::GUIRenderer::RenderDots ( std::span< const tachyon::float2 > positions,
tachyon::IntRect clipRect,
float size,
tachyon::color4f color )
inlinevirtual

RenderDot at each of positions, in order, all alike.

Reimplemented in tachyon::PrimitiveRenderer.

◆ RenderTriangle()

virtual void tachyon::GUIRenderer::RenderTriangle ( tachyon::float2 p0,
tachyon::float2 p1,
tachyon::float2 p2,
tachyon::IntRect clipRect,
tachyon::VisualColorStyleIndex colorStyleIndex,
tachyon::ImageIndex textureIndex = tachyon::ImageIndex::Invalid,
TriangleEdges hardEdges = TriangleEdges::None )
pure virtual

A filled triangle.

hardEdges end without a soft edge, for edges it shares with another triangle of the same shape.

Implemented in tachyon::PrimitiveRenderer.

◆ RenderQuad()

virtual void tachyon::GUIRenderer::RenderQuad ( tachyon::IntRect rect,
tachyon::IntRect clipRect,
tachyon::VisualColorStyleIndex colorStyleIndex,
float cornerRadius = 0.0f,
tachyon::ImageIndex textureIndex = tachyon::ImageIndex::Invalid,
const tachyon::UVRect & uv = {},
const tachyon::ImageDisplay & display = {} )
pure virtual

Draws a filled, optionally rounded and textured rect: a box without borders, style blending or element state.

Implemented in tachyon::PrimitiveRenderer.

◆ RenderShadow()

virtual void tachyon::GUIRenderer::RenderShadow ( tachyon::IntRect rect,
tachyon::IntRect clipRect,
tachyon::VisualColorStyleIndex colorStyleIndex,
float cornerRadius,
int blur )
pure virtual

A box shadow: rect is the shadow's shape, which fades out over blur pixels on either side of its edge (Gaussian, sigma = blur / 2, as CSS).

Implemented in tachyon::PrimitiveRenderer.

◆ RenderOccluder()

virtual void tachyon::GUIRenderer::RenderOccluder ( tachyon::IntRect ,
tachyon::IntRect  )
inlinevirtual

Draws nothing: marks rect as covered by opaque content drawn after this call, so what was drawn before it there is skipped on the GPU.

Only for a rect the later content covers completely, with no anti-aliased edge.

Reimplemented in tachyon::PrimitiveRenderer.

◆ RenderGlyph()

virtual void tachyon::GUIRenderer::RenderGlyph ( tachyon::float2 pos,
tachyon::float2 size,
tachyon::float2 uvMin,
tachyon::float2 uvMax,
float scale,
int bpp,
int mode,
VisualColorStyleIndex textColorIndex,
tachyon::IntRect clipRect,
tachyon::ImageIndex textureIndex = tachyon::ImageIndex::Invalid,
float shadowBlur = -1.0f )
pure virtual

A glyph from the text atlas.

scale is atlas texels per pixel. With a shadowBlur of 0 or more it is a text shadow instead: the glyph's shape in textColorIndex alone (a color glyph's too), blurred by that many pixels (Gaussian, sigma = blur / 2, as CSS) as far as the atlas' distance field reaches.

Implemented in tachyon::PrimitiveRenderer.

◆ RenderGlyphs()

virtual void tachyon::GUIRenderer::RenderGlyphs ( std::span< const GlyphInstance > glyphs,
tachyon::float2 offset,
tachyon::IntRect clipRect )
inlinevirtual

RenderGlyph for each of glyphs, moved by offset, in order: a text's glyphs at once.

Reimplemented in tachyon::PrimitiveRenderer.

◆ RenderFilledPolygon()

void tachyon::GUIRenderer::RenderFilledPolygon ( std::span< const tachyon::float2 > points,
tachyon::IntRect clipRect,
VisualColorStyleIndex colorIndex,
tachyon::ImageIndex textureIndex = tachyon::ImageIndex::Invalid )

Convex polygon, fan-triangulated from points[0]; needs at least 3 points.

◆ RenderPolyline()

void tachyon::GUIRenderer::RenderPolyline ( std::span< const tachyon::int2 > points,
bool closed,
tachyon::IntRect clipRect,
const LineStyle & style )

Outlined polyline; closed adds a segment from the last point back to the first.

◆ RenderArc()

void tachyon::GUIRenderer::RenderArc ( tachyon::float2 center,
float radius,
float width,
float startTurns,
float sweepTurns,
tachyon::IntRect clipRect,
VisualColorStyleIndex colorIndex )

Part of a ring width wide, centred on the circle of radius around center, with round ends.

Angles are in turns (1 = all the way round), clockwise from the right (+x towards +y) as RenderCircle's: from startTurns, sweepTurns round (negative goes the other way). A sweep of a whole turn or more is a closed ring, without ends.

◆ StartResizing()

virtual bool tachyon::GUIRenderer::StartResizing ( ID id)
pure virtual

Implemented in tachyon::PrimitiveRenderer.

◆ StopResizing()

virtual void tachyon::GUIRenderer::StopResizing ( )
pure virtual

Implemented in tachyon::PrimitiveRenderer.

◆ BeginWindow()

virtual bool tachyon::GUIRenderer::BeginWindow ( ID id)
pure virtual

Implemented in tachyon::PrimitiveRenderer.

◆ EndWindow()

virtual void tachyon::GUIRenderer::EndWindow ( )
pure virtual

Implemented in tachyon::PrimitiveRenderer.

◆ DrawsChanged()

virtual bool tachyon::GUIRenderer::DrawsChanged ( ID ) const
inlinevirtual

Whether the window's draws this frame differ from its last frame's (as of its EndWindow); true when the renderer can't tell.

Reimplemented in tachyon::PrimitiveRenderer.

◆ BeginScopeCapture()

virtual void tachyon::GUIRenderer::BeginScopeCapture ( ID )
inlinevirtual

Starts recording primitives under scopeId, replacing its previous capture.

Captures don't nest.

Reimplemented in tachyon::PrimitiveRenderer.

◆ EndScopeCapture()

virtual void tachyon::GUIRenderer::EndScopeCapture ( ID )
inlinevirtual

Ends the capture of scopeId and draws it into the current window.

Reimplemented in tachyon::PrimitiveRenderer.

◆ ReplayScopeCapture()

virtual bool tachyon::GUIRenderer::ReplayScopeCapture ( ID ,
tachyon::int2  )
inlinevirtual

Draws the capture of scopeId again, moved by delta pixels; false if there is none.

Reimplemented in tachyon::PrimitiveRenderer.

◆ HasScopeCapture()

virtual bool tachyon::GUIRenderer::HasScopeCapture ( ID ) const
inlinevirtual

True when scopeId has a non-empty capture.

Reimplemented in tachyon::PrimitiveRenderer.

◆ InvalidateScopeCapture()

virtual void tachyon::GUIRenderer::InvalidateScopeCapture ( ID )
inlinevirtual

Drops the capture of scopeId.

Reimplemented in tachyon::PrimitiveRenderer.

◆ ClearScopeCaptures()

virtual void tachyon::GUIRenderer::ClearScopeCaptures ( )
inlinevirtual

Drops every capture.

Reimplemented in tachyon::PrimitiveRenderer.


The documentation for this class was generated from the following file: