Cairo.Region

Entities

Simple Types

Record Types

Constants

Subprograms

Description

Regions -- Representing a pixel-aligned area Bindings to the Cairo 2D graphics library. Regions are a simple graphical data type representing an area of integer- aligned rectangles. Thay are often used on raster surfaces to track areas of interest, such as change or clip areas.

<c_version>1.10</c_version> <group>Cairo</group>

"="

function "=" (A, B : Cairo_Region) return Boolean

Compares whether A is equivalent to B. Null_Region as an argument is equal to itself, but not to any non-Null_Region region.

Parameters
A
B
Return Value

Cairo_Rectangle_Int

type Cairo_Rectangle_Int is record
   X, Y, Width, Height : aliased Gint;
end record;
Record fields
X
Y
Width
Height

Cairo_Region

type Cairo_Region is private;

A Cairo_Region represents a set of integer-aligned rectangles.

It allows set-theoretical operations like Union and Intersect to be performed on them.

Memory management of Cairo_Region is done with Reference and Destroy.

Since: 1.10

Cairo_Region_Overlap

type Cairo_Region_Overlap is
  (Cairo_Region_Overlap_In,
   Cairo_Region_Overlap_Out,
   Cairo_Region_Overlap_Part
  );

Used as the return value for Contains_Rectangle.

Enumeration Literal
Cairo_Region_Overlap_In

Completely inside region

Cairo_Region_Overlap_Out

Completely outside region

Cairo_Region_Overlap_Part

Partly inside region

Contains_Point

function Contains_Point
  (Region : Cairo_Region;
   X      : Gint;
   Y      : Gint) return Boolean

Checks whether (X,Y) is contained in Region.

Parameters
Region
X
Y
Return Value

Contains_Rectangle

function Contains_Rectangle
  (Region    : Cairo_Region;
   Rectangle : access Cairo_Rectangle_Int) return Cairo_Region_Overlap

Checks whether Rectangle is inside, outside or partially contained in Region

Parameters
Region
Rectangle
Return Value

Copy

function Copy (Original : Cairo_Region) return Cairo_Region

Allocates a new Cairo_Region object copying the area from Original.

Parameters
Original
Return Value

A newly allocated Cairo_Region. Free with Destroy. This function always returns a valid Cairo_Region; if memory cannot be allocated, then a special error object is returned where all operations on the object do nothing. You can check for this with Status.

Create

function Create return Cairo_Region

Allocates a new empty region object.

Return Value

A newly allocated Cairo_Region. Free with Destroy. This function always returns a valid Cairo_Region; if memory cannot be allocated, then a special error object is returned where all operations on the object do nothing. You can check for this with Status.

Create_Rectangle

function Create_Rectangle
  (Rectangle : access Cairo_Rectangle_Int) return Cairo_Region

Allocates a new region object containing Rectangle.

Parameters
Rectangle
Return Value

A newly allocated Cairo_Region. Free with Destroy. This function always returns a valid Cairo_Region; if memory cannot be allocated, then a special error object is returned where all operations on the object do nothing. You can check for this with Status.

Destroy

procedure Destroy (Region : Cairo_Region)

Destroys a Cairo_Region object created with Create, Copy or Create_Rectangle.

Parameters
Region

Do_Xor

function Do_Xor
  (Dst   : Cairo_Region;
   Other : Cairo_Region) return Cairo_Status

Computes the exclusive difference of Dst with Other and places the result in Dst.

Parameters
Dst
Other
Return Value

Cairo_Status_Success or Cairo_Status_No_Memory.

Get_Extents

procedure Get_Extents
  (Region  : Cairo_Region;
   Extents : out Cairo_Rectangle_Int)

Gets the bounding rectangle of Region as a Cairo_Rectangle_Int

Parameters
Region
Extents

Get_Rectangle

procedure Get_Rectangle
  (Region    : Cairo_Region;
   Nth       : Gint;
   Rectangle : out Cairo_Rectangle_Int)

Stores the Nth rectangle from the region in Rectangle.

Parameters
Region
Nth
Rectangle

Intersect

function Intersect
  (Dst   : Cairo_Region;
   Other : Cairo_Region) return Cairo_Status

Computes the intersection of Dst with Other and places the result in Dst

Parameters
Dst
Other
Return Value

Cairo_Status_Success or Cairo_Status_No_Memory.

Intersect_Rectangle

function Intersect_Rectangle
  (Dst       : Cairo_Region;
   Rectangle : access Cairo_Rectangle_Int) return Cairo_Status

Computes the intersection of Dst with Rectangle and places the result in Dst.

Parameters
Dst
Rectangle
Return Value

Cairo_Status_Success or Cairo_Status_No_Memory.

Is_Empty

function Is_Empty (Region : Cairo_Region) return Boolean

Checks whether Region is empty.

Parameters
Region
Return Value

Null_Region

Null_Region : constant Cairo_Region;

Num_Rectangles

function Num_Rectangles (Region : Cairo_Region) return Gint

Returns the number of rectangle contained in Region

Parameters
Region
Return Value

Reference

function Reference (Region : Cairo_Region) return Cairo_Region

Increases the reference count on Region by one. This prefents Region from being destroyed until a matching call to Destroy is made.

Parameters
Region
Return Value

Status

function Status (Region : Cairo_Region) return Cairo_Status

Checks whether an error has occured for this region object.

Parameters
Region
Return Value

Cairo_Status_Success or Cairo_Status_No_Memory

Subtract

function Subtract
  (Dst   : Cairo_Region;
   Other : Cairo_Region) return Cairo_Status

Subtracts Other from Dst and places the result in Dst.

Parameters
Dst
Other
Return Value

Cairo_Status_Success or Cairo_Status_No_Memory.

Subtract_Rectangle

function Subtract_Rectangle
  (Dst       : Cairo_Region;
   Rectangle : access Cairo_Rectangle_Int) return Cairo_Status

Subtracts Rectangle from Dst and places the result in Dst.

Parameters
Dst
Rectangle
Return Value

Cairo_Status_Success or Cairo_Status_No_Memory.

Translate

procedure Translate
  (Region : Cairo_Region;
   dX     : Gint;
   dY     : Gint)

Translates Region by (dX,dY).

Parameters
Region
dX
dY

Union

function Union
  (Dst   : Cairo_Region;
   Other : Cairo_Region) return Cairo_Status

Computes the union of Dst with Other and places the result in Dst.

Parameters
Dst
Other
Return Value

Cairo_Status_Success or Cairo_Status_No_Memory.

Union_Rectangle

function Union_Rectangle
  (Dst       : Cairo_Region;
   Rectangle : access Cairo_Rectangle_Int) return Cairo_Status

Computes the union of Dst with Rectangle and places the result in Dst.

Parameters
Dst
Rectangle
Return Value

Cairo_Status_Success or Cairo_Status_No_Memory.

Xor_Rectangle

function Xor_Rectangle
  (Dst       : Cairo_Region;
   Rectangle : access Cairo_Rectangle_Int) return Cairo_Status

Computes the exclusive difference of Dst with Rectangle and places the result in Dst.

Parameters
Dst
Rectangle
Return Value

Cairo_Status_Success or Cairo_Status_No_Memory.