Canvas utility functions

Some useful canvas utility functions.

The `<gnome-canvas-points>`

structure manages an array of points (X and Y
coordinates) and is used by `<gnome-canvas-line>`

and
`<gnome-canvas-polygon>`

canvas items.

To create a `<gnome-canvas-points>`

structure call
`gnome-canvas-points-new`

and when finished using it call
`gnome-canvas-points-free`

.

Of note is that the `<gnome-canvas-points>`

structure is actually managed
by a reference count, so it won't be freed until this count reaches 0. To
increment its reference count call `gnome-canvas-points-ref`

and to
decrement it call `gnome-canvas-points-unref`

.

— Function: **gnome-canvas-get-miter-points** (`x1 ``y1 ``x2 ``y2 ``x3 ``y3 ``width `` ⇒ `(`ret ``mx1 ``my1 ``mx2 ``my2 `

`double`

) (`double`

) (`double`

) (`double`

) (`double`

) (`double`

) (`double`

)`int`

) (`double`

) (`double`

) (`double`

) (`double`

)Given three points forming an angle, computes the coordinates of the inside and outside points of the mitered corner formed by a line of a given width at that angle.

x1- X coordinate of the first point
y1- Y coordinate of the first point
x2- X coordinate of the second (angle) point
y2- Y coordinate of the second (angle) point
x3- X coordinate of the third point
y3- Y coordinate of the third point
width- Width of the line
mx1- The X coordinate of the first miter point is returned here.
my1- The Y coordinate of the first miter point is returned here.
mx2- The X coordinate of the second miter point is returned here.
my2- The Y coordinate of the second miter point is returned here.
ret- FALSE if the angle is less than 11 degrees (this is the same threshold as X uses. If this occurs, the return points are not modified. Otherwise, returns TRUE.

— Function: **gnome-canvas-get-butt-points** (`x1 ``y1 ``x2 ``y2 ``width ``project `` ⇒ `(`bx1 ``by1 ``bx2 ``by2 `

`double`

) (`double`

) (`double`

) (`double`

) (`double`

) (`int`

)`double`

) (`double`

) (`double`

) (`double`

)Computes the butt points of a line segment.

x1- X coordinate of first point in the line
y1- Y cooordinate of first point in the line
x2- X coordinate of second point (endpoint) of the line
y2- Y coordinate of second point (endpoint) of the line
width- Width of the line
project- Whether the butt points should project out by width/2 distance
bx1- X coordinate of first butt point is returned here
by1- Y coordinate of first butt point is returned here
bx2- X coordinate of second butt point is returned here
by2- Y coordinate of second butt point is returned here

— Function: **gnome-canvas-polygon-to-point** (`num_points ``x ``y `` ⇒ `(`ret ``poly `

`int`

) (`double`

) (`double`

)`double`

) (`double`

)Computes the distance between a point and a polygon.

poly- Vertices of the polygon. X coordinates are in the even indices, and Y coordinates are in the odd indices
num-points- Number of points in the polygon
x- X coordinate of the point
y- Y coordinate of the point
ret- The distance from the point to the polygon, or zero if the point is inside the polygon.

— Function: **gnome-canvas-item-reset-bounds** (`self `

— Method:**reset-bounds**

`<gnome-canvas-item>`

)— Method:

Resets the bounding box of a canvas item to an empty rectangle.

item- A canvas item

— Function: **gnome-canvas-update-bbox** (`item ``x1 ``y1 ``x2 ``y2 `

`<gnome-canvas-item>`

) (`int`

) (`int`

) (`int`

) (`int`

)Sets the bbox to the new value, requesting full repaint.

item- the canvas item needing update
x1- Left coordinate of the new bounding box
y1- Top coordinate of the new bounding box
x2- Right coordinate of the new bounding box
y2- Bottom coordinate of the new bounding box