TQADrawPrivateNew
A drawing engine must define a method to create its own private data and initialize a new draw context.
typedef TQAError (*TQADrawPrivateNew) ( TQADrawContext *newDrawContext, const TQADevice *device, const TQARect *rect, const TQAClip *clip, unsigned long flags);
newDrawContext- The draw context to initialize. On entry, all the fields of this structure have the value
NULL.device- A device.
rect- The rectangular region (specified in device coordinates) of the specified device that can be drawn into by the drawing engine associated with the new draw context.
clip- The two-dimensional clipping region for the new draw context, or
NULLif no clipping is desired. This parameter must be set toNULLfor devices of typekQADeviceMemory.flags- A set of bit flags specifying features of the new draw context. See "Draw Context Flags Masks" (page 1-65) for complete information.
DESCRIPTION
YourTQADrawPrivateNewfunction is called whenever an application callsQADrawContextNewto create a new draw context associated with your drawing engine. Your function should perform any initialization required for the new draw context. In particular, it should return a pointer to the draw context's private data in thedrawPrivatefield of the draw context structure pointed to by thenewDrawContextparameter. In addition, yourTQADrawPrivateNewfunction should set any other fields of that draw context structure to point to public draw context methods defined by the drawing engine.Because it is the responsibility of your
TQADrawPrivateNewfunction to initialize the fields of a draw context structure, you can load different methods depending on the features of the device or draw context specified by thedeviceandflagsparameters. For instance, you might load one line drawing function for a device that displays 16 bits per pixel and a different line drawing function for a device that displays 32 bits per pixel. This technique allows you to avoid testing the display depth each time you draw a line.SEE ALSO
See Listing 1-8 (page 1-26) for a sampleTQADrawPrivateNewfunction.
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help