|
1 /* |
|
2 * Copyright (c) 2005 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef AKNSRLEFFECTUTIL_INL |
|
20 #define AKNSRLEFFECTUTIL_INL |
|
21 |
|
22 // This file should not be directly included, it is included by default in |
|
23 // AknsRlEffectUtil.h |
|
24 |
|
25 //---------------------------------------------------------------------------- |
|
26 // Inline implementation for AknsRlRgb<TUint32, 8,8,8,8> methods |
|
27 inline TUint8 AknsRlRgb<TUint32, 8,8,8,8>::R8( const TUint32 aVal ) |
|
28 { |
|
29 return TUint8((aVal >> 16) & 0xFF); |
|
30 } |
|
31 |
|
32 inline TUint8 AknsRlRgb<TUint32, 8,8,8,8>::G8( const TUint32 aVal ) |
|
33 { |
|
34 return TUint8((aVal >> 8 ) & 0xFF); |
|
35 } |
|
36 |
|
37 inline TUint8 AknsRlRgb<TUint32, 8,8,8,8>::B8( const TUint32 aVal ) |
|
38 { |
|
39 return TUint8((aVal) & 0xFF); |
|
40 } |
|
41 |
|
42 inline void AknsRlRgb<TUint32, 8,8,8,8>::SetRgb8( |
|
43 TUint32* aIn, const TUint8 aR, const TUint8 aG, const TUint8 aB ) |
|
44 { |
|
45 *aIn = (KAknsRlMaskA8888 | (aR << 16) | (aG << 8) | aB); |
|
46 } |
|
47 |
|
48 inline void AknsRlRgb<TUint32, 8,8,8,8>::SetRgb8LessG( |
|
49 TUint32* aIn, const TUint aR, const TUint aG, const TUint aB ) |
|
50 { |
|
51 *aIn = (KAknsRlMaskA8888 | (aR << 16) | (aG << 8) | aB); |
|
52 } |
|
53 |
|
54 //---------------------------------------------------------------------------- |
|
55 // Inline implementation for AknsRlRgb<TUint16, 0,5,6,5> methods |
|
56 inline TUint8 AknsRlRgb<TUint16, 0,5,6,5>::R8( const TUint16 aVal ) |
|
57 { |
|
58 return TUint8(((aVal >> 11) & 0x1F) << 3); |
|
59 } |
|
60 |
|
61 inline TUint8 AknsRlRgb<TUint16, 0,5,6,5>::G8( const TUint16 aVal ) |
|
62 { |
|
63 return TUint8(((aVal >> 5) & 0x3F) << 2); |
|
64 } |
|
65 |
|
66 inline TUint8 AknsRlRgb<TUint16, 0,5,6,5>::B8( const TUint16 aVal ) |
|
67 { |
|
68 return TUint8(((aVal ) & 0x1F) << 3); |
|
69 } |
|
70 |
|
71 inline void AknsRlRgb<TUint16, 0,5,6,5>::SetRgb8( |
|
72 TUint16* aIn, const TUint8 aR, const TUint8 aG, const TUint8 aB ) |
|
73 { |
|
74 *aIn = TUint16((((aR >> 3) & 0x1F) << 11) | |
|
75 (((aG >> 2) & 0x3F) << 5) | |
|
76 (((aB >> 3) & 0x1F) ) ); |
|
77 |
|
78 } |
|
79 |
|
80 inline void AknsRlRgb<TUint16, 0,5,6,5>::SetRgb8LessG( |
|
81 TUint16* aIn, const TUint aR, const TUint aG, const TUint aB ) |
|
82 { |
|
83 // this version does the rounding so green won't dominate in recursive algorithms |
|
84 *aIn = TUint16(((((aR+4) >> 3) & 0x1F) << 11) | |
|
85 ((((aG+1) >> 2) & 0x3F) << 5) | |
|
86 ((((aB+4) >> 3) & 0x1F) ) ); |
|
87 } |
|
88 |
|
89 //---------------------------------------------------------------------------- |
|
90 // AknsRlUtil inline implementations |
|
91 inline TUint8 AknsRlUtil::Grayscale( const TUint8 aR, |
|
92 const TUint8 aG, |
|
93 const TUint8 aB ) |
|
94 { |
|
95 return TUint8( ( 77 * aR + 150 * aG + 28 * aB ) >> 8); |
|
96 } |
|
97 |
|
98 inline TInt AknsRlUtil::Max( TInt aA, TInt aB ) |
|
99 { |
|
100 if( aA > aB ) |
|
101 return aA; |
|
102 return aB; |
|
103 } |
|
104 |
|
105 inline TInt AknsRlUtil::Min( TInt aA, TInt aB) |
|
106 { |
|
107 if( aA < aB ) |
|
108 return aA; |
|
109 return aB; |
|
110 } |
|
111 |
|
112 #endif // AKNSRLEFFECTUTIL_INL |