---
name: "CL_ClipRect"
section: "3"
platform: "linux"
package: "clanlib0-common-dev"
version: "0.4.4-8"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/CL_ClipRect"
---

# CL\_ClipRect(3)

Clipping rectangle class in ClanLib.

## NAME

CL\_ClipRect - Clipping rectangle class in ClanLib.

## 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.

## CLASS MEMBERS

- int **m\_x1**

  - int **m\_y1**

  - int **m\_x2**

  - int **m\_y2**

  - **CL\_ClipRect**()

  - **CL\_ClipRect**(

  ```
  const CL_ClipRect &rect)
  ```

- **CL\_ClipRect**(

  ```
  int x1,
  int y1,
  int x2,
  int y2)
  ```

- bool **test\_clipped**(

  ```
  const CL_ClipRect &rect)
  ```

- bool **test\_unclipped**(

  ```
  const CL_ClipRect &rect)
  ```

- bool **test\_all\_clipped**(

  ```
  const CL_ClipRect &rect)
  ```

- CL\_ClipRect **clip**(

  ```
  const CL_ClipRect &rect)
  ```

- bool **operator ==**(

  ```
  const CL_ClipRect &rect)
  ```

## MEMBERS WITH DESCRIPTIONS

- int **m\_x1**

  ```
  Description:
  ```

  Min x-coordinate of the rectangle.

- int **m\_y1**

  ```
  Description:
  ```

  Min y-coordinate of the rectangle.

- int **m\_x2**

  ```
  Description:
  ```

  Max x-coordinate of the rectangle - NOT included in clipping area

- int **m\_y2**

  ```
  Description:
  ```

  Max y-coordinate of the rectangle - NOT included in clipping area

- **CL\_ClipRect**()

  ```
  Description:
  ```

  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**(

  ```
  const CL_ClipRect &rect)
  ```

  ```
  Description:
  ```

  Copy constructor.

- **CL\_ClipRect**(

  ```
  int x1,
  int y1,
  int x2,
  int y2)
  ```

  ```
  Parameters:
  (x1,y1) - Upper left corner of the rectangle.
  (x2,y2) - Lower right corner of the rectangle (not included)
  ```

  ```
  Description:
  ```

  Constructs a clipping rectangle from (x1,y1) to (x2,y2).

- bool **test\_clipped**(

  ```
  const CL_ClipRect &rect)
  ```

  ```
  Parameters:
  rect - The rectangle to be tested.
  ```

  ```
  Description:
  ```

  Tests if the specified rectangle needs to be clipped with this clip rect.

  ```
  Return value:
  ```

  True if the passed rectangle needs to be clipped.

- bool **test\_unclipped**(

  ```
  const CL_ClipRect &rect)
  ```

  ```
  Parameters:
  rect - The rectangle to be tested.
  ```

  ```
  Description:
  ```

  Tests whether the specified rectangle is entirely contained withinthis clip rect.

  ```
  Return value:
  ```

  True if the passed rectangle is contained within this rectangle.

- bool **test\_all\_clipped**(

  ```
  const CL_ClipRect &rect)
  ```

  ```
  Parameters:
  rect - The rectangle to be tested.
  ```

  ```
  Description:
  ```

  Tests whether all of the specified rectangle is outside this rectangle.

  ```
  Return value:
  ```

  True if the entire specified rect is outside this rectangle.

- CL\_ClipRect **clip**(

  ```
  const CL_ClipRect &rect)
  ```

  ```
  Parameters:
  rect - The rectangle to be clipped.
  ```

  ```
  Description:
  ```

  Clips the given rectangle and returns the result.

  ```
  Return value:
  ```

  The clipped rectangle.

- bool **operator ==**(

  ```
  const CL_ClipRect &rect)
  ```

  ```
  Description:
  ```

  Standard C++ == operator.\
   	friend ostream& operator \<\< (ostream &os, CL\_ClipRect &rect);

  ```
  Return value:
  ```

  True if specified rectangle equals this rectangle.

## SEE ALSO

- **CL\_Display**

  The DisplayCard wrapper class.

- **CL\_DisplayCard**

  The DisplayCard class.

All ClanLib API classes can be found in **clanlib (3)**.

## AUTHORS

Originally written by Magnus Norddahl \<*mbn@dark.x.dtu.dk*\> and Martin Starch \<*starch@dark.x.dtu.dk*\>. ClanLib is now developed by the ClanLib Development team as an Open Source project.

The ClanLib man pages was created using the Perceps documentation system (another excellent piece of Open Source software, available at **http://somewhere.in.the.world.org**).

See **clanlib (3)** to find out how to get a full list of contributors and details on how to submit bug reports, comments etc.
