os/graphics/windowing/windowserver/inc/RemoteGc.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserver/inc/RemoteGc.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,170 @@
     1.4 +// Copyright (c) 2006-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 __REMOTEGC_H__
    1.20 +#define __REMOTEGC_H__
    1.21 +
    1.22 +#include <w32std.h>
    1.23 +#include <s32mem.h>
    1.24 +
    1.25 +class CCommandBuffer;
    1.26 +class RWsDrawableSource;
    1.27 +
    1.28 +/**
    1.29 +MCommandBufferObserver should be implemented by classes that want a notification when the commandbuffer has been updated.
    1.30 +@publishedPartner
    1.31 +@released*/
    1.32 +class MCommandBufferObserver
    1.33 +    {
    1.34 +public:
    1.35 +	/** 
    1.36 +	CommandBufferUpdated is called when the commandbuffer has been updated.
    1.37 +	
    1.38 +	@param aDrawRect The rect that has been updated.
    1.39 +	@param aBoundingRect The boundingrect of the commands that has been updated.
    1.40 +	*/
    1.41 +	virtual void CommandBufferUpdated(const TRect& aDrawRect, const TRect& aBoundingRect) = 0;
    1.42 +	};
    1.43 +
    1.44 +/** 
    1.45 +Intercepts and logs all draw operations to a window-gc 
    1.46 +@publishedPartner
    1.47 +@released*/
    1.48 +NONSHARABLE_CLASS(CRemoteGc): public CWindowGc
    1.49 +	{
    1.50 +public:
    1.51 +	IMPORT_C static CRemoteGc* NewL(CWsScreenDevice* aDevice);
    1.52 +	IMPORT_C ~CRemoteGc();	
    1.53 +	IMPORT_C void SetCommandBufferObserver(MCommandBufferObserver* aCommandBufferObserver);		
    1.54 +	IMPORT_C void ResetCommandBuffer();
    1.55 +	IMPORT_C void ExternalizeL(RWsGraphicMsgBuf& aMsgBuf, TBool aEntireBuffer);
    1.56 +	IMPORT_C void BeginDraw(const TRect& aRect);
    1.57 +	IMPORT_C void EndDraw();
    1.58 +
    1.59 +public: // inherited methods		
    1.60 +	
    1.61 +	// CWindowGc
    1.62 +	void Activate(RDrawableWindow &aDevice);
    1.63 +	void Deactivate();	
    1.64 +	void BitBlt(const TPoint &aPoint, const CWsBitmap *aBitmap);
    1.65 +	void BitBlt(const TPoint &aDestination, const CWsBitmap *aBitmap, const TRect &aSource);
    1.66 +	void BitBltMasked(const TPoint& aPoint, const CWsBitmap *aBitmap, const TRect& aSourceRect, const CWsBitmap *aMaskBitmap, TBool aInvertMask);
    1.67 +	
    1.68 +	// CBitmapContext
    1.69 +	void Clear();
    1.70 +	void Clear(const TRect &aRect);
    1.71 +	void CopyRect(const TPoint &anOffset, const TRect &aRect);
    1.72 +	void BitBlt(const TPoint &aPoint, const CFbsBitmap *aBitmap);
    1.73 +	void BitBlt(const TPoint &aDestination, const CFbsBitmap *aBitmap, const TRect &aSource);
    1.74 +	void BitBltMasked(const TPoint& aPoint, const CFbsBitmap* aBitmap, const TRect& aSourceRect, const CFbsBitmap* aMaskBitmap, TBool aInvertMask);
    1.75 +	void SetFaded(TBool aFaded);
    1.76 +	void SetFadingParameters(TUint8 aBlackMap,TUint8 aWhiteMap);
    1.77 +	TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
    1.78 +	TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp, const TRect& aSrcRect, const CWsBitmap* aAlphaBmp, const TPoint& aAlphaPt);	
    1.79 +	
    1.80 +	// CGraphicsContext
    1.81 +	void SetOrigin(const TPoint &aPoint);
    1.82 +	void SetDrawMode(TDrawMode aDrawingMode);
    1.83 +	void SetClippingRect(const TRect& aRect);
    1.84 +	void CancelClippingRect();
    1.85 +	void Reset();
    1.86 +	void UseFont(const CFont *aFont);
    1.87 +	void DiscardFont();
    1.88 +	void SetUnderlineStyle(TFontUnderline aUnderlineStyle);
    1.89 +	void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle);
    1.90 +	void SetWordJustification(TInt aExcessWidth,TInt aNumGaps);
    1.91 +	void SetCharJustification(TInt aExcessWidth,TInt aNumChars);
    1.92 +	void SetPenColor(const TRgb &aColor);
    1.93 +	void SetPenStyle(TPenStyle aPenStyle);
    1.94 +	void SetPenSize(const TSize& aSize);
    1.95 +	void SetBrushColor(const TRgb &aColor);
    1.96 +	void SetBrushStyle(TBrushStyle aBrushStyle);
    1.97 +	void SetBrushOrigin(const TPoint &aOrigin);
    1.98 +	void UseBrushPattern(const CFbsBitmap *aDevice);
    1.99 +	void DiscardBrushPattern();
   1.100 +	void MoveTo(const TPoint &aPoint);
   1.101 +	void MoveBy(const TPoint &aPoint);
   1.102 +	void Plot(const TPoint &aPoint);
   1.103 +	void DrawArc(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd);
   1.104 +	void DrawLine(const TPoint &aPoint1,const TPoint &aPoint2);
   1.105 +	void DrawLineTo(const TPoint &aPoint);
   1.106 +	void DrawLineBy(const TPoint &aPoint);
   1.107 +	void DrawPolyLine(const CArrayFix<TPoint> *aPointList);
   1.108 +	void DrawPolyLine(const TPoint* aPointList, TInt aNumPoints);
   1.109 +	void DrawPie(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd);
   1.110 +	void DrawEllipse(const TRect &aRect);
   1.111 +	void DrawRect(const TRect &aRect);
   1.112 +	void DrawRoundRect(const TRect &aRect,const TSize &aEllipse);
   1.113 +	TInt DrawPolygon(const CArrayFix<TPoint> *aPointList, TFillRule aFillRule);
   1.114 +	TInt DrawPolygon(const TPoint* aPointList,TInt aNumPoints, TFillRule aFillRule);
   1.115 +	void DrawBitmap(const TPoint &aTopLeft, const CFbsBitmap *aDevice);
   1.116 +	void DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aDevice);
   1.117 +	void DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aDevice, const TRect &aSourceRect);
   1.118 +	void DrawBitmapMasked(const TRect& aDestRect, const CFbsBitmap* aBitmap, const TRect& aSourceRect, const CFbsBitmap* aMaskBitmap, TBool aInvertMask);
   1.119 +	void DrawBitmapMasked(const TRect& aDestRect, const CWsBitmap* aBitmap, const TRect& aSourceRect, const CWsBitmap* aMaskBitmap, TBool aInvertMask);
   1.120 +	
   1.121 +	// Required as not all DrawText and DrawTextVertical functions are implemented in CRemoteGc
   1.122 +	using CWindowGc::DrawText;
   1.123 +	using CWindowGc::DrawTextVertical;
   1.124 +	
   1.125 +	void DrawText(const TDesC &aBuf,const TPoint &aPos);
   1.126 +	void DrawText(const TDesC &aBuf,const TRect &aBox,TInt aBaselineOffset, TTextAlign aHoriz, TInt aLeftMrg);
   1.127 +	void DrawText(const TDesC& aText,const TPoint& aPosition,const TDrawTextParam& aParam);
   1.128 +	void MapColors(const TRect& aRect,const TRgb* aColors, TInt aNumPairs, TBool aMapForwards);
   1.129 +	TInt SetClippingRegion(const TRegion &aRegion);
   1.130 +	void CancelClippingRegion();	
   1.131 +	void DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp);
   1.132 +	void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert,TInt aMargin);
   1.133 +	void DrawWsGraphic(const TWsGraphicId& aId,const TRect& aDestRect);
   1.134 +	void DrawWsGraphic(const TWsGraphicId& aId,const TRect& aDestRect,const TDesC8& aData);
   1.135 +	void SetDitherOrigin(const TPoint& aPoint);
   1.136 +	void SetOpaque(TBool aDrawOpaque=ETrue);	
   1.137 +protected:	
   1.138 +	TInt APIExtension(TUid aUid, TAny*& aOutput, TAny* aInput);
   1.139 +private:
   1.140 +	CRemoteGc(CWsScreenDevice* aDevice);
   1.141 +	void ConstructL();
   1.142 +	TInt APIExGetUnderlineMetrics(TAny*& aOutput);
   1.143 +	TInt APIExSetShadowColor(TAny* aShadowColor);
   1.144 +	TInt APIExGetShadowColor(TAny*& aOutput);
   1.145 +	// New DrawText API's that take in context
   1.146 +	TInt APIExDrawText(const TDesC &aBuf,const TTextParameters* aParam,const TPoint &aPos);
   1.147 +	TInt APIExDrawText(const TDesC &aBuf,const TTextParameters* aParam,const TRect &aBox,TInt aBaselineOffset,TTextAlign aHoriz=ELeft,TInt aLeftMrg=0);
   1.148 +
   1.149 +	TInt APIExDrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPos,TBool aUp);
   1.150 +	TInt APIExDrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
   1.151 +	TInt APIExInterface(TAny*& aInterface, TUid aInterfaceId);
   1.152 +
   1.153 +	void DrawResource(const TPoint& aPos, const RWsDrawableSource& aSource, CWindowGc::TGraphicsRotation aRotation=CWindowGc::EGraphicsRotationNone);
   1.154 +	void DrawResource(const TRect& aDestRect, const RWsDrawableSource& aSource, CWindowGc::TGraphicsRotation aRotation=CWindowGc::EGraphicsRotationNone);
   1.155 +	void DrawResource(const TRect& aDestRect, const RWsDrawableSource& aSource, const TRect& aSrcRect, CWindowGc::TGraphicsRotation aRotation=CWindowGc::EGraphicsRotationNone);
   1.156 +	void DrawResource(const TRect& aDestRect, const RWsDrawableSource& aSource, const TDesC8& aParam);
   1.157 +
   1.158 +private:
   1.159 +	TRect iDrawRect;
   1.160 +	TRect iBoundingRect;
   1.161 +	TBool iHasBitmapCommand;
   1.162 +	CCommandBuffer* iCommandBuffer;	
   1.163 +	MCommandBufferObserver* iCommandBufferObserver;
   1.164 +#ifdef SYMBIAN_GRAPHICS_GCE
   1.165 +	CFbsFont *iFont;
   1.166 +	TRgb iShadowColor;
   1.167 +	class CPimpl;
   1.168 +	friend class CPimpl;
   1.169 +	CPimpl* iRemoteGcPimpl;
   1.170 +#endif	
   1.171 +	};
   1.172 +	
   1.173 +#endif	// __REMOTEGC_H__