All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Nimble::ClipStack Class Reference

This class provides an implementation of a clipping stack. More...

#include <Nimble/ClipStack.hpp>

Public Member Functions

Nimble::Rect boundingBox () const
 Get the bounding box encompassing all the rectangles in the clipstack. More...
 
 ClipStack ()
 Construct a new ClipStack.
 
 ClipStack (const ClipStack &other)
 Construct a copy of a ClipStack. More...
 
bool isVisible (const Nimble::Rectangle &r) const
 Check if the given rectangle is visible. More...
 
bool isVisible (const Nimble::Vector2 &p) const
 Check if the given point is visible. More...
 
ClipStackoperator= (const ClipStack &other)
 Copy a ClipStack. More...
 
ClipStackpop ()
 Pop a rectangle from the top of the ClipStack. More...
 
ClipStackpush (const Rectangle &r)
 Push a rectangle to the top of the ClipStack. More...
 
size_t stackDepth () const
 Get the depth of the clip stack. More...
 
Nimble::Rectangle stackRectangle (size_t index) const
 Get a rectangle from the stack. More...
 
 ~ClipStack ()
 Destroy a ClipStack.
 

Detailed Description

This class provides an implementation of a clipping stack.

The stack is defined by a list of rectangles. Each rectangle defines the visible area on that stack level. The ClipStack is used, for example, by the rendering algorithm to determine which widgets are visible and need to be drawn.

Constructor & Destructor Documentation

Nimble::ClipStack::ClipStack ( const ClipStack other)

Construct a copy of a ClipStack.

Parameters
otherClipStack to copy

Member Function Documentation

Nimble::Rect Nimble::ClipStack::boundingBox ( ) const

Get the bounding box encompassing all the rectangles in the clipstack.

Returns
bounding box of all rectangles
bool Nimble::ClipStack::isVisible ( const Nimble::Rectangle r) const

Check if the given rectangle is visible.

A rectangle is visible, if the intersection of the given rectangle and every rectangle in stack is non-empty.

Parameters
rrectangle to check
Returns
true if the rectangle is visible; otherwise false
bool Nimble::ClipStack::isVisible ( const Nimble::Vector2 p) const

Check if the given point is visible.

Parameters
ppoint to check
Returns
true if the point is visible: otherwise false
ClipStack& Nimble::ClipStack::operator= ( const ClipStack other)

Copy a ClipStack.

Parameters
otherClipStack to copy
Returns
reference to the ClipStack
ClipStack& Nimble::ClipStack::pop ( )

Pop a rectangle from the top of the ClipStack.

Returns
reference to the ClipStack
ClipStack& Nimble::ClipStack::push ( const Rectangle r)

Push a rectangle to the top of the ClipStack.

Parameters
rrectangle to push
Returns
reference to the ClipStack
size_t Nimble::ClipStack::stackDepth ( ) const

Get the depth of the clip stack.

Returns the number of rectangles in the stack.

Returns
depth of the stack
Nimble::Rectangle Nimble::ClipStack::stackRectangle ( size_t  index) const

Get a rectangle from the stack.

The index ranges from zero (bottom of the stack) to stackDepth() - 1 (top of the stack).

Parameters
indexindex of the rectangle in the stack
Returns
stack requested rectangle