Re: how to draw the slope text ?

2003-12-25 Thread Aaron Ardiri
> does anyone know how to draw text with different slope/angles 
> (e.g. 30, 45, 90 degrees) ?
> thx!

implement your own rotation algorithm... or, wait until PalmOS
catches up to every other platform with providing graphic context
support (and, stuff like this), in Palm OS6 :)

---
Aaron Ardiri
[EMAIL PROTECTED]
http://www.mobilewizardry.com/members/aaron_ardiri.php [profile]

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


Re: how to draw the slope text ?

2003-12-25 Thread KEN

"Aaron Ardiri" <[EMAIL PROTECTED]> ??? news:[EMAIL PROTECTED]
???...
> > does anyone know how to draw text with different slope/angles
> > (e.g. 30, 45, 90 degrees) ?
> > thx!
>
> implement your own rotation algorithm... or, wait until PalmOS
> catches up to every other platform with providing graphic context
> support (and, stuff like this), in Palm OS6 :)

many map programs display/draw street names according to the slope of their
street lines, but I have no idea how to do that


>
> ---
> Aaron Ardiri
> [EMAIL PROTECTED]
> http://www.mobilewizardry.com/members/aaron_ardiri.php [profile]
>



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


re: how to draw the slope text ?

2003-12-25 Thread Steve
Rotating bitmap fonts… pretty ugly, except for 90°*n with n an integer.

TrueType fonts would be the real solution, as promised for palmOS V6…
but you have still to manage V5 device (v6 will not replace v5 but will
co-live for a time) and v6 will not be really on the market before a
year (My own estimation).

At the company I working we have developed a graphical toolkit. One of
it keys points is anti-aliased fonts (but still bitmap) we can print
them along any direction. This is still not rotated text but is enough
for our own use. When I will have time (hope soon), I will consider
adding vector fonts.

…The toolkit contains also fast optimized procedures for standard
drawing operations. With a little code, we can manage sprite animation.

This is not a general purpose toolkit; it has only the features we
require for our own projects. But we can customize it, if someone would
like to license it.

If any one is interested, please contact me directly.

Steve




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


Re: how to draw the slope text ?

2003-12-25 Thread Aaron Ardiri
> > > does anyone know how to draw text with different slope/angles
> > > (e.g. 30, 45, 90 degrees) ?
> > > thx!
> >
> > implement your own rotation algorithm... or, wait until PalmOS
> > catches up to every other platform with providing graphic context
> > support (and, stuff like this), in Palm OS6 :)
> 
> many map programs display/draw street names according to the slope of their
> street lines, but I have no idea how to do that

google for rotation transformation matrix.

http://kwon3d.com/theory/transform/transform.html
http://kwon3d.com/theory/transform/rot.html

draw it to an offscreen window - then, apply a rotation. then 
overlay onto the 'final' display :) done. doesn't take much to
code up :) to save you doing a lot of digging/math - here is the
basic algorithm

void 
rotate(x,y,*_x,*_y,angle)
{
  *x = ( cos(angle) * x) + (sin(angle) * y);
  *y = (-sin(angle) * x) + (cos(angle) * y);
}

basic trigonometry :) piece of cake - now, to make it fast
you can use integer math instead of using 'cos' and 'sin'
functions (= slow). Mathlib can help there if needed. 

---
Aaron Ardiri
[EMAIL PROTECTED]
http://www.mobilewizardry.com/members/aaron_ardiri.php [profile]

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


Re: how to draw the slope text ?

2003-12-25 Thread KEN

"Aaron Ardiri" <[EMAIL PROTECTED]> ??? news:[EMAIL PROTECTED]
???...
> > > > does anyone know how to draw text with different slope/angles
> > > > (e.g. 30, 45, 90 degrees) ?
> > > > thx!
> > >
> > > implement your own rotation algorithm... or, wait until PalmOS
> > > catches up to every other platform with providing graphic context
> > > support (and, stuff like this), in Palm OS6 :)
> >
> > many map programs display/draw street names according to the slope of
their
> > street lines, but I have no idea how to do that
>
> google for rotation transformation matrix.
>
> http://kwon3d.com/theory/transform/transform.html
> http://kwon3d.com/theory/transform/rot.html
>
> draw it to an offscreen window - then, apply a rotation. then
> overlay onto the 'final' display :) done. doesn't take much to
> code up :) to save you doing a lot of digging/math - here is the
> basic algorithm
>
> void
> rotate(x,y,*_x,*_y,angle)
> {
>   *x = ( cos(angle) * x) + (sin(angle) * y);
>   *y = (-sin(angle) * x) + (cos(angle) * y);
> }

