gegl-rectangle

gegl-rectangle

Functions

Types and Values

GeglRectangle result
#define GEGL_FLOAT_EPSILON

Description

Functions

gegl_rectangle_new ()

GeglRectangle *
gegl_rectangle_new (gint x,
                    gint y,
                    guint width,
                    guint height);

Creates a new rectangle set with the values from x , y , width and height .

Parameters

x

upper left x coordinate

 

y

upper left y coordinate

 

width

width in pixels.

 

height

height in pixels.

 

gegl_rectangle_set ()

void
gegl_rectangle_set (GeglRectangle *rectangle,
                    gint x,
                    gint y,
                    guint width,
                    guint height);

Sets the x , y , width and height on rectangle .

Parameters

rectangle

a GeglRectangle

 

x

upper left x coordinate

 

y

upper left y coordinate

 

width

width in pixels.

 

height

height in pixels.

 

gegl_rectangle_equal ()

gboolean
gegl_rectangle_equal (const GeglRectangle *rectangle1,
                      const GeglRectangle *rectangle2);

Check if two GeglRectangles are equal.

Returns TRUE if rectangle and rectangle2 are equal.

Parameters

rectangle1

a GeglRectangle

 

rectangle2

a GeglRectangle

 

gegl_rectangle_equal_coords ()

gboolean
gegl_rectangle_equal_coords (const GeglRectangle *rectangle,
                             gint x,
                             gint y,
                             gint width,
                             gint height);

Check if a rectangle is equal to a set of parameters.

Returns TRUE if rectangle and x ,y width x height are equal.

Parameters

rectangle

a GeglRectangle

 

x

X coordinate

 

y

Y coordinate

 

width

width of rectangle

 

height

height of rectangle

 

gegl_rectangle_is_empty ()

gboolean
gegl_rectangle_is_empty (const GeglRectangle *rectangle);

Check if a rectangle has zero area.

Returns TRUE if the width or height of rectangle is 0.

Parameters

rectangle

a GeglRectangle

 

gegl_rectangle_dup ()

GeglRectangle *
gegl_rectangle_dup (const GeglRectangle *rectangle);

Create a new copy of rectangle .

Parameters

rectangle

the GeglRectangle to duplicate

 

gegl_rectangle_copy ()

void
gegl_rectangle_copy (GeglRectangle *destination,
                     const GeglRectangle *source);

Copies the rectangle information stored in source over the information in destination .

destination may point to the same object as source .

Parameters

destination

a GeglRectangle

 

source

a GeglRectangle

 

gegl_rectangle_align ()

gboolean
gegl_rectangle_align (GeglRectangle *destination,
                      const GeglRectangle *rectangle,
                      const GeglRectangle *tile,
                      GeglRectangleAlignment alignment);

Aligns rectangle to a regular tile grid, of which tile is a representative tile, and stores the result in destination .

alignment can be one of:

GEGL_RECTANGLE_ALIGNMENT_SUBSET: Calculate the biggest aligned rectangle contained in rectangle .

GEGL_RECTANGLE_ALIGNMENT_SUPERSET: Calculate the smallest aligned rectangle containing rectangle .

GEGL_RECTANGLE_ALIGNMENT_NEAREST: Calculate the nearest aligned rectangle to rectangle .

destination may point to the same object as rectangle or tile .

Returns TRUE if the result is not empty.

Parameters

destination

a GeglRectangle

 

rectangle

a GeglRectangle

 

tile

a GeglRectangle

 

alignment

a GeglRectangleAlignment value

 

gegl_rectangle_align_to_buffer ()

gboolean
gegl_rectangle_align_to_buffer (GeglRectangle *destination,
                                const GeglRectangle *rectangle,
                                GeglBuffer *buffer,
                                GeglRectangleAlignment alignment);

Aligns rectangle to the tile grid of buffer , and stores the result in destination .

alignment has the same meaning as for gegl_rectangle_align().

destination may point to the same object as rectangle .

Returns TRUE if the result is not empty.

Parameters

destination

a GeglRectangle

 

rectangle

a GeglRectangle

 

buffer

