AUI Framework
master
Cross-platform base for C++ UI apps
|
Base class for rendering. More...
#include <AUI/Render/IRenderer.h>
Classes# | |
class | IMultiStringCanvas |
class | IPrerenderedString |
Public Member Functions# | |
_< ITexture > | getNewTexture () |
Creates new texture (image representation optimized for GPU rendering). | |
virtual _< IMultiStringCanvas > | newMultiStringCanvas (const AFontStyle &style)=0 |
Creates new canvas for batching multiple prerender string calls. | |
virtual void | rectangle (const ABrush &brush, glm::vec2 position, glm::vec2 size)=0 |
Draws simple rectangle. | |
virtual void | roundedRectangle (const ABrush &brush, glm::vec2 position, glm::vec2 size, float radius)=0 |
Draws rounded rect (with antialiasing, if msaa enabled). | |
virtual void | rectangleBorder (const ABrush &brush, glm::vec2 position, glm::vec2 size, float lineWidth=1.f)=0 |
Draws rectangle's border. | |
virtual void | roundedRectangleBorder (const ABrush &brush, glm::vec2 position, glm::vec2 size, float radius, int borderWidth)=0 |
Draws rounded rectangle's border. | |
virtual void | boxShadow (glm::vec2 position, glm::vec2 size, float blurRadius, const AColor &color)=0 |
Draws a rectangle-shaped shadow. | |
virtual void | boxShadowInner (glm::vec2 position, glm::vec2 size, float blurRadius, float spreadRadius, float borderRadius, const AColor &color, glm::vec2 offset)=0 |
Draws inner (inset) rectangle-shaped shadow. | |
virtual void | string (glm::vec2 position, const AString &string, const AFontStyle &fs={})=0 |
Draws string. | |
virtual _< IPrerenderedString > | prerenderString (glm::vec2 position, const AString &text, const AFontStyle &fs)=0 |
Analyzes string and creates an instance of IRenderer::IPrerenderedString which helps IRenderer to efficiently render the string. | |
void | line (const ABrush &brush, glm::vec2 p1, glm::vec2 p2, const ABorderStyle &style=ABorderStyle::Solid{}, AMetric width=1_dp) |
virtual void | lines (const ABrush &brush, AArrayView< glm::vec2 > points, const ABorderStyle &style, AMetric width)=0 |
Draws polyline (non-loop line strip). | |
void | lines (const ABrush &brush, AArrayView< glm::vec2 > points, const ABorderStyle &style=ABorderStyle::Solid{}) |
Draws polyline (non-loop line strip). | |
virtual void | points (const ABrush &brush, AArrayView< glm::vec2 > points, AMetric size)=0 |
Draws points list. | |
virtual void | lines (const ABrush &brush, AArrayView< std::pair< glm::vec2, glm::vec2 > > points, const ABorderStyle &style, AMetric width)=0 |
Draws multiple individual lines in a batch. | |
void | lines (const ABrush &brush, AArrayView< std::pair< glm::vec2, glm::vec2 > > points, const ABorderStyle &style=ABorderStyle::Solid{}) |
Draws multiple individual lines in a batch. | |
virtual void | squareSector (const ABrush &brush, const glm::vec2 &position, const glm::vec2 &size, AAngleRadians begin, AAngleRadians end)=0 |
Draws sector in rectangle shape. The sector is drawn clockwise from begin to end angles. | |
void | setColorForced (const AColor &color) |
Sets the color which is multiplied with any brush. | |
void | setColor (const AColor &color) |
Sets the color which is multiplied with any brush. Unlike setColorForced , the new color is multiplied by the previous color. | |
const AColor & | getColor () const |
void | setTransform (const glm::mat4 &transform) |
Sets the transform matrix which is applicable for any figure. Unlike setTransformForced , the new matrix is multiplied by the previous matrix. | |
void | setTransformForced (const glm::mat4 &transform) |
Sets the transform matrix which is applicable for any figure. | |
virtual void | pushMaskBefore ()=0 |
witches drawing to the stencil buffer instead of color buffer. | |
virtual void | pushMaskAfter ()=0 |
Switches drawing to the color buffer back from the stencil. Increases stencil depth. | |
virtual void | popMaskBefore ()=0 |
Switches drawing to the stencil buffer instead of color buffer. | |
virtual void | popMaskAfter ()=0 |
Switches drawing to the color buffer back from the stencil. Decreases stencil depth. | |
virtual void | setBlending (Blending blending)=0 |
Sets blending mode. | |
virtual _unique< IRenderViewToTexture > | newRenderViewToTexture () noexcept=0 |
Returns a new instance of IRenderViewToTexture interface associated with this renderer. | |
virtual void | setWindow (AWindowBase *window) |
Sets the window to render on. | |
AWindowBase * | getWindow () const noexcept |
virtual glm::mat4 | getProjectionMatrix () const =0 |
const glm::mat4 & | getTransform () |
std::uint8_t | getStencilDepth () const noexcept |
void | setStencilDepth (uint8_t stencilDepth) |
void | translate (const glm::vec2 &offset) |
Wrapper for setTransform applying matrix translate transformation. | |
void | rotate (const glm::vec3 &axis, AAngleRadians angle) |
wrapper for setTransform applying matrix rotation along the specified axis. | |
void | rotate (AAngleRadians angle) |
wrapper for setTransform applying matrix rotation along z axis. | |
void | setAllowRenderToTexture (bool allowRenderToTexture) |
bool | allowRenderToTexture () const noexcept |
void | backdrops (glm::ivec2 position, glm::ivec2 size, std::span< ass::Backdrop::Any > backdrops) |
Draws rectangular backdrop effects. | |
![]() | |
noncopyable (const noncopyable &)=delete | |
noncopyable & | operator= (const noncopyable &)=delete |
Protected Member Functions# | |
virtual _unique< ITexture > | createNewTexture ()=0 |
void | stub (glm::vec2 position, glm::vec2 size) |
Draws stub (i.e., gray rectangle) | |
virtual void | backdrops (glm::ivec2 position, glm::ivec2 size, std::span< ass::Backdrop::Preprocessed > backdrops) |
Protected Attributes# | |
AColor | mColor |
glm::mat4 | mTransform |
AWindowBase * | mWindow = nullptr |
APool< ITexture > | mTexturePool |
uint8_t | mStencilDepth = 0 |
Renderer is shared between windows. It's expected to share resources (if any). Thus, it does not perform any platform specific routines.
void IRenderer::backdrops | ( | glm::ivec2 | position, |
glm::ivec2 | size, | ||
std::span< ass::Backdrop::Any > | backdrops ) |
position | rectangle position (px) |
size | rectangle size (px) |
backdrops | array of backdrop effects. Impl might apply optimizations on using several effects at once. |
Implementation might draw stub (i.e., gray rectangle) instead of drawing complex backdrop effects.
|
pure virtual |
position | position |
size | rectangle size |
blurRadius | blur radius |
color | shadow color |
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
pure virtual |
position | position |
size | rectangle size |
blurRadius | blur radius |
spreadRadius | spread (offset) radius |
borderRadius | border radius of the rectangle. |
color | shadow color |
offset | shadow offset. Unlike outer shadow (ctx.render.boxShadow), the offset is passed to the shader instead of a simple rectangle position offset. |
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
inline |
ARender::lines
function instead.
|
pure virtual |
brush | brush |
points | polyline points |
style | style |
width | line width |
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
inline |
brush | brush |
points | polyline points |
style | style |
|
pure virtual |
brush | brush |
points | line points |
style | style |
width | line width |
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
inline |
brush | brush |
points | line points |
style | style |
|
pure virtual |
IMultiStringCanvas
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
nodiscardpure virtualnoexcept |
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
pure virtual |
brush | brush |
points | points |
size | point size |
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
pure virtual |
Stencil buffer should not be changed after calling this function. Should be called after the popMaskBefore
function.
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
pure virtual |
Stencil pixel is decreased by each affected pixel. Should be called before the popMaskAfter
function.
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
pure virtual |
position | string's top left point |
text | string to prerender |
fs | font style |
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
pure virtual |
Stencil buffer should not be changed after calling this function. Should be called after the pushMaskBefore
function.
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
pure virtual |
Stencil pixel is increased by each affected pixel. Should be called before the pushMaskAfter
function.
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
pure virtual |
brush | brush to use |
position | rectangle position (px) |
size | rectangle size (px) |
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
pure virtual |
brush | brush to use |
position | rectangle position (px) |
size | rectangle size (px) |
lineWidth | border line width (px) |
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
inline |
angle | angle to rotate |
|
inline |
axis | axis |
angle | angle to rotate |
|
pure virtual |
brush | brush to use |
position | rectangle position (px) |
size | rectangle size (px) |
radius | corner radius (px) |
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
pure virtual |
brush | brush to use |
position | rectangle position (px) |
size | rectangle size (px) |
radius | corner radius (px) |
borderWidth | border line width (px) |
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
pure virtual |
blending | new blending mode |
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
inline |
color | color |
|
inline |
color | color |
|
inline |
transform | transform matrix |
|
inline |
transform | transform matrix |
|
inlinevirtual |
window | target window |
Reimplemented in SoftwareRenderer.
|
pure virtual |
brush | brush to use |
position | rectangle position (px) |
size | rectangle size (px) |
begin | begin angle of the sector |
end | end angle of the sector |
The method can be used as mask to ctx.render.roundedRect, creating arc shape.
Implemented in OpenGLRenderer, and SoftwareRenderer.
|
pure virtual |
position | string's top left point |
string | string to render |
fs | font style (optional) |
string
and does GPU buffer allocations. If you want to render the same string for several times (frames), consider using the IRenderer::prerenderString function or high level views (such as ALabel) instead. Implemented in OpenGLRenderer, and SoftwareRenderer.
|
protected |
This can be used if implementation does not support or can't draw complex effects (i.e., blur)
|
inline |
offset | offset in pixels to translate. |