Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

KnightWRX

macrumors Pentium
Original poster
Jan 28, 2009
15,046
4
Quebec, Canada
Is there a way to select the scaling algorithm used by Apple's CGContextScaleCTM() function ? Basically, I see they are doing some kind of filtering, probably a simple bilinear filter, but I want no filtering or interpolation at all, I want a very basic nearest neighbor algorithm.

Thankfully, my pixels are stored as a linear array, so I was able to write my own scaling function with a very simple algorithm, but I was wondering if there was a "cleaner" way that would let me implement all sorts of filtering in my scaling function in case I ever wanted cleaner graphics.

I can't find squat in the documentation aside from CGContextScaleCTM to scale a Bitmap context and that function doesn't take a filtering argument. Doing it manually means I would have to write a bunch of scalers for 4 byte pixel arrays and call the appropriate one based on the filtering argument sent to the function.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.