WinCoord Class Reference

Structure holding a 16-bit/32-bit (Win16/Win32) cartesian coordinate. Its main use is to hold the coordinates supplied to and from the operating system. The origin for this coordinate system is the top-left of the screen or window. More...

#include <wincoord.h>

List of all members.

Public Member Functions

 WinCoord ()
 WinCoord (INT32 x, INT32 y)
 Constructor for a WinCoord. Calls CPoint::CPoint(x, y).
 WinCoord (wxPoint pt)
 Constructor for a WinCoord. Calls CPoint::CPoint(x, y).
OilCoord ToOil (View *pView, BOOL PixelCentre=FALSE) const
 Converts a WinCoord to a OilCoord.


Detailed Description

Structure holding a 16-bit/32-bit (Win16/Win32) cartesian coordinate. Its main use is to hold the coordinates supplied to and from the operating system. The origin for this coordinate system is the top-left of the screen or window.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/8/1993 Base Class: The wx point coordinate structure, wxPoint.

Definition at line 125 of file wincoord.h.


Constructor & Destructor Documentation

WinCoord::WinCoord  )  [inline]
 

Definition at line 128 of file wincoord.h.

00128 : wxPoint() {}

WinCoord::WinCoord INT32  x,
INT32  y
 

Constructor for a WinCoord. Calls CPoint::CPoint(x, y).

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/8/93
Parameters:
Two integers (either signed 16 or 32 bits, depending on the Windows platform). [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: None. See Also: class CPoint

Definition at line 124 of file wincoord.cpp.

00124                                    : wxPoint(x, y)
00125 {
00126 }

WinCoord::WinCoord wxPoint  pt  ) 
 

Constructor for a WinCoord. Calls CPoint::CPoint(x, y).

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/8/93
Parameters:
Two integers (either signed 16 or 32 bits, depending on the Windows platform). [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: None. See Also: class CPoint

Definition at line 144 of file wincoord.cpp.

00144                              : wxPoint(pt)
00145 {
00146 }


Member Function Documentation

OilCoord WinCoord::ToOil View pView,
BOOL  PixelCentre = FALSE
const
 

Converts a WinCoord to a OilCoord.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/8/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The position, as an OIL coordinate, of the bottom-left corner of the pixel located at (this) in the Windows coordinate system.

Errors: None. See Also: OilCoord::ToWin()

Definition at line 165 of file wincoord.cpp.

00166 {
00167     // Note that we have to negate the y coord, because Windows starts with 0 at the top
00168     // and then positive coordinates in a downward direction, i.e. the opposite to
00169     // Camelot's coordinate systems.
00170     // NB. More importantly, we add 1 to the y coord, because the flipping of the y axis
00171     //     causes a misalignment in the pixel systems.  This is because Camelot coords
00172     //     specify the bottom left of the pixel, whereas GDI coords specify the top-left.
00173     //     (See coord.doc for more details)
00174 //  return OilCoord(LongMulFixed16(x, OilCoord::PixelWidth()),
00175 //                 -LongMulFixed16(y + 1, OilCoord::PixelHeight()));
00176 
00177     // New info: (Phil, 17/11/94)
00178     // The one pixel bodge is no longer required because the pixel model has been modified
00179     // so that pixel coordinates are in the centres of pixels, not on any edge.
00180     // This allows coordinate systems to be negated without any extra work.
00181 //  return OilCoord(LongMulFixed16(x, OilCoord::PixelWidth()),
00182 //                 -LongMulFixed16(y, OilCoord::PixelHeight()));
00183     
00184     FIXED16 PixelWidth, PixelHeight;
00185     pView->GetPixelSize(&PixelWidth, &PixelHeight);
00186     OilCoord temp = OilCoord(LongMulFixed16(x, PixelWidth),
00187                             -LongMulFixed16(y, PixelHeight)
00188                             );
00189     if (PixelCentre)
00190     {
00191         // Coordinate is a click coord which is different than normal rectangle coords
00192         // Rectangle coords need to specify the joints between pixels
00193         // Click coords need to specify pixel centres
00194         // So shift this coord to the centre of the pixel above and to the right of the
00195         // joint specified by the raw OilCoord.
00196         // The amount added is just less than half a pixel so that GDraw's anti-aliasing
00197         // will draw thin lines predictably.
00198         temp.x += (PixelWidth.MakeLong()*15)/32;
00199         temp.y -= (PixelHeight.MakeLong()*15)/32;
00200     }
00201 
00202     return temp;
00203 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:03:08 2007 for Camelot by  doxygen 1.4.4