I don't really understand the above algorithm
x & y are the original coordinates ?
so what do  *_x  &  *_y  mean? why they are not included in :
*x = ( cos(angle) * x) + (sin(angle) * y);
*y = (-sin(angle) * x) + (cos(angle) * y);
?
and  *x  & *y  are the new coordinates ?
I'm quite confused


>
> basic trigonometry :) piece of cake - now, to make it fast
> you can use integer math instead of using 'cos' and 'sin'
> functions (= slow). Mathlib can help there if needed.
>
> ---
> Aaron Ardiri
> [EMAIL PROTECTED]
> http://www.mobilewizardry.com/members/aaron_ardiri.php [profile]
>



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


Re: how to draw the slope text ?

2003-12-25 Thread Aaron Ardiri
> > void
> > rotate(x,y,*_x,*_y,angle)
> > {
> >   *x = ( cos(angle) * x) + (sin(angle) * y);
> >   *y = (-sin(angle) * x) + (cos(angle) * y);
> > }
> 
> I don't really understand the above algorithm

sorry, that should have read:

> *_x = ( cos(angle) * x) + (sin(angle) * y);
> *_y = (-sin(angle) * x) + (cos(angle) * y);

new co-ordinates = value based on old co-ordinates

---
Aaron Ardiri
[EMAIL PROTECTED]
http://www.mobilewizardry.com/members/aaron_ardiri.php [profile]

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


Re: how to draw the slope text ?

2003-12-25 Thread KEN

"Aaron Ardiri" <[EMAIL PROTECTED]> ??? news:[EMAIL PROTECTED]
???...
> > > void
> > > rotate(x,y,*_x,*_y,angle)
> > > {
> > >   *x = ( cos(angle) * x) + (sin(angle) * y);
> > >   *y = (-sin(angle) * x) + (cos(angle) * y);
> > > }
> >
> > I don't really understand the above algorithm
>
> sorry, that should have read:
>
> > *_x = ( cos(angle) * x) + (sin(angle) * y);
> > *_y = (-sin(angle) * x) + (cos(angle) * y);
>
> new co-ordinates = value based on old co-ordinates

the orginial XY system changes to the new X'Y' system, however, if I draw
the texts, they should appear as horizontal no matter as XY or X'Y' system,
so how can I display the texts with slope in the orginial XY system?



>
> ---
> Aaron Ardiri
> [EMAIL PROTECTED]
> http://www.mobilewizardry.com/members/aaron_ardiri.php [profile]
>



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


Re: how to draw the slope text ?

2003-12-25 Thread KEN

> "Aaron Ardiri" <[EMAIL PROTECTED]> ???
news:[EMAIL PROTECTED]
> ???...
> > > > void
> > > > rotate(x,y,*_x,*_y,angle)
> > > > {
> > > >   *x = ( cos(angle) * x) + (sin(angle) * y);
> > > >   *y = (-sin(angle) * x) + (cos(angle) * y);
> > > > }
> > >
> > > I don't really understand the above algorithm
> >
> > sorry, that should have read:
> >
> > > *_x = ( cos(angle) * x) + (sin(angle) * y);
> > > *_y = (-sin(angle) * x) + (cos(angle) * y);
> >
> > new co-ordinates = value based on old co-ordinates
>
> the orginial XY system changes to the new X'Y' system, however, if I draw
> the texts, they should appear as horizontal no matter as XY or X'Y'
system,
> so how can I display the texts with slope in the orginial XY system?

what I mean is how to copy the "screen" of X'Y' system and make it appears
as slope in XY system?


>
> >
> > ---
> > Aaron Ardiri
> > [EMAIL PROTECTED]
> > http://www.mobilewizardry.com/members/aaron_ardiri.php [profile]
> >
>
>
>



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


Re: how to draw the slope text ?

2003-12-25 Thread Aaron Ardiri
> > sorry, that should have read:
> >
> > > *_x = ( cos(angle) * x) + (sin(angle) * y);
> > > *_y = (-sin(angle) * x) + (cos(angle) * y);
> >
> > new co-ordinates = value based on old co-ordinates
> 
> the orginial XY system changes to the new X'Y' system, however, if I draw
> the texts, they should appear as horizontal no matter as XY or X'Y' system,
> so how can I display the texts with slope in the orginial XY system?

simple:

step #1
- draw text to *normal* buffer, using WinDrawChars()

step #2
- apply rotation of the *normal* buffer, using rotation matrix

step #3
- copy (using invert/overlay) the rotated buffer to the display

