Path: utzoo!attcan!uunet!dino!ux1.cso.uiuc.edu!brutus.cs.uiuc.edu!apple!well!oster From: oster@well.sf.ca.us (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: Text Orientation Message-ID: <19101@well.sf.ca.us> Date: 18 Jul 90 10:45:56 GMT References: <9111@goofy.Apple.COM> Organization: Whole Earth 'Lectronic Link, Sausalito, CA Lines: 26 There is a clever, but SLOOOW routine to rotate a bitmap given in the Smalltalk - 80 reference manual and implemented in C in Best of MacTutor vol 1. (Example is rotation of a picture of liberty bell.) A more recent volume of MacTutor gave the correct algorithm for the 1-bit per pixel case: copy the image to an offscreen bitmap that is a multiple of 8 wide and a multiple of 8 tall (round up if necessary.) Copy that to a second offscreen bitmap that is the transpose in dimensions (i.e, if the soure is 16x8, the dest is 8x16. Do this with your own custom assembly language routine that moves an 8x8 square of pixels at a time, transposing them as it copies (The 68000 data registers and shift instructions are a big help here.) Then pick out of the dest what you actually need and copybits it to the screen. (This transposing process can put margins on original rectangles that aren't a multiple of 8 in dimension.) The 8-bit per pixel case is much simpler, just move the pixels: for(i = 0;i < IMAX;i++){ for(j = 0;j < JMAX;j++){ dest[i][j] = src[j][i]; } } from the src to the dest offscreen pixmaps. Naturally, the above code will also work for 32bit per pixel pixmaps. I leave the 2 bit, and 4 bit per pixel cases as an exercise. -- -- David Phillip Oster - Note new address. Old one has gone Bye Bye. -- oster@well.sf.ca.us = {backbone}!well!oster