[comp.sys.mac.programmer] Rotating Text...

mag653@csc.anu.oz (11/16/89)

I am trying to rotate text within a window. As mentioned in TN41, I am 
using an offscreen bitmap. However, I am having troble rotating the 
bitmap itself. I have used the brute force approach in tranposing bit by 
bit into a new bitmap, But this seems very unreasonable. Can anyone 
please suggest a cleaner way of doing this.

Many thanks.


Martin  Grant
mag653@csc.anu.oz

oster@dewey.soe.berkeley.edu (David Phillip Oster) (11/17/89)

There was a great MacTutor article on running TextEdit() with 90 and 180
degree rotations.  the basic idea is: divide the bitmap into 8x8 pixel
rectangles, then use a tuned assembly language routine to rotate the
rectangles, then use CopyBits() (or a tuned loop) to copy each 8x8
rectangle to its destination.  There are some boundary conditions to watch
out for, but you can definately rotate a 256x256 area many times a
second.

houpt@husc8.HARVARD.EDU (Thomas Houpt) (01/17/90)

 I may have missed something somewhere, but how do you rotate text
 under Quickdraw? I just want to write characters along a vertical
 baseline. All the other graphic interfaces I've worked with allowed
 you to specify a baseline for text to be drawn along. I know it
 can be done, since lots of applications support rotating text.
 My planned hack is to draw the text to an off-screen bit-map, then
 rotate the pixels "by hand" before copying them to the screen.
 Is there a more elegant solution (aside from (I hope) system 7?).

 Tom Houpt
 houpt@husc8.harvard.edu

stevem@hpvcfs1.HP.COM (Steve Miller) (01/19/90)

> Is there a more elegant solution  [to rotate text]

Nope.

Steven Miller

oster@dewey.soe.berkeley.edu (David Phillip Oster) (01/19/90)

In article <1274@husc6.harvard.edu> houpt@husc8.UUCP (Thomas Houpt) writes:
> My planned hack is to draw the text to an off-screen bit-map, then
> rotate the pixels "by hand" before copying them to the screen.
> Is there a more elegant solution (aside from (I hope) system 7?).

Nope, you've got the right way to do it under the current and past system
software. There was an article in MacTutor magazine that gave source code
for this (It showed TextEdit remapped to do all 4 90 degree rotations,
simultaneously.) I think it was last year. Great article.

--- David Phillip Oster            --  No, I come from Boston. I just work
Arpa: oster@dewey.soe.berkeley.edu --  in cyberspace.
Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu

gillies@p.cs.uiuc.edu (01/22/90)

I think it's kind of surprising that Quickdraw doesn't have a
RotateCopyBits call, not even for just 90, 180, and 270 degrees
rotations.  This is an oversight of mammoth proportion.  Does anyone
know why?

casseres@apple.com (David Casseres) (01/23/90)

In article <104700070@p.cs.uiuc.edu> gillies@p.cs.uiuc.edu writes:
> I think it's kind of surprising that Quickdraw doesn't have a
> RotateCopyBits call, not even for just 90, 180, and 270 degrees
> rotations.  This is an oversight of mammoth proportion.  Does anyone
> know why?

Not an oversight, really.  It's for the same reason a lot of programming 
languages don't have an exponentiation operator built in:  there are a 
number of ways to do the job, but which one is best depends on the 
circumstances.  Doing simple rotations is rather easy in assembly 
language, but how you optimize depends heavily on things like the exact 
dimensions of your bitmap.  In general, note that QuickDraw provides a 
rather complete set of bitmap _transfer_ facilities (i.e. all the 
different transfer modes) but essentially no bitmap _processing_ 
facilities other than simple pack and unpack operations.

David Casseres
     Exclaimer:  Hey!

cecala@m2.csc.ti.com (Tony Cecala) (01/25/90)

A friend of mine is doing perceptual experiments with her Mac.  We've
got Scrapbook bitmaps going on the screen and subjects make decisions about
these PICTs.  We need to rotate these and would like pointers to some CODE,
preferably in Pascal.  The rotations need to be done in an OffScreen bitmap
and then blasted onto the screen with CopyBits (this is a reaction time
study).  Any help would be very much appreciated.

If you wish to respond directly, 
please send to: 2459***@prime.acc.virginia.edu

Tony Cecala
User Interface Designer      | 2414 Spring Meadow Dr., Mesquite, TX 75150
Texas Instruments, Inc.      | Arpanet: cecala@m2.csc.ti.com
*I speak for me only*        | AppleLink: VIA.applelink.apple.com

timm@yoyodyne.ncsa.uiuc.edu (Tim McClarren) (06/12/91)

I'm sorry to do this...I know this was just discussed a couple months
ago, but I now have need to rotate text...could someone please e-mail
me references to the solutions that were discussed on the net
(or code if you have it?).  Thanks much.
Tim