sl@0: // Copyright (c) 2007-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: sl@0: #ifndef DIRECTGDIENGINE_H sl@0: #define DIRECTGDIENGINE_H sl@0: sl@0: /** sl@0: @file sl@0: @publishedPartner sl@0: @prototype sl@0: */ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: // Forward declarations. sl@0: // sl@0: class CFbsBitmap; sl@0: class RDirectGdiImageSource; sl@0: class RDirectGdiImageTarget; sl@0: class RDirectGdiDrawableSource; sl@0: sl@0: /** sl@0: Pure virtual interface for licensee adaptation of GDI platform implementation. sl@0: sl@0: @publishedPartner sl@0: @prototype sl@0: @deprecated sl@0: */ sl@0: class MDirectGdiEngine sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: @see CDirectGdiContext::Activate() sl@0: @see Deactivate() sl@0: */ sl@0: virtual TInt Activate(RDirectGdiImageTarget& aTarget) = 0; sl@0: sl@0: /** sl@0: Unbinds the current rendering target (if any) from drawing engine. Drawing engine states or settings which sl@0: are not dependent or non-target-specific remain unchanged. sl@0: sl@0: The DirectGDI generic layer will call this method prior to activating the drawing engine for another sl@0: rendering target. sl@0: sl@0: @see Activate() sl@0: sl@0: @pre None. sl@0: @post Drawing engine is no longer associated with any rendering target. sl@0: */ sl@0: virtual void Deactivate() = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::SetOrigin() sl@0: */ sl@0: virtual void SetOrigin(const TPoint& aOrigin) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::ResetClippingRegion() sl@0: @see SetClippingRegion() sl@0: */ sl@0: virtual void SetClippingRegion(const TRegion& aRegion) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::ReetClippingRegion() sl@0: @see SetClippingRegion() sl@0: */ sl@0: virtual void ResetClippingRegion() = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::SetDrawMode() sl@0: */ sl@0: virtual void SetDrawMode(DirectGdi::TDrawMode aMode) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::SetPenColor() sl@0: @see DrawLine() sl@0: @see DrawLineTo() sl@0: @see DrawLineBy() sl@0: @see DrawPolyLine() sl@0: @see DrawPolygon() sl@0: @see DrawRect() sl@0: @see DrawRoundRect() sl@0: */ sl@0: virtual void SetPenColor(const TRgb& aColor) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::SetPenStyle() sl@0: @see DrawLine() sl@0: @see DrawLineTo() sl@0: @see DrawLineBy() sl@0: @see DrawPolyLine() sl@0: @see DrawPolygon() sl@0: @see DrawRect() sl@0: @see DrawRoundRect() sl@0: */ sl@0: virtual void SetPenStyle(DirectGdi::TPenStyle aStyle) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::SetPenSize() sl@0: @see DrawLine() sl@0: @see DrawLineTo() sl@0: @see DrawLineBy() sl@0: @see DrawPolyLine() sl@0: @see DrawPolygon() sl@0: @see DrawRect() sl@0: @see DrawRoundRect() sl@0: @see Plot() sl@0: */ sl@0: virtual void SetPenSize(const TSize& aSize) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::SetTextShadowColor() sl@0: */ sl@0: virtual void SetTextShadowColor(const TRgb& aColor) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::SetBrushColor() sl@0: */ sl@0: virtual void SetBrushColor(const TRgb& aColor) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::SetBrushStyle() sl@0: @see SetBrushPattern() sl@0: */ sl@0: virtual void SetBrushStyle(DirectGdi::TBrushStyle aStyle) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::SetBrushOrigin() sl@0: @see SetBrushPattern() sl@0: */ sl@0: virtual void SetBrushOrigin(const TPoint& aOrigin) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::SetBrushPattern() sl@0: @see ResetBrushPattern() sl@0: sl@0: @return KErrNone if successful, otherwise one of the system-wide error codes. sl@0: */ sl@0: virtual TInt SetBrushPattern(const CFbsBitmap& aPattern) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::ResetBrushPattern() sl@0: @see SetBrushPattern() sl@0: */ sl@0: virtual void ResetBrushPattern() = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::SetFont() sl@0: sl@0: @param aFontId The Font identifier. sl@0: */ sl@0: virtual void SetFont(TUint32 aFontId) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::ResetFont() sl@0: */ sl@0: virtual void ResetFont() = 0; sl@0: sl@0: /** sl@0: Resets the engine state to default values. sl@0: sl@0: @see CDirectGdiContext::Reset() sl@0: */ sl@0: virtual void Reset() = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::Clear(const TRect&) sl@0: @see Clear() sl@0: @see SetBrushColor() sl@0: */ sl@0: virtual void Clear(const TRect& aRect) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::Clear() sl@0: @see Clear(const TRect&) sl@0: @see SetBrushColor() sl@0: */ sl@0: virtual void Clear() = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::MoveTo() sl@0: @see MoveBy() sl@0: */ sl@0: virtual void MoveTo(const TPoint& aPoint) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::MoveBy() sl@0: @see MoveTo() sl@0: */ sl@0: virtual void MoveBy(const TPoint& aVector) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::Plot() sl@0: @see SetPenSize() sl@0: @see SetPenColor() sl@0: @see SetDrawMode() sl@0: */ sl@0: virtual void Plot(const TPoint& aPoint) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawLine() sl@0: @see DrawLineTo() sl@0: @see DrawLineBy() sl@0: @see SetPenSize() sl@0: @see SetPenStyle() sl@0: @see SetPenColor() sl@0: @see SetDrawMode() sl@0: */ sl@0: virtual void DrawLine(const TPoint& aStart, const TPoint& aEnd) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawLineTo() sl@0: @see DrawLine() sl@0: @see DrawLineBy() sl@0: @see SetPenSize() sl@0: @see SetPenStyle() sl@0: @see SetPenColor() sl@0: @see SetDrawMode() sl@0: @see MoveTo() sl@0: @see MoveBy() sl@0: */ sl@0: virtual void DrawLineTo(const TPoint& aPoint) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawLineBy() sl@0: @see DrawLine() sl@0: @see DrawLineTo() sl@0: @see SetPenSize() sl@0: @see SetPenStyle() sl@0: @see SetPenColor() sl@0: @see DrawMode() sl@0: @see MoveTo() sl@0: @see MoveBy() sl@0: */ sl@0: virtual void DrawLineBy(const TPoint& aVector) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawRect() sl@0: */ sl@0: virtual void DrawRect(const TRect& aRect) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawRoundRect() sl@0: */ sl@0: virtual void DrawRoundRect(const TRect& aRect, const TSize& aCornerSize) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawPolyLine() sl@0: @see SetPenColor() sl@0: @see SetPenSize() sl@0: @see SetPenStyle() sl@0: @see SetDrawMode() sl@0: */ sl@0: virtual void DrawPolyLine(const TArray& aPointList) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawPolyLineNoEndPoint() sl@0: @see SetPenColor() sl@0: @see SetPenSize() sl@0: @see SetPenStyle() sl@0: @see SetDrawMode() sl@0: */ sl@0: virtual void DrawPolyLineNoEndPoint(const TArray& aPointList) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawPolygon() sl@0: */ sl@0: virtual void DrawPolygon(const TArray& aPoints, DirectGdi::TFillRule aRule) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawArc() sl@0: @see DrawPie() sl@0: */ sl@0: virtual void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawPie() sl@0: */ sl@0: virtual void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawEllipse() sl@0: */ sl@0: virtual void DrawEllipse(const TRect& aRect) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::BitBlt(const TPoint&, const CFbsBitmap&, const TRect&) sl@0: */ sl@0: virtual void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aBitmap, const TRect& aSourceRect) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::BitBltMasked(const TPoint&, const CFbsBitmap&, const TRect&, const CFbsBitmap&, TBool) sl@0: */ sl@0: virtual void BitBltMasked(const TPoint& aDestPos, sl@0: const CFbsBitmap& aBitmap, sl@0: const TRect& aSourceRect, sl@0: const CFbsBitmap& aMask, sl@0: TBool aInvertMask) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::BitBltMasked(const TPoint&, const CFbsBitmap&, const TRect&, const CFbsBitmap&, const TPoint&) sl@0: */ sl@0: virtual void BitBltMasked(const TPoint& aDestPos, sl@0: const CFbsBitmap& aBitmap, sl@0: const TRect& aSourceRect, sl@0: const CFbsBitmap& aMask, sl@0: const TPoint& aMaskPos) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawBitmap(const TRect&, const CFbsBitmap&, const TRect&) sl@0: */ sl@0: virtual void DrawBitmap(const TRect& aDestRect, sl@0: const CFbsBitmap& aBitmap, sl@0: const TRect& aSourceRect) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawBitmapMasked(const TRect&, const CFbsBitmap&, const TRect&, const CFbsBitmap&, TBool) sl@0: */ sl@0: virtual void DrawBitmapMasked(const TRect& aDestRect, sl@0: const CFbsBitmap& aBitmap, sl@0: const TRect& aSourceRect, sl@0: const CFbsBitmap& aMask, sl@0: TBool aInvertMask) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawResource(const TPoint&, const RDirectGdiImageSource&, DirectGdi::TGraphicsRotation) sl@0: */ sl@0: virtual void DrawResource(const TPoint& aPos, sl@0: const RDirectGdiDrawableSource& aSource, sl@0: DirectGdi::TGraphicsRotation aRotation) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawResource(const TRect&, const RDirectGdiImageSource&, DirectGdi::TGraphicsRotation) sl@0: */ sl@0: virtual void DrawResource(const TRect& aDestRect, sl@0: const RDirectGdiDrawableSource& aSource, sl@0: DirectGdi::TGraphicsRotation aRotation) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawResource(const TRect&, const RDirectGdiImageSource&, const TRect&, DirectGdi::TGraphicsRotation) sl@0: */ sl@0: virtual void DrawResource(const TRect& aDestRect, sl@0: const RDirectGdiDrawableSource& aSource, sl@0: const TRect& aSourceRect, sl@0: DirectGdi::TGraphicsRotation aRotation) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::DrawResource(const TRect&, const RDirectGdiDrawableSource&, const TDesC8&) sl@0: */ sl@0: virtual void DrawResource(const TRect& aDestRect, const RDirectGdiDrawableSource& aSource, const TDesC8& aParam) = 0; sl@0: sl@0: /** sl@0: Draws a glyph. sl@0: sl@0: @param aPos Position to start drawing the glyph after rotation has been applied (if necessary). sl@0: @param aChar Character being drawn. sl@0: @param aGlyphImage Pointer to the glyph image data. sl@0: @param aBitmapType Type of bitmap format. sl@0: @param aGlyphImageSize Glyph image size. sl@0: @param aClipRect Clipping rect. sl@0: @param aRotation Rotation specifying how the glyph will be drawn. sl@0: sl@0: @pre The rendering target has been activated. sl@0: @post Request to draw the glyph has been accepted. sl@0: */ sl@0: virtual void DrawGlyph(const TPoint& aPos, sl@0: const TChar aChar, sl@0: const TUint8* aGlyphImage, sl@0: const TGlyphBitmapType aBitmapType, sl@0: const TSize& aGlyphImageSize, sl@0: const TRect& aClipRect, sl@0: const DirectGdi::TGraphicsRotation aRotation = DirectGdi::EGraphicsRotationNone) = 0; sl@0: sl@0: /** sl@0: Copies the contents of a rectangular area on the target to another location. sl@0: The source rectangle will be intersected with the full extent of the target. sl@0: sl@0: @param aOffset Offset from the top left corner of the rectangle to be copied to the top left corner of the copy. sl@0: @param aRect Area to be copied. sl@0: sl@0: @pre The rendering target has been activated. sl@0: @post Request to copy an area has been accepted. There is no guarantee that the sl@0: request has been processed when this method returns. sl@0: */ sl@0: virtual void CopyRect(const TPoint& aOffset, const TRect& aRect) = 0; sl@0: sl@0: /** sl@0: Writes the drawing engine object state to the passed write stream. sl@0: sl@0: @see CDirectGdiContext::ExternalizeL() sl@0: @see InternalizeL() sl@0: sl@0: @param aWriteStream Write stream. sl@0: sl@0: @pre None. sl@0: @post The drawing engine object state has been written to the write stream. sl@0: */ sl@0: virtual void ExternalizeL(RWriteStream& aWriteStream) = 0; sl@0: sl@0: /** sl@0: Sets the drawing engine object state from the read stream. sl@0: sl@0: @see CDirectGdiContext::InternalizeL() sl@0: @see ExternalizeL() sl@0: sl@0: @param aReadStream Read stream. sl@0: sl@0: @pre None. sl@0: @post The drawing engine object state has been updated with the values from the read stream. sl@0: */ sl@0: virtual void InternalizeL(RReadStream& aReadStream) = 0; sl@0: sl@0: /** sl@0: @see CDirectGdiContext::GetInterface() sl@0: */ sl@0: virtual TInt GetInterface(TUid aInterfaceId, TAny*& aInterface) = 0; sl@0: sl@0: /** sl@0: Prepares the drawing engine for drawing text as multiple DrawGlyph() commands. sl@0: This function must always have a corresponding call to EndDrawGlyph() after the multiple sl@0: DrawGlyph() commands have been made. sl@0: Other than DrawGlyph(), no other rendering should be issued to the engine until EndDrawGlyph() has been called. sl@0: sl@0: @see EndDrawGlyph() sl@0: @see DrawGlyph() sl@0: sl@0: @pre None. sl@0: @post None. sl@0: */ sl@0: virtual void BeginDrawGlyph() = 0; sl@0: sl@0: /** sl@0: Notifies the drawing engine that the last call to DrawGlyph() has been made for the sl@0: text string. This function must always be matched to a corresponding BeginDrawGlyph() call. sl@0: Other than DrawGlyph(), no other rendering should be issued to the engine until EndDrawGlyph() has sl@0: been called. sl@0: sl@0: @see BeginDrawGlyph() sl@0: @see DrawGlyph() sl@0: sl@0: @pre BeginDrawGlyph() has been called. sl@0: @post None. sl@0: */ sl@0: virtual void EndDrawGlyph() = 0; sl@0: sl@0: }; sl@0: sl@0: const TUid KDirectGdiEngineUid = {0x10285A72}; sl@0: sl@0: sl@0: #endif