|
||
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 CPicture::Draw(CGraphicsContext &,const TPoint &,const TRect &,MGraphicsDeviceMap *)const
, which draws the picture onto the graphics context at a particular point. It also has two important pure virtual functions:
CPicture::ExternalizeL(RWriteStream &)const
and CPicture::GetOriginalSizeInTwips(TSize &)const
.
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 CPicture::Draw(CGraphicsContext &,const TPoint &,const TRect &,MGraphicsDeviceMap *)const
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.
CBase
-
Base class for all classes to be instantiated on the heap.
CPicture
- Abstract base class for: drawing a picture to a graphics context, storing and re...
Defined in CPicture
:
AddCropInPixels(MGraphicsDeviceMap *,const TMargins &)
Adds pixel cropping margins to the picture.CPicture()
Capability()const
Gets the picture's capabilities.DetachFromStoreL(TDetach)
Draw(CGraphicsContext &,const TPoint &,const TRect &,MGraphicsDeviceMap *)const
Draws a picture.EDetachDraw
Internalise enough information to draw the picture (and no more); null any refer...EDetachFull
Internalise all data that is required to fully store the picture later; null any...ExternalizeL(RWriteStream &)const
Externalises the picture to a stream.GetCropInTwips(TMargins &)const
Gets the cropping margins of a picture in twips.GetOriginalSizeInTwips(TSize &)const
Gets the pictur's original size, in twips.GetSizeInPixels(MGraphicsDeviceMap *,TSize &)const
Gets the picture's size in pixels.GetSizeInTwips(TSize &)const
Gets the picture's size, in twips.LineBreakPossible(TUint,TBool,TBool)const
States whether a line break is possible, either before or after a picture.NativePixelSize(TSize &)
Derived classes might be implemented as bitmaps, in that case it might be intere...ResetToOriginal()
Resets the picture's scaling and cropping attributes to their original values. ScaleFactorHeight()const
Gets the pictures height scale factor.ScaleFactorWidth()const
Gets the picture's width scale factor.SetCropInTwips(const TMargins &)
Sets the cropping margins of a picture in twips.SetScaleFactor(TInt,TInt)
Sets the picture's scale factors.SetSizeInPixels(MGraphicsDeviceMap *,const TSize &)
Sets the picture's size in pixels.SetSizeInTwips(const TSize &)
Sets the picture's size, in twipsStoreL(CStreamStore &)const
Stores the picture to the specified store.TDetach
Options for detaching pictures from stores. Used by CPicture::DetachFromStoreL(T...~CPicture()
Frees all resources owned by the object prior to its destruction. Inherited from CBase
:
Delete(CBase *)
Deletes the specified object.Extension_(TUint,TAny *&,TAny *)
Extension function operator new(TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TAny *)
Initialises the object to binary zeroes.operator new(TUint,TLeave)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TLeave,TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TUint)
Allocates the object from the heap and then initialises its contents to binary z...IMPORT_C virtual ~CPicture();
Frees all resources owned by the object prior to its destruction.
virtual void Draw(CGraphicsContext &aGc, const TPoint &aTopLeft, const TRect &aClipRect, MGraphicsDeviceMap *aMap) const=0;
Draws a picture.
|
IMPORT_C virtual TStreamId StoreL(CStreamStore &aStore) const;
Stores the picture to the specified store.
The default implementation assumes that the content of the picture is externalized to a single stream. The implementation may need to be changed for those derived classes that have components.
|
|
virtual void ExternalizeL(RWriteStream &aStream) const=0;
Externalises the picture to a stream.
The presence of this function means that the standard templated stream operator<<(RWriteStream &,const T &)
is available to externalise objects of this class.
A derived class must supply an implementation of this function.
|
virtual void GetOriginalSizeInTwips(TSize &aSize) const=0;
Gets the pictur's original size, in twips.
|
IMPORT_C virtual void SetScaleFactor(TInt aScaleFactorWidth, TInt aScaleFactorHeight);
Sets the picture's scale factors.
|
IMPORT_C virtual void SetCropInTwips(const TMargins &aMargins);
Sets the cropping margins of a picture in twips.
These are relative to the original unscaled size of the picture.
|
IMPORT_C virtual TPictureCapability Capability() const;
Gets the picture's capabilities.
These include whether it is scalable and croppable.
|
IMPORT_C virtual void GetCropInTwips(TMargins &aMargins) const;
Gets the cropping margins of a picture in twips.
These margins are relative to the original unscaled size of the picture.
|
IMPORT_C virtual TInt ScaleFactorWidth() const;
Gets the picture's width scale factor.
|
IMPORT_C virtual TInt ScaleFactorHeight() const;
Gets the pictures height scale factor.
|
IMPORT_C virtual TBool LineBreakPossible(TUint aClass, TBool aBeforePicture, TBool aHaveSpaces) const;
States whether a line break is possible, either before or after a picture.
The default implementation returns ETrue, implying that there is a break opportunity both before and after the picture, whether or not a space is present.
This may be overridden for special types of pictures.
|
|
IMPORT_C virtual TBool NativePixelSize(TSize &aPixelSize);
Derived classes might be implemented as bitmaps, in that case it might be interesting to now the native pixel size of the bitmap.
|
|
IMPORT_C void GetSizeInPixels(MGraphicsDeviceMap *aMap, TSize &aSize) const;
Gets the picture's size in pixels.
This is calculated from the original size of the picture, taking cropping and scaling into account.
|
IMPORT_C void SetSizeInPixels(MGraphicsDeviceMap *aMap, const TSize &aSize);
Sets the picture's size in pixels.
|
IMPORT_C void AddCropInPixels(MGraphicsDeviceMap *aMap, const TMargins &aMargins);
Adds pixel cropping margins to the picture.
|
IMPORT_C void GetSizeInTwips(TSize &aSize) const;
Gets the picture's size, in twips.
This size is calculated from the original size of the picture, taking cropping and scaling into account.
|
IMPORT_C void SetSizeInTwips(const TSize &aSize);
Sets the picture's size, in twips
|
IMPORT_C void ResetToOriginal();
Resets the picture's scaling and cropping attributes to their original values.
TDetach
Options for detaching pictures from stores. Used by CPicture::DetachFromStoreL(TDetach)
.
|