javauis/lcdui_akn/javalcdui/inc.nokialcdui/TMID565Format.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:  5 bits for red, 6 for green and 5 for blue component in a pixel.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TMID565FORMAT_H
       
    20 #define TMID565FORMAT_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "TMIDFormatConverter.h"
       
    24 
       
    25 
       
    26 //  CONSTANTS
       
    27 const TUint32 K565RMax = 0x0000F800;
       
    28 const TUint32 K565GMax = 0x000007E0;
       
    29 const TUint32 K565BMax = 0x0000001F;
       
    30 const TInt KBytesPerPixel565 = 2;
       
    31 
       
    32 
       
    33 //  CLASS DEFINITION
       
    34 /**
       
    35  * 5 bits for red, 6 for green and 5 for blue component in a pixel, stored
       
    36  * as a short (0xRRRRRGGGGGGBBBBBB).
       
    37  *
       
    38  */
       
    39 
       
    40 NONSHARABLE_CLASS(TMID565Format):  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     // Set bitmap
       
    62     void SetBitmap(TUint32* aBitmap)
       
    63     {
       
    64         iBitmap = (TUint16*)aBitmap;
       
    65     }
       
    66 
       
    67     // Get bitmap
       
    68     TUint32* Bitmap()
       
    69     {
       
    70         return (TUint32*)iBitmap;
       
    71     }
       
    72 protected: // from TMIDFormatConverter
       
    73     // checks how many pixels is occupied and is last pixel in that limit
       
    74     TBool CheckSize(TInt aPixelSize, TInt aLastDrawnPixelOffset);
       
    75 
       
    76 private: // data
       
    77     TUint16* iBitmap;
       
    78 };
       
    79 
       
    80 #endif // TMID565FORMAT_H