Deprecated CIContext Methods
A method identified as deprecated has been superseded and may become unsupported in the future.
Deprecated in OS X v10.6
contextWithCGLContext:pixelFormat:options:
Creates a Core Image context from a CGL context, using the specified options and pixel format object. (Deprecated in OS X v10.6. Instead use contextWithCGLContext:pixelFormat:colorSpace:options:.)
Parameters
- ctx
A CGL context (
CGLContextObjobject) obtain by calling the CGL functionCGLCreateContext.- pf
A CGL pixel format object (
CGLPixelFormatObjobject) created by calling the CGL functionCGLChoosePixelFormat. This argument must be the same pixel format object used to create the CGL context. The pixel format object must be valid for the lifetime of the Core Image context. Don’t release the pixel format object until after you release the Core Image context.- options
A dictionary that contains color space information. You can provide the keys
kCIContextOutputColorSpaceorkCIContextWorkingColorSpacealong with aCGColorSpaceRefobject for each color space.
Discussion
After calling this method, Core Image draws content into the surface (drawable object) attached to the CGL context. A CGL context is an OS X OpenGL context. For more information, see OpenGL Programming Guide for Mac.
When you create a CIContext object using a CGL context, all OpenGL states set for the CGL context affect rendering to that context. That means that coordinate and viewport transformations set on the CGL context as well as the vertex color.
For best results, follow these guidelines when you use Core Image to render into an OpenGL context:
Ensure that the a single unit in the coordinate space of the OpenGL context represents a single pixel in the output device.
The Core Image coordinate space has the origin in the bottom left corner of the screen. You should configure the OpenGL context in the same way.
The OpenGL context blending state is respected by Core Image. If the image you want to render contains translucent pixels, it’s best to enable blending using a blend function with the parameters
GL_ONE, GL_ONE_MINUS_SRC_ALPHA, as shown in the following code example.
Some typical initialization code for a view with width W and height H is:
glViewport (0, 0, W, H); |
glMatrixMode (GL_PROJECTION); |
glLoadIdentity (); |
glOrtho (0, W, 0, H, -1, 1); |
glMatrixMode (GL_MODELVIEW); |
glLoadIdentity (); |
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
glEnable (GL_BLEND); |
Availability
- Available in OS X v10.4 and later.
- Deprecated in OS X v10.6.
See Also
Declared In
CIContext.hDeprecated in OS X v10.8
drawImage:atPoint:fromRect:
Renders a region of an image to a point in the context destination. (Deprecated in OS X v10.8. Instead use drawImage:inRect:fromRect:.)
Parameters
- im
A Core Image image object.
- p
The point in the context destination to draw to.
- src
The region of the image to draw.
Discussion
This method because it is ambiguous as to the units of the dimensions and won’t work as expected in a high-resolution environment which is why you should use drawImage:inRect:fromRect: instead.
On iOS platforms, this method draws the image onto a render buffer for the OpenGL ES context. Use this method only if the CIContext object is created with contextWithEAGLContext:, and hence, you are rendering to a CAEAGLLayer.
Availability
- Available in OS X v10.4 and later.
- Deprecated in OS X v10.8.
See Also
Declared In
CIContext.h© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-09-19)