CPicture Class Reference

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.

Inherits from

Constructor & Destructor Documentation

CPicture()

IMPORT_CCPicture()[protected]

~CPicture()

IMPORT_C~CPicture()[virtual]

Member Functions Documentation

AddCropInPixels(MGraphicsDeviceMap *, const TMargins &)

IMPORT_C voidAddCropInPixels(MGraphicsDeviceMap *aMap,
const TMargins &aMargins
)

Parameters

MGraphicsDeviceMap * aMap
const TMargins & aMargins

Capability()

IMPORT_C TPictureCapabilityCapability()const [virtual]

DetachFromStoreL(TDetach)

voidDetachFromStoreL(TDetach = EDetachFull)[inline, virtual]

Parameters

TDetach  = EDetachFull

Draw(CGraphicsContext &, const TPoint &, const TRect &, MGraphicsDeviceMap *)

voidDraw(CGraphicsContext &aGc,
const TPoint &aTopLeft,
const TRect &aClipRect,
MGraphicsDeviceMap *aMap
)const [pure virtual]

Draws a picture.

Parameters

CGraphicsContext & aGcThe graphics context.
const TPoint & aTopLeftThe 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 & aClipRectA 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 * aMapThe device map for the graphics device. The implementation should use this to find the scaling to apply to the picture.

ExternalizeL(RWriteStream &)

voidExternalizeL(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.

Parameters

RWriteStream & aStreamThe write stream.

GetCropInTwips(TMargins &)

IMPORT_C voidGetCropInTwips(TMargins &aMargins)const [virtual]

Parameters

TMargins & aMargins

GetOriginalSizeInTwips(TSize &)

voidGetOriginalSizeInTwips(TSize &aSize)const [pure virtual]

Gets the pictur's original size, in twips.

Parameters

TSize & aSizeThe size of the picture, in twips

GetSizeInPixels(MGraphicsDeviceMap *, TSize &)

IMPORT_C voidGetSizeInPixels(MGraphicsDeviceMap *aMap,
TSize &aSize
)const

Parameters

MGraphicsDeviceMap * aMap
TSize & aSize

GetSizeInTwips(TSize &)

IMPORT_C voidGetSizeInTwips(TSize &aSize)const

Parameters

TSize & aSize

LineBreakPossible(TUint, TBool, TBool)

IMPORT_C TBoolLineBreakPossible(TUintaClass,
TBoolaBeforePicture,
TBoolaHaveSpaces
)const [virtual]

Parameters

TUint aClass
TBool aBeforePicture
TBool aHaveSpaces

NativePixelSize(TSize &)

IMPORT_C TBoolNativePixelSize(TSize &aPixelSize)[virtual]

Parameters

TSize & aPixelSize

ResetToOriginal()

IMPORT_C voidResetToOriginal()

ScaleFactorHeight()

IMPORT_C TIntScaleFactorHeight()const [virtual]

ScaleFactorWidth()

IMPORT_C TIntScaleFactorWidth()const [virtual]

SetCropInTwips(const TMargins &)

IMPORT_C voidSetCropInTwips(const TMargins &aMargins)[virtual]

Parameters

const TMargins & aMargins

SetScaleFactor(TInt, TInt)

IMPORT_C voidSetScaleFactor(TIntaScaleFactorWidth,
TIntaScaleFactorHeight
)[virtual]

Parameters

TInt aScaleFactorWidth
TInt aScaleFactorHeight

SetSizeInPixels(MGraphicsDeviceMap *, const TSize &)

IMPORT_C voidSetSizeInPixels(MGraphicsDeviceMap *aMap,
const TSize &aSize
)

Parameters

MGraphicsDeviceMap * aMap
const TSize & aSize

SetSizeInTwips(const TSize &)

IMPORT_C voidSetSizeInTwips(const TSize &aSize)

Parameters

const TSize & aSize

StoreL(CStreamStore &)

IMPORT_C TStreamIdStoreL(CStreamStore &aStore)const [virtual]

Parameters

CStreamStore & aStore

Member Enumerations Documentation

Enum TDetach

Options for detaching pictures from stores. Used by DetachFromStoreL().

Enumerators

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.