#include <xrb_rendercontext.hpp>
Public Member Functions | |
RenderContext (ScreenCoordRect const &clip_rect, Color const &color_bias, Color const &color_mask) | |
Constructs a RenderContext using the given clip_rect and color_mask . | |
RenderContext (RenderContext const &source) | |
Copy constructor. | |
~RenderContext () | |
Destructor. Does nothing. | |
void | operator= (RenderContext const &source) |
Assignment operator. | |
ScreenCoordRect const & | ClipRect () const |
Returns the clipping rectangle. | |
Color const & | ColorBias () const |
Returns the color bias. | |
Color const & | ColorMask () const |
Returns the color mask. | |
Color & | ColorBias () |
Returns a non-const reference to the color bias. | |
Color & | ColorMask () |
Returns a non-const reference to the color mask. | |
ScreenCoordRect | ClippedRect (ScreenCoordRect const &rect) const |
Returns the intersection of the clipping rect and the given. | |
Color | BlendedColorBias (Color const &color_bias) const |
Returns the given color bias blended (on the right/inside) with this render context's color bias (i.e. blending function composition). | |
Color | MaskedColor (Color const &color) const |
Returns the masked version of the given color. | |
bool | MaskAndBiasWouldResultInNoOp () const |
Returns true iff the color mask and color bias would force any rendering operation to be a no op (i.e. completely transparent). | |
bool | MaskAndBiasWouldResultInNoOp (ColorCoord color_alpha_channel_value) const |
Returns true iff the color mask, color bias and drawing color alpha channel value would force any rendering operation to be a no op (i.e. completely transparent). | |
void | SetClipRect (ScreenCoordRect const &clip_rect) |
Sets the value of the clipping rectangle using the given rect. | |
void | ApplyClipRect (ScreenCoordRect const &clip_rect) |
Clips the clipping rectangle using the given rectangle. | |
void | ApplyColorBias (Color const &color_bias) |
Blends the current color bias with the given color (right-multiplication). | |
void | ApplyColorMask (Color const &color_mask) |
Masks the color mask using the given color. | |
void | ApplyAlphaMaskToColorMask (Float const alpha_mask) |
Masks only the alpha component of the color mask. | |
void | SetupGLClipRect () const |
Causes OpenGL to use the current clipping rectangle. |
Contains the clipping rectangle, color mask and color bias for rendering. The clipping rectangle indicates the area of the screen which is valid to render to. The color mask is a color which is component-wise multiplied into each pixel of the rendered pixels. The color bias specifies the color that the drawn pixels will be tinted (the alpha channel is used to specify the strength of the tinting).
RenderContext is just a convenient container for the properties, and provides a few extra convenience methods.
This form of container lends itself mainly toward recursive widget rendering, where each child widget has a progressively smaller rectangle inside its parent widget, and the color mask and color bias are cumulative down the widget hierarchy. Widget creates a new RenderContext for each recursive level, applying the clipping rectangle, color mask and bias color of each child it renders. See Xrb::Widget::Draw.
Definition at line 42 of file xrb_rendercontext.hpp.
Xrb::RenderContext::RenderContext | ( | RenderContext const & | source | ) | [inline] |
Copy constructor.
Simply copies the values of the source RenderContext.
Definition at line 61 of file xrb_rendercontext.hpp.
void Xrb::RenderContext::operator= | ( | RenderContext const & | source | ) | [inline] |
Assignment operator.
Simply copies the properties of the source.
Definition at line 74 of file xrb_rendercontext.hpp.
References m_clip_rect, m_color_bias, and m_color_mask.
Color& Xrb::RenderContext::ColorBias | ( | ) | [inline] |
Returns a non-const reference to the color bias.
Use this method to change the color bias.
Definition at line 102 of file xrb_rendercontext.hpp.
Color& Xrb::RenderContext::ColorMask | ( | ) | [inline] |
Returns a non-const reference to the color mask.
Use this method to change the color mask.
Definition at line 109 of file xrb_rendercontext.hpp.
ScreenCoordRect Xrb::RenderContext::ClippedRect | ( | ScreenCoordRect const & | rect | ) | const [inline] |
Returns the intersection of the clipping rect and the given.
This method is used when rectangular regions need to be clipped against the clipping rectangle.
Definition at line 117 of file xrb_rendercontext.hpp.
Color Xrb::RenderContext::MaskedColor | ( | Color const & | color | ) | const [inline] |
Returns the masked version of the given color.
Performs component-wise multiplication of the color and color mask,
Definition at line 133 of file xrb_rendercontext.hpp.
Referenced by Xrb::Render::DrawArrow(), Xrb::Render::DrawCircularArc(), Xrb::Render::DrawLine(), Xrb::Render::DrawPolygon(), and Xrb::Render::DrawScreenRect().
bool Xrb::RenderContext::MaskAndBiasWouldResultInNoOp | ( | ColorCoord | color_alpha_channel_value | ) | const |
Returns true iff the color mask, color bias and drawing color alpha channel value would force any rendering operation to be a no op (i.e. completely transparent).
color_alpha_channel_value | The alpha channel value of the drawing color, analogous to a texture fragment alpha value. |
Definition at line 23 of file xrb_rendercontext.cpp.
References Xrb::Dim::A.