Trevor, you're right. Core Image should work fine even if you're doing software rendering. It sounds like you are writing a filter. You need a CIImage that wraps the input image, and a CIContext that wraps the output image.
Step 1 For the input image, a straightforward approach is to wrap a CGBitmapContext around the input image, then call CGBitmapContextCreateImage() to get a CGImage from that, and then call +[CIImage imageWithCGImage:] to get a CGImage from that. Then use the Core Image APIs to apply a CIFilter to that. You're going to use the output CIImage from that operation.
Step 2 For the output, wrap a CGBitmapContext around the output image. Then make a CIContext from that with +[CIContext contextWithCGContext:options:dict:]. Draw your CIImage from step 1 into this CIContext. You now have pixels in your FxPlug output bitmap.
For hardware rendering, the steps are similar, but your images and context will be OpenGL-based instead of Core Graphics-based.
The best sample code for this is probably the Core Image samples.
Good luck! Dave On Apr 27, 2007, at 11:04 AM, Trevor Anderson wrote: Hi everyone,
I'm having trouble implementing Core Image as a software renderer in FxPlug. I'm fairly new to mac programming in general, which is probably the problem :) I can get vImage to work great, but I would like to go beyond that a little. Most of the macs I have don't support hardware rendering, but that doesn't seem to bother Core Image, so I figured it would work. I'm not sure of the process path for this though, should I create a core graphics image first, then a core image image? Sample code would be the best, as I find it easier to learn from, but I can't find any out there. The only code seems to load the images from disk, but we already have them in memory, and not wrapped in any particular way, and there seems to be many ways to represent this data for the different graphics apis that apple has working. vImage appears to be the easiest so far as I can just through raw data at it. Any help would be appreciated as all my code seems to crash the system and without real examples I don't really know what I'm doing.
Thanks, Trevor
|