svgtopt/gfx2d/src/GfxGc/GfxRenderingHints.cpp
changeset 46 88edb906c587
equal deleted inserted replaced
-1:000000000000 46:88edb906c587
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Graphics Extension Library source file
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "GfxRenderingHints.h"
       
    20 
       
    21 
       
    22 const TUint32 KCurveQualityMask = 0x00000007;  // bit 0-2
       
    23 const TUint32 KVisibilityMask = 0x00000008;    // bit 3
       
    24 const TUint32 KFontEngineMask = 0x00000010;    // bit 4
       
    25 
       
    26 
       
    27 // --------------------------------------------------------------------------
       
    28 //  TGfxRenderingHints::TGfxRenderingHints()
       
    29 // ---------------------------------------------------------------------------
       
    30  TGfxRenderingHints::TGfxRenderingHints()
       
    31     {
       
    32     iHintBits = KVisibilityMask;    // Default visibility = visible
       
    33     iHintBits |= ( KCurveQualityMask & 2 ); // Default Flattening level = 2
       
    34 
       
    35     // Notes:
       
    36     //   KFontEngineMask bitp is 0 -> use scalable font as default
       
    37     }
       
    38 
       
    39 
       
    40 // ==========================================================================
       
    41 // Visibility
       
    42 // ==========================================================================
       
    43 // --------------------------------------------------------------------------
       
    44 //  void TGfxRenderingHints::SetVisibility( TBool aVisibility )
       
    45 // ---------------------------------------------------------------------------
       
    46  void TGfxRenderingHints::SetVisibility( TBool aVisibility )
       
    47     {
       
    48     if ( aVisibility )
       
    49         {
       
    50         iHintBits |= KVisibilityMask;
       
    51         }
       
    52     else
       
    53         {
       
    54         iHintBits &= ~KVisibilityMask;
       
    55         }
       
    56     }
       
    57 
       
    58 // --------------------------------------------------------------------------
       
    59 //  TBool TGfxRenderingHints::Visibility()
       
    60 // ---------------------------------------------------------------------------
       
    61  TBool TGfxRenderingHints::Visibility()
       
    62     {
       
    63     return ( ( iHintBits & KVisibilityMask ) != 0 );
       
    64     }
       
    65 
       
    66 // ==========================================================================
       
    67 // Curve quality
       
    68 // ==========================================================================
       
    69 // --------------------------------------------------------------------------
       
    70 //  void TGfxRenderingHints::SetCurveQuality( TInt aCurveQuality )
       
    71 // ---------------------------------------------------------------------------
       
    72  void TGfxRenderingHints::SetCurveQuality( TInt aCurveQuality )
       
    73     {
       
    74     iHintBits &= ~KCurveQualityMask;                    // clear
       
    75     iHintBits |= ( KCurveQualityMask & aCurveQuality ); // set
       
    76     }
       
    77 
       
    78 // --------------------------------------------------------------------------
       
    79 //  TInt TGfxRenderingHints::CurveQuality()
       
    80 // ---------------------------------------------------------------------------
       
    81  TInt TGfxRenderingHints::CurveQuality()
       
    82     {
       
    83     return ( iHintBits & KCurveQualityMask );
       
    84     }
       
    85 
       
    86 // ==========================================================================
       
    87 // switch rendering engine (Open Font system/bitmap font)
       
    88 // ==========================================================================
       
    89 // --------------------------------------------------------------------------
       
    90 //  void TGfxRenderingHints::SetFastFontRendering( TBool aFastFontRendering )
       
    91 // ---------------------------------------------------------------------------
       
    92  void TGfxRenderingHints::SetFastFontRendering( TBool aFastFontRendering )
       
    93     {
       
    94     if ( aFastFontRendering )
       
    95         {
       
    96         iHintBits |= KFontEngineMask;
       
    97         }
       
    98     else
       
    99         {
       
   100         iHintBits &= ~KFontEngineMask;
       
   101         }
       
   102     }
       
   103 
       
   104 // --------------------------------------------------------------------------
       
   105 //  TBool TGfxRenderingHints::FastFontRendering()
       
   106 // ---------------------------------------------------------------------------
       
   107  TBool TGfxRenderingHints::FastFontRendering()
       
   108     {
       
   109     return ( ( iHintBits & KFontEngineMask ) != 0 );
       
   110     }
       
   111 
       
   112 
       
   113 // --------------------------------------------------------------------------
       
   114 //  void TGfxRenderingHints::SetShapeAntiAliasing( TBool /* aShapeAntiAliasing */ )
       
   115 // ---------------------------------------------------------------------------
       
   116  void TGfxRenderingHints::SetShapeAntiAliasing( TBool /* aShapeAntiAliasing */ )
       
   117     {
       
   118     }
       
   119 
       
   120 // --------------------------------------------------------------------------
       
   121 //  TBool TGfxRenderingHints::ShapeAntiAliasing()
       
   122 // ---------------------------------------------------------------------------
       
   123  TBool TGfxRenderingHints::ShapeAntiAliasing()
       
   124     {
       
   125     return EFalse;
       
   126     }
       
   127 
       
   128 // --------------------------------------------------------------------------
       
   129 //  TGfxImageInterpolation TGfxRenderingHints::ImageInterpolation()
       
   130 // ---------------------------------------------------------------------------
       
   131  TGfxImageInterpolation TGfxRenderingHints::ImageInterpolation()
       
   132     {
       
   133     return EGfxInterpolationNearestNeighbor;
       
   134     }
       
   135