Entire Class Index | Main Class Index | Cross Index | Global Index

# Class CL_ClipRect

Clipping rectangle class in ClanLib.
Contained in: global
Derived from: none
Derived by: none
Group: Display (Display 2D)

#include <ClanLib/display.h>

### public function member index:

### Construction:

`` | `CL_ClipRect` | `()`;
`` | `CL_ClipRect` | `(`const` `CL_ClipRect`& `rect`)`;
`` | `CL_ClipRect` | `(`int` `x1`, `int` `y1`, `int` `x2`, `int` `y2`)`;

### Attributes:

``bool`` | `test_clipped` | `(`const` `CL_ClipRect`& `rect`) `const``;
``bool`` | `test_unclipped` | `(`const` `CL_ClipRect`& `rect`) `const``;
``bool`` | `test_all_clipped` | `(`const` `CL_ClipRect`& `rect`) `const``;

### Operations:

``CL_ClipRect`` | `clip` | `(`const` `CL_ClipRect`& `rect`) `const``;

### Operators:

``bool`` | `operator``==` | `(`const` `CL_ClipRect`& `rect`) `const``;

## Description:

This class is used to define clipping regions when drawing graphics to the backbufffer. This is useful if it is too expensive to update the entire screen each time - instead you can define a limited area where everything outside the rectangle should be discarded.
The clipping rectangle is used together with the clipping rect functions in CL_Display and CL_DisplayCard.
See also: CL_Display - The DisplayCard wrapper class.
See also: CL_DisplayCard - The DisplayCard class.

## Function Member Descriptions:

CL_ClipRect::CL_ClipRect - Constructs an uninitialized clip rectangle.
(x1, y1) and (x2, y2) contain random values, and should be manually initialized before usage of the clip rect.
`` `CL_ClipRect` `()`;

CL_ClipRect::CL_ClipRect - Copy constructor.
`` `CL_ClipRect` `(`const` `CL_ClipRect`& `rect`)`;

CL_ClipRect::CL_ClipRect - Constructs a clipping rectangle from (x1,y1) to (x2,y2).
(x1,y1) - Upper left corner of the rectangle.
(x2,y2) - Lower right corner of the rectangle (not included)
`` `CL_ClipRect` `(`int` `x1`, `int` `y1`, `int` `x2`, `int` `y2`)`;

CL_ClipRect::clip - Clips the given rectangle and returns the result.
``CL_ClipRect`` `clip` `(`const` `CL_ClipRect`& `rect`) `const``;

> rect - The rectangle to be clipped.
> Returns - The clipped rectangle.

CL_ClipRect::operator == - Standard C++ == operator.
``bool`` `operator``==` `(`const` `CL_ClipRect`& `rect`) `const``;

> Returns - True if specified rectangle equals this rectangle.

CL_ClipRect::test_all_clipped - Tests whether all of the specified rectangle is outside this rectangle.
``bool`` `test_all_clipped` `(`const` `CL_ClipRect`& `rect`) `const``;

> rect - The rectangle to be tested.
> Returns - True if the entire specified rect is outside this rectangle.

CL_ClipRect::test_clipped - Tests if the specified rectangle needs to be clipped with this clip rect.
``bool`` `test_clipped` `(`const` `CL_ClipRect`& `rect`) `const``;

> rect - The rectangle to be tested.
> Returns - True if the passed rectangle needs to be clipped.

CL_ClipRect::test_unclipped - Tests whether the specified rectangle is entirely contained within this clip rect.
``bool`` `test_unclipped` `(`const` `CL_ClipRect`& `rect`) `const``;

> rect - The rectangle to be tested.
> Returns - True if the passed rectangle is contained within this rectangle.

## Variable Member Descriptions:

CL_ClipRect::m_x1 - Min x-coordinate of the rectangle.
``int`` ``m_x1`;`

CL_ClipRect::m_x2 - Max x-coordinate of the rectangle - NOT included in clipping area
``int`` ``m_x2`;`

CL_ClipRect::m_y1 - Min y-coordinate of the rectangle.
``int`` ``m_y1`;`

CL_ClipRect::m_y2 - Max y-coordinate of the rectangle - NOT included in clipping area
``int`` ``m_y2`;`