skins/AknSkins/rlplugininc/AknsRlEffectPluginSolarize.h
changeset 0 05e9090e2422
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     1 /*
       
     2 * Copyright (c) 2004-2008 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:  Solarize provides functionality to solarize bitmap images on per channel
       
    15 *                basis.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef AKNSRLEFFECTPLUGINSOLARIZE_H
       
    21 #define AKNSRLEFFECTPLUGINSOLARIZE_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "AknsRlEffectPlugin.h"
       
    25 #include <AknsRlEffect.h>
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 // Effect plugin UID
       
    30 const TInt KAknsRlEffectPluginSolarizeUID = 0x10204AE7;
       
    31 
       
    32 // Constants for parameter names
       
    33 _LIT( KAknsRlEffectSolarizeTreshold, "t" );
       
    34 _LIT( KAknsRlEffectSolarizeChannels, "c" );
       
    35 _LIT( KAknsRlEffectSolarizeBlendFactor, "f" );
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40 * Solarize provides functionality to solarize bitmap images on per channel
       
    41 * basis (e.g. you could solarize red channel only).
       
    42 *
       
    43 * @since 2.8
       
    44 */
       
    45 NONSHARABLE_CLASS(CAknsRlEffectPluginSolarize):
       
    46     public CAknsRlEffectPlugin,
       
    47     public MAknsRlEffect
       
    48     {
       
    49     public:
       
    50         /**
       
    51         * Constants for constructing the channel bitmask.
       
    52         */
       
    53         enum TBitmask
       
    54             {
       
    55             EMaskR = 0x01,
       
    56             EMaskG = 0x02,
       
    57             EMaskB = 0x04
       
    58             };
       
    59 
       
    60     public: // Constructors and destructor
       
    61 
       
    62         /**
       
    63         * Default constructor.
       
    64         *
       
    65         * @since 2.8
       
    66         */
       
    67         CAknsRlEffectPluginSolarize();
       
    68 
       
    69         /**
       
    70         * Destructor.
       
    71         *
       
    72         * @since 2.8
       
    73         */
       
    74         virtual ~CAknsRlEffectPluginSolarize();
       
    75 
       
    76     public: // Implementation of CAknsEffectPlugin
       
    77 
       
    78         TUid EffectUid() const;
       
    79         MAknsRlEffect* Effect( const TInt aInterface );
       
    80 
       
    81     public: // Implementation of MAknsRlEffect
       
    82 
       
    83         void InitializeL();
       
    84         void Release();
       
    85 
       
    86         void ActivateL( MAknsRlEffectContext* aContext );
       
    87         void Deactivate();
       
    88 
       
    89         /**
       
    90         * Accepted named parameters:
       
    91         * - "t", integer, solarize treshold
       
    92         * - "c", integer, selected channels
       
    93         * - "f", integer, normal range [0, 255], blend factor.
       
    94         *
       
    95         * Solarize treshold:
       
    96         * Channel values above threshold will be inverted, otherwise the
       
    97         * original value is used. Normal range for treshold is [0, 255] but
       
    98         * values outside range work as expected.
       
    99         *
       
   100         * Selected channels:
       
   101         * A bitmask that defines the solarized channels. The channel bits are:
       
   102         * - 001 red
       
   103         * - 010 green
       
   104         * - 100 blue
       
   105         * All combinations are supported. The bitmask can be constructed by
       
   106         * orring the TBitmask enumerations. Any extra bit on parameter is
       
   107         * ignored. All channel bits are ignored on Gray256 -> Gray256
       
   108         * operations
       
   109         *
       
   110         * Blend factor:
       
   111         * Blend factor controls the resulting opacity of the applied effect.
       
   112         * Normal value range is [0, 255] but values outside will also work.
       
   113         * - Value 0 will result in the original image.
       
   114         * - Value 255 will result in the filtered image.
       
   115         * - Values outside range [0, 255] will result in underexposure or
       
   116         *   overexposure.
       
   117         *
       
   118         * The default parameter values are:
       
   119         * - "t" = 127
       
   120         * - "c" = 7 (111, all channels are solarized)
       
   121         * - "f" = 255, full filter opacity
       
   122         */
       
   123         void SetParametersL( MAknsRlParameterIterator& aParameters );
       
   124 
       
   125         /**
       
   126         * Supported modes:
       
   127         * - EColor64K -> EColor64K
       
   128         * - EColor16MU -> EColor16MU
       
   129         * - EGray256 -> EGray256
       
   130         *
       
   131         * Masks are ignored. Target layer and input layer A are both required.
       
   132         */
       
   133         void GetCapabilities( TAknsRlEffectCaps& aCaps );
       
   134 
       
   135         TInt Render( const TAknsRlRenderOpParam& aParam );
       
   136 
       
   137     private:
       
   138 
       
   139         MAknsRlEffectContext* iContext;
       
   140 
       
   141         TInt iTreshold;
       
   142         TInt iBlendFactor;
       
   143 
       
   144         /**
       
   145         * Defines which channels are solarized. Values EMaskR, EMaskG
       
   146         * and EMaskB orred.
       
   147         */
       
   148         TUint8 iChannelMask;
       
   149     };
       
   150 
       
   151 #endif // AKNSRLEFFECTPLUGINSOLARIZE_H
       
   152 
       
   153 // End of File