1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserverplugins/openwfc/inc/directgdigcwrapper.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,171 @@
1.4 +// Copyright (c) 2008-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 "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.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 +#ifndef __DIRECTGDIGCWRAPPER_H__
1.20 +#define __DIRECTGDIGCWRAPPER_H__
1.21 +
1.22 +#include <graphics/wsgraphicscontext.h>
1.23 +#include <graphics/directgdiimagetarget.h>
1.24 +#include <graphics/directgdicontext.h>
1.25 +#include <graphics/wsdrawablesourceprovider.h>
1.26 +#include <graphics/sgimage.h>
1.27 +#include <graphics/wscursor.h>
1.28 +
1.29 +
1.30 +/*
1.31 + * Required by MWsFader implementation
1.32 + */
1.33 +struct TFadingParams
1.34 + {
1.35 + TUint8 blackMap;
1.36 + TUint8 whiteMap;
1.37 + };
1.38 +
1.39 +/**
1.40 +The purpose of this class is to wrap a @c CDirectGdiContext whenever an
1.41 +@c MWsGraphicsContext is needed.
1.42 +
1.43 +The methods doesn't do anything other than calling the corresponding method
1.44 +in @c MWsGraphicsContext.
1.45 +
1.46 +@see MWsGraphicsContext
1.47 +@see MWsDrawableSourceProvider
1.48 +@see CDirectGdiContext;
1.49 +
1.50 +@internalComponent
1.51 +*/
1.52 +class CDirectGdiGcWrapper : public CBase, public MWsGraphicsContext, public MWsFader, public MWsDrawableSourceProvider, public MWsTextCursor
1.53 + {
1.54 +public:
1.55 + static CDirectGdiGcWrapper* NewL();
1.56 + ~CDirectGdiGcWrapper();
1.57 + inline CDirectGdiContext& DirectGdiGc();
1.58 +
1.59 +public: //from MWsGraphicsContext
1.60 + void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap);
1.61 + void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect);
1.62 + void BitBltMasked(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, TBool aInvertMask);
1.63 + void BitBltMasked(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, const TPoint& aMaskPos);
1.64 + void ResetClippingRegion();
1.65 + void Clear();
1.66 + void Clear(const TRect& aRect);
1.67 + void ResetBrushPattern();
1.68 + void ResetFont();
1.69 + void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
1.70 + void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
1.71 + void DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap);
1.72 + void DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect);
1.73 + void DrawBitmapMasked(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, TBool aInvertMask);
1.74 + void DrawRoundRect(const TRect& aRect, const TSize& aEllipse);
1.75 + void DrawPolyLine(const TArray<TPoint>& aPointList);
1.76 + void DrawPolyLineNoEndPoint(const TArray<TPoint>& aPointList);
1.77 + void DrawPolygon(const TArray<TPoint>& aPointList, TFillRule aFillRule=EAlternate);
1.78 + void DrawEllipse(const TRect& aRect);
1.79 + void DrawLine(const TPoint& aStart, const TPoint& aEnd);
1.80 + void DrawLineTo(const TPoint& aPoint);
1.81 + void DrawLineBy(const TPoint& aVector);
1.82 + void DrawRect(const TRect& aRect);
1.83 + void DrawText(const TDesC& aText,const TTextParameters* aParam);
1.84 + void DrawText(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPosition);
1.85 + void DrawText(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect);
1.86 + void DrawText(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipFillRect,TInt aBaselineOffset,TTextAlign aHrz=ELeft,TInt aMargin=0);
1.87 + void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,TBool aUp);
1.88 + void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPosition,TBool aUp);
1.89 + void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TBool aUp);
1.90 + void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
1.91 + void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TInt aBaselineOffset,TInt aTextWidth,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
1.92 + void MoveTo(const TPoint& aPoint);
1.93 + void MoveBy(const TPoint& aVector);
1.94 + void Plot(const TPoint& aPoint);
1.95 + void Reset();
1.96 + void SetBrushColor(const TRgb& aColor);
1.97 + void SetBrushOrigin(const TPoint& aOrigin);
1.98 + void SetBrushStyle(TBrushStyle aBrushStyle);
1.99 + void SetClippingRegion(const TRegion& aRegion);
1.100 + void SetDrawMode(TDrawMode aDrawMode);
1.101 + void SetOrigin(const TPoint& aPoint = TPoint(0, 0));
1.102 + void SetPenColor(const TRgb& aColor);
1.103 + void SetPenStyle(TPenStyle aPenStyle);
1.104 + void SetPenSize(const TSize& aSize);
1.105 + void SetTextShadowColor(const TRgb& aColor);
1.106 + void SetCharJustification(TInt aExcessWidth, TInt aNumChars);
1.107 + void SetWordJustification(TInt aExcessWidth, TInt aNumGaps);
1.108 + void SetUnderlineStyle(TFontUnderline aUnderlineStyle);
1.109 + void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle);
1.110 + void SetBrushPattern(const CFbsBitmap& aBitmap);
1.111 + void SetBrushPattern(TInt aFbsBitmapHandle);
1.112 + void SetFont(const CFont* aFont);
1.113 + void CopyRect(const TPoint& aOffset, const TRect& aRect);
1.114 + void UpdateJustification(const TDesC& aText,const TTextParameters* aParam);
1.115 + void UpdateJustificationVertical(const TDesC& aText,const TTextParameters* aParam,TBool aUp);
1.116 + void SetFontNoDuplicate(const CFont* aFont);
1.117 + TBool HasBrushPattern() const;
1.118 + TBool HasFont() const;
1.119 + TRgb BrushColor() const;
1.120 + TRgb PenColor() const;
1.121 + TRgb TextShadowColor() const;
1.122 +
1.123 + // Return current error status of MWsGraphicsContext
1.124 + TInt GetError();
1.125 + // Getters
1.126 + TPoint Origin() const;
1.127 + const TRegion& ClippingRegion();
1.128 + // Save and retrieve gc settings
1.129 + TInt Push();
1.130 + void Pop();
1.131 +
1.132 +public: // MWsFader
1.133 + void SetFadingParameters(const TDesC8& aData);
1.134 + void FadeArea(const TRegion& aRegion);
1.135 +
1.136 + //from MWsObjectProvider
1.137 + TAny* ResolveObjectInterface(TUint aTypeId);
1.138 +
1.139 + //from MWsDrawableSourceProvider
1.140 + TInt CreateDrawableSource(const TSgDrawableId& aDrawableId, TAny*& aSource);
1.141 + void CloseDrawableSource(TAny* aSource);
1.142 + void DrawResource(const TAny* aSource, const TPoint& aPos, CWindowGc::TGraphicsRotation aRotation = CWindowGc::EGraphicsRotationNone);
1.143 + void DrawResource(const TAny* aSource, const TRect& aRect, CWindowGc::TGraphicsRotation aRotation = CWindowGc::EGraphicsRotationNone);
1.144 + void DrawResource(const TAny* aSource, const TRect& aRectDest, const TRect& aRectSrc, CWindowGc::TGraphicsRotation aRotation = CWindowGc::EGraphicsRotationNone);
1.145 + void DrawResource(const TAny* aSource, const TRect& aRect, const TDesC8& aParam);
1.146 +
1.147 +public: // from MWsTextCursor
1.148 + void DrawTextCursor(const TTextCursorInfo& aTextCursorInfo);
1.149 +
1.150 +private:
1.151 + void SetError(TInt aError);
1.152 +
1.153 +private:
1.154 + CDirectGdiContext* iContext;
1.155 + TInt iErrorCode;
1.156 + CBufBase* iGcBuf; // used for keeping state when drawing CWsGraphicDrawers
1.157 + RRegionBuf<20> iClippingRegion; // Clipping region while doing drawing
1.158 + TPoint iOrigin; // Window Origin + User defined gc origin
1.159 + RPointerArray<RDirectGdiDrawableSource> iDrawableSources;
1.160 + //Required by MWsFader implmentation
1.161 + TRgb iFadeColor;
1.162 + const TUint16* iLut;
1.163 + };
1.164 +
1.165 +//
1.166 +// CDirectGdiGcWrapper
1.167 +//
1.168 +
1.169 +inline CDirectGdiContext& CDirectGdiGcWrapper::DirectGdiGc()
1.170 + {return(*iContext);}
1.171 +
1.172 +
1.173 +
1.174 +#endif //__DIRECTGDIGCWRAPPER_H__