thats about all the help i'll give you - you can figure out the 
rest :) also, you might also want to consider doing something
like the following screen shots (works nice, and, doesn't require much)

http://www.ardiri.com/palm/citikey/map3.gif
http://www.ardiri.com/palm/citikey/map4.gif

damn.. that code is so old *g* - long were the days of hacking
grayscale on old 16Mhz devices *g*

---
Aaron Ardiri
[EMAIL PROTECTED]
http://www.mobilewizardry.com/members/aaron_ardiri.php [profile]

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


Re: how to draw the slope text ?

2003-12-25 Thread KEN

"Aaron Ardiri" <[EMAIL PROTECTED]> ??? news:[EMAIL PROTECTED]
???...
> > > sorry, that should have read:
> > >
> > > > *_x = ( cos(angle) * x) + (sin(angle) * y);
> > > > *_y = (-sin(angle) * x) + (cos(angle) * y);
> > >
> > > new co-ordinates = value based on old co-ordinates
> >
> > the orginial XY system changes to the new X'Y' system, however, if I
draw
> > the texts, they should appear as horizontal no matter as XY or X'Y'
system,
> > so how can I display the texts with slope in the orginial XY system?
>
> simple:
>
> step #1
> - draw text to *normal* buffer, using WinDrawChars()
>
> step #2
> - apply rotation of the *normal* buffer, using rotation matrix
>
> step #3
> - copy (using invert/overlay) the rotated buffer to the display
>

step #2 is the process I don't understand

if using these 2 formulae:
*_x = ( cos(angle) * x) + (sin(angle) * y);
*_y = (-sin(angle) * x) + (cos(angle) * y);
only the coordinates will be changed
e.g., if x=0, y=50, angle=90 degrees, then *_x = 50, *_y =0

then, just for demonstration, below code segment only draw the "rotated"
text abc to a different position but not sloping it, thats what I don't
understand
---
 WinHandle  originalWindow, offscreenWindow;
 UInt16  err;
 RectangleType r;

 offscreenWindow = WinCreateOffscreenWindow(160,160,genericFormat, &err);
 originalWindow = WinSetDrawWindow(offscreenWindow);

 WinDrawChars("abc",StrLen("abc"),0,50);   //original x,y position at (0,50)
 WinDrawChars("abc",StrLen("abc"),50,0);   //new *_x , *_y position at
(50,0)

 WinGetBounds(offscreenWindow, &r);
 WinCopyRectangle(offscreenWindow, originalWindow, &r, 0, 0, winOverlay);
 WinSetDrawWindow(originalWindow);
---

so how does the rotation achieve?


> thats about all the help i'll give you - you can figure out the
> rest :) also, you might also want to consider doing something
> like the following screen shots (works nice, and, doesn't require much)
>
> http://www.ardiri.com/palm/citikey/map3.gif
> http://www.ardiri.com/palm/citikey/map4.gif

It is very nice, in fact I am working sth very similar to it.


>
> damn.. that code is so old *g* - long were the days of hacking
> grayscale on old 16Mhz devices *g*
>
> ---
> Aaron Ardiri
> [EMAIL PROTECTED]
> http://www.mobilewizardry.com/members/aaron_ardiri.php [profile]
>



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


Re: how to draw the slope text ?

2003-12-25 Thread Albert J. Franklin
Ken,

   I think that what Aaron means is that the every pixel in the offscreen
window buffer is rotated before being overlayed on the original window
display.  What you are doing is calculating one point, and using that as the
source of the a WinDrawChars (hence, new origin, but no rotation).

Al

- Original Message - 
From: "KEN" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Friday, December 26, 2003 1:09 AM
Subject: Re: how to draw the slope text ?


>
> "Aaron Ardiri" <[EMAIL PROTECTED]> ???
news:[EMAIL PROTECTED]
> ???...
> > > > sorry, that should have read:
> > > >
> > > > > *_x = ( cos(angle) * x) + (sin(angle) * y);
> > > > > *_y = (-sin(angle) * x) + (cos(angle) * y);
> > > >
> > > > new co-ordinates = value based on old co-ordinates
> > >
> > > the orginial XY system changes to the new X'Y' system, however, if I
> draw
> > > the texts, they should appear as horizontal no matter as XY or X'Y'
> system,
> > > so how can I display the texts with slope in the orginial XY system?
> >
> > simple:
> >
> > step #1
> > - draw text to *normal* buffer, using WinDrawChars()
> >
> > step #2
> > - apply rotation of the *normal* buffer, using rotation matrix
> >
> > step #3
> > - copy (using invert/overlay) the rotated buffer to the display
> >
>
> step #2 is the process I don't understand
>
> if using these 2 formulae:
> *_x = ( cos(angle) * x) + (sin(angle) * y);
> *_y = (-sin(angle) * x) + (cos(angle) * y);
> only the coordinates will be changed
> e.g., if x=0, y=50, angle=90 degrees, then *_x = 50, *_y =0
>
> then, just for demonstration, below code segment only draw the "rotated"
> text abc to a different position but not sloping it, thats what I don't
> understand
> ---
>  WinHandle  originalWindow, offscreenWindow;
>  UInt16  err;
>  RectangleType r;
>
>  offscreenWindow = WinCreateOffscreenWindow(160,160,genericFormat, &err);
>  originalWindow = WinSetDrawWindow(offscreenWindow);
>
>  WinDrawChars("abc",StrLen("abc"),0,50);   //original x,y position at
(0,50)
>  WinDrawChars("abc",StrLen("abc"),50,0);   //new *_x , *_y position at
> (50,0)
>
>  WinGetBounds(offscreenWindow, &r);
>  WinCopyRectangle(offscreenWindow, originalWindow, &r, 0, 0, winOverlay);
>  WinSetDrawWindow(originalWindow);
> ---
>
> so how does the rotation achieve?
>
>
> > thats about all the help i'll give you - you can figure out the
> > rest :) also, you might also want to consider doing something
> > like the following screen shots (works nice, and, doesn't require much)
> >
> > http://www.ardiri.com/palm/citikey/map3.gif
> > http://www.ardiri.com/palm/citikey/map4.gif
>
> It is very nice, in fact I am working sth very similar to it.
>
>
> >
> > damn.. that code is so old *g* - long were the days of hacking
> > grayscale on old 16Mhz devices *g*
> >
> > ---
> > Aaron Ardiri
> > [EMAIL PROTECTED]
> > http://www.mobilewizardry.com/members/aaron_ardiri.php [profile]
> >
>
>
>
> -- 
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
>



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


Re: how to draw the slope text ?

2003-12-25 Thread Aaron Ardiri
> I think that what Aaron means is that the every pixel in the offscreen
> window buffer is rotated before being overlayed on the original window
> display.  What you are doing is calculating one point, and using that 
> as the source of the a WinDrawChars (hence, new origin, but no rotation).

http://www.gamedev.net/reference/articles/article811.asp

whats wrong with people 'looking' for answers to their problems
instead of just asking for help? if you cannot figure it out from
here, maybe it is time you decided to do something else.

---
Aaron Ardiri
[EMAIL PROTECTED]
http://www.mobilewizardry.com/members/aaron_ardiri.php [profile]

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


Re: how to draw the slope text ?

2003-12-26 Thread Ron Nicholson
A good textbook on 3d computer graphics will explain how to rotate
a bitmap much more thoroughly than a PalmOS forum.  Applying
a rotation transformation matrix to every point in a rectangular
bitmap is not even close to the most efficient algorithm.

Computer Graphics: Principles and Practice
by Foley and van Dam, is one highly regarded textbook on the subject.

You can also examine the code inside various software texture-mapped
3d renderers.  You might also want to use interpolation if you don't
want small bitmapped fonts to look even more ragged after rotation.


IMHO. YMMV.

Ron Nicholson
HotPaw Productions
 http://www.hotpaw.com/rhn/palm






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


Re: how to draw the slope text ?

2003-12-26 Thread Aaron Ardiri
> A good textbook on 3d computer graphics will explain how to rotate
> a bitmap much more thoroughly than a PalmOS forum.  Applying
> a rotation transformation matrix to every point in a rectangular
> bitmap is not even close to the most efficient algorithm.
> 
> Computer Graphics: Principles and Practice
> by Foley and van Dam, is one highly regarded textbook on the subject.
> 
> You can also examine the code inside various software texture-mapped
> 3d renderers.  You might also want to use interpolation if you don't
> want small bitmapped fonts to look even more ragged after rotation.

game developer websites are also good. also old demo sites.
(most examples are in assembler, but, same concepts) :P

my example using a transformation matrix was intentional. at least
that way they can understand *how* it works. of course, there are a 
different algorithms to do the same thing - the shear/transform
approach is well recommended. 

anti-aliasing is another topic of discussion all together *g*

there is nothing worse than someone just c+p'ing an algorithm
from somewhere without actually understanding how it works. it
kinda makes it harder to debug :)

---
Aaron Ardiri
[EMAIL PROTECTED]
http://www.mobilewizardry.com/members/aaron_ardiri.php [profile]

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


RE: how to draw the slope text ?

2003-12-26 Thread steve
Thanks Aaron, you're a mother to all of us

Steve

> there is nothing worse than someone just c+p'ing an algorithm
> from somewhere without actually understanding how it works. it
> kinda makes it harder to debug :)
> 
> ---
> Aaron Ardiri



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