mmplugins/imagingplugins/codecs/ICOCodec/icomaskprocessor.h
branchRCL_3
changeset 50 948c7f65f6d4
parent 0 40261b775718
equal deleted inserted replaced
49:735348f59235 50:948c7f65f6d4
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef ICOMASKPROCESSOR_H
       
    17 #define ICOMASKPROCESSOR_H
       
    18 
       
    19 #include <icl/imageprocessor.h>
       
    20 
       
    21 /**
       
    22 Image Processor specific to the ICO decoder when decoding to a 16MA destination bitmap.
       
    23 This class applies the alpha channel
       
    24 */
       
    25 class CIcoMaskProcessor : public CImageProcessor
       
    26 	{
       
    27 public:
       
    28 	static CIcoMaskProcessor* NewL(TInt aReductionFactor);
       
    29 	~CIcoMaskProcessor();
       
    30 	
       
    31 	// From CImageProcessor
       
    32 	void PrepareL(CFbsBitmap& aBitmap,const TRect& aImageRect);
       
    33 	void PrepareL(CFbsBitmap& aBitmap,const TRect& aImageRect,const TSize& aRgbBlockSize);
       
    34 	void SetYPosIncrement(TInt aYInc);
       
    35 	void SetLineRepeat(TInt aLineRepeat);
       
    36 	void SetPixelPadding(TInt aNumberOfPixels);
       
    37 	TBool SetPixel(TRgb aColor);
       
    38 	TBool SetPixelRun(TRgb aColor,TInt aCount);
       
    39 	TBool SetPixels(TRgb* aColorBuffer,TInt aBufferLength);
       
    40 	TBool SetPixelBlock(TRgb* aColorBuffer);
       
    41 	TBool SetMonoPixel(TInt aGray256);
       
    42 	TBool SetMonoPixelRun(TInt aGray256,TInt aCount);
       
    43 	TBool SetMonoPixels(TUint32* aGray256Buffer,TInt aBufferLength);
       
    44 	TBool SetMonoPixelBlock(TUint32* aGray256Buffer);
       
    45 	TBool SetPos(const TPoint& aPosition);
       
    46 	TBool FlushPixels();
       
    47 
       
    48 private:
       
    49 	CIcoMaskProcessor(TInt aReductionFactor);
       
    50 	void Reset();
       
    51 	void ProcessScaledPixels();
       
    52 	TBool DoFlushPixels();
       
    53 
       
    54 private:
       
    55 	class TMonochromeSum
       
    56 		{
       
    57 	public:
       
    58 		TInt iLevel;
       
    59 		TInt iCount;
       
    60 		};
       
    61 
       
    62 private:
       
    63 	TInt iReductionFactor;
       
    64 	CFbsBitmap* iDestBitmap; // not owned
       
    65 	TRect iImageRegion;
       
    66 	TPoint iPosition;
       
    67 	TPoint iScaledPosition;
       
    68 	TInt iYIncrement;
       
    69 	TInt iPixelPadding;
       
    70 	TInt iPixelsToSkip;
       
    71 	
       
    72 	TRgb* iMaskBuffer;
       
    73 	TRgb* iMaskBufferPtr;
       
    74 	TRgb* iMaskBufferPtrLimit;
       
    75 	
       
    76 	// For scaling
       
    77 	TMonochromeSum* iScaledMaskBuffer;
       
    78 	TMonochromeSum* iScaledMaskBufferPtrLimit;
       
    79 	};
       
    80 
       
    81 #endif // ICOMASKPROCESSOR_H
       
    82