class CAlfCompositionPixelSource : public CAlfCompositionSource |
Example1: // to draw frames with CAlfCompositionPixelSource API class CMyClass: public CBase, public MAlfBufferProvider { private: CAlfCompositionPixelSource* iAlfCompositionPixelSource; MAlfBufferProvider::TBufferCreationAttributes iAttributes; public:
CMyClass() {}
ConstructL() { // ... iAttributes.iWidth = width; iAttributes.iHeight = height; iAttributes.iFormat = MAlfBufferProvider::ESourceFormatARGB_8888; iAttributes.iStride = iAttributes.iWidth * 4; iAttributes.iAlignment = 32;
iAlfCompositionPixelSource = CAlfCompositionPixelSource::NewL(*this, iMyDrawableWindow); iAlfCompositionPixelSource->iActivateL() }
TBool ProduceNewFrameL(const TRegion& aVisibleRegion, TUint8*& aBuffer) { // ... // copy pixel data to aBuffer TUint8* from = (TUint8*)bitmap->DataAddress(); TUint bytes = bitmap->SizeInPixels()*4; for (TInt y = bitmap->SizeInPixels().iHeight; y > 0; y--) { Mem::Copy(aBuffer, from, bytes); aBuffer += iAttributes.iStride; from += bitmap->DataStride(); } // ... return ETrue; // to continue getting ProduceNewFrameL callbacks };
MAlfBufferProvider::TBufferCreationAttributes& BufferAttributes() { return iAttributes };
void ContextAboutToSuspend() {}; void OnActivation() {}; // ... }
Example2: // client may want or need to adjust ProduceNewFrameL-callbacks inverval class CMyClass: public CActive, public MAlfBufferProvider { private: CAlfCompositionPixelSource* iAlfCompositionPixelSource; MAlfBufferProvider::TBufferCreationAttributes iAttributes; TBool iDrawNext; TTimeIntervalMicroSeconds32 iWaitTime; RTimer iTimer; public:
CMyClass() {}
ConstructL() { // ... iDrawNext = ETrue; iWaitTime = 25*1000; // ... }
void RunL() { if( iStatus.Int() != KErrNone ) { iDrawNext = ETrue; iAlfCompositionPixelSource->ActivateL(); } } // ... TBool ProduceNewFrameL(const TRegion& aVisibleRegion, TUint8*& aBuffer) { if( iDrawNext ) { iDrawNext = EFalse; } else { iTimer.After( iStatus, iWaitTime ); return EFalse; } // ... // copy pixel data to aBuffer // ... return ETrue; // to continue getting ProduceNewFrameL callbacks }; // ... }
Example3: // API can be used withou the actual window class CMyClass: public CBase, public MAlfBufferProvider { private: CAlfCompositionPixelSource* iAlfCompositionPixelSource; MAlfBufferProvider::TBufferCreationAttributes iAttributes; public:
CMyClass() {}
ConstructL() { // ... iAttributes.iWidth = width; iAttributes.iHeight = height; iAttributes.iFormat = MAlfBufferProvider::ESourceFormatARGB_8888; iAttributes.iStride = iAttributes.iWidth * 4; iAttributes.iAlignment = 32;
iAlfCompositionPixelSource = CAlfCompositionPixelSource::NewL(*this, NULL); iAlfCompositionPixelSource->SetExtent(TRect(0,0,600,300),0,1); iAlfCompositionPixelSource->iActivateL(); } // ... TBool ProduceNewFrameL(const TRegion& aVisibleRegion, TUint8*& aBuffer) { // ... // copy pixel data to aBuffer // ... return ETrue; // to continue getting ProduceNewFrameL callbacks }; // ...
// Notice: When activating Composition pixel source after being suspended, SetExtent needs to be called again. void ContinueAfterSuspendL() { iAlfCompositionPixelSource->SetExtent(TRect(0,0,600,300),0,1); iAlfCompositionPixelSource->iActivateL(); } }
Public Member Functions | |
---|---|
~CAlfCompositionPixelSource() | |
IMPORT_C void | ActivateL() |
IMPORT_C void | ActivateSyncL() |
TBool | DrawFrameL(TRequestStatus &, TInt) |
IMPORT_C CAlfCompositionPixelSource * | NewL(MAlfBufferProvider &, RWindow *) |
IMPORT_C CAlfCompositionPixelSource * | NewL(MAlfBufferProvider &, TInt, RWindow *) |
IMPORT_C TInt | SetExtent(const TRect &, TInt) |
IMPORT_C void | Suspend() |
Protected Member Functions | |
---|---|
void | HandleEventL(TInt, TAny *) |
Private Member Functions | |
---|---|
TUint8 * | Buffer(TInt) |
void | ConstructL(MAlfBufferProvider &, TInt, RWindow *) |
void | ConstructSurfaceL(MAlfBufferProvider::TBufferCreationAttributes &) |
void | FreeSurface() |
Inherited Enumerations | |
---|---|
CActive:TPriority | |
CAlfCompositionClientBase:TAlfCompositionPermission |
Private Attributes | |
---|---|
CAlfCompositionPixelSourceData * | iData |
Inherited Attributes | |
---|---|
CActive::iStatus |
IMPORT_C void | ActivateL | ( | ) |
Activate drawing for the first time or continue drawing if it is being paused or suspended
void | ConstructL | ( | MAlfBufferProvider & | aProvider, |
TInt | aPriority, | |||
RWindow * | aWindow | |||
) | [private] |
MAlfBufferProvider & aProvider | |
TInt aPriority | |
RWindow * aWindow |
void | ConstructSurfaceL | ( | MAlfBufferProvider::TBufferCreationAttributes & | aCreationAttributes | ) | [private] |
MAlfBufferProvider::TBufferCreationAttributes & aCreationAttributes |
TBool | DrawFrameL | ( | TRequestStatus & | aStatus, |
TInt | aBufferNumber = 0 | |||
) |
Internal For drawing one frame
TRequestStatus & aStatus | |
TInt aBufferNumber = 0 |
void | HandleEventL | ( | TInt | aEventType, |
TAny * | aEventData | |||
) | [protected, virtual] |
Internal From base class
IMPORT_C CAlfCompositionPixelSource * | NewL | ( | MAlfBufferProvider & | aProvider, |
RWindow * | aWindow = NULL | |||
) | [static] |
Constructor
MAlfBufferProvider & aProvider | |
RWindow * aWindow = NULL |
IMPORT_C CAlfCompositionPixelSource * | NewL | ( | MAlfBufferProvider & | aProvider, |
TInt | aPriority = CActive::EPriorityIdle, | |||
RWindow * | aWindow = NULL | |||
) | [static] |
Constructor for application to decide AO priority
MAlfBufferProvider & aProvider | |
TInt aPriority = CActive::EPriorityIdle | |
RWindow * aWindow = NULL |
IMPORT_C TInt | SetExtent | ( | const TRect & | aRect, |
TInt | aScreen | |||
) |
From base class Defines extent of the composition target on a defined screen Does not affect on hit testing, keyboard focus etc. but is just additional information for composition
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.