javauis/lcdui_akn/javalcdui/inc.nokialcdui/TMID444Format.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14: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:  4 bits for red, green and blue component in a pixel.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TMID444FORMAT_H
       
    20 #define TMID444FORMAT_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "TMIDFormatConverter.h"
       
    24 
       
    25 //  CONSTANTS
       
    26 const TUint16 K444RMax = 0xF00;
       
    27 const TUint16 K444GMax = 0x0F0;
       
    28 const TUint16 K444BMax = 0x00F;
       
    29 const TInt KBytesInPixel444 = 2;
       
    30 
       
    31 
       
    32 //  CLASS DEFINITION
       
    33 /**
       
    34  * 4 bits for red, green and blue component in a pixel, stored as a
       
    35  * short (0x0RGB).
       
    36  *
       
    37  */
       
    38 
       
    39 NONSHARABLE_CLASS(TMID444Format): public TMIDFormatConverter
       
    40 {
       
    41 public: //  initialization
       
    42     void InitializeL(const TMIDBitmapParameters& aParameters);
       
    43 
       
    44 public: // from TMIDFormatConverter
       
    45     // Convert from internal to int
       
    46     TUint32 ConvertInternal(const TMIDInternalARGB& aInternal);
       
    47 
       
    48     // Convert from int to internal
       
    49     void Convert(TMIDInternalARGB& aResult, TUint32 aColor) const;
       
    50 
       
    51     // Get pixel from current position
       
    52     void GetPixel(TMIDInternalARGB& aResult) const;
       
    53 
       
    54     // Get alpha which is in same format as bitmap
       
    55     TUint8 GetAlpha() const;
       
    56 
       
    57     // Plot pixel to current position
       
    58     void PlotPixel(const TMIDInternalARGB& aInternal);
       
    59 
       
    60     // Set bitmap and alpha bitmap
       
    61     void SetBitmap(TUint32* aBitmap)
       
    62     {
       
    63         iBitmap = (TUint16*)aBitmap;
       
    64     }
       
    65 
       
    66     // Get bitmap
       
    67     TUint32* Bitmap()
       
    68     {
       
    69         return (TUint32*)iBitmap;
       
    70     }
       
    71 protected: // from TMIDFormatConverter
       
    72     // checks how many pixels is occupied and is last pixel in that limit
       
    73     TBool CheckSize(TInt aPixelSize, TInt aLastDrawnPixelOffset);
       
    74 
       
    75 private: // data
       
    76     TUint16* iBitmap;
       
    77     TUint8* iAlphaBitmap;
       
    78 };
       
    79 
       
    80 #endif // TMID444FORMAT_H