|
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: 1 bit format, 2 distinct color values, stored as a byte. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef TMIDGRAY1VERTICAL_H |
|
20 #define TMIDGRAY1VERTICAL_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "TMIDFormatConverter.h" |
|
24 |
|
25 // CONSTANTS |
|
26 const TInt KPixelsInByteGray1Vertical = 8; |
|
27 const TInt KGray1VerticalShift = 3; |
|
28 const TInt KGray1VerticalAnd = 7; |
|
29 |
|
30 |
|
31 // CLASS DEFINITION |
|
32 /** |
|
33 * 1 bit format, 2 distinct color values (on/off), stored as |
|
34 * a byte. 8 pixel values in a single byte. |
|
35 * The pixel data is presented in bytes in which each |
|
36 * byte defines 8 vertically packed pixels. The byte packed |
|
37 * pixels are arranged in columns from left to right. |
|
38 * |
|
39 */ |
|
40 |
|
41 NONSHARABLE_CLASS(TMIDGray1Vertical): public TMIDFormatConverter |
|
42 { |
|
43 public: // initialization |
|
44 void InitializeL(const TMIDBitmapParameters& aParameters); |
|
45 |
|
46 public: // from TMIDFormatConverter |
|
47 // Convert from internal to int |
|
48 TUint32 ConvertInternal(const TMIDInternalARGB& aInternal); |
|
49 |
|
50 // Convert from int to internal |
|
51 void Convert(TMIDInternalARGB& aResult, TUint32 aColor) const; |
|
52 |
|
53 // Get pixel from current position |
|
54 void GetPixel(TMIDInternalARGB& aResult) const; |
|
55 |
|
56 // Get alpha which is in same format as bitmap |
|
57 TUint8 GetAlpha() const; |
|
58 |
|
59 // Plot pixel to current position |
|
60 void PlotPixel(const TMIDInternalARGB& aInternal); |
|
61 |
|
62 // Plot pixel with alpha |
|
63 void PlotPixelWithAlpha(const TMIDInternalARGB& aInternal); |
|
64 |
|
65 // Set bitmap and alpha bitmap |
|
66 void SetBitmap(TUint32* aBitmap) |
|
67 { |
|
68 iBitmap = (TUint8*)aBitmap; |
|
69 } |
|
70 |
|
71 // Get bitmap |
|
72 TUint32* Bitmap() |
|
73 { |
|
74 return (TUint32*)iBitmap; |
|
75 } |
|
76 |
|
77 protected: // from TMIDFormatConverter |
|
78 // checks how many pixels is occupied and is last pixel in that limit |
|
79 TBool CheckSize(TInt aPixelSize, TInt aLastDrawnPixelOffset); |
|
80 |
|
81 private: // data |
|
82 TUint8* iBitmap; |
|
83 }; |
|
84 |
|
85 #endif // TMIDGRAY1VERTICAL_H |