This topic introduces the essential features of CPicture
-derived classes and other features, which, although not essential, are normally also provided.
Each CPicture
-derived class must provide:
a constructor which creates a ‘real-world’ picture and sets a data member to the picture’s original size in device-independent units (for example, iOriginalSizeInTwips
could be used for twips);
a GetOriginalSizeInTwips()
function which returns the original size of the picture in twips;
a Draw()
function which draws the picture to a particular graphics map on a graphics context - at this point, and not before, the picture’s co-ordinates should be converted from device-independent units to pixels;
an ExternalizeL()
function which externalizes the picture to a stream.
Normally, a CPicture
-derived class will also provide:
an InternalizeL()
function to internalize the picture from a stream;
StoreL()
and RestoreL()
functions to store and restore pictures from a stream store;
one or more data members to access and manipulate the original picture - the picture’s scaling may be altered (this changes the ‘real-world’ size of the picture in twips);
if necessary, behavior that performs appropriate clean-up.
CApaIconPicture
is an example of a CPicture
-derived class.