swarm-support
[Top][All Lists]
Advanced

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

Re: Rendering rotated characters in a raster?


From: Benedikt Stefansson
Subject: Re: Rendering rotated characters in a raster?
Date: Thu, 02 Oct 1997 13:46:57 -0700

Phil,


I'll jump in here for fun and then maybe Nelson or someone who actually
knows what he is talking about can correct me.

I think you don't need to mess around with any Tk/Tcl hacking to do this.
Start by creating bitmaps for the characters (one nice utility that can
help you with this are the ASCII graphics tools such as pbmtoascii).

Then implement a class which is a wrapper around XPixmap (which is the
class that actually copies the .xpm files into the Tk buffer). In this new
class do the black magic you just described, i.e. by giving a command such
as "rotateLeft", the class will map a base bitmap that has been read from a
.xpm file into a rotated bitmap (both the source and the destination are
going to be arrays of char's). I must have slept through my linear algebra
classes so I'm not going to venture into the subject of rotating a matrix.

Next either generate a new instance of XPixmap and hand it the generated
array or overwrite the pixmap array in an existing XPixmap instance. (Note
that XPixmap in the Swarmlibs now only knows how to read the array from
file so you'll have to implement a new method which accepts a new array via
pointer. Might take some tweaking because of memory allocation problems).

Finally hand a pointer to the XPixmap instance over to the objects that
require it to draw themselves on raster, as in Heatbugs. Using XPixmap
allows you to avoid all Tk hacking (hopefully).

Sorry that I can't provide you with code. And of course some Tk hacker
might now a command that actually does all of this with the original
buffer. (Check out createEnd in XPixmap for hints)

-Benedikt
--
----------------
Benedikt Stefansson                 address@hidden
Department of Economics, UCLA       Fax. (310) 825-9528
Los Angeles, CA 90095-1477          Tel. (310) 825-1777



                  ==================================
   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]