1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/gulsprite.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,102 @@
1.4 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#if !defined(__GULSPRITE_H__)
1.20 +#define __GULSPRITE_H__
1.21 +
1.22 +#include <w32std.h>
1.23 +#include <gulicon.h>
1.24 +
1.25 +class CWindowToBitmapMappingGc;
1.26 +
1.27 +class CSpriteSet : public CBase
1.28 +/**
1.29 +The CSpriteSet class allows a window server sprite to be drawn to a window. The class
1.30 +supports storage of any number of bitmap/mask pairs, though allowing only one of these
1.31 +bitmap/mask members to be displayed at any one time. The client of this class should
1.32 +provide the source bitmap/mask pairs which can be resized to fit a specified rectangle.
1.33 +Also provided for at runtime is the ability to draw onto the sprite as though it were a
1.34 +regular CWindowGc and using the same coordinate offsets as the window it exists in.
1.35 +
1.36 +@publishedPartner
1.37 +@released
1.38 +*/
1.39 + {
1.40 +public:
1.41 + enum TSpriteResizeMode
1.42 + {
1.43 + ENoResizing,
1.44 + EResizeHorizToFit,
1.45 + EResizeVertToFit,
1.46 + EResizeHorizAndVertToFit
1.47 + };
1.48 +public:
1.49 + // methods for creation of the sprite set
1.50 + IMPORT_C static CSpriteSet* NewL(RWindowTreeNode& aWindow, RWsSession& aWs, CWsScreenDevice& aDevice, CGulIcon* aSpriteSetMember, TBool aInvertMask);
1.51 + IMPORT_C static CSpriteSet* NewLC(RWindowTreeNode& aWindow, RWsSession& aWs, CWsScreenDevice& aDevice, CGulIcon* aSpriteSetMember, TBool aInvertMask);
1.52 + IMPORT_C void AddMemberL(CGulIcon* aSpriteSetMember);
1.53 + IMPORT_C void RemoveMember(TInt aSpriteSetMemberIndex);
1.54 + // methods for preparing and using a sprite in the set
1.55 + IMPORT_C void PrepareSpriteForDisplayL(TInt aSpriteType, const TPoint& aSpritePos, const TSize& aSpriteSize, TSpriteResizeMode aSpriteResizeMode);
1.56 + IMPORT_C void StartDisplayingSpriteL();
1.57 + IMPORT_C void StopDisplayingSprite();
1.58 + IMPORT_C CWindowGc* SpriteGc() const;
1.59 + IMPORT_C void TranslateSpritePosition(const TPoint& aSpritePos);
1.60 + IMPORT_C void SetClippingRect(const TRect& aRect);
1.61 +public:
1.62 + ~CSpriteSet();
1.63 +private:
1.64 + enum TInternalSpriteResizeMode
1.65 + {
1.66 + EHSameVSame,
1.67 + EHSameVShrink,
1.68 + EHSameVStretch,
1.69 + EHShrinkVSame,
1.70 + EHShrinkVShrink,
1.71 + EHShrinkVStretch,
1.72 + EHStretchVSame,
1.73 + EHStretchVShrink,
1.74 + EHStretchVStretch
1.75 + };
1.76 +private:
1.77 + CSpriteSet(TBool aInvertMask);
1.78 + void ConstructL(RWindowTreeNode& aWindow, RWsSession& aWs, CWsScreenDevice& aDevice);
1.79 + void CreateSpriteMember();
1.80 + void AdjustSpriteSizeAccordingToResizeMode(TSize& aTargetSize, const TSize& aSourceSize, TSpriteResizeMode aSpriteResizeMode) const;
1.81 + void ComputeInternalResizeMode(TInternalSpriteResizeMode& aInternalSpriteResizeMode, TSpriteResizeMode aSpriteResizeMode, const TSize& aSourceSize, const TSize& aSpriteSize) const;
1.82 + void RenderSprite(TInt aSpriteType, TInternalSpriteResizeMode aInternalSpriteResizeMode, const TSize& aSourceSize, const TSize& aSpriteSize);
1.83 +private:
1.84 + enum TFlags
1.85 + {
1.86 + EMaskIsInverted =0x01,
1.87 + ESpriteIsCurrentlyDisplayed =0x02
1.88 + };
1.89 +private:
1.90 + RPointerArray<CGulIcon> iSourceMembers;
1.91 + CWsBitmap* iTargetBitmap;
1.92 + CWsBitmap* iTargetMaskBitmap;
1.93 + RWsSprite iSprite;
1.94 + TSpriteMember iSpriteMember;
1.95 + CWindowToBitmapMappingGc* iWindowToBitmapMappingGc;
1.96 + CFbsBitGc* iMainFbsBitGc;
1.97 + CFbsBitGc* iMaskFbsBitGc;
1.98 + CFbsBitmapDevice* iMainBmpDevice;
1.99 + CFbsBitmapDevice* iMaskBmpDevice;
1.100 + TPoint iSpritePosition;
1.101 + TRect iClippingRect;
1.102 + TInt iFlags;
1.103 + };
1.104 +
1.105 +#endif