Back to Corkboard

CorkBufferedPboardInterpreter Class Reference

An abstract subclass of CorkPboardInterpreter that buffers drawing commands. More...

Inheritance diagram for CorkBufferedPboardInterpreter:

CorkPboardInterpreter

List of all members.

Public Member Functions

(void) - drawUnbufferedContentsInRect:drawingToBuffer:
 Sent to the receiver when its content needs to be drawn.


Detailed Description

An abstract subclass of CorkPboardInterpreter that buffers drawing commands.

If your interpreter subclass has complex drawing instructions, you may want to subclass this class instead of directly subclassing CorkPboardInterpreter. This class attempts to re-use what you draw wherever possible.

Due to the nature of buffered drawing (as implemented in Quartz on Mac OS X,) the exact content drawn may vary slightly from what you expect depending on the characteristics of the destination context. If you need pixel-perfect drawing, you should not use this class.

Attention:
If you are using this class instead of CorkPboardInterpreter, you should perform your drawing in drawUnbufferedContentsInRect:drawingToBuffer: (CorkBufferedPboardInterpreter) instead of drawContentsInRect: (CorkPboardInterpreter) -- if you override the latter, it will defeat the purpose of the class.
See also:
CorkPboardInterpreter
Since:
CorkCore 1.1

Member Function Documentation

- (void) drawUnbufferedContentsInRect: (NSRect)  rect
drawingToBuffer: (BOOL)  toBuffer 

Sent to the receiver when its content needs to be drawn.

  • rect: The rectangle that has been invalidated. Drawing operations are clipped to this rectangle.
  • toBuffer: Whether or not the current graphics context is associated with a buffer owned by the receiver.
When this is called, draw your content. The nature of the graphics context put in place for this method is an implementation detail.

Drawing can be performed using Cocoa or Quartz; since you need to compile your subclasses for both 32-bit and 64-bit, you cannot use QuickDraw.

On Mac OS X, you can use [NSGraphicsContext currentContext] to get the current Cocoa drawing context, or [[NSGraphicsContext currentContext] graphicsPort] for the current Quartz drawing context. On iPhone OS, you can use UIGraphicsGetCurrentContext() to get the current drawing context.

By default, this method fills rect with white so that the user can see the view, but does nothing otherwise.

Attention:
If you are subclassing CorkBufferedPboardInterpreter, you must override this method instead of drawContentsInRect: (CorkPboardInterpreter) if you want to gain the benefits of buffered drawing. This method may be called more than once over the lifetime of the receiver (for instance, if the receiver's buffer is flushed or if it is inappropriate to use it for a particular graphics context.)
Subclassing considerations:
Subclasses should override this symbol.
See also:
- drawContentsInRect: (CorkPboardInterpreter)
Since:
CorkCore 1.1


The documentation for this class was generated from the following file:

CorkCore Framework Reference © 2008–2009 Ayluro, Inc. All rights reserved. Questions or comments? Contact us.