gtk/docs/reference/gdk/tmpl/regions.sgml
Alexander Larsson 5b4c8afa7e i2000-11-22 Alexander Larsson <alexl@redhat.com>
* gdk/gdktypes.h:
	Add new type GdkSpan

	* docs/reference/gdk/gdk-sections.txt,
	docs/reference/gdk/tmpl/regions.sgml, gdk/gdkregion-generic.c,
	gdk/gdkregion.h:
	Implement and document gdk_region_spans_intersect_foreach.

	* gdk/linux-fb/Makefile.am, gdk/linux-fb/gdkrender-fb.c:
	Add new file gdkrender-fb.c which contains all core
	rendering code.
	Add gdk_fb_fill_rectangle_generic (old rectangle code) and
	gdk_fb_fill_rectangle_simple_16, gdk_fb_fill_rectangle_simple_32
	(optimized rectangle fillers).

	* gdk/linux-fb/gdkdrawable-fb2.c:
	Move all rendering code to gdkrender-fb.c.
	Change from using GdkRectangles and GdkSegments for spans to GdkSpan.
	Use the new span intersection functions in gdk_fb_fill_spans.
	gdk_fb_draw_rectangle() clips filled rectangles and calls
	gc->fill_rectangle with the result.
	gdk_fb_fill_spans() gets extra argument "sorted".

	* gdk/linux-fb/gdkevents-fb.c:
	Remove unused includes and defines.
	New function gdk_fb_get_time() to get correct time for events.

	* gdk/linux-fb/gdkinput-ps2.c:
	Use gdk method of generating multiple-clicks (gdk_event_button_generate)
	Make sure to set the time of all events.

	* gdk/linux-fb/gdkmain-fb.c:
	Use gdk_fb_get_time ().

	* gdk/linux-fb/gdkprivate-fb.h:
	New virtual GC calls: fill_span & fill_rectangle.
	Export gdk_fb_get_time().
	gdk_fb_fill_spans() gets extra argument "sorted".

	* gdk/linux-fb/mi*.c:
	Use GdkSpan instead of GdkRectangle.
	Pass correct sorted to gdk_fb_fill_spans. (sorted value taken
	from XFree 4 source)
2000-11-22 10:07:34 +00:00

302 lines
6.3 KiB
Plaintext

