swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Rendering rotated characters in a raster?


From: Phil Knight
Subject: Rendering rotated characters in a raster?
Date: Thu, 2 Oct 1997 20:21:46 +0100

I'm putting together a CA like sim in which each agent is represented
on a raster as an alpha character. The agent can face in any one of 
four directions - N, S, E, W. (I may later extend this to eight).

I thought of setting up a class, agentImage, which contained four
agentPixmaps - one for each direction. agentPixmap would extend XPixmap
and would include an additional method, setChar:Angle, which would be
called before createEnd to set up the pixmap from the specified
character rotated through the specified angle. (Does this sound 
reasonable so far?)

The new method will need to do the following (I think :-) )
 1) create a bitmap B and write the character to it.
 2) create an XImage I1 from B.
 3) create an XImage I2.
 4) for each x,y in I2, I2(x,y) = I1(a,b) where 
      a = x * cos(theta) - y * sin(theta)
      b = x * sin(theta) + y * cos(theta)
 5) copy I2 back to the original bitmap B.

Now here's the catch. I know next to zilch about tcl/tk and X 
programming and to be honest, with the pending arrival of the Java GUI 
Swarm, its not a learning curve I'm too keen to tackle. So <grin> 
can any of the Swarm gurus out there give me some advice on how to 
code this method, i.e. what X functions do I need to call and how?
Also, what (if any) are the implications of fonts? Or is there a much
better way of achieving the same thing?

Any help would be much appreciated.
-- 
Phil Knight

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]