Home Segments Index Top Previous Next

617: Mainline

Each pixel lies at a place that can be referred to by an instance of the Point class. Such Point instances contain the coordinates of the point, expressed in terms of two nonnegative integer instance variables, x and y.

You can create a new point, with coordinates 5 and 3, by sending the x:y: class method to the Point class:

Point x: 5 y: 3  <-- The point with x=5 and y=3 

Note that x and y are measured with respect to the left side and top of a window, rather than to the left side and bottom. The x coordinate of the point shown in the following, for example, is 5, and the y coordinate is 3: