>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):
But, if I'm drawing to a native screen (instead of standard), will that line consist
of 2x2 pixels on a hi-res screen, or will it automatically resolve itself and draw
twice as many 1x1 pixels? In other words, if I were to draw a point at 10,10 on a
standard screen, I don't need the ability to, on a hi-res display, change that to
20,21. I will only EVER use the standard resolution in terms of where to draw. I
only want the hi-resolution rendering of those drawings.
>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);
>
Ah, but another person said that if I use nativeFormat and leave it as 160x160, then
it will, underneath, create a 320x320 window. This seems to contradict what you just
said.
>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);
>}
This is all confusing me more, actually. I don't care about working in 320x320
resolution. I just want my lines and text to render in hi-resolution if available.
So, I don't know if I have to surround EACH and EVERY drawing command with code that
checks if hi-res is supported, and if it is, change the coordinate system and double
all of the x,y values accordingly. It would be a lot of work if this is necessary.
But, based on what you are writing, it makes it sound like it is. Based on what Eron
wrote earlier, it sounds like you don't.
Of course, another question I have is how you determine what resolution the device
actually supports. There is, for example, a call to get the supported densities of
the device. But the documentation says that this isn't necessarily what you can
actually draw to...only what the blitter supports (whatever a blitter is!). So, while
this may report some desities, you might not actually be able to render to this. YOu
can use the GetCoordinateSystem, because that only gets the CURRENT coordinate system.
If I set the CoordinateSystem, it uses a different type (though, similarly defined)
for coordinate systems versus densities.
There is another call about getting the screen attributes, but that SOUNDS like it is
getting the actual pixels that the display supports. That's no good, either. Some
devices support 320x240, others 320x320, and others still 320x480. My code would have
to be able to know the difference. For example, is 320x240 mean that one direction is
1 1/2 times versus 2x density...or does it mean that the device is actually 240x240
plus an extended 80 pixels for a virtual graffiti area?
So, for now, I will only try to detect double density if necessary and automatically
just double all values. But, I'm not sure I even need to do that! It may be as simple
(perhaps???) as creating a native format off-screen window, and setting the coordinate
system when I do the CopyRectangle. I don't know, though. That's why I'm hoping
people here can help! :-)
Ryan
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/