javauis/lcdui_akn/javalcdui/inc.nokialcdui/TMID4444Format.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 alpha, red, green and blue component in a pixel.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TMID4444FORMAT_H
       
    20 #define TMID4444FORMAT_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "TMIDFormatConverter.h"
       
    24 
       
    25 //  CONSTANTS
       
    26 const TUint16 K4444AMax = 0xF000;
       
    27 const TUint16 K4444RMax = 0x0F00;
       
    28 const TUint16 K4444GMax = 0x00F0;
       
    29 const TUint16 K4444BMax = 0x000F;
       
    30 const TInt KBytesPerPixel4444 = 2;
       
    31 
       
    32 
       
    33 //  CLASS DEFINITION
       
    34 /**
       
    35  * 4 bits for alpha, red, green and blue component in a pixel, stored as a
       
    36  * short (0xARGB).
       
    37  *
       
    38  */
       
    39 
       
    40 NONSHARABLE_CLASS(TMID4444Format):  public TMIDFormatConverter
       
    41 {
       
    42 public: //  initialization
       
    43     void InitializeL(const TMIDBitmapParameters& aParameters);
       
    44 
       
    45 public: // from TMIDFormatConverter
       
    46     // Convert from internal to int
       
    47     TUint32 ConvertInternal(const TMIDInternalARGB& aInternal);
       
    48 
       
    49     // Convert from int to internal
       
    50     void Convert(TMIDInternalARGB& aResult, TUint32 aColor) const;
       
    51 
       
    52     // Get pixel from current position
       
    53     void GetPixel(TMIDInternalARGB& aResult) const;
       
    54 
       
    55     // Get alpha which is in same format as bitmap
       
    56     TUint8 GetAlpha() const;
       
    57 
       
    58     // Plot pixel to current position
       
    59     void PlotPixel(const TMIDInternalARGB& aInternal);
       
    60 
       
    61     // Checks is alpha calculation needed
       
    62     TBool IsAlpha()
       
    63     {
       
    64         return ETrue; /* always alpha */
       
    65     }
       
    66 
       
    67     // Set bitmap
       
    68     void SetBitmap(TUint32* aBitmap)
       
    69     {
       
    70         iBitmap = (TUint16*)aBitmap;
       
    71     }
       
    72 
       
    73     // Get bitmap
       
    74     TUint32* Bitmap()
       
    75     {
       
    76         return (TUint32*)iBitmap;
       
    77     }
       
    78 protected: // from TMIDFormatConverter
       
    79     // checks how many pixels is occupied and is last pixel in that limit
       
    80     TBool CheckSize(TInt aPixelSize, TInt aLastDrawnPixelOffset);
       
    81 
       
    82 private: // data
       
    83     TUint16* iBitmap;
       
    84 };
       
    85 
       
    86 #endif // TMID4444FORMAT_H