Documentation Archive Developer
Search

ADC Home > Reference Library > Technical Q&As > Graphics & Imaging > Quartz >

CGContext Bounds


Q: How do I determine the bounds of a CGContext?

A: CGContexts don't have the concept of a bounding rectangle, per se. In cases where bounds matter, the CGContext was derived from another source that did have a bounds associated with it, i.e. a window port or an offscreen bitmap. In such cases, you need to remember the bounds of the structure the CGContext was derived from.

If you created the context using CreateCGContextForPort, store the result of GetPortBounds along with the context.

Likewise, if you created an offscreen context using CGBitmapContextCreate, you know the bounds already since you had to pass them into CGBitmapContextCreate.


[Jul 02 2001]