javauis/lcdui_akn/javalcdui/inc.nokialcdui/TMIDGray1.h
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     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 TMIDGRAY1_H
       
    20 #define TMIDGRAY1_H
       
    21 
       
    22 
       
    23 //  INCLUDES
       
    24 #include "TMIDFormatConverter.h"
       
    25 
       
    26 //  CONSTANTS
       
    27 const TInt KPixelsInByteGray1 = 8;
       
    28 const TInt KGray1Shift = 3;
       
    29 
       
    30 //  CLASS DEFINITION
       
    31 /**
       
    32  * 1 bit format, 2 distinct color values (on/off), stored as
       
    33  * a byte. 8 pixel values in a single byte, packed as close
       
    34  * as possible.
       
    35  */
       
    36 
       
    37 NONSHARABLE_CLASS(TMIDGray1): public TMIDFormatConverter
       
    38 {
       
    39 public: //  initialization
       
    40     void InitializeL(const TMIDBitmapParameters& aParameters);
       
    41 
       
    42 public: // from TMIDFormatConverter
       
    43     // Convert from internal to int
       
    44     TUint32 ConvertInternal(const TMIDInternalARGB& aInternal);
       
    45 
       
    46     // Convert from int to internal
       
    47     void Convert(TMIDInternalARGB& aResult, TUint32 aColor) const;
       
    48 
       
    49     // Get pixel from current position
       
    50     void GetPixel(TMIDInternalARGB& aResult) const;
       
    51 
       
    52     // Get alpha which is in same format as bitmap
       
    53     TUint8 GetAlpha() const;
       
    54 
       
    55     // Plot pixel to current position
       
    56     void PlotPixel(const TMIDInternalARGB& aInternal);
       
    57 
       
    58     // Plot pixel with alpha
       
    59     void PlotPixelWithAlpha(const TMIDInternalARGB& aInternal);
       
    60 
       
    61     // Set bitmap
       
    62     void SetBitmap(TUint32* aBitmap)
       
    63     {
       
    64         iBitmap = (TUint8*)aBitmap;
       
    65     }
       
    66 
       
    67     // Get bitmap
       
    68     TUint32* Bitmap()
       
    69     {
       
    70         return (TUint32*)iBitmap;
       
    71     }
       
    72 
       
    73 protected: // from TMIDFormatConverter
       
    74     // checks how many pixels is occupied and is last pixel in that limit
       
    75     TBool CheckSize(TInt aPixelSize, TInt aLastDrawnPixelOffset);
       
    76 
       
    77 private:
       
    78 
       
    79     TUint8* iBitmap;
       
    80 };
       
    81 
       
    82 #endif // TMIDGRAY1_H