CAlfCompositionPixelSource Class Reference

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 Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CAlfCompositionClientBase::CAlfCompositionClientBase(TInt)
CAlfCompositionClientBase::Handle()const
CAlfCompositionClientBase::RequestEventL(TInt,RAlfBridgerClient *)
CAlfCompositionClientBase::RunError(TInt)
CAlfCompositionClientBase::SendEvent(TInt,const TAny *,TInt)
CAlfCompositionClientBase::SetHandleL(TInt)
CAlfCompositionClientBase::~CAlfCompositionClientBase()
CAlfCompositionSource::AddCompositionObserverL(MAlfCompositionObserver &,TInt)
CAlfCompositionSource::ConstructL(RWindow &)
CAlfCompositionSource::ConstructL(TInt,TInt,TInt)
CAlfCompositionSource::CreatePermissionToken(TInt,TInt)
CAlfCompositionSource::EnableAlpha(TBool)
CAlfCompositionSource::EnableKeyboard(TBool,TInt)
CAlfCompositionSource::Handle()
CAlfCompositionSource::NewL(RWindow &)
CAlfCompositionSource::RemoveObserver(MAlfCompositionObserver &)
CAlfCompositionSource::SetIsBackgroundAnim(TBool)
CAlfCompositionSource::SetOpacity(TReal32)
CAlfCompositionSource::SetRotation(TInt)
CAlfCompositionSource::SetSourceRect(const TRect &)
CAlfCompositionSource::SetZOrder(const CAlfCompositionClientBase &,TBool,TInt)
CAlfCompositionSource::~CAlfCompositionSource()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Inherited Enumerations
CActive:TPriority
CAlfCompositionClientBase:TAlfCompositionPermission
Private Attributes
CAlfCompositionPixelSourceData * iData
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

~CAlfCompositionPixelSource()

IMPORT_C ~CAlfCompositionPixelSource ( )

Member Functions Documentation

ActivateL()

IMPORT_C void ActivateL ( )

Activate drawing for the first time or continue drawing if it is being paused or suspended

ActivateSyncL()

IMPORT_C void ActivateSyncL ( )

Buffer(TInt)

TUint8 * Buffer ( TInt aBufferNumber ) [private]

Parameters

TInt aBufferNumber

ConstructL(MAlfBufferProvider &, TInt, RWindow *)

void ConstructL ( MAlfBufferProvider & aProvider,
TInt aPriority,
RWindow * aWindow
) [private]

Parameters

MAlfBufferProvider & aProvider
TInt aPriority
RWindow * aWindow

ConstructSurfaceL(MAlfBufferProvider::TBufferCreationAttributes &)

void ConstructSurfaceL ( MAlfBufferProvider::TBufferCreationAttributes & aCreationAttributes ) [private]

Parameters

MAlfBufferProvider::TBufferCreationAttributes & aCreationAttributes

DrawFrameL(TRequestStatus &, TInt)

TBool DrawFrameL ( TRequestStatus & aStatus,
TInt aBufferNumber = 0
)

Internal For drawing one frame

Parameters

TRequestStatus & aStatus
TInt aBufferNumber = 0

FreeSurface()

void FreeSurface ( ) [private]

HandleEventL(TInt, TAny *)

void HandleEventL ( TInt aEventType,
TAny * aEventData
) [protected, virtual]

Internal From base class

Parameters

TInt aEventType
TAny * aEventData

NewL(MAlfBufferProvider &, RWindow *)

IMPORT_C CAlfCompositionPixelSource * NewL ( MAlfBufferProvider & aProvider,
RWindow * aWindow = NULL
) [static]

Constructor

Parameters

MAlfBufferProvider & aProvider
RWindow * aWindow = NULL

NewL(MAlfBufferProvider &, TInt, RWindow *)

IMPORT_C CAlfCompositionPixelSource * NewL ( MAlfBufferProvider & aProvider,
TInt aPriority = CActive::EPriorityIdle,
RWindow * aWindow = NULL
) [static]

Constructor for application to decide AO priority

Parameters

MAlfBufferProvider & aProvider
TInt aPriority = CActive::EPriorityIdle
RWindow * aWindow = NULL

SetExtent(const TRect &, TInt)

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

Parameters

const TRect & aRect
TInt aScreen

Suspend()

IMPORT_C void Suspend ( )

Suspend drawing

Member Data Documentation

CAlfCompositionPixelSourceData * iData

CAlfCompositionPixelSourceData * iData [private]