waung@rscene.hac.com (Franklin Waung) (12/14/90)
Hi there, I have a bit map of say 80 by 100 pixels 1 bit deep (black or white), and I want to expand the image on the bitmap to say 120 by 150 pixels. Does anyone know some short algorithms to do this? Any help is appreciated. Thanks. -Franklin Waung ===================================================================== ** Franklin Waung **
hairston@henry.ece.cmu.edu (David Hairston) (12/14/90)
[waung@rscene.hac.com (Franklin Waung) writes:] [] I have a bit map of say 80 by 100 pixels 1 bit deep (black or white), [] and I want to expand the image on the bitmap to say 120 by 150 pixels. [] [] Does anyone know some short algorithms to do this? read about Copybits in IM-I, QuickDraw Bit Transfer Operations. Copybits gets better with age but ever since the beginning you could transfer an image from one bitmap to another and the image will be sized according to the source and destination rectangles. the trick in all this is to keep rowBytes even (review QuickDraw focussing on bitmap operations). if you want to look at some related tools then see also: ScalePt, MapPt and MapRect under QuickDraw Miscellaneous Routines. -dave- hairston@henry.ece.cmu.edu
daven@svc.portal.com (12/15/90)
In article <12279@hacgate.UUCP> waung@rscene.hac.com (Franklin Waung) writes: > > I have a bit map of say 80 by 100 pixels 1 bit deep (black or white), >and I want to expand the image on the bitmap to say 120 by 150 pixels. > > Does anyone know some short algorithms to do this? > Yes, it's called "CopyBits". It takes as part of it's parameters the rectangle that surrounds the bits to be copied, and a rectangle that surrounds the destination. If the destination rectangle is larger than the source rectangle it will "scale" your image to fit the destination - probably what you want. It will also shrink an image if the destination rectangle is smaller than the source's. -- ------------------------------------------------------------------------------- Dave Newman | daven@svc.portal.com | AppleLink: D0025 Sofware Ventures Corp. | AOL: MicroPhone | CIS: 76004,2161 Berkeley, CA 94705 | WELL: tinman@well.sf.ca.us | (415) 644-3232
oster@well.sf.ca.us (David Phillip Oster) (12/17/90)
In article <12279@hacgate.UUCP> waung@rscene.hac.com (Franklin Waung) writes: > I have a bit map of say 80 by 100 pixels 1 bit deep (black or white), >and I want to expand the image on the bitmap to say 120 by 150 pixels. Copybits has this kind of distortion built in. example: Rect src, dest; SetRect(&src, 0, 0, 80, 100); SetRect(&dest, 0, 0, 120, 150); CopyBits(&thePort->portBits, &thePort->portBits, &src, &dest, srcCopy, NIL); If you are running on a macine with color quickdraw, and you have 32-bit color quickdraw installed either becasue it is a CI or newer, or because you re running a new enough system or because you have the 32-bit Color quickdraw file in your system folder, then CopyBits has a new transfer mode, srcCopyDithered, that does much better interpolation when stretching bitmaps, particularly gray-scale pixmaps. -- -- David Phillip Oster - At least the government doesn't make death worse. -- oster@well.sf.ca.us = {backbone}!well!oster