lafagnosticuifoundation/uigraphicsutils/gulsrc/gulgcmap.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 2001-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 #include <gulgcmap.h>
       
    17 
       
    18 // GC MAPPING CLASS
       
    19 
       
    20 /**
       
    21  * Static factory construction method.  Creates (and returns a pointer to) 
       
    22  * the object which performs as an adaptor between this <code>CWindowGc</code> 
       
    23  * derived class and an internally held <code>CBitmapGc</code>.  
       
    24  * The internal CBitmapGc is provided as <code>aFbsBitGc</code>.  
       
    25  * Ownership of the arguments is not transferred.'
       
    26  *
       
    27  * @since     7.0
       
    28  * @param     "CWsScreenDevice& aDevice"
       
    29  * @param     "CFbsBitGc& aFbsBitGc" 
       
    30  *
       
    31  * @return   "CWindowToBitmapMappingGc*"
       
    32  *             Pointer to the new Window to Bitmap Mapping Graphical Context.
       
    33  *
       
    34  */
       
    35 EXPORT_C CWindowToBitmapMappingGc* CWindowToBitmapMappingGc::NewL(CWsScreenDevice& aDevice,CFbsBitGc& aFbsBitGc)
       
    36 	{
       
    37 	CWindowToBitmapMappingGc* self = new(ELeave) CWindowToBitmapMappingGc(aDevice,aFbsBitGc);
       
    38 	return self;
       
    39 	}
       
    40 
       
    41 EXPORT_C CWindowToBitmapMappingGc::~CWindowToBitmapMappingGc()
       
    42 	{
       
    43 	}
       
    44 	
       
    45 //====================Functions from GDI.H===============================
       
    46 
       
    47 EXPORT_C CGraphicsDevice* CWindowToBitmapMappingGc::Device() const
       
    48 	{
       
    49 	return (iFbsBitGc.Device());
       
    50 	}
       
    51 
       
    52 EXPORT_C void CWindowToBitmapMappingGc::Activate(RDrawableWindow& /*aWindow*/)
       
    53 	{
       
    54 	}
       
    55 
       
    56 EXPORT_C void CWindowToBitmapMappingGc::Deactivate()
       
    57 	{
       
    58 	}
       
    59 
       
    60 EXPORT_C void CWindowToBitmapMappingGc::SetOrigin(const TPoint &aPoint)
       
    61 	{
       
    62 	iFbsBitGc.SetOrigin(aPoint);
       
    63 	}
       
    64 
       
    65 EXPORT_C void CWindowToBitmapMappingGc::SetClippingRect(const TRect& aRect)
       
    66 	{
       
    67 	iFbsBitGc.SetClippingRect(aRect);
       
    68 	}
       
    69 
       
    70 EXPORT_C void CWindowToBitmapMappingGc::CancelClippingRect()
       
    71 	{
       
    72 	iFbsBitGc.CancelClippingRect();
       
    73 	}
       
    74 
       
    75 EXPORT_C TInt CWindowToBitmapMappingGc::SetClippingRegion(const TRegion &aRegion)
       
    76 	{
       
    77 	iFbsBitGc.SetClippingRegion(&aRegion);
       
    78 	return 0;
       
    79 	}
       
    80 
       
    81 EXPORT_C void CWindowToBitmapMappingGc::CancelClippingRegion()
       
    82 	{
       
    83 	iFbsBitGc.CancelClippingRegion();
       
    84 	}
       
    85 	
       
    86 EXPORT_C void CWindowToBitmapMappingGc::SetOpaque(TBool /*aDrawOpaque*/)
       
    87 	{
       
    88 	}
       
    89 
       
    90 EXPORT_C void CWindowToBitmapMappingGc::SetDrawMode(TDrawMode aDrawingMode)
       
    91 	{
       
    92 	iFbsBitGc.SetDrawMode(aDrawingMode);
       
    93 	}
       
    94 
       
    95 EXPORT_C void CWindowToBitmapMappingGc::UseFont(const CFont *aFont)
       
    96 	{
       
    97 	iFbsBitGc.UseFont(aFont);
       
    98 	}
       
    99 
       
   100 EXPORT_C void CWindowToBitmapMappingGc::DiscardFont()
       
   101 	{
       
   102 	iFbsBitGc.DiscardFont();
       
   103 	}
       
   104 
       
   105 EXPORT_C void CWindowToBitmapMappingGc::SetUnderlineStyle(TFontUnderline aUnderlineStyle)
       
   106 	{
       
   107 	iFbsBitGc.SetUnderlineStyle(aUnderlineStyle);
       
   108 	}
       
   109 
       
   110 EXPORT_C void CWindowToBitmapMappingGc::SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle)
       
   111 	{
       
   112 	iFbsBitGc.SetStrikethroughStyle(aStrikethroughStyle);
       
   113 	}
       
   114 
       
   115 EXPORT_C void CWindowToBitmapMappingGc::SetWordJustification(TInt aExcessWidth,TInt aNumGaps)
       
   116 	{
       
   117 	iFbsBitGc.SetWordJustification(aExcessWidth,aNumGaps);
       
   118 	}
       
   119 
       
   120 EXPORT_C void CWindowToBitmapMappingGc::SetCharJustification(TInt aExcessWidth,TInt aNumChars)
       
   121 	{
       
   122 	iFbsBitGc.SetCharJustification(aExcessWidth,aNumChars);
       
   123 	}
       
   124 
       
   125 EXPORT_C void CWindowToBitmapMappingGc::SetPenColor(const TRgb &aColor)
       
   126 	{
       
   127 	iFbsBitGc.SetPenColor(aColor);
       
   128 	}
       
   129 
       
   130 EXPORT_C void CWindowToBitmapMappingGc::SetPenStyle(TPenStyle aPenStyle)
       
   131 	{
       
   132 	iFbsBitGc.SetPenStyle(aPenStyle);
       
   133 	}
       
   134 
       
   135 EXPORT_C void CWindowToBitmapMappingGc::SetPenSize(const TSize& aSize)
       
   136 	{
       
   137 	iFbsBitGc.SetPenSize(aSize);
       
   138 	}
       
   139 
       
   140 EXPORT_C void CWindowToBitmapMappingGc::SetBrushColor(const TRgb &aColor)
       
   141 	{
       
   142 	iFbsBitGc.SetBrushColor(aColor);
       
   143 	}
       
   144 
       
   145 EXPORT_C void CWindowToBitmapMappingGc::SetBrushStyle(TBrushStyle aBrushStyle)
       
   146 	{
       
   147 	iFbsBitGc.SetBrushStyle(aBrushStyle);
       
   148 	}
       
   149 
       
   150 EXPORT_C void CWindowToBitmapMappingGc::SetBrushOrigin(const TPoint &aOrigin)
       
   151 	{
       
   152 	iFbsBitGc.SetBrushOrigin(aOrigin);
       
   153 	}
       
   154 
       
   155 EXPORT_C void CWindowToBitmapMappingGc::UseBrushPattern(const CFbsBitmap *aDevice)
       
   156 	{
       
   157 	iFbsBitGc.UseBrushPattern(aDevice);
       
   158 	}
       
   159 
       
   160 EXPORT_C void CWindowToBitmapMappingGc::DiscardBrushPattern()
       
   161 	{
       
   162 	iFbsBitGc.DiscardBrushPattern();
       
   163 	}
       
   164 
       
   165 EXPORT_C void CWindowToBitmapMappingGc::Plot(const TPoint &aPoint)
       
   166 	{
       
   167 	iFbsBitGc.Plot(aPoint);
       
   168 	}
       
   169 
       
   170 EXPORT_C void CWindowToBitmapMappingGc::DrawLine(const TPoint &aPoint1,const TPoint &aPoint2)
       
   171 	{
       
   172 	iFbsBitGc.DrawLine(aPoint1,aPoint2);
       
   173 	}
       
   174 
       
   175 EXPORT_C void CWindowToBitmapMappingGc::MoveTo(const TPoint &aPoint)
       
   176 	{
       
   177 	iFbsBitGc.MoveTo(aPoint);
       
   178 	}
       
   179 
       
   180 EXPORT_C void CWindowToBitmapMappingGc::MoveBy(const TPoint &aPoint)
       
   181 	{
       
   182 	iFbsBitGc.MoveBy(aPoint);
       
   183 	}
       
   184 
       
   185 EXPORT_C void CWindowToBitmapMappingGc::DrawLineTo(const TPoint &aPoint)
       
   186 	{
       
   187 	iFbsBitGc.DrawLineTo(aPoint);
       
   188 	}
       
   189 
       
   190 EXPORT_C void CWindowToBitmapMappingGc::DrawLineBy(const TPoint &aPoint)
       
   191 	{
       
   192 	iFbsBitGc.DrawLineBy(aPoint);
       
   193 	}
       
   194 
       
   195 EXPORT_C void CWindowToBitmapMappingGc::DrawPolyLine(const TPoint* aPointList,TInt aNumPoints)
       
   196 	{
       
   197 	iFbsBitGc.DrawPolyLine(aPointList,aNumPoints);
       
   198 	}
       
   199 
       
   200 EXPORT_C void CWindowToBitmapMappingGc::DrawPolyLine(const CArrayFix<TPoint> *aPointArray)
       
   201 	{
       
   202 	iFbsBitGc.DrawPolyLine(aPointArray);
       
   203 	}
       
   204 
       
   205 EXPORT_C TInt CWindowToBitmapMappingGc::DrawPolygon(const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule)
       
   206 	{
       
   207 	return (iFbsBitGc.DrawPolygon(aPointList,aNumPoints,aFillRule));
       
   208 	}
       
   209 
       
   210 EXPORT_C TInt CWindowToBitmapMappingGc::DrawPolygon(const CArrayFix<TPoint> *aPointArray,TFillRule aFillRule)
       
   211 	{
       
   212 	return (iFbsBitGc.DrawPolygon(aPointArray,aFillRule));
       
   213 	}
       
   214 
       
   215 EXPORT_C void CWindowToBitmapMappingGc::DrawArc(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd)
       
   216 	{
       
   217 	iFbsBitGc.DrawArc(aRect,aStart,aEnd);
       
   218 	}
       
   219 
       
   220 EXPORT_C void CWindowToBitmapMappingGc::DrawPie(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd)
       
   221 	{
       
   222 	iFbsBitGc.DrawPie(aRect,aStart,aEnd);
       
   223 	}
       
   224 
       
   225 EXPORT_C void CWindowToBitmapMappingGc::DrawEllipse(const TRect &aRect)
       
   226 	{
       
   227 	iFbsBitGc.DrawEllipse(aRect);
       
   228 	}
       
   229 
       
   230 EXPORT_C void CWindowToBitmapMappingGc::DrawRect(const TRect &aRect)
       
   231 	{
       
   232 	iFbsBitGc.DrawRect(aRect);
       
   233 	}
       
   234 
       
   235 EXPORT_C void CWindowToBitmapMappingGc::DrawRoundRect(const TRect &aRect,const TSize &aEllipse)
       
   236 	{
       
   237 	iFbsBitGc.DrawRoundRect(aRect,aEllipse);
       
   238 	}
       
   239 
       
   240 EXPORT_C void CWindowToBitmapMappingGc::DrawBitmap(const TPoint &aTopLeft, const CFbsBitmap *aDevice)
       
   241 	{
       
   242 	iFbsBitGc.DrawBitmap(aTopLeft,aDevice);
       
   243 	}
       
   244 
       
   245 EXPORT_C void CWindowToBitmapMappingGc::DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aDevice)
       
   246 	{
       
   247 	iFbsBitGc.DrawBitmap(aDestRect,aDevice);
       
   248 	}
       
   249 
       
   250 EXPORT_C void CWindowToBitmapMappingGc::DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aDevice, const TRect &aSourceRect)
       
   251 	{
       
   252 	iFbsBitGc.DrawBitmap(aDestRect,aDevice,aSourceRect);
       
   253 	}
       
   254 
       
   255 EXPORT_C void CWindowToBitmapMappingGc::DrawBitmapMasked(const TRect& aDestRect, const CFbsBitmap* aBitmap, const TRect& aSourceRect, const CFbsBitmap* aMaskBitmap, TBool aInvertMask)
       
   256 	{
       
   257 	iFbsBitGc.DrawBitmapMasked(aDestRect, aBitmap, aSourceRect, aMaskBitmap, aInvertMask);
       
   258 	}
       
   259 	
       
   260 EXPORT_C void CWindowToBitmapMappingGc::DrawBitmapMasked(const TRect& aDestRect, const CWsBitmap* aBitmap, const TRect& aSourceRect, const CWsBitmap* aMaskBitmap, TBool aInvertMask)
       
   261 	{
       
   262 	iFbsBitGc.DrawBitmapMasked(aDestRect, aBitmap, aSourceRect, aMaskBitmap, aInvertMask);
       
   263 	}
       
   264 
       
   265 EXPORT_C void CWindowToBitmapMappingGc::DrawText(const TDesC &aBuf, const TPoint &aPos)
       
   266 	{
       
   267 	iFbsBitGc.DrawText(aBuf,aPos);
       
   268 	}
       
   269 
       
   270 EXPORT_C void CWindowToBitmapMappingGc::DrawText(const TDesC &aBuf,const TRect &aBox,TInt aBaselineOffset,TTextAlign aHoriz,TInt aLeftMrg)
       
   271 	{
       
   272 	iFbsBitGc.DrawText(aBuf,aBox,aBaselineOffset,aHoriz,aLeftMrg);
       
   273 	}
       
   274 
       
   275 EXPORT_C void CWindowToBitmapMappingGc::DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp)
       
   276 	{
       
   277 	iFbsBitGc.DrawTextVertical(aText,aPos,aUp);
       
   278 	}
       
   279 
       
   280 EXPORT_C void CWindowToBitmapMappingGc::DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert,TInt aMargin)
       
   281 	{
       
   282 	iFbsBitGc.DrawTextVertical(aText,aBox,aBaselineOffset,aUp,aVert,aMargin);
       
   283 	}
       
   284 
       
   285 //========================Extra functions============================
       
   286 
       
   287 EXPORT_C void CWindowToBitmapMappingGc::CopyRect(const TPoint &anOffset,const TRect &aRect)
       
   288 	{
       
   289 	iFbsBitGc.CopyRect(anOffset,aRect);
       
   290 	}
       
   291 
       
   292 EXPORT_C void CWindowToBitmapMappingGc::BitBlt(const TPoint &aPoint, const CFbsBitmap *aBitmap)
       
   293 	{
       
   294 	iFbsBitGc.BitBlt(aPoint,aBitmap);
       
   295 	}
       
   296 
       
   297 EXPORT_C void CWindowToBitmapMappingGc::BitBlt(const TPoint &aDestination,const CFbsBitmap *aBitmap,const TRect &aSource)
       
   298 	{
       
   299 	iFbsBitGc.BitBlt(aDestination,aBitmap,aSource);
       
   300 	}
       
   301 
       
   302 EXPORT_C void CWindowToBitmapMappingGc::BitBltMasked(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask)
       
   303 	{
       
   304 	iFbsBitGc.BitBltMasked(aPoint,aBitmap,aSourceRect,aMaskBitmap,aInvertMask);
       
   305 	}
       
   306 
       
   307 EXPORT_C void CWindowToBitmapMappingGc::BitBlt(const TPoint &aPoint, const CWsBitmap *aBitmap)
       
   308 	{
       
   309 	iFbsBitGc.BitBlt(aPoint,aBitmap);
       
   310 	}
       
   311 
       
   312 EXPORT_C void CWindowToBitmapMappingGc::BitBlt(const TPoint &aDestination,const CWsBitmap  *aBitmap,const TRect &aSource)
       
   313 	{
       
   314 	iFbsBitGc.BitBlt(aDestination,aBitmap,aSource);
       
   315 	}
       
   316 
       
   317 EXPORT_C void CWindowToBitmapMappingGc::BitBltMasked(const TPoint& aPoint,const CWsBitmap * aBitmap,const TRect& aSourceRect,const CWsBitmap * aMaskBitmap,TBool aInvertMask)
       
   318 	{
       
   319 	iFbsBitGc.BitBltMasked(aPoint,aBitmap,aSourceRect,aMaskBitmap,aInvertMask);
       
   320 	}
       
   321 
       
   322 EXPORT_C void CWindowToBitmapMappingGc::MapColors(const TRect &aRect,const TRgb *aColors,TInt aNumPairs,TBool aMapForwards)
       
   323 	{
       
   324 	iFbsBitGc.MapColors(aRect,aColors,aNumPairs,aMapForwards);
       
   325 	}
       
   326 
       
   327 EXPORT_C void CWindowToBitmapMappingGc::Clear(const TRect &aRect)
       
   328 	{
       
   329 	iFbsBitGc.Clear(aRect);
       
   330 	}
       
   331 
       
   332 EXPORT_C void CWindowToBitmapMappingGc::Clear()
       
   333 	{
       
   334 	iFbsBitGc.Clear();
       
   335 	}
       
   336 
       
   337 EXPORT_C void CWindowToBitmapMappingGc::Reset()
       
   338 	{
       
   339 	iFbsBitGc.Reset();
       
   340 	}
       
   341 
       
   342 EXPORT_C void CWindowToBitmapMappingGc::SetDitherOrigin(const TPoint& aPoint)
       
   343 	{
       
   344 	iFbsBitGc.SetDitherOrigin(aPoint);
       
   345 	}
       
   346 
       
   347 /**
       
   348  *
       
   349  * Sets whether the graphics context is faded.
       
   350  *
       
   351  * @since     7.0
       
   352  * @param     "TBool aFaded"
       
   353  *            if <code>ETrue</code>  to fade GC
       
   354  *			  if <code>EFalse</code> not to fade GC
       
   355  */
       
   356 EXPORT_C void CWindowToBitmapMappingGc::SetFaded(TBool aFaded)
       
   357 	{
       
   358 	iFbsBitGc.SetFaded(aFaded);
       
   359 	}
       
   360 
       
   361 /**
       
   362  *
       
   363  * Sets fading parameters.
       
   364  *
       
   365  * @since     7.0
       
   366  * @param     "TUint8 aBlackMap"
       
   367  *             Black map fading parameter. 
       
   368  * @param	  "TUint8 aWhiteMap"
       
   369  *			   White map fading parameter. 			  
       
   370  */
       
   371 EXPORT_C void CWindowToBitmapMappingGc::SetFadingParameters(TUint8 aBlackMap,TUint8 aWhiteMap)
       
   372 	{
       
   373 	iFbsBitGc.SetFadingParameters(aBlackMap,aWhiteMap);
       
   374 	}
       
   375 	
       
   376 EXPORT_C TInt CWindowToBitmapMappingGc::AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt)
       
   377 	{
       
   378 	return iFbsBitGc.AlphaBlendBitmaps(aDestPt,aSrcBmp,aSrcRect,aAlphaBmp,aAlphaPt);
       
   379 	}
       
   380 	
       
   381 EXPORT_C TInt CWindowToBitmapMappingGc::AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp,	const TRect& aSrcRect, const CWsBitmap* aAlphaBmp, const TPoint& aAlphaPt)
       
   382 	{
       
   383 	return iFbsBitGc.AlphaBlendBitmaps(aDestPt,aSrcBmp,aSrcRect,aAlphaBmp,aAlphaPt);
       
   384 	}
       
   385 
       
   386 EXPORT_C CWindowToBitmapMappingGc::CWindowToBitmapMappingGc(CWsScreenDevice& aDevice, CFbsBitGc& aFbsBitGc)
       
   387 		: CWindowGc(&aDevice), iFbsBitGc(aFbsBitGc)
       
   388 	{
       
   389 	}