<!-- ##### SECTION Title ##### -->
Points, Rectangles and Regions
<!-- ##### SECTION Short_Description ##### -->
simple graphical data types.
<!-- ##### SECTION Long_Description ##### -->
<para>
GDK provides the #GdkPoint, #GdkRectangle, #GdkRegion and #GdkSpan data types
for representing pixels and sets of pixels on the screen.
</para>
<para>
#GdkPoint is a simple structure containing an x and y coordinate of a point.
</para>
<para>
#GdkRectangle 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().
</para>
<para>
#GdkRegion 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()).
</para>
<para>
#GdkSpan 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().
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### STRUCT GdkPoint ##### -->
<para>
</para>
@x:
@y:
<!-- ##### STRUCT GdkRectangle ##### -->
<para>
</para>
@x:
@y:
@width:
@height:
<!-- ##### FUNCTION gdk_rectangle_intersect ##### -->
<para>
</para>
@src1:
@src2:
@dest:
@Returns:
<!-- ##### FUNCTION gdk_rectangle_union ##### -->
<para>
</para>
@src1:
@src2:
@dest:
<!-- ##### STRUCT GdkRegion ##### -->
<para>
A GdkRegion represents a set of pixels on the screen.
The only user-visible field of the structure is the user_data member, which
can be used to attach arbitrary data to the #GdkRegion.
</para>
<!-- ##### FUNCTION gdk_region_new ##### -->
<para>
Creates a new empty #GdkRegion.
</para>
@Returns: a new empty #GdkRegion.
<!-- ##### FUNCTION gdk_region_polygon ##### -->
<para>
Creates a new #GdkRegion using the polygon defined by a number of points.
</para>
@points: an array of #GdkPoint structs.
@npoints: the number of elements in the @points array.
@fill_rule: specifies which pixels are included in the region when the polygon
overlaps itself.
@Returns: a new #GdkRegion based on the given polygon.
<!-- ##### ENUM GdkFillRule ##### -->
<para>
The method for determining which pixels are included in a region, when
creating a #GdkRegion from a polygon.
The fill rule is only relevant for polygons which overlap themselves.
</para>
@GDK_EVEN_ODD_RULE: areas which are overlapped an odd number of times are
included in the region, while areas overlapped an even number of times are not.
@GDK_WINDING_RULE: overlapping areas are always included.
<!-- ##### FUNCTION gdk_region_copy ##### -->
<para>
</para>
@region:
@Returns:
<!-- ##### FUNCTION gdk_region_rectangle ##### -->
<para>
</para>
@rectangle:
@Returns:
<!-- ##### FUNCTION gdk_region_destroy ##### -->
<para>
Destroys a #GdkRegion.
</para>
@region: a #GdkRegion.
<!-- ##### FUNCTION gdk_region_get_clipbox ##### -->
<para>
Returns the smallest rectangle which includes the entire #GdkRegion.
</para>
@region: a #GdkRegion.
@rectangle: returns the smallest rectangle which includes all of @region.
<!-- ##### FUNCTION gdk_region_empty ##### -->
<para>
Returns TRUE if the #GdkRegion is empty.
</para>
@region: a #GdkRegion.
@Returns: TRUE if @region is empty.
<!-- ##### FUNCTION gdk_region_equal ##### -->
<para>
Returns TRUE if the two regions are the same.
</para>
@region1: a #GdkRegion.
@region2: a #GdkRegion.
@Returns: TRUE if @region1 and @region2 are equal.
<!-- ##### FUNCTION gdk_region_point_in ##### -->
<para>
Returns TRUE if a point is in a region.
</para>
@region: a #GdkRegion.
@x: the x coordinate of a point.
@y: the y coordinate of a point.
@Returns: TRUE if the point is in @region.
<!-- ##### FUNCTION gdk_region_rect_in ##### -->
<para>
Tests whether a rectangle is within a region.
</para>
@region: a #GdkRegion.
@rect: a #GdkRectangle.
@Returns: 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 #GdkRegion, respectively.
<!-- ##### ENUM GdkOverlapType ##### -->
<para>
Specifies the possible values returned by gdk_region_rect_in().
</para>
@GDK_OVERLAP_RECTANGLE_IN: if the rectangle is inside the #GdkRegion.
@GDK_OVERLAP_RECTANGLE_OUT: if the rectangle is outside the #GdkRegion.
@GDK_OVERLAP_RECTANGLE_PART: if the rectangle is partly inside the #GdkRegion.
<!-- ##### FUNCTION gdk_region_offset ##### -->
<para>
Moves a region the specified distance.
</para>
@region: a #GdkRegion.
@dx: the distance to move the region horizontally.
@dy: the distance to move the region vertically.
<!-- ##### FUNCTION gdk_region_shrink ##### -->
<para>
Resizes a region by the specified amount.
Positive values shrink the region. Negative values expand it.
</para>
@region: a #GdkRegion.
@dx: the number of pixels to shrink the region horizontally.
@dy: the number of pixels to shrink the region vertically.
<!-- ##### FUNCTION gdk_region_union_with_rect ##### -->
<para>
Returns the union of a region and a rectangle.
</para>
@region: a #GdkRegion.
@rect: a #GdkRectangle.
<!-- # Unused Parameters # -->
@Returns: the union of @region and @rect.
<!-- ##### FUNCTION gdk_region_intersect ##### -->
<para>
</para>
@source1:
@source2:
<!-- ##### FUNCTION gdk_region_union ##### -->
<para>
</para>
@source1:
@source2:
<!-- ##### FUNCTION gdk_region_subtract ##### -->
<para>
</para>
@source1:
@source2:
<!-- ##### FUNCTION gdk_region_xor ##### -->
<para>
</para>
@source1:
@source2:
<!-- ##### STRUCT GdkSpan ##### -->
<para>
</para>
@x:
@y:
@width:
<!-- ##### USER_FUNCTION GdkSpanFunc ##### -->
<para>
</para>
@span: The intersected part of the span.
@data: Opaque data passed by user.
<!-- ##### FUNCTION gdk_region_spans_intersect_foreach ##### -->
<para>
Intersects a set of spans with a region and call a user specified
function for each resulting spanline. This function is a lot more effective
if the spans are sorted.
</para>
@region: The region to intersect against.
@spans: Array of spans to intersect.
@n_spans: Number of spans.
@sorted: True if the spans are sorted in increasing y order.
@function: The function to call for each intersected spanline.
@data: Opaque user data passed to function.