First public contribution.
1 // Copyright (c) 2007-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #ifndef DIRECTGDIENGINE_H
18 #define DIRECTGDIENGINE_H
26 #include <graphics/directgditypes.h>
29 // Forward declarations.
32 class RDirectGdiImageSource;
33 class RDirectGdiImageTarget;
34 class RDirectGdiDrawableSource;
37 Pure virtual interface for licensee adaptation of GDI platform implementation.
43 class MDirectGdiEngine
48 @see CDirectGdiContext::Activate()
51 virtual TInt Activate(RDirectGdiImageTarget& aTarget) = 0;
54 Unbinds the current rendering target (if any) from drawing engine. Drawing engine states or settings which
55 are not dependent or non-target-specific remain unchanged.
57 The DirectGDI generic layer will call this method prior to activating the drawing engine for another
63 @post Drawing engine is no longer associated with any rendering target.
65 virtual void Deactivate() = 0;
68 @see CDirectGdiContext::SetOrigin()
70 virtual void SetOrigin(const TPoint& aOrigin) = 0;
73 @see CDirectGdiContext::ResetClippingRegion()
74 @see SetClippingRegion()
76 virtual void SetClippingRegion(const TRegion& aRegion) = 0;
79 @see CDirectGdiContext::ReetClippingRegion()
80 @see SetClippingRegion()
82 virtual void ResetClippingRegion() = 0;
85 @see CDirectGdiContext::SetDrawMode()
87 virtual void SetDrawMode(DirectGdi::TDrawMode aMode) = 0;
90 @see CDirectGdiContext::SetPenColor()
99 virtual void SetPenColor(const TRgb& aColor) = 0;
102 @see CDirectGdiContext::SetPenStyle()
111 virtual void SetPenStyle(DirectGdi::TPenStyle aStyle) = 0;
114 @see CDirectGdiContext::SetPenSize()
124 virtual void SetPenSize(const TSize& aSize) = 0;
127 @see CDirectGdiContext::SetTextShadowColor()
129 virtual void SetTextShadowColor(const TRgb& aColor) = 0;
132 @see CDirectGdiContext::SetBrushColor()
134 virtual void SetBrushColor(const TRgb& aColor) = 0;
137 @see CDirectGdiContext::SetBrushStyle()
138 @see SetBrushPattern()
140 virtual void SetBrushStyle(DirectGdi::TBrushStyle aStyle) = 0;
143 @see CDirectGdiContext::SetBrushOrigin()
144 @see SetBrushPattern()
146 virtual void SetBrushOrigin(const TPoint& aOrigin) = 0;
149 @see CDirectGdiContext::SetBrushPattern()
150 @see ResetBrushPattern()
152 @return KErrNone if successful, otherwise one of the system-wide error codes.
154 virtual TInt SetBrushPattern(const CFbsBitmap& aPattern) = 0;
157 @see CDirectGdiContext::ResetBrushPattern()
158 @see SetBrushPattern()
160 virtual void ResetBrushPattern() = 0;
163 @see CDirectGdiContext::SetFont()
165 @param aFontId The Font identifier.
167 virtual void SetFont(TUint32 aFontId) = 0;
170 @see CDirectGdiContext::ResetFont()
172 virtual void ResetFont() = 0;
175 Resets the engine state to default values.
177 @see CDirectGdiContext::Reset()
179 virtual void Reset() = 0;
182 @see CDirectGdiContext::Clear(const TRect&)
186 virtual void Clear(const TRect& aRect) = 0;
189 @see CDirectGdiContext::Clear()
190 @see Clear(const TRect&)
193 virtual void Clear() = 0;
196 @see CDirectGdiContext::MoveTo()
199 virtual void MoveTo(const TPoint& aPoint) = 0;
202 @see CDirectGdiContext::MoveBy()
205 virtual void MoveBy(const TPoint& aVector) = 0;
208 @see CDirectGdiContext::Plot()
213 virtual void Plot(const TPoint& aPoint) = 0;
216 @see CDirectGdiContext::DrawLine()
224 virtual void DrawLine(const TPoint& aStart, const TPoint& aEnd) = 0;
227 @see CDirectGdiContext::DrawLineTo()
237 virtual void DrawLineTo(const TPoint& aPoint) = 0;
240 @see CDirectGdiContext::DrawLineBy()
250 virtual void DrawLineBy(const TPoint& aVector) = 0;
253 @see CDirectGdiContext::DrawRect()
255 virtual void DrawRect(const TRect& aRect) = 0;
258 @see CDirectGdiContext::DrawRoundRect()
260 virtual void DrawRoundRect(const TRect& aRect, const TSize& aCornerSize) = 0;
263 @see CDirectGdiContext::DrawPolyLine()
269 virtual void DrawPolyLine(const TArray<TPoint>& aPointList) = 0;
272 @see CDirectGdiContext::DrawPolyLineNoEndPoint()
278 virtual void DrawPolyLineNoEndPoint(const TArray<TPoint>& aPointList) = 0;
281 @see CDirectGdiContext::DrawPolygon()
283 virtual void DrawPolygon(const TArray<TPoint>& aPoints, DirectGdi::TFillRule aRule) = 0;
286 @see CDirectGdiContext::DrawArc()
289 virtual void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd) = 0;
292 @see CDirectGdiContext::DrawPie()
294 virtual void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd) = 0;
297 @see CDirectGdiContext::DrawEllipse()
299 virtual void DrawEllipse(const TRect& aRect) = 0;
302 @see CDirectGdiContext::BitBlt(const TPoint&, const CFbsBitmap&, const TRect&)
304 virtual void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aBitmap, const TRect& aSourceRect) = 0;
307 @see CDirectGdiContext::BitBltMasked(const TPoint&, const CFbsBitmap&, const TRect&, const CFbsBitmap&, TBool)
309 virtual void BitBltMasked(const TPoint& aDestPos,
310 const CFbsBitmap& aBitmap,
311 const TRect& aSourceRect,
312 const CFbsBitmap& aMask,
313 TBool aInvertMask) = 0;
316 @see CDirectGdiContext::BitBltMasked(const TPoint&, const CFbsBitmap&, const TRect&, const CFbsBitmap&, const TPoint&)
318 virtual void BitBltMasked(const TPoint& aDestPos,
319 const CFbsBitmap& aBitmap,
320 const TRect& aSourceRect,
321 const CFbsBitmap& aMask,
322 const TPoint& aMaskPos) = 0;
325 @see CDirectGdiContext::DrawBitmap(const TRect&, const CFbsBitmap&, const TRect&)
327 virtual void DrawBitmap(const TRect& aDestRect,
328 const CFbsBitmap& aBitmap,
329 const TRect& aSourceRect) = 0;
332 @see CDirectGdiContext::DrawBitmapMasked(const TRect&, const CFbsBitmap&, const TRect&, const CFbsBitmap&, TBool)
334 virtual void DrawBitmapMasked(const TRect& aDestRect,
335 const CFbsBitmap& aBitmap,
336 const TRect& aSourceRect,
337 const CFbsBitmap& aMask,
338 TBool aInvertMask) = 0;
341 @see CDirectGdiContext::DrawResource(const TPoint&, const RDirectGdiImageSource&, DirectGdi::TGraphicsRotation)
343 virtual void DrawResource(const TPoint& aPos,
344 const RDirectGdiDrawableSource& aSource,
345 DirectGdi::TGraphicsRotation aRotation) = 0;
348 @see CDirectGdiContext::DrawResource(const TRect&, const RDirectGdiImageSource&, DirectGdi::TGraphicsRotation)
350 virtual void DrawResource(const TRect& aDestRect,
351 const RDirectGdiDrawableSource& aSource,
352 DirectGdi::TGraphicsRotation aRotation) = 0;
355 @see CDirectGdiContext::DrawResource(const TRect&, const RDirectGdiImageSource&, const TRect&, DirectGdi::TGraphicsRotation)
357 virtual void DrawResource(const TRect& aDestRect,
358 const RDirectGdiDrawableSource& aSource,
359 const TRect& aSourceRect,
360 DirectGdi::TGraphicsRotation aRotation) = 0;
363 @see CDirectGdiContext::DrawResource(const TRect&, const RDirectGdiDrawableSource&, const TDesC8&)
365 virtual void DrawResource(const TRect& aDestRect, const RDirectGdiDrawableSource& aSource, const TDesC8& aParam) = 0;
370 @param aPos Position to start drawing the glyph after rotation has been applied (if necessary).
371 @param aChar Character being drawn.
372 @param aGlyphImage Pointer to the glyph image data.
373 @param aBitmapType Type of bitmap format.
374 @param aGlyphImageSize Glyph image size.
375 @param aClipRect Clipping rect.
376 @param aRotation Rotation specifying how the glyph will be drawn.
378 @pre The rendering target has been activated.
379 @post Request to draw the glyph has been accepted.
381 virtual void DrawGlyph(const TPoint& aPos,
383 const TUint8* aGlyphImage,
384 const TGlyphBitmapType aBitmapType,
385 const TSize& aGlyphImageSize,
386 const TRect& aClipRect,
387 const DirectGdi::TGraphicsRotation aRotation = DirectGdi::EGraphicsRotationNone) = 0;
390 Copies the contents of a rectangular area on the target to another location.
391 The source rectangle will be intersected with the full extent of the target.
393 @param aOffset Offset from the top left corner of the rectangle to be copied to the top left corner of the copy.
394 @param aRect Area to be copied.
396 @pre The rendering target has been activated.
397 @post Request to copy an area has been accepted. There is no guarantee that the
398 request has been processed when this method returns.
400 virtual void CopyRect(const TPoint& aOffset, const TRect& aRect) = 0;
403 Writes the drawing engine object state to the passed write stream.
405 @see CDirectGdiContext::ExternalizeL()
408 @param aWriteStream Write stream.
411 @post The drawing engine object state has been written to the write stream.
413 virtual void ExternalizeL(RWriteStream& aWriteStream) = 0;
416 Sets the drawing engine object state from the read stream.
418 @see CDirectGdiContext::InternalizeL()
421 @param aReadStream Read stream.
424 @post The drawing engine object state has been updated with the values from the read stream.
426 virtual void InternalizeL(RReadStream& aReadStream) = 0;
429 @see CDirectGdiContext::GetInterface()
431 virtual TInt GetInterface(TUid aInterfaceId, TAny*& aInterface) = 0;
434 Prepares the drawing engine for drawing text as multiple DrawGlyph() commands.
435 This function must always have a corresponding call to EndDrawGlyph() after the multiple
436 DrawGlyph() commands have been made.
437 Other than DrawGlyph(), no other rendering should be issued to the engine until EndDrawGlyph() has been called.
445 virtual void BeginDrawGlyph() = 0;
448 Notifies the drawing engine that the last call to DrawGlyph() has been made for the
449 text string. This function must always be matched to a corresponding BeginDrawGlyph() call.
450 Other than DrawGlyph(), no other rendering should be issued to the engine until EndDrawGlyph() has
453 @see BeginDrawGlyph()
456 @pre BeginDrawGlyph() has been called.
459 virtual void EndDrawGlyph() = 0;
463 const TUid KDirectGdiEngineUid = {0x10285A72};