| class CPicture : public CBase |
Abstract base class for: drawing a picture to a graphics context, storing and restoring the picture.
The class defines the protocol for a number of concrete picture classes. Its main role is to support glass doors used in object embedding.
The class provides a protocol for the provision of scaling and cropping functions by derived classes, together with default implementations.
Its main function is Draw(), which draws the picture onto the graphics context at a particular point. It also has two important pure virtual functions: ExternalizeL() and GetOriginalSizeInTwips().
A picture has both an original representation and an on-screen representation. The original representation has a size in twips, and can somehow be drawn. The on-screen representation is assumed to be drawn under the control of an application which may wish to re-size or scale the original in some way, to crop it at the edges, and/or to ensure it fits within a particular defined area on the screen.
The class provides several functions that allow an application to set scaling and cropping before invoking the Draw() function to draw the picture on-screen. It is up to the internal workings of the function to determine the order of application cropping and scaling.
| Public Member Functions | |
|---|---|
| ~CPicture() | |
| IMPORT_C void | AddCropInPixels(MGraphicsDeviceMap *, const TMargins &) |
| IMPORT_C TPictureCapability | Capability() |
| void | DetachFromStoreL(TDetach) |
| void | Draw(CGraphicsContext &, const TPoint &, const TRect &, MGraphicsDeviceMap *) |
| void | ExternalizeL(RWriteStream &) |
| IMPORT_C void | GetCropInTwips(TMargins &) |
| void | GetOriginalSizeInTwips(TSize &) |
| IMPORT_C void | GetSizeInPixels(MGraphicsDeviceMap *, TSize &) |
| IMPORT_C void | GetSizeInTwips(TSize &) |
| IMPORT_C TBool | LineBreakPossible(TUint, TBool, TBool) |
| IMPORT_C TBool | NativePixelSize(TSize &) |
| IMPORT_C void | ResetToOriginal() |
| IMPORT_C TInt | ScaleFactorHeight() |
| IMPORT_C TInt | ScaleFactorWidth() |
| IMPORT_C void | SetCropInTwips(const TMargins &) |
| IMPORT_C void | SetScaleFactor(TInt, TInt) |
| IMPORT_C void | SetSizeInPixels(MGraphicsDeviceMap *, const TSize &) |
| IMPORT_C void | SetSizeInTwips(const TSize &) |
| IMPORT_C TStreamId | StoreL(CStreamStore &) |
| Protected Member Functions | |
|---|---|
| CPicture() | |
| Public Member Enumerations | |
|---|---|
| enum | TDetach { EDetachFull, EDetachDraw } |
| IMPORT_C void | AddCropInPixels | ( | MGraphicsDeviceMap * | aMap, |
| const TMargins & | aMargins | |||
| ) | ||||
| MGraphicsDeviceMap * aMap | |
| const TMargins & aMargins |
| void | DetachFromStoreL | ( | TDetach | = EDetachFull | ) | [inline, virtual] |
| TDetach = EDetachFull |
| void | Draw | ( | CGraphicsContext & | aGc, |
| const TPoint & | aTopLeft, | |||
| const TRect & | aClipRect, | |||
| MGraphicsDeviceMap * | aMap | |||
| ) | const [pure virtual] | |||
Draws a picture.
| CGraphicsContext & aGc | The graphics context. |
| const TPoint & aTopLeft | The co-ordinates where the top left corner pixel of the picture should be placed. Note that whether this is actually drawn depends on the clipping area defined. |
| const TRect & aClipRect | A clipping rectangle that defines the area to which the function should draw. An implementation should never draw outside this rectangle. Note that the graphics context may also have a clipping rectangle set on it. |
| MGraphicsDeviceMap * aMap | The device map for the graphics device. The implementation should use this to find the scaling to apply to the picture. |
| void | ExternalizeL | ( | RWriteStream & | aStream | ) | const [pure virtual] |
Externalises the picture to a stream.
The presence of this function means that the standard templated stream operator<<() is available to externalise objects of this class.
A derived class must supply an implementation of this function.
| RWriteStream & aStream | The write stream. |
| IMPORT_C void | GetCropInTwips | ( | TMargins & | aMargins | ) | const [virtual] |
| TMargins & aMargins |
| void | GetOriginalSizeInTwips | ( | TSize & | aSize | ) | const [pure virtual] |
Gets the pictur's original size, in twips.
| TSize & aSize | The size of the picture, in twips |
| IMPORT_C void | GetSizeInPixels | ( | MGraphicsDeviceMap * | aMap, |
| TSize & | aSize | |||
| ) | const | |||
| MGraphicsDeviceMap * aMap | |
| TSize & aSize |
| IMPORT_C TBool | LineBreakPossible | ( | TUint | aClass, |
| TBool | aBeforePicture, | |||
| TBool | aHaveSpaces | |||
| ) | const [virtual] | |||
| IMPORT_C TBool | NativePixelSize | ( | TSize & | aPixelSize | ) | [virtual] |
| TSize & aPixelSize |
| IMPORT_C void | SetCropInTwips | ( | const TMargins & | aMargins | ) | [virtual] |
| const TMargins & aMargins |
| IMPORT_C void | SetScaleFactor | ( | TInt | aScaleFactorWidth, |
| TInt | aScaleFactorHeight | |||
| ) | [virtual] | |||
| IMPORT_C void | SetSizeInPixels | ( | MGraphicsDeviceMap * | aMap, |
| const TSize & | aSize | |||
| ) | ||||
| MGraphicsDeviceMap * aMap | |
| const TSize & aSize |
| IMPORT_C void | SetSizeInTwips | ( | const TSize & | aSize | ) |
| const TSize & aSize |
| IMPORT_C TStreamId | StoreL | ( | CStreamStore & | aStore | ) | const [virtual] |
| CStreamStore & aStore |
Options for detaching pictures from stores. Used by DetachFromStoreL().
| EDetachFull |
Internalise all data that is required to fully store the picture later; null any references to containing stores. |
| EDetachDraw |
Internalise enough information to draw the picture (and no more); null any references to containing stores. |