a GeglBuffer

 

alignment

a GeglRectangleAlignment value

 

gegl_rectangle_bounding_box ()

void
gegl_rectangle_bounding_box (GeglRectangle *destination,
                             const GeglRectangle *source1,
                             const GeglRectangle *source2);

Computes the bounding box of the rectangles source1 and source2 and stores the resulting bounding box in destination .

destination may point to the same object as source1 or source2 .

Parameters

destination

a GeglRectangle

 

source1

a GeglRectangle

 

source2

a GeglRectangle

 

gegl_rectangle_intersect ()

gboolean
gegl_rectangle_intersect (GeglRectangle *dest,
                          const GeglRectangle *src1,
                          const GeglRectangle *src2);

Calculates the intersection of two rectangles. If the rectangles do not intersect, dest's width and height are set to 0 and its x and y values are undefined.

dest may point to the same object as src1 or src2 .

Returns TRUE if the rectangles intersect.

Parameters

dest

return location for the intersection of src1 and src2 , or NULL.

 

src1

a GeglRectangle

 

src2

a GeglRectangle

 

gegl_rectangle_subtract ()

gint
gegl_rectangle_subtract (GeglRectangle destination[4],
                         const GeglRectangle *minuend,
                         const GeglRectangle *subtrahend);

Subtracts subtrahend from minuend , and stores the resulting rectangles in destination . Between 0 and 4 disjoint rectangles may be produced.

destination may contain minuend or subtrahend .

Returns the number of resulting rectangles.

Parameters

destination

an array of 4 GeglRectangle elements

 

minuend

a GeglRectangle

 

subtrahend

a GeglRectangle

 

gegl_rectangle_subtract_bounding_box ()

gboolean
gegl_rectangle_subtract_bounding_box (GeglRectangle *destination,
                                      const GeglRectangle *minuend,
                                      const GeglRectangle *subtrahend);

Computes the bounding box of the area formed by subtracting subtrahend from minuend , and stores the result in destination .

destination may point to the same object as minuend or subtrahend .

Returns TRUE if the result is not empty.

Parameters

destination

a GeglRectangle

 

minuend

a GeglRectangle

 

subtrahend

a GeglRectangle

 

gegl_rectangle_xor ()

gint
gegl_rectangle_xor (GeglRectangle destination[4],
                    const GeglRectangle *source1,
                    const GeglRectangle *source2);

Computes the symmetric difference of the rectangles source1 and source2 , and stores the resulting rectangles in destination . Between 0 and 4 disjoint rectangles may be produced.

destination may contain rectangle1 or rectangle2 .

Returns the number of resulting rectangles.

Parameters

destination

an array of 4 GeglRectangle elements

 

source1

a GeglRectangle

 

source2

a GeglRectangle

 

gegl_rectangle_contains ()

gboolean
gegl_rectangle_contains (const GeglRectangle *parent,
                         const GeglRectangle *child);

Checks if the GeglRectangle child is fully contained within parent .

Returns TRUE if the child is fully contained in parent .

Parameters

parent

a GeglRectangle

 

child

a GeglRectangle

 

gegl_rectangle_infinite_plane ()

GeglRectangle
gegl_rectangle_infinite_plane (void);

Returns a GeglRectangle that represents an infininte plane.


gegl_rectangle_is_infinite_plane ()

gboolean
gegl_rectangle_is_infinite_plane (const GeglRectangle *rectangle);

Returns TRUE if the GeglRectangle represents an infininte plane, FALSE otherwise.

Parameters

rectangle

A GeglRectangle.

 

gegl_rectangle_dump ()

void
gegl_rectangle_dump (const GeglRectangle *rectangle);

For debugging purposes, not stable API.

Parameters

rectangle

A GeglRectangle.

 

GEGL_FLOAT_EQUAL()

#define GEGL_FLOAT_EQUAL(v1, v2)      (_gegl_float_epsilon_equal ((v1), (v2)))

Types and Values

result

  GeglRectangle result = {x, y, width, height};

GEGL_FLOAT_EPSILON

#define GEGL_FLOAT_EPSILON            (1e-5)