sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef METAFILE_H sl@0: #define METAFILE_H sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: const TInt KWinPrintMetafileUidVal(268435687); sl@0: sl@0: /** sl@0: * @internalTechnology sl@0: * Internal to Symbian sl@0: */ sl@0: class CMetafileDevice : public CGraphicsDevice sl@0: { sl@0: protected: sl@0: IMPORT_C CMetafileDevice(CGraphicsDevice* aDevice); sl@0: public: sl@0: IMPORT_C static CMetafileDevice* NewL(CGraphicsDevice* aDevice); sl@0: IMPORT_C ~CMetafileDevice(); sl@0: IMPORT_C TInt HorizontalTwipsToPixels(TInt aTwips) const; sl@0: IMPORT_C TInt VerticalTwipsToPixels(TInt aTwips) const; sl@0: IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixels) const; sl@0: IMPORT_C TInt VerticalPixelsToTwips(TInt aPixels) const; sl@0: IMPORT_C TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec); sl@0: IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont,const TFontSpec& aFontSpec); sl@0: IMPORT_C TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont,const TFontSpec& aFontSpec, TInt aMaxHeight); sl@0: IMPORT_C void ReleaseFont(CFont* aFont); sl@0: IMPORT_C TDisplayMode DisplayMode() const; sl@0: IMPORT_C TSize SizeInPixels() const; sl@0: IMPORT_C TSize SizeInTwips() const; sl@0: IMPORT_C TInt CreateContext(CGraphicsContext*& aGC); sl@0: IMPORT_C TInt NumTypefaces() const; sl@0: IMPORT_C void TypefaceSupport(TTypefaceSupport& aTypefaceSupport, TInt aTypefaceIndex) const; sl@0: IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex, TInt aHeightIndex) const; sl@0: IMPORT_C void PaletteAttributes(TBool& aModifiable, TInt& aNumEntries) const; sl@0: IMPORT_C void SetPalette(CPalette* aPalette); sl@0: IMPORT_C TInt GetPalette(CPalette*& aPalette) const; sl@0: IMPORT_C void UseGcL(TInt aGcIndex); sl@0: IMPORT_C void StartOutputStreamL(RWriteStream& aStream); // Returns error code sl@0: IMPORT_C void EndOfStreamL(); sl@0: IMPORT_C RWriteStream& WriteStream(); sl@0: private: sl@0: TInt iGcCount; sl@0: TInt iGcIndex; sl@0: CGraphicsDevice* iRealDevice; sl@0: RWriteStream* iWriteStream; sl@0: }; sl@0: sl@0: /** sl@0: * @internalTechnology sl@0: * Internal to Symbian sl@0: */ sl@0: class CMetafileGc : public CGraphicsContext sl@0: { sl@0: friend class CMetafileDevice; sl@0: protected: sl@0: IMPORT_C CMetafileGc(CMetafileDevice* aMetafileDevice, TInt anIndex); sl@0: public: sl@0: IMPORT_C ~CMetafileGc(); sl@0: IMPORT_C CGraphicsDevice* Device() const; sl@0: IMPORT_C void SetOrigin(const TPoint& aPos = TPoint(0, 0)); sl@0: IMPORT_C void SetDrawMode(TDrawMode aDrawingMode); sl@0: IMPORT_C void SetClippingRect(const TRect& aRect); sl@0: IMPORT_C void CancelClippingRect(); sl@0: IMPORT_C void Reset(); sl@0: IMPORT_C void UseFont(const CFont* aFont); sl@0: IMPORT_C void DiscardFont(); sl@0: IMPORT_C void SetUnderlineStyle(TFontUnderline aUnderlineStyle); sl@0: IMPORT_C void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle); sl@0: IMPORT_C void SetWordJustification(TInt aExcessWidth, TInt aNumGaps); sl@0: IMPORT_C void SetCharJustification(TInt aExcessWidth, TInt aNumChars); sl@0: IMPORT_C void SetPenColor(const TRgb& aColor); sl@0: IMPORT_C void SetPenStyle(TPenStyle aPenStyle); sl@0: IMPORT_C void SetPenSize(const TSize& aSize); sl@0: IMPORT_C void SetBrushColor(const TRgb& aColor); sl@0: IMPORT_C void SetBrushStyle(TBrushStyle aBrushStyle); sl@0: IMPORT_C void SetBrushOrigin(const TPoint& aOrigin); sl@0: IMPORT_C void UseBrushPattern(const CFbsBitmap* aBitmap); sl@0: IMPORT_C void DiscardBrushPattern(); sl@0: IMPORT_C void MoveTo(const TPoint& aPoint); sl@0: IMPORT_C void MoveBy(const TPoint& aVector); sl@0: IMPORT_C void Plot(const TPoint& aPoint); sl@0: IMPORT_C void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd); sl@0: IMPORT_C void DrawLine(const TPoint& aPoint1, const TPoint& aPoint2); sl@0: IMPORT_C void DrawLineTo(const TPoint& aPoint); sl@0: IMPORT_C void DrawLineBy(const TPoint& aVector); sl@0: IMPORT_C void DrawPolyLine(const CArrayFix* aPointList); sl@0: IMPORT_C void DrawPolyLine(const TPoint* aPointList, TInt aNumPoints); sl@0: IMPORT_C void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd); sl@0: IMPORT_C void DrawEllipse(const TRect& aRect); sl@0: IMPORT_C void DrawRect(const TRect& aRect); sl@0: IMPORT_C void DrawRoundRect(const TRect& aRect, const TSize& aCornerSize); sl@0: IMPORT_C TInt DrawPolygon(const CArrayFix* aPointList, TFillRule aFillRule = EAlternate); sl@0: IMPORT_C TInt DrawPolygon(const TPoint* aPointList, TInt aNumPoints, TFillRule aFillRule = EAlternate); sl@0: IMPORT_C void DrawBitmap(const TPoint& aTopLeft, const CFbsBitmap* aSource); sl@0: IMPORT_C void DrawBitmap(const TRect& aDestRect, const CFbsBitmap* aSource); sl@0: IMPORT_C void DrawBitmap(const TRect& aDestRect, const CFbsBitmap* aSource, const TRect& aSourceRect); sl@0: IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask); sl@0: IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CWsBitmap* aBitmap,const TRect& aSourceRect,const CWsBitmap* aMaskBitmap,TBool aInvertMask); sl@0: IMPORT_C void DrawText(const TDesC& aString, const TPoint& aPosition); sl@0: IMPORT_C void DrawText(const TDesC& aString, const TRect& aBox, TInt aBaselineOffset, TTextAlign aHoriz = ELeft, TInt aLeftMrg = 0); sl@0: sl@0: IMPORT_C void MapColors(const TRect& aRect,const TRgb* aColors,TInt aNumPairs,TBool aMapForwards); sl@0: IMPORT_C TInt SetClippingRegion(const TRegion &aRegion); sl@0: IMPORT_C void CancelClippingRegion(); sl@0: IMPORT_C void DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp); sl@0: IMPORT_C void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0); sl@0: IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt); sl@0: IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp, const TRect& aSrcRect, const CWsBitmap* aAlphaBmp, const TPoint& aAlphaPt); sl@0: sl@0: private: sl@0: void ExternalizeBitmapL(const CFbsBitmap* aSource); sl@0: private: sl@0: CMetafileDevice* iDevice; sl@0: TInt iIndex; sl@0: }; sl@0: sl@0: /** sl@0: * @internalTechnology sl@0: * Internal to Symbian sl@0: */ sl@0: class CMetafilePlayback : public CBase sl@0: { sl@0: protected: sl@0: IMPORT_C CMetafilePlayback(CGraphicsDevice* aDevice); sl@0: public: sl@0: IMPORT_C static CMetafilePlayback* NewL(CGraphicsDevice* aDevice); sl@0: IMPORT_C ~CMetafilePlayback(); sl@0: IMPORT_C void DrawL(RReadStream& aReadStream); sl@0: protected: sl@0: CGraphicsDevice* iDevice; sl@0: }; sl@0: sl@0: #endif sl@0: