On Fri, 2004-02-13 at 13:58, [EMAIL PROTECTED] wrote:
> >You can either draw in 160x160 coordinates, or you can set the mode to
> >high density and draw to it. When you do the copy to the main window,
> >you just use the 160x160 coordinates again.
>
> I'm sorry to be so dense...but this information doesn't tell me
> anything. If I draw in 160x160 coordinates, will the actual DRAWING
> take place in hi-res? WHen I call WinDrawChars, for example, will it
> then draw the font in a hi-res font even though I'm using 160x160
> coordinates? Or, do I have to set the screen density, and then double
> the coordinates??? Of course, does this make the font, then, half the
> original size instead of just hi-res version of the same on-screen
> size?
This function should draw on the regular screen in 160x160:
void draw()
{
WinPaintLine(10,10,150,150);
}
This one, if run on a high res machine will do the same thing, but in
high res (this doesn't check to make sure the device you're on has
high-res, and will crash if run on, say, a m515):
void draw()
{
WinSetCoordinateSystem(kCoordinatesNative);
WinPaintLine(0,0,300,300);
WinSetCoordinateSystem(kCoordinatesStandard);
}
If you want to draw in high res to an off-screen buffer, and then
display that, you have to make sure to allocate your offscreen buffer in
nativeFormat, not screenFormat:
// in screen setup code
WinHandle wh=WinCreateOffscreenWindow(320,320,nativeFormat,&error);
void draw()
{
RectangleType r={{0,0},{320,320}};
WinSetDrawWindow(wh);
WinSetCoordinateSystem(kCoordinatesNative);
WinPaintLine(0,0,300,300);
WinSetCoordinateSystem(kCoordinatesStandard);
// Now blit the offscreen window to the main window
WinCopyRectangle(wh,WinGetDisplayWindow(),&r,0,0,winPaint);
}
That should be it.
disclaimer: this is off the top of my head. I haven't compiled it.
> Same thing for WinDrawLine...If I tell it to draw from 0,0 to 160,160,
> will it draw in 2x2 sized pixels on hi-res displays unless I set the
> screen coordinates to double-density? Or, since I created an
> off-screen bitmap of native format...will it automatically draw the
> line as I want...which is 1x1 pixel segments?
If you're on a high-res device, and you haven't explicitly called
'WinSetCoordinateSystem(kCoordinatesNative)', you're drawing in 160,160
mode.
Remember to always call 'WinSetCoordinateSystem(kCoordinatesStandard);'
just as soon as you're done drawing.
> I would prefer to NOT have to conditionally double every coordinate if
> I don't have to. I'd rather just be able to keep my code as is in
> terms of drawing, but have hi-res screens take advantage of the
> hi-resolution! But, I can't figure that out.
So write a program to draw lines with a gentle slope using the
information I've given you above and see if the lines are pixelated in
the various states you're concerned about. Even on the simulator you
should be able to tell, but on a real device it's obvious, as the pixels
on the screen are clearly visible.
> Yes...but, what you have explained so far hasn't really told me
> much...and neither does the companion doc. I'll re-read it yet again,
> though, in light of these conversations to see if anything makes more
> sense to me.
It sounds like you need to put pedal to the metal and write some code to
see how this all behaves in the real world. Just hack around and see
what happens.
> BTW, I'm sorry if I sound like I'm picking on you...I'm not really. I
> appreciate all the help I can get. It's just so far, I haven't
> received anything that makes any sense TO ME. Examples would be nice,
> if I knew where to find some.
Again, may I suggest that once you've got a test program that
demonstrates these capabilities to yourself that you post the code up on
the FAQ web site? (http://www.flippinbits.com/palmdevfaq)
-Ken
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/