Join Now
Quality Rating:
  • Currently 4.0 / 5
(4.0 / 5 - 2 votes cast)
Expertise Level:
  • Currently 3.5 / 5
(3.5 / 5 - 2 votes cast)

This page was last modified 23:36, 3 July 2008.

CS000866 - CBitmapRotator

From Forum Nokia Wiki


ID CS000866 Creation date March 28, 2008
Platform S60 3rd Edition Tested on devices Nokia N95
Category Symbian C++ Subcategory UI


Keywords (APIs, classes, methods, functions): CBitmapRotator

Overview

CBitmapRotator helps when have to rotate the bitmaps.

MMP file

Following libraries are needed

LIBRARY bitmaptransforms.lib

Header

#include <e32base.h>
#include <BitmapTransforms.h>
 
class CBitmapRotator;
 
class MBitmapRotatorObserver
    {
    public:
        virtual void RotateComplete( TInt aError ) = 0;
    };
 
class CBitmapRotatorHandler : public CActive
    {
    public:
        static CBitmapRotatorHandler* NewL(MBitmapRotatorObserver& aObserver);
        virtual ~CBitmapRotatorHandler();
    
    private:
        CBitmapRotatorHandler(MBitmapRotatorObserver& aObserver);
        void ConstructL();
        
    private: // From CActive
        void DoCancel();
        void RunL();
        TInt RunError(TInt aError);
        
    public: // New functions
        // Rotates a bitmap by a specified angle
        void Rotate(CFbsBitmap& aBitmap, 
        CBitmapRotator::TRotationAngle aAngle);
 
    private: // Data
        MBitmapRotatorObserver& iObserver;
        CBitmapRotator* iBitmapRotator;
    };

Source

#include "CBitmapRotatorHandler.h"
 
CBitmapRotatorHandler* CBitmapRotatorHandler::NewL(MBitmapRotatorObserver& aObserver)
    {
    CBitmapRotatorHandler* self = new (ELeave) CBitmapRotatorHandler( aObserver );
    CleanupStack::PushL( self );
    self->ConstructL();
    CleanupStack::Pop();
    return self;
    }
 
CBitmapRotatorHandler::~CBitmapRotatorHandler()
    {
    if (IsActive())
        {
        Cancel();
        }
    
    if (iBitmapRotator)
        {
        delete iBitmapRotator;
        iBitmapRotator = NULL;
        }
    }
 
CBitmapRotatorHandler::CBitmapRotatorHandler(MBitmapRotatorObserver& aObserver)
    :CActive( CActive::EPriorityHigh ),
    iObserver( aObserver )
    {
    }
 
void CBitmapRotatorHandler::ConstructL()
    {
    CActiveScheduler::Add( this );
    iBitmapRotator = CBitmapRotator::NewL();
    }
 
void CBitmapRotatorHandler::DoCancel()
    {
    if( iBitmapRotator )
        {
        iBitmapRotator->Cancel();
        }
    }
 
void CBitmapRotatorHandler::RunL()
    {
    iObserver.RotateComplete( iStatus.Int() );
    }
 
TInt CBitmapRotatorHandler::RunError( TInt aError )
    {
    return KErrNone;
    }
 
 
// Rotates a bitmap by a specified angle.
// This variant of CBitmapRotator::Rotate() schedules a rotate operation
// by a specified number of degrees on the bitmap specified in aBitmap
// and overwrites the original bitmap with the new rotated image. 
// This operation is asynchronous, the result is stored in a 
// location pointed to by iStatus.
void CBitmapRotatorHandler::Rotate(CFbsBitmap& aBitmap,
CBitmapRotator::TRotationAngle aAngle)
    {
    if( iBitmapRotator )
        {
        if( !IsActive() )
            {
            SetActive();
            iBitmapRotator->Rotate( &iStatus, aBitmap, aAngle );
            }
        }
    }


Using CBitmapRotatorHandler

iBitmapRotator = CBitmapRotatorHandler::NewL(*this);
iBitmapRotator->Rotate(*iCurrentImage,
CBitmapRotator::ERotation90DegreesClockwise);

Postconditions

Bitmap is rotated.

Related Discussions
Thread Thread Starter Forum Replies Last Post
flip image horizontally flicker82 Symbian User Interface 2 2004-09-07 02:35
如何将一张图片左右镜像以后贴出来? hz_chenpeng Symbian 2 2007-03-17 09:45
Image Creatinon Nitin SuperByte Symbian User Interface 7 2008-01-07 09:05
Mirror a svg image Tatanka.nbr1 Symbian Media (Graphics & Sounds) 0 2006-10-11 16:12
Video decoder ominolego Symbian Media (Graphics & Sounds) 119 2008-04-09 08:02
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX