Simple graphical data types
GDK provides the <gdk-point>
, <gdk-rectangle>
, <gdk-region>
and <gdk-span>
data types for representing pixels and sets of pixels on
the screen.
<gdk-point>
is a simple structure containing an x and y coordinate of a
point.
<gdk-rectangle>
is a structure holding the position and size of a
rectangle. The intersection of two rectangles can be computed with
gdk-rectangle-intersect
. To find the union of two rectangles use
gdk-rectangle-union
.
<gdk-region>
is an opaque data type holding a set of arbitrary pixels,
and is usually used for clipping graphical operations (see
gdk-gc-set-clip-region
).
<gdk-span>
is a structure holding a spanline. A spanline is a horizontal
line that is one pixel wide. It is mainly used when rasterizing other graphics
primitives. It can be intersected to regions by using
gdk-region-spans-intersect-foreach
.
<gdk-region>
)Creates a new empty
<gdk-region>
.
- ret
- a new empty
<gdk-region>
<gdk-region>
) ⇒ (ret <gdk-region>
)Copies region, creating an identical new region.
- region
- a
<gdk-region>
- ret
- a new region identical to region
<gdk-rectangle>
) ⇒ (ret <gdk-region>
)Creates a new region containing the area rectangle.
- rectangle
- a
<gdk-rectangle>
- ret
- a new region
<gdk-region>
) ⇒ (ret bool
)Finds out if the
<gdk-region>
is empty.
- region
- a
<gdk-region>
- ret
- ‘
#t
’ if region is empty.
<gdk-region>
) (region2 <gdk-region>
) ⇒ (ret bool
)Finds out if the two regions are the same.
- region1
- a
<gdk-region>
- region2
- a
<gdk-region>
- ret
- ‘
#t
’ if region1 and region2 are equal.
<gdk-region>
) (x int
) (y int
) ⇒ (ret bool
)Finds out if a point is in a region.
- region
- a
<gdk-region>
- x
- the x coordinate of a point
- y
- the y coordinate of a point
- ret
- ‘
#t
’ if the point is in region.
<gdk-region>
) (rectangle <gdk-rectangle>
) ⇒ (ret <gdk-overlap-type>
)Tests whether a rectangle is within a region.
- region
- a
<gdk-region>
.- rectangle
- a
<gdk-rectangle>
.- ret
- ‘GDK_OVERLAP_RECTANGLE_IN’, ‘GDK_OVERLAP_RECTANGLE_OUT’, or ‘GDK_OVERLAP_RECTANGLE_PART’, depending on whether the rectangle is inside, outside, or partly inside the
<gdk-region>
, respectively.
<gdk-region>
) (dx int
) (dy int
)Moves a region the specified distance.
- region
- a
<gdk-region>
- dx
- the distance to move the region horizontally
- dy
- the distance to move the region vertically
<gdk-region>
) (dx int
) (dy int
)Resizes a region by the specified amount. Positive values shrink the region. Negative values expand it.
- region
- a
<gdk-region>
- dx
- the number of pixels to shrink the region horizontally
- dy
- the number of pixels to shrink the region vertically
<gdk-region>
) (rect <gdk-rectangle>
)Sets the area of region to the union of the areas of region and rect. The resulting area is the set of pixels contained in either region or rect.
- region
- a
<gdk-region>
.- rect
- a
<gdk-rectangle>
.
<gdk-region>
) (source2 <gdk-region>
)Sets the area of source1 to the intersection of the areas of source1 and source2. The resulting area is the set of pixels contained in both source1 and source2.
- source1
- a
<gdk-region>
- source2
- another
<gdk-region>
<gdk-region>
) (source2 <gdk-region>
)Sets the area of source1 to the union of the areas of source1 and source2. The resulting area is the set of pixels contained in either source1 or source2.
- source1
- a
<gdk-region>
- source2
- a
<gdk-region>
<gdk-region>
) (source2 <gdk-region>
)Subtracts the area of source2 from the area source1. The resulting area is the set of pixels contained in source1 but not in source2.
- source1
- a
<gdk-region>
- source2
- another
<gdk-region>
<gdk-region>
) (source2 <gdk-region>
)Sets the area of source1 to the exclusive-OR of the areas of source1 and source2. The resulting area is the set of pixels contained in one or the other of the two sources but not in both.
- source1
- a
<gdk-region>
- source2
- another
<gdk-region>