Coordinate System Conversion Functions

Sometimes it's necessary to convert coordinates between screen space and world space. At other times, such as when using Windows API functions that write directly to the client area, we may need to convert virtual buffer coordinates to the equivalent client area position, or vice versa. Fastgraph includes eight conversion functions, four for x coordinates and four for y coordinates, to perform such conversions. The conversion functions all have a single parameter -- the coordinate to translate -- and return the translated coordinate as their function value.

The fg_xclient() and fg_yclient() functions convert virtual buffer screen space coordinates to client area screen space coordinates. The fg_xclient() function translates x coordinates, while fg_yclient() translates y coordinates. Conversely, fg_xvb() and fg_yvb() convert client area screen space coordinates to virtual buffer screen space coordinates. Note that fg_xvb() and fg_yvb() only work when the calling application is the foreground window. If another application is in the foreground, both functions will return -1.

The fg_xscreen() and fg_yscreen() functions convert world space coordinates to screen space. The fg_xscreen() function translates x coordinates, while fg_yscreen() translates y coordinates. Conversely, fg_xworld() and fg_yworld() convert screen space coordinates to world space.

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.