Graphics Environment: 5.6 Coordinate Space: Current Position

Up: GEOS SDK TechDocs| Up | Prev: 5.5 Larger Document Spaces | Next: 6 Graphics State
GrMoveTo(), GrMoveToWWFixed(), GrRelMoveTo(), GrGetCurPos(), GrGetCurPosWWFixed()

The graphics system supports the notion of a current position, sometimes called a pen position. Note that the pen position metaphor predates "pen computing"; please don't confuse these concepts. The concept behind the pen position is that all graphics commands are executed by a pen that ends up at the last place drawn. So if the last command was to draw a curve ending at (20, 20), the pen will still be there. There are special drawing commands that work with the pen position, so you could then draw a line from the current position to (30, 30). The line would extend from (20, 20) to (30, 30), and the pen would then be at (30, 30).

Calling GrMoveTo() moves the pen position to coordinates of your choice. GrMoveToWWFixed() moves the pen position to coordinates which may be specified with a great deal of precision. GrRelMoveTo() moves the pen to a location relative to its present position. GrRelMoveTo() takes coordinates accurate to a fraction of a point, allowing for very precise placement. Call GrGetCurPos() to get the current position, GrGetCurPosWWFixed() to do so with greater accuracy.

There are some guidelines to follow when figuring out where your pen position is going to end up after a draw operation. If you call the GrDrawLineTo() procedure, the pen will end up at the point drawn to. If you call any draw/fill procedure that takes two points as arguments, the pen position usually ends up at the second point passed; if it does not, the reference entry will note where the pen position ends. When text draws at the current position, the current position is used to place the left side of the text. When done drawing the text, the current position has moved to the right side of the text.


Up: GEOS SDK TechDocs| Up | Prev: 5.5 Larger Document Spaces | Next: 6 Graphics State