#include <wincoord.h>
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. |
Definition at line 125 of file wincoord.h.
|
Definition at line 128 of file wincoord.h.
|
|
Constructor for a WinCoord. Calls CPoint::CPoint(x, y).
Definition at line 124 of file wincoord.cpp.
|
|
Constructor for a WinCoord. Calls CPoint::CPoint(x, y).
Definition at line 144 of file wincoord.cpp.
|
|
Converts a WinCoord to a OilCoord.
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 }
|