First public contribution.
1 // Copyright (c) 2007-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
26 #include <pixelformats.h>
29 Provides conversion between TDisplayMode/TUidPixelFormat and other pixel format related functionality.
31 NONSHARABLE_STRUCT(PixelFormatUtil)
33 static TUidPixelFormat ConvertToPixelFormat(TDisplayMode aDisplayMode);
34 static TBool HasAlpha(TUidPixelFormat aPixelFormat);
35 static TInt BitsPerPixel(TUidPixelFormat aPixelFormat);
36 static TDisplayMode ConvertToDisplayMode(TUidPixelFormat aPixelFormat);
40 Provides access to the contents of a pixel buffer. Functionality includes copying pixels into
41 user buffer and perform format conversion or scaling up/down. Copying can be performed
42 horizontally from left to right or right to left, and vertically from top to bottom or bottom
45 Supported buffer pixel format:
46 -EUidPixelFormatRGB_565
47 -EUidPixelFormatXRGB_8888
48 -EUidPixelFormatARGB_8888
49 -EUidPixelFormatARGB_8888_PRE
51 Supported read pixel format:
52 -EUidPixelFormatRGB_565
53 -EUidPixelFormatXRGB_8888
54 -EUidPixelFormatARGB_8888
55 -EUidPixelFormatARGB_8888_PRE
57 NONSHARABLE_CLASS(TPixelBufferReader)
63 EReadHorizontalReverse,
68 TPixelBufferReader(const TUint32* aPixelBuffer, const TSize& aSize, TInt aStride,TUidPixelFormat aFormat);
70 void GetScanLine(TDes8& aReadBuf, const TPoint& aReadPos, TInt aReadLen,
71 TUidPixelFormat aReadFormat, TReadDirection aReadDir) const;
72 void GetScaledScanLine(TDes8& aReadBuf, const TPoint& aReadPos, TInt aClipDestPos,
73 TInt aClipDestLen, TInt aDestLen, TInt aSrcLen, TUidPixelFormat aReadFormat,
74 TReadDirection aReadDir) const;
76 const TUint32* GetPixelAddr(const TPoint& aPos) const;
79 TPixelBufferReader(); //declare but not defined
80 const TUint32* GetScanLineAddr(TInt aRow) const;
82 void GetScanLineRGB_565(TDes8& aReadBuf, const TPoint& aReadPos, TInt aReadLen, TReadDirection aReadDir) const;
83 void GetScanLineXRGB_8888(TDes8& aReadBuf, const TPoint& aReadPos, TInt aReadLen, TReadDirection aReadDir) const;
84 void GetScanLineARGB_8888(TDes8& aReadBuf, const TPoint& aReadPos, TInt aReadLen, TReadDirection aReadDir) const;
85 void GetScanLineARGB_8888_PRE(TDes8& aReadBuf, const TPoint& aReadPos, TInt aReadLen, TReadDirection aReadDir) const;
87 void CopyFromRGB_565(TUint32* aDestPtr, const TUint16* aSrcPtr, TInt aLen, TInt aAdvance) const;
88 TInt GetAdvance(TReadDirection aReadDir) const;
90 void GetScaledScanLineH(TDes8& aReadBuf, const TPoint& aReadPos, TInt aClipDestPos,
91 TInt aClipDestLen, TInt aDestLen, TInt aSrcLen, TUidPixelFormat aReadFormat,
92 TReadDirection aReadDir) const;
93 void GetScaledScanLineV(TDes8& aReadBuf, const TPoint& aReadPos, TInt aClipDestPos,
94 TInt aClipDestLen, TInt aDestLen, TInt aSrcLen, TUidPixelFormat aReadFormat,
95 TReadDirection aReadDir) const;
98 const TUint32* iBuffer;
101 TUidPixelFormat iFormat;
104 #endif /*PIXELUTIL_H*/