|
1 /* |
|
2 * Copyright (c) 2006 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: 8 bits for alpha, red, green and blue component in a pixel. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef TMID8888FORMAT_H |
|
20 #define TMID8888FORMAT_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "TMIDFormatConverter.h" |
|
24 |
|
25 // CONSTANTS |
|
26 const TUint32 K8888AMax = 0xFF000000; |
|
27 const TUint32 K8888RMax = 0x00FF0000; |
|
28 const TUint32 K8888GMax = 0x0000FF00; |
|
29 const TUint32 K8888BMax = 0x000000FF; |
|
30 const TInt KBytesPerPixel8888 = 4; |
|
31 |
|
32 |
|
33 // CLASS DEFINITION |
|
34 /** |
|
35 * 8 bits for alpha, red, green and blue component in a pixel (0xAARRGGBB). |
|
36 * |
|
37 * note that this class does not use external alpha bitmap, use |
|
38 * TMID888AFormat for that. |
|
39 * |
|
40 */ |
|
41 |
|
42 NONSHARABLE_CLASS(TMID8888Format): public TMIDFormatConverter |
|
43 { |
|
44 public: // initialization |
|
45 void InitializeL(const TMIDBitmapParameters& aParameters); |
|
46 |
|
47 public: // from TMIDFormatConverter |
|
48 // Convert from internal to int |
|
49 TUint32 ConvertInternal(const TMIDInternalARGB& aInternal); |
|
50 |
|
51 // Convert from int to internal |
|
52 void Convert(TMIDInternalARGB& aResult, TUint32 aColor) const; |
|
53 |
|
54 // Get pixel from current position |
|
55 void GetPixel(TMIDInternalARGB& aResult) const; |
|
56 |
|
57 // Get alpha which is in same format as bitmap |
|
58 TUint8 GetAlpha() const; |
|
59 |
|
60 // Get pixel with alpha values |
|
61 void GetPixelWithAlpha(TMIDInternalARGB& aResult) const; |
|
62 |
|
63 // Plot pixel to current position |
|
64 void PlotPixel(const TMIDInternalARGB& aInternal); |
|
65 |
|
66 // Checks is alpha calculation needed |
|
67 TBool IsAlpha() |
|
68 { |
|
69 return ETrue; /* always alpha */ |
|
70 } |
|
71 |
|
72 // Set bitmap |
|
73 void SetBitmap(TUint32* aBitmap) |
|
74 { |
|
75 iBitmap = aBitmap; |
|
76 } |
|
77 |
|
78 // Get bitmap |
|
79 TUint32* Bitmap() |
|
80 { |
|
81 return iBitmap; |
|
82 } |
|
83 |
|
84 protected: // from TMIDFormatConverter |
|
85 // checks how many pixels is occupied and is last pixel in that limit |
|
86 TBool CheckSize(TInt aPixelSize, TInt aLastDrawnPixelOffset); |
|
87 |
|
88 private: // data |
|
89 TUint32* iBitmap; |
|
90 }; |
|
91 |
|
92 #endif // TMID8888FORMAT_H |