printingservices/printerdriversupport/inc/METAFILE.H
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef METAFILE_H
       
    17 #define METAFILE_H
       
    18 
       
    19 #include <e32std.h>
       
    20 #include <gdi.h>
       
    21 #include <s32file.h>
       
    22 
       
    23 const TInt KWinPrintMetafileUidVal(268435687);
       
    24 
       
    25 /**
       
    26  * @internalTechnology
       
    27  * Internal to Symbian
       
    28  */
       
    29 class CMetafileDevice :	public CGraphicsDevice
       
    30 	{
       
    31 protected:
       
    32 	IMPORT_C CMetafileDevice(CGraphicsDevice* aDevice);
       
    33 public:
       
    34 	IMPORT_C static CMetafileDevice* NewL(CGraphicsDevice* aDevice);
       
    35 	IMPORT_C ~CMetafileDevice();
       
    36 	IMPORT_C TInt HorizontalTwipsToPixels(TInt aTwips) const;
       
    37 	IMPORT_C TInt VerticalTwipsToPixels(TInt aTwips) const;
       
    38 	IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixels) const;
       
    39 	IMPORT_C TInt VerticalPixelsToTwips(TInt aPixels) const;
       
    40 	IMPORT_C TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
       
    41 	IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont,const TFontSpec& aFontSpec);
       
    42 	IMPORT_C TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont,const TFontSpec& aFontSpec, TInt aMaxHeight);
       
    43 	IMPORT_C void ReleaseFont(CFont* aFont);
       
    44 	IMPORT_C TDisplayMode DisplayMode() const;
       
    45 	IMPORT_C TSize SizeInPixels() const;
       
    46 	IMPORT_C TSize SizeInTwips() const;
       
    47 	IMPORT_C TInt CreateContext(CGraphicsContext*& aGC);
       
    48 	IMPORT_C TInt NumTypefaces() const;
       
    49 	IMPORT_C void TypefaceSupport(TTypefaceSupport& aTypefaceSupport, TInt aTypefaceIndex) const;
       
    50 	IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex, TInt aHeightIndex) const;
       
    51 	IMPORT_C void PaletteAttributes(TBool& aModifiable, TInt& aNumEntries) const;
       
    52 	IMPORT_C void SetPalette(CPalette* aPalette);
       
    53 	IMPORT_C TInt GetPalette(CPalette*& aPalette) const;
       
    54 	IMPORT_C void UseGcL(TInt aGcIndex);
       
    55 	IMPORT_C void StartOutputStreamL(RWriteStream& aStream);  // Returns error code
       
    56 	IMPORT_C void EndOfStreamL(); 
       
    57 	IMPORT_C RWriteStream& WriteStream();
       
    58 private:
       
    59 	TInt iGcCount;
       
    60 	TInt iGcIndex;
       
    61 	CGraphicsDevice* iRealDevice;
       
    62 	RWriteStream* iWriteStream;
       
    63 	};
       
    64 
       
    65 /**
       
    66  * @internalTechnology
       
    67  * Internal to Symbian
       
    68  */
       
    69 class CMetafileGc : public CGraphicsContext
       
    70 	{
       
    71 	friend class CMetafileDevice;
       
    72 protected:
       
    73 	IMPORT_C CMetafileGc(CMetafileDevice* aMetafileDevice, TInt anIndex);
       
    74 public:
       
    75 	IMPORT_C ~CMetafileGc();
       
    76 	IMPORT_C CGraphicsDevice* Device() const;
       
    77 	IMPORT_C void SetOrigin(const TPoint& aPos = TPoint(0, 0));
       
    78 	IMPORT_C void SetDrawMode(TDrawMode aDrawingMode);
       
    79 	IMPORT_C void SetClippingRect(const TRect& aRect);
       
    80 	IMPORT_C void CancelClippingRect();
       
    81 	IMPORT_C void Reset();
       
    82 	IMPORT_C void UseFont(const CFont* aFont);
       
    83 	IMPORT_C void DiscardFont();
       
    84 	IMPORT_C void SetUnderlineStyle(TFontUnderline aUnderlineStyle);
       
    85 	IMPORT_C void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle);
       
    86 	IMPORT_C void SetWordJustification(TInt aExcessWidth, TInt aNumGaps);
       
    87 	IMPORT_C void SetCharJustification(TInt aExcessWidth, TInt aNumChars);
       
    88 	IMPORT_C void SetPenColor(const TRgb& aColor);
       
    89 	IMPORT_C void SetPenStyle(TPenStyle aPenStyle);
       
    90 	IMPORT_C void SetPenSize(const TSize& aSize);
       
    91 	IMPORT_C void SetBrushColor(const TRgb& aColor);
       
    92 	IMPORT_C void SetBrushStyle(TBrushStyle aBrushStyle);
       
    93 	IMPORT_C void SetBrushOrigin(const TPoint& aOrigin);
       
    94 	IMPORT_C void UseBrushPattern(const CFbsBitmap* aBitmap);
       
    95 	IMPORT_C void DiscardBrushPattern();
       
    96 	IMPORT_C void MoveTo(const TPoint& aPoint);
       
    97 	IMPORT_C void MoveBy(const TPoint& aVector);
       
    98 	IMPORT_C void Plot(const TPoint& aPoint);
       
    99 	IMPORT_C void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
       
   100 	IMPORT_C void DrawLine(const TPoint& aPoint1, const TPoint& aPoint2);
       
   101 	IMPORT_C void DrawLineTo(const TPoint& aPoint);
       
   102 	IMPORT_C void DrawLineBy(const TPoint& aVector);
       
   103 	IMPORT_C void DrawPolyLine(const CArrayFix<TPoint>* aPointList);
       
   104 	IMPORT_C void DrawPolyLine(const TPoint* aPointList, TInt aNumPoints);
       
   105 	IMPORT_C void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
       
   106 	IMPORT_C void DrawEllipse(const TRect& aRect);
       
   107 	IMPORT_C void DrawRect(const TRect& aRect);
       
   108 	IMPORT_C void DrawRoundRect(const TRect& aRect, const TSize& aCornerSize);
       
   109 	IMPORT_C TInt DrawPolygon(const CArrayFix<TPoint>* aPointList, TFillRule aFillRule = EAlternate);
       
   110 	IMPORT_C TInt DrawPolygon(const TPoint* aPointList, TInt aNumPoints, TFillRule aFillRule = EAlternate);
       
   111 	IMPORT_C void DrawBitmap(const TPoint& aTopLeft, const CFbsBitmap* aSource);
       
   112 	IMPORT_C void DrawBitmap(const TRect& aDestRect, const CFbsBitmap* aSource);
       
   113 	IMPORT_C void DrawBitmap(const TRect& aDestRect, const CFbsBitmap* aSource, const TRect& aSourceRect);
       
   114 	IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask);
       
   115 	IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CWsBitmap* aBitmap,const TRect& aSourceRect,const CWsBitmap* aMaskBitmap,TBool aInvertMask);
       
   116 	IMPORT_C void DrawText(const TDesC& aString, const TPoint& aPosition);
       
   117 	IMPORT_C void DrawText(const TDesC& aString, const TRect& aBox, TInt aBaselineOffset, TTextAlign aHoriz = ELeft, TInt aLeftMrg = 0);
       
   118 							
       
   119 	IMPORT_C void MapColors(const TRect& aRect,const TRgb* aColors,TInt aNumPairs,TBool aMapForwards);
       
   120 	IMPORT_C TInt SetClippingRegion(const TRegion &aRegion);
       
   121 	IMPORT_C void CancelClippingRegion();
       
   122 	IMPORT_C void DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp);
       
   123 	IMPORT_C void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);								
       
   124 	IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
       
   125 	IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp,  const TRect& aSrcRect, const CWsBitmap*  aAlphaBmp, const TPoint& aAlphaPt);
       
   126 	
       
   127 private:
       
   128 	void ExternalizeBitmapL(const CFbsBitmap* aSource);
       
   129 private:
       
   130 	CMetafileDevice* iDevice;
       
   131 	TInt iIndex;
       
   132 	};
       
   133 
       
   134 /**
       
   135  * @internalTechnology
       
   136  * Internal to Symbian
       
   137  */
       
   138 class CMetafilePlayback : public CBase
       
   139 	{
       
   140 protected:
       
   141 	IMPORT_C CMetafilePlayback(CGraphicsDevice* aDevice);
       
   142 public:
       
   143 	IMPORT_C static CMetafilePlayback* NewL(CGraphicsDevice* aDevice);
       
   144 	IMPORT_C ~CMetafilePlayback();
       
   145 	IMPORT_C void DrawL(RReadStream& aReadStream);
       
   146 protected:
       
   147 	CGraphicsDevice* iDevice;
       
   148 	};
       
   149 
       
   150 #endif
       
   151