gb2a+@andrew.cmu.edu (George J. Baxter) (07/12/90)
Hey guys and gals, Question: I'm writing a plotting routine for a C program, but can't seem to figure out how to flip the Y axis labelling so that the text is oriented sideways. Is there a way, and how the heck.. ???? George, late for dinner again.
casseres@apple.com (David Casseres) (07/13/90)
In article <Eaax8qu00Uh_4370dR@andrew.cmu.edu> gb2a+@andrew.cmu.edu (George J. Baxter) writes: > I'm writing a plotting routine for a C program, but can't > seem to figure out how to flip the Y axis labelling so that the text is > oriented sideways. Is there a way, and how the heck.. ???? QuickDraw doesn't provide any way of drawing text in any orientation except the usual horizontal one. So what you have to do is draw into the proverbial offscreen bitmap, and then have a routine that copies bits from that bitmap into another one, rotating as it goes. Have fun! David Casseres Exclaimer: Hey!
d_volaric@vaxa.cc.uwa.oz.au (07/13/90)
In article <Eaax8qu00Uh_4370dR@andrew.cmu.edu>, gb2a+@andrew.cmu.edu (George J. Baxter) writes: > Hey guys and gals, > Question: I'm writing a plotting routine for a C program, but can't > seem to figure out how to flip the Y axis labelling so that the text is > oriented sideways. Is there a way, and how the heck.. ???? > George, late for dinner again. The only way we can think of is to write into an off-screen bitmap, rotate the bitmap and copybits' it onto the screen (Easy isn't it?). How do you rotate bitmaps? Well we don't really know, but there is a very clever algorithm describes in MacTutor/Best of MacTutor somewhere (with code in C)... John and Darko. -- ------------------------------------------------------------------------------- D V O R A K C O M P U T E R Phone : +61 9 330 2876 The Bunker, Rear 57 Holman Street, Alfred Cove, Western Australia, 6154. P.O. Box 315, Melville, WA, 6156. -------------------------------------------------------------------------------
oster@well.sf.ca.us (David Phillip Oster) (07/18/90)
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