I'm trying to do something very simple, but haven't figured out the key to
make it work.  What I want to do is shift an arbitrary rectangular area on
the screen to the right by exactly one pixel, regardless of screen density.

I have code that works on the low resolution devices, but on the
double-density devices such as the Tungsten, the rectangle shifts by 2
pixels.  I expected this, as the OS is adjusting for compatibility.  So, in
order to shift it by 1 pixel, I'm trying to write some OS5 particular code.


After reading the docs, it seemed that I needed to set the coordinate system
to native mode so that there is a 1-1 mapping of coordinates to pixels.  I
then expect the full screen to be from (0,0) to (319,319).  Then I convert
the rectangle coordinates from standard (160x160) to native (320x320).  Then
I shift the rectangle.  The code below illustrates what I'm doing.

RectangleType ShiftRect;
RectangleType EraseRect;

ShiftRect.topLeft.x = 1;
ShiftRect.topLeft.y = 1;
ShiftRect.extent.x = 10;
ShiftRect.extent.y = 10;

WinPushDrawState();
WinSetCoordinateSystem(kCoordinatesNative);
WinScaleRectangle( & ShiftRect);

ShiftRect.extent.x += 1;                                

WinScrollRectangle(& ShiftRect, winRight, 1, & EraseRect);
WinEraseRectangle( & EraseRect, 0);

WinPopDrawState();

However, the values of ShiftRect aren't changed.  I expected them to be
(2,2) with width of 20 and height of 20.  Even more strange,
WinScrollRectangle is scrolling as if the 160x160 coordinate system was
still in use.  This results in the appropriate display, but again shifted by
2 pixels.

Any advice would be most appreciated.

Jeff
 




--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to