File: coordinates.xml

package info (click to toggle)
goocanvas 0.13-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 5,416 kB
  • ctags: 4,070
  • sloc: ansic: 25,430; xml: 11,548; sh: 9,261; makefile: 186
file content (86 lines) | stat: -rw-r--r-- 3,728 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="goocanvas-coordinates">
  <refmeta>
    <refentrytitle>Coordinate Spaces and Limits</refentrytitle>
    <manvolnum>3</manvolnum>
    <refmiscinfo>GOOCANVAS Library</refmiscinfo>
  </refmeta>

  <refnamediv>
    <refname>Coordinate Spaces and Limits</refname>
    <refpurpose>how coordinates are used.</refpurpose>
  </refnamediv>

  <refsect1 id="coordinates">
    <title>Coordinate Spaces</title>
    <para>
      Items in the canvas typically have a number of properties specifying
      their location and size. For example the #GooCanvasRect item has
      #GooCanvasRect:x, #GooCanvasRect:y, #GooCanvasRect:width and
      #GooCanvasRect:height properties.
    </para>
    <para>
      However, items can also have a transformation matrix (e.g. the
      #GooCanvasItem:transform property).
      Transformation matrices modify the item's coordinate space in some
      way. Modifications include translation (moving the origin), rotation,
      scaling, and skewing, or combinations of these. Thus the final
      position of the item on the canvas can be altered dramatically.
    </para>
    <para>
      The simple animation features in #GooCanvas are accomplished by
      modifying the item's transformation matrix over time.
      (See goo_canvas_item_animate().)
    </para>
    <para>
      Since items are in a hierarchy it is possible to move or rotate an
      entire group of items by simply changing the transformation matrix
      of the group containing them.
    </para>
    <para>
      The coordinate space used within the item itself (e.g. where the
      #GooCanvasRect:x and #GooCanvasRect:y properties of a #GooCanvasRect
      are specified)
      is referred to as "Item Space". The coordinate space used by
      the entire canvas is referred to as "Device Space". "Item Space"
      and "Device Space" may or may not be the same, depending on whether
      the item or any of its ancestors have a transformation matrix set.
      (Note that the entire canvas may also be scrolled and/or zoomed,
      which means that there may be additional transformations above
      "Device Space".)
    </para>
    <para>
      Functions are provided to convert between coordinate spaces,
      e.g. goo_canvas_convert_to_item_space() and
      goo_canvas_convert_from_item_space() convert device space coordinates
      to item space and vice versa.
    </para>

    <refsect2 id="coordinate-limits">
      <title>Coordinate Limits</title>
      <para>
	GooCanvas uses the Cairo graphics library to render canvas items.
	For performance reasons Cairo uses 32-bit fixed point integers
	internally when rendering graphics, with 24 bits used for the integer
	part of values and 8 bits used for the fractional part.
	This means that values are limited to roughly +/- 8,388,608.
	(Prior to Cairo 1.6 16 bits were used for the integer part and 16 bits
	for the	fractional part, meaning values were limited to +/- 32,768.)
      </para>
      <para>
	GooCanvas includes code to work around the Cairo limits to some extent.
	Subclasses of GooCanvasItemSimple (including all builtin items) can
	use any desired translation using a transformation matrix.
	But item space coordinates (modified by any scale, rotation or skew)
	must be within the Cairo limits.
      </para>
      <para>
	It is possible to create new canvas items that avoid the Cairo
	limits completely. For an example of this see the "Large Items" page
	in the GooCanvas demo application, and the corresponding code.
      </para>
    </refsect2>
  </refsect1>
</refentry>