NextPrevUpTopContentsIndex

2.5.2 CLIM Point Objects

A point is a mathematical point in the drawing plane that is identified by its coordinates, a pair of real numbers. Points have neither area nor length. Note that a point is not the same thing as a pixel; CLIM's model of the drawing plane has continuous coordinates.

You can create point objects and use them as arguments to the drawing functions. Alternatively, you can use the spread versions of the drawing functions, that is, the drawing functions with stars appended to their names. For example, instead of draw-point , use draw-point* , which takes two arguments specifying a point by its coordinates. (Note that, for performance reasons, we generally recommend the use of the spread versions.)

The operations for creating and dealing with points are:

point [Protocol Class]	

Summary: The protocol class that corresponds to a mathematical point. This is a subclass of region and bounding-rectangle . If you want to create a new class that behaves like a point, it should be a subclass of point . Subclasses of point obey the point protocol.

pointp [Function]	

Arguments: object

Summary: Returns t if object is a point; otherwise, it returns nil .

standard-point

Summary: An instantiable class that implements a point. This is a subclass of point . This is the class that make-point instantiates. Members of this class are immutable.

make-point [Function]	

Arguments: x y

Summary: Returns an object of class standard-point whose coordinates are x and y . x and y must be real numbers.

The following generic functions comprise the point Application Programmer Interface. Only point-position is in the point protocol; that is, all classes that are subclasses of point must implement methods for point-position , but need not implement methods for point-x and point-y .

point-position [Generic Function]

Arguments: point

Summary: Returns both the x and y coordinates of the point point as two values.

point-x [Generic Function]

Arguments: point

point-y [Generic Function]

Arguments: point

Summary: Returns the x or y coordinate of the point point , respectively. CLIM will supply default methods for point-x and point-y on the protocol class point that are implemented by calling point-position .


Common Lisp Interface Manager 2.0 User's Guide - 27 Feb 2008

NextPrevUpTopContentsIndex