imageeditorengine/EngineWrapper/src/ImageEditorEngineWrapper.cpp
author qifeima <>
Thu, 03 Jun 2010 18:57:10 +0800
changeset 8 18b321db4884
parent 1 edfc90759b9f
permissions -rw-r--r--
*m enhance
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     1
/*
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     2
* Copyright (c) 2010 Ixonos Plc.
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     3
* All rights reserved.
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     5
* under the terms of the "Eclipse Public License v1.0"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     8
*
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     9
* Initial Contributors:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    10
* Nokia Corporation - Initial contribution
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    11
*
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    12
* Contributors:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    13
* Ixonos Plc
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    14
*
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    15
* Description:  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    16
*
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    17
*/
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    18
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    19
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    20
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    21
//	INCLUDES
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    22
#include <bautils.h>
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    23
#include <eikenv.h>
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    24
#include <aknutils.h>
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    25
#include <e32math.h>
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    26
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    27
//#include "ImageEditorPluginBase.hrh"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    28
#include "platform_security_literals.hrh"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    29
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    30
#include "ImageEditorEngineWrapper.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    31
#include "CFilterStack.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    32
#include "MImageFilter.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    33
#include "SystemParameters.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    34
#include "ImageEditorError.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    35
#include "ImageEditorUtils.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    36
#include "EditorVersion.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    37
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    38
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    39
#include "CExifParser.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    40
#include "TBitmapHandle.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    41
#include "MJpegSave.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    42
#include "JpegSaveFactory.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    43
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    44
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    45
//  Debug logger definitions
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    46
#include "imageeditordebugutils.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    47
_LIT( KEngineWrapperLogFile,"EngineWrapper.log" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    48
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    49
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    50
// CONSTANTS
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    51
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    52
// 	Minimum source image x-y value that the engine is able to render
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    53
const TInt KObMinSourceDimension    		= 16; 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    54
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    55
//	EXIF thumbnail quality
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    56
const TInt KThumbnailJpegQuality    		= 60; 		// [0,100]
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    57
const TInt KThumbnailMaxDimension			= 160;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    58
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    59
//  Used fixed point resolution for scales
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    60
const TInt KScaleBits						= 12;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    61
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    62
const TReal KZoomScaleFactor                 = 0.5; 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    63
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    64
// Comment tag to be written to the EXIF data of JPEG file.
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    65
_LIT8( KImageEditorExifComment, "Edited with Nokia Image Editor %d.%d.%d" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    66
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    67
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    68
// 	Filter paths
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    69
_LIT(KFilterJpegSource, "FilterJpegSource.dll");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    70
_LIT(KFilterIclSource, "FilterIclSource.dll");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    71
_LIT(KFilterTarget, "FilterJpegTarget.dll");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    72
_LIT(KFilterBuffer, "FilterBuffer.dll");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    73
_LIT(KFilterScale, 	"FilterScale.dll");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    74
_LIT(KFilterRotate, "FilterRotate.dll");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    75
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    76
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    77
EXPORT_C CEngineWrapper * CEngineWrapper::NewL ()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    78
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    79
    LOG_INIT ( KEngineWrapperLogFile );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    80
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    81
	CEngineWrapper * self = new (ELeave) CEngineWrapper;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    82
	CleanupStack::PushL (self);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    83
	self->ConstructL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    84
	CleanupStack::Pop(); // self
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    85
	return self;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    86
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    87
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    88
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    89
EXPORT_C CEngineWrapper::~CEngineWrapper ()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    90
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    91
    LOG( KEngineWrapperLogFile, "CEngineWrapper::~CEngineWrapper");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    92
    Cleanup();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    93
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    94
	delete iExifParser;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    95
	iExifParser = NULL;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    96
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    97
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    98
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    99
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   100
EXPORT_C void CEngineWrapper::CreateJpegSourceL (const TDesC & aFileName)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   101
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   102
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   103
#ifdef VERBOSE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   104
    LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL\taFileName: %S", &aFileName );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   105
#endif // VERBOSE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   106
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   107
    //  SANITY CHECKS
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   108
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   109
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   110
        LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   111
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   112
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   113
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   114
	//	Add JPEG source to engine
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   115
	LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL --- Add jpeg source" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   116
	if ( iMainEngine->NumFilters() == 0 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   117
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   118
		iMainEngine->AddFilterL ( KFilterJpegSource );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   119
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   120
	else if  ( IsSameString ( (TUint8*)iMainEngine->Filter(0)->Type(), (TUint8*)"iclsource" ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   121
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   122
		iMainEngine->RemoveFilter (0);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   123
		iMainEngine->AddFilterL (KFilterJpegSource, 0);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   124
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   125
	else if  ( !IsSameString ( (TUint8*)iMainEngine->Filter(0)->Type(), (TUint8*)"jpegsource" ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   126
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   127
		iMainEngine->AddFilterL (KFilterJpegSource, 0);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   128
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   129
	iCmd.Copy ( _L("file \""));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   130
	iCmd.Append ( aFileName );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   131
	iCmd.Append ( _L("\""));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   132
	LOGFMT ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL: Cmd: %S", &aFileName );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   133
	iMainEngine->FunctionL ( 0, iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   134
	LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL --- Jpeg source added" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   135
	iMainEngine->FunctionL ( 0, _L("loadimage"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   136
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   137
	//	Get source image size
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   138
	TRect rect = iMainEngine->Filter (0)->Rect(); 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   139
	iSourceSize = iMainEngine->Filter (0)->ViewPortSize(); 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   140
	LOGFMT ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL: source width: %d", iSourceSize.iWidth);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   141
	LOGFMT ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL: source height: %d", iSourceSize.iHeight);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   142
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   143
    //  Check that the source image is of minimum size
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   144
    if (iSourceSize.iWidth < KObMinSourceDimension || iSourceSize.iHeight < KObMinSourceDimension)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   145
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   146
        User::Leave (KSIEEOpenFile);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   147
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   148
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   149
	//	Initialize crop parameters
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   150
	iBoundingRect.iTl.iX = 0;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   151
	iBoundingRect.iTl.iY = 0;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   152
	iBoundingRect.iBr.iX = iSourceSize.iWidth;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   153
	iBoundingRect.iBr.iY = iSourceSize.iHeight;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   154
    iScale = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   155
    iMaxScale = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   156
    iMinScale = (TReal)iScreenSize.iWidth / iSourceSize.iWidth; 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   157
    iPanX = iSourceSize.iWidth * 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   158
    iPanY = iSourceSize.iHeight * 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   159
    iPanStep = 128.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   160
    iZoomMode = EZoomNormal;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   161
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   162
	//	Initialize system parameters
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   163
    iSysPars->SourceSize() = iSourceSize;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   164
    iSysPars->Scale() = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   165
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   166
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   167
	LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL ---  Read EXIF data" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   168
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   169
	//	Read EXIF data pointer
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   170
	iCmd.Copy ( _L("exifdata"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   171
	TUint8 * exifptr = (TUint8 *)iMainEngine->FunctionL ( 0, iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   172
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   173
	//	Read EXIF data length
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   174
	iCmd.Copy ( _L("exiflength"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   175
	TInt exiflen = (TInt)iMainEngine->FunctionL ( 0, iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   176
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   177
	//	Create and initialize EXIF parser
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   178
	TPtrC8 exifdata (exifptr, exiflen);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   179
	if (iExifParser)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   180
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   181
		delete iExifParser;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   182
		iExifParser = NULL;		
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   183
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   184
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   185
	iExifParser = CExifParser::NewL ();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   186
	TRAPD( err, iExifParser->ParseL (exifdata) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   187
	if (KErrNone == err)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   188
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   189
		LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL --- EXIF data read." );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   190
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   191
	else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   192
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   193
		LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL --- FAILED to parse EXIF data. Ignored." );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   194
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   195
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   196
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   197
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   198
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   199
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   200
EXPORT_C void CEngineWrapper::CreateJpegTargetL (
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   201
	const TDesC & aFileName,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   202
    const TInt      aQuality,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   203
    const TSize *   aSize 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   204
    )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   205
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   206
    LOG( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   207
#ifdef VERBOSE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   208
    LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL\taFileName: %S", &aFileName );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   209
    LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL\taQuality: %d", aQuality );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   210
    if (aSize)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   211
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   212
        LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL\taSize->iWidth: %d", aSize->iWidth);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   213
        LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL\taSize->iHeight: %d", aSize->iHeight);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   214
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   215
    else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   216
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   217
		LOG( KEngineWrapperLogFile, "aSize == NULL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   218
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   219
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   220
#endif // VERBOSE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   221
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   222
    //  SANITY CHECKS
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   223
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   224
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   225
        LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   226
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   227
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   228
    if ( aQuality < 0 || aQuality > 100)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   229
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   230
        LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL: Invalid parameter aQuality!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   231
        User::Panic (KEnginePanic, KEnginePanicParameter);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   232
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   233
    if ( aSize && ( (aSize->iWidth < 0 || aSize->iHeight < 0) ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   234
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   235
        LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL: Invalid parameter aSize!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   236
        User::Panic (KEnginePanic, KEnginePanicParameter);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   237
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   238
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   239
	//	Remove source buffer
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   240
	iMainEngine->FunctionL (0, _L("fileoutput"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   241
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   242
	//	Remove screen buffer
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   243
	LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL --- Remove screen buffer" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   244
	if ( IsSameString ( (TUint8*)iMainEngine->Filter(iMainEngine->NumFilters() - 1)->Type(), (TUint8*)"buffer" ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   245
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   246
		iMainEngine->RemoveFilter(iMainEngine->NumFilters() - 1);	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   247
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   248
	LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL --- Screen buffer removed" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   249
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   250
	//	Remove jpeg target buffer
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   251
	if ( IsSameString ( (TUint8*)iMainEngine->Filter(iMainEngine->NumFilters() - 1)->Type(), (TUint8*)"jpegtarget" ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   252
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   253
		iMainEngine->RemoveFilter(iMainEngine->NumFilters() - 1);	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   254
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   255
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   256
	//	Remove scale buffer, if image is not scaled
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   257
	if ( iSysPars->Scale() == 1.0 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   258
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   259
		LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL --- Remove screen scale filter." );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   260
		if ( IsSameString ( (TUint8*)iMainEngine->Filter(iMainEngine->NumFilters() - 1)->Type(), (TUint8*)"scale" ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   261
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   262
			iMainEngine->RemoveFilter(iMainEngine->NumFilters() - 1);	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   263
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   264
		LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL --- Screen scale filter removed." );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   265
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   266
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   267
	LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL --- Add jpeg target filter." );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   268
	iMainEngine->AddFilterL ( KFilterTarget );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   269
	LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL --- Jpeg target filter added." );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   270
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   271
	//	If external target size is given, set it to target.
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   272
	if ( aSize )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   273
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   274
		iCmd.Format( _L("width %d height %d"), aSize->iWidth, aSize->iHeight );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   275
		iMainEngine->FunctionL ( iMainEngine->NumFilters() - 1, iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   276
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   277
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   278
	//	Set the scaled source size to target
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   279
	if ( iSysPars->Scale() != 1.0 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   280
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   281
		TReal scale = iSysPars->Scale();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   282
		TSize tgtsize = iMainEngine->Filter ( iMainEngine->NumFilters() - 3 )->ViewPortSize();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   283
		tgtsize.iWidth = (TInt)(tgtsize.iWidth * scale + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   284
		tgtsize.iHeight = (TInt)(tgtsize.iHeight * scale + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   285
		iCmd.Format( _L("width %d height %d"), tgtsize.iWidth, tgtsize.iHeight);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   286
		iMainEngine->FunctionL ( iMainEngine->NumFilters() - 1, iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   287
		iMainEngine->FunctionL ( iMainEngine->NumFilters() - 2, _L("nop"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   288
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   289
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   290
	//	Store save file name
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   291
	iTargetFile.Copy ( aFileName );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   292
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   293
    LOG ( KEngineWrapperLogFile, "CreateJpegTargetL: Sink created" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   294
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   295
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   296
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   297
EXPORT_C void CEngineWrapper::CreateIclSourceL (const TDesC & aFileName)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   298
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   299
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   300
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateIclSourceL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   301
#ifdef VERBOSE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   302
    LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::CreateIclSourceL\taFileName: %S", &aFileName );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   303
#endif // VERBOSE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   304
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   305
    //  SANITY CHECKS
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   306
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   307
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   308
        LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateIclSourceL: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   309
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   310
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   311
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   312
	//	Add JPEG source to engine
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   313
	LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateIclSourceL --- Add icl source" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   314
	if ( iMainEngine->NumFilters() == 0 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   315
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   316
		iMainEngine->AddFilterL ( KFilterIclSource );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   317
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   318
	else if  ( IsSameString ( (TUint8*)iMainEngine->Filter(0)->Type(), (TUint8*)"jpegsource" ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   319
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   320
		iMainEngine->RemoveFilter(0);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   321
		iMainEngine->AddFilterL ( KFilterIclSource, 0);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   322
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   323
	else if  ( !IsSameString ( (TUint8*)iMainEngine->Filter(0)->Type(), (TUint8*)"iclsource" ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   324
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   325
		iMainEngine->AddFilterL ( KFilterIclSource, 0);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   326
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   327
	iCmd.Copy (_L("file \""));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   328
	iCmd.Append ( aFileName );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   329
	iCmd.Append (_L("\""));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   330
	LOGFMT ( KEngineWrapperLogFile, "CEngineWrapper::CreateIclSourceL: Cmd: %S", &iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   331
	iMainEngine->FunctionL ( 0, iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   332
	LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateIclSourceL --- Icl source added" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   333
	iMainEngine->FunctionL ( 0, _L("loadimage"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   334
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   335
	//	Get source image size
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   336
	TRect rect = iMainEngine->Filter (0)->Rect(); 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   337
	iSourceSize = iMainEngine->Filter (0)->ViewPortSize(); 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   338
	LOGFMT ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL: source width: %d", iSourceSize.iWidth);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   339
	LOGFMT ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL: source height: %d", iSourceSize.iHeight);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   340
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   341
    //  Check that the source image is of minimum size
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   342
    if (iSourceSize.iWidth < KObMinSourceDimension || iSourceSize.iHeight < KObMinSourceDimension)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   343
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   344
        User::Leave (KSIEEOpenFile);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   345
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   346
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   347
	//	Initialize crop parameters
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   348
    iScale = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   349
    iMaxScale = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   350
    iMinScale = (TReal)iScreenSize.iWidth / iSourceSize.iWidth; 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   351
    iPanX = iSourceSize.iWidth * 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   352
    iPanY = iSourceSize.iHeight * 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   353
    iPanStep = 128.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   354
    iZoomMode = EZoomNormal;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   355
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   356
	//	Initialize system parameters
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   357
    iSysPars->SourceSize() = iSourceSize;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   358
    iSysPars->Scale() = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   359
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   360
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   361
	LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateIclSourceL ---  Create EXIF parser" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   362
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   363
	if (iExifParser)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   364
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   365
		delete iExifParser;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   366
		iExifParser = NULL;		
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   367
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   368
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   369
	iExifParser = CExifParser::NewL ();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   370
	LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL --- EXIF parser created." );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   371
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   372
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   373
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   374
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   375
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   376
EXPORT_C void CEngineWrapper::CreateRGB888TargetL ()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   377
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   378
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   379
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL " );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   380
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   381
    //  SANITY CHECKS
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   382
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   383
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   384
        LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   385
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   386
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   387
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   388
#ifdef VERBOSE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   389
    LOGFMT( KEngineWrapperLogFile, "\tiScreenSize.w: %d", iScreenSize.iWidth);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   390
    LOGFMT( KEngineWrapperLogFile, "\tiScreenSize.h: %d", iScreenSize.iHeight);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   391
#endif
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   392
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   393
	//	Create source buffer
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   394
	iMainEngine->FunctionL (0, _L("bufferoutput"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   395
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   396
	//	Remove target filter and add screen buffer
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   397
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL --- Add buffer target." );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   398
    TInt n = iMainEngine->NumFilters();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   399
	if ( IsSameString ( (TUint8*)iMainEngine->Filter(n - 1)->Type(), (TUint8*)"jpegtarget") ) 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   400
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   401
		iMainEngine->RemoveFilter(n - 1);	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   402
		iMainEngine->AddFilterL ( KFilterBuffer );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   403
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   404
	else if ( !IsSameString ( (TUint8*)iMainEngine->Filter(n - 1)->Type(), (TUint8*)"buffer" ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   405
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   406
		iMainEngine->AddFilterL ( KFilterBuffer );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   407
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   408
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL --- Buffer target added." );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   409
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   410
	//	Set buffer size
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   411
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL --- Set buffer size ");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   412
	iCmd.Format( _L("width %d height %d"), iScreenSize.iWidth, iScreenSize.iHeight );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   413
	LOGDES (KEngineWrapperLogFile, iCmd);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   414
	iMainEngine->FunctionL ( iMainEngine->NumFilters() - 1, iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   415
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL --- Buffer size set." );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   416
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   417
	//	Set scale buffer before screen buffer
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   418
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL --- Add screen buffer scale filter");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   419
	if ( !IsSameString ( (TUint8*)iMainEngine->Filter(iMainEngine->NumFilters() - 2)->Type(), (TUint8*)"scale") ) 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   420
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   421
		iMainEngine->AddFilterL ( KFilterScale, iMainEngine->NumFilters() - 1);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   422
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   423
	iMainEngine->FunctionL ( iMainEngine->NumFilters() - 2, iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   424
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL --- Screen buffer scale filter added.");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   425
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   426
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL: Sink created" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   427
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   428
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   429
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   430
EXPORT_C void CEngineWrapper::SetScreenSizeL (const TSize & aSize)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   431
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   432
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   433
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::SetScreenSizeL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   434
#ifdef VERBOSE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   435
    LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::SetScreenSizeL\taSize.iWidth: %d", aSize.iWidth );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   436
    LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::SetScreenSizeL\taSize.iHeight: %d", aSize.iHeight );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   437
#endif // VERBOSE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   438
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   439
    //  SANITY CHECKS
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   440
    if ( aSize.iWidth < 0 || aSize.iHeight < 0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   441
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   442
        LOG ( KEngineWrapperLogFile, "CEngineWrapper::SetScreenSizeL: Invalid parameter aSize!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   443
        User::Panic (KEnginePanic, KEnginePanicParameter);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   444
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   445
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   446
	if ( aSize != iScreenSize )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   447
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   448
		iScreenSize = aSize;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   449
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   450
		//	Set buffer size
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   451
		TInt n = iMainEngine->NumFilters();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   452
		if (n > 2)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   453
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   454
			if ( IsSameString ((TUint8*)iMainEngine->Filter(n - 1)->Type(), (TUint8*) "buffer" ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   455
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   456
				iCmd.Format( _L("width %d height %d"), iScreenSize.iWidth, iScreenSize.iHeight);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   457
				iMainEngine->FunctionL ( n - 1, iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   458
				iMainEngine->FunctionL ( n - 2, _L("nop"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   459
				UpdateCropRectL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   460
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   461
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   462
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   463
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   464
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   465
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   466
EXPORT_C void CEngineWrapper::AddFilterL (const TDesC & aFilterName) 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   467
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   468
    LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::AddFilterL (TDes & aFilterName: %S)", &aFilterName );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   469
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   470
    //  SANITY CHECKS
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   471
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   472
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   473
        LOG ( KEngineWrapperLogFile, "CEngineWrapper::AddFilterL: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   474
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   475
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   476
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   477
	//  Check whether the filter is found
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   478
	TFileName filtername;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   479
	filtername.Copy (aFilterName);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   480
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   481
    /*
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   482
    // no need for this as AddFilterL will leave if there is an error
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   483
    if (FileExists (filtername) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   484
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   485
           TParse parse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   486
           User::LeaveIfError( parse.Set( aFilterName ,NULL, NULL ) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   487
           filtername = parse.NameAndExt();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   488
    };
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   489
    */
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   490
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   491
	TInt n = iMainEngine->NumFilters();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   492
	if (n >= 2)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   493
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   494
		iMainEngine->AddFilterL ( filtername, n - 2 );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   495
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   496
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::AddFilterL: Filter added" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   497
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   498
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   499
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   500
EXPORT_C void CEngineWrapper::SetParamsL (const TDesC & aParam)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   501
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   502
    LOG( KEngineWrapperLogFile, "CEngineWrapper::SetParamsL " );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   503
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   504
    //  SANITY CHECKS
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   505
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   506
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   507
        LOG ( KEngineWrapperLogFile, "CEngineWrapper::SetParamsL: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   508
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   509
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   510
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   511
    //  Initialize error value
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   512
	TInt n = iMainEngine->NumFilters();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   513
	if ( n > 2 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   514
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   515
    	LOGDES( KEngineWrapperLogFile, aParam );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   516
		iMainEngine->FunctionL ( n - 3, aParam );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   517
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   518
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   519
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   520
	if ( IsSameString ( (TUint8*)iMainEngine->Filter(n - 3)->Type(), (TUint8*) "rotate" ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   521
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   522
		if (iScale == 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   523
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   524
			ComputeBoundingRectL();	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   525
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   526
		UpdateCropRectL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   527
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   528
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   529
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   530
    LOG( KEngineWrapperLogFile, "CEngineWrapper::SetParamsL: Parameters set " );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   531
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   532
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   533
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   534
EXPORT_C void CEngineWrapper::RenderL (TInt* /*aMultiSessionBlockCount*/)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   535
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   536
    LOG( KEngineWrapperLogFile, "CEngineWrapper::RenderL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   537
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   538
    //  SANITY CHECKS
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   539
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   540
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   541
        LOG ( KEngineWrapperLogFile, "CEngineWrapper::RenderL: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   542
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   543
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   544
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   545
	TInt n = iMainEngine->NumFilters();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   546
	for ( TInt i = 0; i < iMainEngine->NumFilters(); ++i)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   547
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   548
		iMainEngine->FunctionL (i, _L("nop"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   549
		TBuf<100> buf;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   550
		buf.Copy(TPtrC8 ( (TUint8 *)iMainEngine->Filter(i)->Type() ));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   551
		LOGDES (KEngineWrapperLogFile,  buf) ;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   552
		TRect rect = iMainEngine->Filter(i)->Rect();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   553
		buf.Format( _L("%d %d %d %d"), rect.iTl.iX, rect.iTl.iY, rect.iBr.iX, rect.iBr.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   554
		LOGDES (KEngineWrapperLogFile,  buf) ;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   555
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   556
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   557
	//	Render to buffer target
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   558
	if ( IsSameString ( (TUint8*)iMainEngine->Filter(n - 1)->Type(), (TUint8*) "buffer" ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   559
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   560
		iCmd.Copy (_L("getbitmap"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   561
		if ( iRenderScaleBuffer )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   562
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   563
			iMainEngine->FunctionL ( 0, _L("loadimage"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   564
			iRenderScaleBuffer = EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   565
			for ( TInt i = 0; i < iMainEngine->NumFilters(); ++i)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   566
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   567
				iMainEngine->FunctionL (i, _L("nop"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   568
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   569
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   570
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   571
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   572
		LOG ( KEngineWrapperLogFile, "CEngineWrapper::RenderL -- Render screen buffer." );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   573
		TUint32 * buffer = (TUint32 *)iMainEngine->FunctionL ( n - 1, iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   574
		CopyBufferL (buffer);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   575
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   576
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   577
	//	Render to JPEG target
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   578
	else if ( IsSameString ( (TUint8*)iMainEngine->Filter(n - 1)->Type(), (TUint8*)"jpegtarget" ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   579
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   580
		iCmd.Zero();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   581
		
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   582
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   583
	LOG ( KEngineWrapperLogFile, "CEngineWrapper::RenderL: Set EXIF data" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   584
		
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   585
		//	Update EXIF tags
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   586
		UpdateExifTagsL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   587
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   588
		//	Update EXIF thumbnail 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   589
		TPtrC8 savedexifdata = UpdateExifThumbnailL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   590
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   591
		//	Set EXIF data to target
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   592
		iCmd.Format (_L("exifdata %d exiflen %d"), (TInt)(savedexifdata.Ptr()), savedexifdata.Length());
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   593
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   594
	LOG ( KEngineWrapperLogFile, "CEngineWrapper::RenderL: EXIF data set." );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   595
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   596
		
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   597
		iCmd.Append (_L(" file \""));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   598
		iCmd.Append ( iTargetFile );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   599
		iCmd.Append (_L("\""));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   600
		iMainEngine->FunctionL ( n - 1, iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   601
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   602
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   603
    LOG( KEngineWrapperLogFile, "CEngineWrapper::RenderL: Rendered" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   604
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   605
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   606
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   607
EXPORT_C TInt CEngineWrapper::RenderBlockL()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   608
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   609
#ifdef VERBOSE_2
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   610
    LOG( KEngineWrapperLogFile, "CEngineWrapper::RenderBlockL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   611
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   612
    LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::RenderBlockL\tiBlock: %d", iBlock);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   613
    if (iTestBitmap)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   614
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   615
        LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::RenderBlock\tiTestBitmap->DataAddress(): %d", (TInt)iTestBitmap->DataAddress());
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   616
        LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::RenderBlock\tiTestBitmap->Handle(): %d", iTestBitmap->Handle());
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   617
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   618
    LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::RenderBlockL\tiBuffer: %d", (TInt)iBuffer);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   619
#endif
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   620
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   621
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   622
    //  Check that the model is found
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   623
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   624
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   625
        LOG ( KEngineWrapperLogFile, "RenderBlockL: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   626
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   627
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   628
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   629
	iCmd.Copy ( _L("store") );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   630
	TInt percentage = iMainEngine->FunctionL ( iMainEngine->NumFilters() - 1, iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   631
	if (percentage == 100)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   632
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   633
		iChangeCount = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   634
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   635
	return percentage;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   636
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   637
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   638
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   639
EXPORT_C void CEngineWrapper::RenderAbortL()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   640
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   641
	LOG( KEngineWrapperLogFile, "CEngineWrapper::RenderAbortL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   642
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   643
    //  Check that the model is found
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   644
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   645
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   646
        LOG ( KEngineWrapperLogFile, "RenderAbort: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   647
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   648
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   649
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   650
    iCmd.Copy ( _L("abort"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   651
	iMainEngine->FunctionL ( iMainEngine->NumFilters() - 1, iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   652
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   653
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   654
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   655
EXPORT_C void CEngineWrapper::InitUndoRedo()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   656
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   657
    LOG( KEngineWrapperLogFile, "CEngineWrapper::InitUndoRedo" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   658
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   659
    //  Check that the model is found
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   660
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   661
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   662
        LOG ( KEngineWrapperLogFile, "InitUndoRedo: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   663
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   664
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   665
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   666
	//	Purge undo stack
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   667
	iUndoPoints.Reset();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   668
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   669
	//	Undo
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   670
	iPrevChangeCount = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   671
    iChangeCount = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   672
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   673
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   674
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   675
EXPORT_C void CEngineWrapper::AddUndoRedoStepL()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   676
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   677
    LOG( KEngineWrapperLogFile, "CEngineWrapper::AddUndoRedoStepL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   678
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   679
    //  Check that the model is found
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   680
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   681
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   682
        LOG ( KEngineWrapperLogFile, "AddUndoRedoStepL: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   683
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   684
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   685
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   686
	//	Store undo point
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   687
	TInt n = iMainEngine->NumFilters();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   688
	if (n > 2)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   689
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   690
		//	Set undo point before target filter
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   691
		iUndoPoints.Append ( n - 3 );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   692
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   693
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   694
	iPrevChangeCount = iChangeCount;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   695
    iChangeCount++;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   696
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   697
    LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::AddUndoRedoStepL: iChangeCount = %d", iChangeCount);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   698
    LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::AddUndoRedoStepL: iPrevChangeCount = %d", iPrevChangeCount);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   699
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   700
    //  Store rotation and scale
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   701
    User::LeaveIfError( iScaleUndoBuf.Append ( iSysPars->Scale() ) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   702
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   703
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   704
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   705
EXPORT_C void CEngineWrapper::UndoL()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   706
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   707
    LOG( KEngineWrapperLogFile, "CEngineWrapper::UndoL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   708
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   709
    //  Check that the model is found
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   710
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   711
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   712
        LOG ( KEngineWrapperLogFile, "UndoL: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   713
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   714
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   715
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   716
	TBool computeBoundingRect = EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   717
	TBool reloadImage = EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   718
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   719
	if (iMainEngine->NumFilters() > 2)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   720
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   721
		TInt m = iUndoPoints.Count();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   722
		TInt undoindex = iUndoPoints[m-1];
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   723
		while (iMainEngine->NumFilters() - 3 > undoindex)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   724
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   725
			TInt index = iMainEngine->NumFilters() - 3;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   726
			if ( IsSameString ( (TUint8*)iMainEngine->Filter(index)->Type(), (TUint8*) "rotate" ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   727
				{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   728
				computeBoundingRect = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   729
				}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   730
			else if ( IsSameString ( (TUint8*)iMainEngine->Filter(index)->Type(), (TUint8*) "crop" ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   731
				{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   732
				reloadImage = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   733
				}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   734
		
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   735
			iMainEngine->RemoveFilter (index);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   736
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   737
		iUndoPoints.Remove (iUndoPoints.Count() - 1);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   738
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   739
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   740
    iPrevChangeCount = iChangeCount;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   741
    iChangeCount--;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   742
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   743
    LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::UndoL: iChangeCount = %d", iChangeCount);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   744
    LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::UndoL: iPrevChangeCount = %d", iPrevChangeCount);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   745
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   746
    TInt count = iScaleUndoBuf.Count();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   747
    if ( count > 0 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   748
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   749
        iSysPars->Scale() = iScaleUndoBuf[count - 1];
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   750
        iScaleUndoBuf.Remove (count - 1);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   751
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   752
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   753
	if (reloadImage)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   754
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   755
		iCmd.Format( _L("ulc %d ulr %d lrc %d lrr %d"), 0,0,0,0);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   756
		iMainEngine->FunctionL ( 0, iCmd);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   757
		iMainEngine->FunctionL ( 0, _L("loadimage"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   758
		for (TInt i = 0; i < iMainEngine->NumFilters(); ++i)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   759
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   760
			iMainEngine->FunctionL (i, _L("nop"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   761
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   762
    	ComputeBoundingRectL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   763
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   764
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   765
    if (  iMainEngine->NumFilters() > 3 && computeBoundingRect && iScale == 1.0 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   766
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   767
    	ComputeBoundingRectL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   768
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   769
    else if ( iMainEngine->NumFilters() <= 3 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   770
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   771
    	iBoundingRect.iTl.iX = 0;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   772
    	iBoundingRect.iTl.iY = 0;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   773
    	iBoundingRect.iBr.iX = iSourceSize.iWidth;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   774
    	iBoundingRect.iBr.iY = iSourceSize.iHeight;   
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   775
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   776
    UpdateCropRectL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   777
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   778
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   779
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   780
EXPORT_C TBool CEngineWrapper::CanUndo ()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   781
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   782
    LOG( KEngineWrapperLogFile, "CEngineWrapper::CanUndo" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   783
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   784
    //  Check that the model is found
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   785
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   786
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   787
        LOG ( KEngineWrapperLogFile, "CanUndo: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   788
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   789
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   790
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   791
	if ( iUndoPoints.Count() > 0 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   792
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   793
		return ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   794
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   795
	else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   796
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   797
		return EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   798
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   799
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   800
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   801
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   802
EXPORT_C TBool CEngineWrapper::IsImageChanged()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   803
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   804
    LOGFMT2( KEngineWrapperLogFile, "CEngineWrapper::IsImageChanged: iChangeCount = %d, iPrevChangeCount = %d", iChangeCount, iPrevChangeCount );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   805
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   806
    if ( iChangeCount || (iChangeCount == 0 && iPrevChangeCount < 0)) 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   807
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   808
        return ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   809
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   810
    else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   811
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   812
        return EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   813
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   814
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   815
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   816
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   817
CEngineWrapper::CEngineWrapper () : 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   818
iScreenSize (),
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   819
iChangeCount(0),
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   820
iPrevChangeCount(0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   821
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   822
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   823
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   824
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   825
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   826
void CEngineWrapper::ConstructL ()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   827
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   828
    LOG( KEngineWrapperLogFile, "CEngineWrapper::ConstructL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   829
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   830
	//	Create new engine
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   831
	iMainEngine = CFilterStack::NewL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   832
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   833
    // Set screen size to default
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   834
    iScreenSize.iWidth = 1;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   835
    iScreenSize.iHeight = 1;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   836
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   837
    //  Create and initialize system parameters
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   838
	LOG( KEngineWrapperLogFile, "CEngineWrapper: Creating system parameters" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   839
    iSysPars = new (ELeave) CSystemParameters;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   840
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   841
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   842
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   843
TInt CEngineWrapper::FileExists (TDes & aFileName) const
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   844
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   845
    LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::FileExists (TDes & aFileName: %S)", &aFileName );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   846
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   847
	TInt result = KErrNone;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   848
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   849
	RFs &fs = CEikonEnv::Static()->FsSession();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   850
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   851
	aFileName[0] = 'e';
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   852
	if ( !BaflUtils::FileExists (fs, aFileName) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   853
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   854
		aFileName[0] = 'c';
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   855
		if ( !BaflUtils::FileExists (fs, aFileName) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   856
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   857
			aFileName[0] = 'z';
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   858
			if ( !BaflUtils::FileExists (fs, aFileName) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   859
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   860
				return KErrNotFound;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   861
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   862
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   863
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   864
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   865
	if ( !BaflUtils::FileExists (fs, aFileName) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   866
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   867
		result = KErrNotFound;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   868
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   869
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   870
	LOGFMT( KEngineWrapperLogFile, "\tresult: %d", result );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   871
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   872
	return result;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   873
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   874
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   875
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   876
void CEngineWrapper::Cleanup()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   877
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   878
    LOG( KEngineWrapperLogFile, "CEngineWrapper::Cleanup" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   879
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   880
	//	Purge undo / redo information
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   881
	iUndoPoints.Reset();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   882
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   883
	//	Delete filters
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   884
	for ( TInt i = 0; i < iMainEngine->NumFilters(); ++i)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   885
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   886
		iMainEngine->RemoveFilter(i);	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   887
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   888
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   889
	//	Delete engine
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   890
	if (iMainEngine)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   891
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   892
		delete iMainEngine;	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   893
		iMainEngine = NULL;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   894
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   895
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   896
    //  Clear rotation and scale undo buffers
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   897
    iScaleUndoBuf.Reset();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   898
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   899
    //  Delete system parameters
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   900
    if (iSysPars)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   901
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   902
    	delete iSysPars;	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   903
    	iSysPars = NULL;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   904
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   905
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   906
    if (iJpegComment)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   907
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   908
    	delete iJpegComment;	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   909
    	iJpegComment = NULL;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   910
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   911
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   912
    //	Delete thumbnail buffer
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   913
    delete[] iThumb;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   914
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   915
  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   916
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   917
EXPORT_C void CEngineWrapper::StoreZoomL ()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   918
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   919
    LOG( KEngineWrapperLogFile, "CEngineWrapper::StoreZoom" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   920
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   921
	iScaleSt = iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   922
	iPanXSt = iPanX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   923
	iPanYSt = iPanY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   924
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   925
	iScale = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   926
    iPanX = iSourceSize.iWidth * 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   927
    iPanY = iSourceSize.iHeight * 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   928
    UpdateCropRectL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   929
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   930
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   931
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   932
EXPORT_C void CEngineWrapper::RestoreZoomL()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   933
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   934
    LOG( KEngineWrapperLogFile, "CEngineWrapper::RestoreZoom" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   935
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   936
	if (iScale != iScaleSt)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   937
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   938
		iScale = iScaleSt;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   939
		iPanX = iPanXSt;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   940
		iPanY = iPanYSt;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   941
	    UpdateCropRectL();		
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   942
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   943
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   944
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   945
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   946
EXPORT_C void CEngineWrapper::ZoomL (const TZoom aZoom)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   947
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   948
    LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::ZoomL: %d", (TInt)aZoom);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   949
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   950
    //  Check that the model is found
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   951
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   952
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   953
        LOG ( KEngineWrapperLogFile, "ZoomFactor: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   954
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   955
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   956
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   957
	if ( aZoom == EZoomMin )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   958
    	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   959
    	iScale = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   960
        iZoomMode = EZoomNormal;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   961
	    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   962
	    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   963
	else if ( aZoom == EZoomIn )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   964
	    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   965
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   966
        if ( iScale == 1.0 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   967
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   968
        	ComputeBoundingRectL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   969
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   970
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   971
        if ( iZoomMode < ( ENumOfZooms - 1 ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   972
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   973
            // rescale
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   974
            iScale *= KZoomScaleFactor;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   975
            // set next zoom mode
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   976
            iZoomMode = ( TZoomMode )( ( TInt )iZoomMode + 1 );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   977
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   978
	    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   979
	else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   980
	    {	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   981
	    if ( iZoomMode > EZoomNormal )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   982
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   983
            // rescale
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   984
            iScale *= 1.0 / KZoomScaleFactor;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   985
            //set previous zoom mode	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   986
            iZoomMode = ( TZoomMode )( ( TInt )iZoomMode - 1 );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   987
	        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   988
	    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   989
	    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   990
	UpdateCropRectL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   991
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   992
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   993
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   994
EXPORT_C TZoomMode CEngineWrapper::GetZoomMode()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   995
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   996
    return iZoomMode;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   997
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   998
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   999
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1000
EXPORT_C void CEngineWrapper::PanL (const TDirection aDir)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1001
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1002
    LOG( KEngineWrapperLogFile, "CEngineWrapper::PanL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1003
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1004
#ifdef VERBOSE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1005
    LOGFMT( KEngineWrapperLogFile, "\taDir: %d", (TInt)aDir);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1006
#endif // VERBOSE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1007
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1008
    if (iScale == 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1009
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1010
        return;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1011
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1012
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1013
    //  Check that the model is found
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1014
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1015
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1016
        LOG ( KEngineWrapperLogFile, "SetPanL: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1017
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1018
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1019
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1020
    TInt angle = ComputeRotationL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1021
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1022
	switch (aDir)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1023
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1024
		case EDirectionUp:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1025
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1026
			if (angle == 0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1027
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1028
    			iPanY -= iPanStep  * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1029
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1030
			else if (angle == 90)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1031
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1032
    			iPanX -= iPanStep  * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1033
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1034
			else if (angle == 180)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1035
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1036
    			iPanY += iPanStep  * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1037
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1038
			else if (angle == 270)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1039
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1040
    			iPanX += iPanStep  * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1041
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1042
			break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1043
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1044
		case EDirectionDown:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1045
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1046
			if (angle == 0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1047
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1048
    			iPanY += iPanStep  * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1049
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1050
			else if (angle == 90)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1051
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1052
    			iPanX += iPanStep  * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1053
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1054
			else if (angle == 180)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1055
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1056
    			iPanY -= iPanStep  * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1057
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1058
			else if (angle == 270)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1059
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1060
    			iPanX -= iPanStep  * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1061
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1062
			break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1063
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1064
		case EDirectionLeft:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1065
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1066
			if (angle == 0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1067
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1068
    			iPanX -= iPanStep * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1069
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1070
			else if (angle == 90)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1071
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1072
    			iPanY += iPanStep * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1073
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1074
			else if (angle == 180)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1075
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1076
    			iPanX += iPanStep * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1077
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1078
			else if (angle == 270)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1079
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1080
    			iPanY -= iPanStep * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1081
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1082
			break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1083
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1084
		case EDirectionRight:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1085
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1086
			if (angle == 0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1087
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1088
    			iPanX += iPanStep  * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1089
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1090
			else if (angle == 90)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1091
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1092
    			iPanY -= iPanStep * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1093
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1094
			else if (angle == 180)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1095
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1096
    			iPanX -= iPanStep * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1097
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1098
			else if (angle == 270)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1099
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1100
    			iPanY += iPanStep * iScale;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1101
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1102
			break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1103
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1104
		default:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1105
			break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1106
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1107
	UpdateCropRectL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1108
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1109
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1110
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1111
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1112
EXPORT_C void CEngineWrapper::PanL( TInt aXChange, TInt aYChange )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1113
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1114
    LOG( KEngineWrapperLogFile, "CEngineWrapper::Pan" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1115
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1116
#ifdef VERBOSE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1117
    LOGFMT( KEngineWrapperLogFile, "\taXChange: %d, aYChange: %d ", aXChange, aYChange );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1118
#endif // VERBOSE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1119
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1120
    if (iScale == 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1121
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1122
        return;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1123
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1124
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1125
    //  Check that the model is found
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1126
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1127
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1128
        LOG ( KEngineWrapperLogFile, "SetPanL: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1129
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1130
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1131
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1132
    TInt angle = ComputeRotationL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1133
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1134
    if (angle == 0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1135
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1136
		// X change
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1137
        iPanX += aXChange*(iScale/iMinScale);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1138
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1139
        // Y change
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1140
        iPanY += aYChange*(iScale/iMinScale);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1141
   		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1142
	else if (angle == 90)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1143
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1144
		// X change
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1145
        iPanX += aYChange*(iScale/iMinScale);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1146
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1147
        // Y change
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1148
        iPanY -= aXChange*(iScale/iMinScale);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1149
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1150
	else if (angle == 180)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1151
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1152
		// X change
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1153
        iPanX -= aXChange*(iScale/iMinScale);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1154
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1155
        // Y change
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1156
        iPanY -= aYChange*(iScale/iMinScale);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1157
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1158
	else if (angle == 270)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1159
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1160
		// X change
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1161
        iPanX -= aYChange*(iScale/iMinScale);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1162
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1163
        // Y change
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1164
        iPanY += aXChange*(iScale/iMinScale);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1165
		}			
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1166
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1167
	UpdateCropRectL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1168
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1169
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1170
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1171
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1172
EXPORT_C void CEngineWrapper::RotateL (const TRotation aRot)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1173
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1174
    LOG( KEngineWrapperLogFile, "CEngineWrapper::RotateL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1175
#ifdef VERBOSE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1176
    LOGFMT( KEngineWrapperLogFile, "\taRot: %d", (TInt)aRot);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1177
#endif // VERBOSE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1178
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1179
    //  Check that the model is found
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1180
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1181
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1182
        LOG ( KEngineWrapperLogFile, "Rotation: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1183
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1184
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1185
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1186
    //  Set undo / redo point
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1187
    AddUndoRedoStepL ();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1188
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1189
    //  Add rotate filter
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1190
    AddRotateFilterL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1191
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1192
    //  Set rotation pars
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1193
    TBuf<128> cmd;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1194
	cmd.Copy (_L("angle "));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1195
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1196
    if ( ERotationCounterClockwise == aRot )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1197
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1198
		cmd.AppendNum (270);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1199
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1200
    else if ( ERotationClockwise == aRot )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1201
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1202
		cmd.AppendNum (90);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1203
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1204
    else if ( ERotation180 == aRot )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1205
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1206
		cmd.AppendNum (180);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1207
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1208
    else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1209
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1210
        User::Leave (KErrArgument);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1211
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1212
    SetParamsL (cmd);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1213
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1214
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1215
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1216
EXPORT_C CSystemParameters * CEngineWrapper::GetSystemPars ()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1217
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1218
	LOG( KEngineWrapperLogFile, "CEngineWrapper::GetSystemPars" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1219
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1220
	ComputeSystemParameters();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1221
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1222
    return iSysPars;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1223
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1224
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1225
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1226
void CEngineWrapper::ComputeSystemParameters ()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1227
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1228
	LOG( KEngineWrapperLogFile, "CEngineWrapper::ComputeSystemParameters" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1229
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1230
	    //  Check that the model is found
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1231
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1232
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1233
        LOG ( KEngineWrapperLogFile, "GetSystemPars: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1234
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1235
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1236
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1237
	MImageFilter * filter = iMainEngine->Filter(iMainEngine->NumFilters() - 3);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1238
	TSize size = filter->ViewPortSize();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1239
	iSysPars->ViewPortRect().iTl.iX = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1240
	iSysPars->ViewPortRect().iTl.iY = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1241
	iSysPars->ViewPortRect().iBr.iX = size.iWidth;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1242
	iSysPars->ViewPortRect().iBr.iY = size.iHeight;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1243
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1244
    LOGFMT( KEngineWrapperLogFile, "ViewPortRect().iTl.iX: %d", iSysPars->ViewPortRect().iTl.iX );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1245
    LOGFMT( KEngineWrapperLogFile, "ViewPortRect().iTl.iY: %d", iSysPars->ViewPortRect().iTl.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1246
    LOGFMT( KEngineWrapperLogFile, "ViewPortRect().iBr.iX: %d", iSysPars->ViewPortRect().iBr.iX );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1247
    LOGFMT( KEngineWrapperLogFile, "ViewPortRect().iBr.iY: %d", iSysPars->ViewPortRect().iBr.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1248
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1249
	iSysPars->VisibleImageRect() = filter->Rect();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1250
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1251
    LOGFMT( KEngineWrapperLogFile, "VisibleImageRect().iTl.iX: %d", iSysPars->VisibleImageRect().iTl.iX );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1252
    LOGFMT( KEngineWrapperLogFile, "VisibleImageRect().iTl.iY: %d", iSysPars->VisibleImageRect().iTl.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1253
    LOGFMT( KEngineWrapperLogFile, "VisibleImageRect().iBr.iX: %d", iSysPars->VisibleImageRect().iBr.iX );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1254
    LOGFMT( KEngineWrapperLogFile, "VisibleImageRect().iBr.iY: %d", iSysPars->VisibleImageRect().iBr.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1255
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1256
    // Get the relative scale of the topmost filter
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1257
    iSysPars->RelScale() = filter->Scale();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1258
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1259
	LOGFMT( KEngineWrapperLogFile, "RelScale(): %f", iSysPars->RelScale() );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1260
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1261
	TInt n = iMainEngine->NumFilters();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1262
	if ( n > 3 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1263
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1264
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1265
		TRect rect;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1266
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1267
		TSize srcsize = iMainEngine->Filter(n - 3)->Rect().Size();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1268
		TSize tgtsize = iMainEngine->Filter(n - 1)->Rect().Size();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1269
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1270
		//	Compute aspect ratio of the source
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1271
		TInt ars = (TReal)(srcsize.iWidth << KScaleBits) / srcsize.iHeight + 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1272
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1273
		//	Compute aspect ratio of the target
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1274
		TInt art = (TReal)(tgtsize.iWidth << KScaleBits) / tgtsize.iHeight + 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1275
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1276
		//	Select scale so that aspect ratio is preserved
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1277
		if ( ars >= art )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1278
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1279
			TInt scale = (TReal)(tgtsize.iWidth << KScaleBits) / srcsize.iWidth + 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1280
			rect.iTl.iX = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1281
			rect.iBr.iX = tgtsize.iWidth;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1282
			TInt h = (srcsize.iHeight * scale) >> KScaleBits;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1283
			rect.iTl.iY = (TReal)(tgtsize.iHeight - h) / 2 + 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1284
			rect.iBr.iY = (TReal)(tgtsize.iHeight + h) / 2 + 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1285
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1286
		else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1287
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1288
			TInt scale = (TReal)(tgtsize.iHeight << KScaleBits) / srcsize.iHeight + 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1289
			rect.iTl.iY = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1290
			rect.iBr.iY = tgtsize.iHeight;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1291
			TInt w = (srcsize.iWidth * scale) >> KScaleBits;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1292
			rect.iTl.iX = (TReal)(tgtsize.iWidth - w) / 2 + 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1293
			rect.iBr.iX = (TReal)(tgtsize.iWidth + w) / 2 + 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1294
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1295
   	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1296
		iSysPars->VisibleImageRectPrev() = rect;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1297
   		
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1298
	    LOGFMT( KEngineWrapperLogFile, "VisibleImageRectPrev().iTl.iX: %d", iSysPars->VisibleImageRectPrev().iTl.iX );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1299
	    LOGFMT( KEngineWrapperLogFile, "VisibleImageRectPrev().iTl.iY: %d", iSysPars->VisibleImageRectPrev().iTl.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1300
	    LOGFMT( KEngineWrapperLogFile, "VisibleImageRectPrev().iBr.iX: %d", iSysPars->VisibleImageRectPrev().iBr.iX );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1301
	    LOGFMT( KEngineWrapperLogFile, "VisibleImageRectPrev().iBr.iY: %d", iSysPars->VisibleImageRectPrev().iBr.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1302
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1303
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1304
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1305
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1306
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1307
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1308
EXPORT_C void CEngineWrapper::GetOutputImageSize ( TInt& /*aWidth*/, TInt& /*aHeight*/ ) const
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1309
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1310
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1311
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1312
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1313
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1314
EXPORT_C void CEngineWrapper::SetJpegCommentL (const TDesC8& /*aComment*/)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1315
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1316
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::SetJpegComment" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1317
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1318
    //  Check that the model is found
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1319
    if ( !iMainEngine )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1320
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1321
        LOG ( KEngineWrapperLogFile, "SetJpegComment: iMainEngine not created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1322
        User::Panic (KEnginePanic, KEnginePanicAllocation);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1323
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1324
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1325
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1326
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1327
void CEngineWrapper::AddRotateFilterL()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1328
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1329
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::AddRotateFilterL()" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1330
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1331
    //  Add filter to engine
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1332
    AddFilterL (KFilterRotate);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1333
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1334
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1335
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1336
TRect CEngineWrapper::ComputeViewPort (const TInt /*aStartInd*/)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1337
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1338
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::ComputeViewPort()" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1339
    return TRect();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1340
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1341
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1342
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1343
TRect CEngineWrapper::ComputeVisibleViewPort (const TRect & /*aViewPort*/)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1344
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1345
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::ComputeVisibleViewPort()" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1346
	return TRect(0,0,0,0);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1347
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1348
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1349
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1350
TPoint CEngineWrapper::ComputeNewPanValue (const TRect & /*aVvpOld*/)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1351
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1352
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::ComputeNewPanValue()" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1353
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1354
	return TPoint();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1355
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1356
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1357
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1358
void CEngineWrapper::CopyBufferL (TUint32 * aBuffer)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1359
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1360
    LOG( KEngineWrapperLogFile, "CEngineWrapper::CopyBufferL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1361
    
8
18b321db4884 *m enhance
qifeima <>
parents: 1
diff changeset
  1362
//	iScreenBitmap->LockHeapLC();
1
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1363
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1364
	TSize size = iScreenBitmap->SizeInPixels();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1365
	TDisplayMode dmode = iScreenBitmap->DisplayMode();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1366
	TInt ws = iScreenBitmap->ScanLineLength (size.iWidth, dmode);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1367
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1368
	TUint8 * tpos = (TUint8*)( iScreenBitmap->DataAddress() );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1369
	TUint8 * tp;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1370
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1371
	for ( TInt y = 0; y < size.iHeight; y++ )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1372
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1373
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1374
		tp = tpos;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1375
		tpos += ws;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1376
		
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1377
		for ( TInt x = 0; x < size.iWidth; x++ )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1378
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1379
			TUint32 c = *aBuffer++;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1380
			*tp++ = c & 0xFF;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1381
			c >>= 8;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1382
			*tp++ = c & 0xFF;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1383
			c >>= 8;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1384
			*tp++ = c & 0xFF;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1385
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1386
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1387
8
18b321db4884 *m enhance
qifeima <>
parents: 1
diff changeset
  1388
//	CleanupStack::PopAndDestroy(); // iScreenBitmap->LockHeapLC	
1
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1389
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1390
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1391
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1392
TBool CEngineWrapper::IsSameString (
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1393
	const TUint8 *		aString1, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1394
	const TUint8 *		aString2
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1395
	)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1396
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1397
	TPtrC8 s1( (TUint8*)aString1 );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1398
	TPtrC8 s2( (TUint8*)aString2);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1399
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1400
	if ( s1.Compare( s2 ) == 0 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1401
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1402
		return ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1403
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1404
	else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1405
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1406
		return EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1407
	}		
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1408
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1409
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1410
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1411
void CEngineWrapper::UpdateCropRectL ()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1412
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1413
    LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateCropRect" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1414
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1415
    TSize screensize = iScreenSize;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1416
    TSize imagesize = iBoundingRect.Size();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1417
	TRect croprect = iBoundingRect;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1418
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1419
	if (iScale != 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1420
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1421
	    //  check rotation
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1422
	    TInt angle = ComputeRotationL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1423
	    TSize cropsize = imagesize;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1424
	    TReal sw = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1425
	    TReal sh = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1426
	    if ((angle == 90) || (angle == 270))
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1427
	    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1428
	        cropsize.iWidth = imagesize.iWidth;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1429
	        cropsize.iHeight = (TReal)(screensize.iWidth * imagesize.iWidth) / screensize.iHeight + 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1430
	        TReal ari = (TReal)cropsize.iWidth / cropsize.iHeight;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1431
	        TReal ars = (TReal)screensize.iWidth / screensize.iHeight;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1432
	        if (ari >= ars)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1433
	        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1434
	            sw = 0.5 * iScale * cropsize.iWidth;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1435
	            sh = 0.5 * iScale * cropsize.iHeight;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1436
	        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1437
	        else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1438
	        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1439
	            sh = 0.5 * iScale * cropsize.iHeight;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1440
	            sw = 0.5 * iScale * cropsize.iWidth;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1441
	        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1442
	    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1443
	    else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1444
	    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1445
	        TReal ari = (TReal)cropsize.iWidth / cropsize.iHeight;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1446
	        TReal ars = (TReal)screensize.iWidth / screensize.iHeight;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1447
	        if (ari >= ars)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1448
	        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1449
	            sw = 0.5 * iScale * cropsize.iWidth;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1450
	            sh = 0.5 * iScale * (cropsize.iWidth / ars);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1451
	        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1452
	        else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1453
	        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1454
	            sh = 0.5 * iScale * cropsize.iHeight;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1455
	            sw = 0.5 * iScale * (cropsize.iHeight * ars);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1456
	        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1457
	    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1458
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1459
	    //  clip pan
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1460
	    if (iPanX - sw < iBoundingRect.iTl.iX)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1461
	    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1462
	    	if (iScale == 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1463
	    	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1464
	    		iPanX = (iBoundingRect.iTl.iX + iBoundingRect.iBr.iX) / 2;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1465
	    	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1466
	    	else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1467
	    	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1468
	        	iPanX = iBoundingRect.iTl.iX + sw;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1469
	    	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1470
	    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1471
	    else if (iPanX + sw > iBoundingRect.iBr.iX)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1472
	    {   
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1473
	    	if (iScale == 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1474
	    	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1475
	    		iPanX = (iBoundingRect.iTl.iX + iBoundingRect.iBr.iX) / 2;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1476
	    	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1477
	    	else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1478
	    	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1479
	        	iPanX = iBoundingRect.iBr.iX - sw;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1480
	    	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1481
	    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1482
	    if (iPanY - sh < iBoundingRect.iTl.iY)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1483
	    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1484
	    	if (iScale == 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1485
	    	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1486
	    		iPanY = (iBoundingRect.iTl.iY + iBoundingRect.iBr.iY) / 2;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1487
	    	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1488
	    	else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1489
	    	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1490
	        	iPanY = iBoundingRect.iTl.iY + sh;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1491
	    	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1492
	    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1493
	    else if (iPanY + sh > iBoundingRect.iBr.iY)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1494
	    {   
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1495
	    	if (iScale == 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1496
	    	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1497
	    		iPanY = (iBoundingRect.iTl.iY + iBoundingRect.iBr.iY) / 2;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1498
	    	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1499
	    	else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1500
	    	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1501
	        	iPanY = iBoundingRect.iBr.iY - sh;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1502
	    	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1503
	    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1504
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1505
	    //  scale rect
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1506
	    croprect = TRect(iPanX - sw, iPanY - sh, iPanX + sw, iPanY + sh);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1507
	    if (croprect.iTl.iX < iBoundingRect.iTl.iX)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1508
	    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1509
	        croprect.iTl.iX = iBoundingRect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1510
	    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1511
	    if (croprect.iTl.iY < iBoundingRect.iTl.iY)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1512
	    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1513
	        croprect.iTl.iY = iBoundingRect.iTl.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1514
	    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1515
	    if (croprect.iBr.iX > iBoundingRect.iBr.iX)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1516
	    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1517
	        croprect.iBr.iX = iBoundingRect.iBr.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1518
	    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1519
	    if (croprect.iBr.iY > iBoundingRect.iBr.iY)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1520
	    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1521
	        croprect.iBr.iY = iBoundingRect.iBr.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1522
	    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1523
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1524
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1525
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1526
	if (croprect != iOldCropRect)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1527
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1528
		//	Update crop rectangle
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1529
		iCmd.Format( _L("ulc %d ulr %d lrc %d lrr %d"), croprect.iTl.iX, croprect.iTl.iY, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1530
			croprect.iBr.iX, croprect.iBr.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1531
		LOGDES (KEngineWrapperLogFile, iCmd);			
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1532
		iMainEngine->FunctionL ( 0, iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1533
		iRenderScaleBuffer = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1534
		iOldCropRect = croprect;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1535
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1536
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1537
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1538
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1539
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1540
TPtrC8 CEngineWrapper::UpdateExifThumbnailL ()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1541
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1542
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifThumbnailL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1543
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1544
	//	Create Jpeg encoder for memory buffer
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1545
	MJpegSave * encoder = JpegSaveFactory::CreateJpegSaveLC (0,0);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1546
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1547
    LOG ( KEngineWrapperLogFile, "UpdateExifThumbnailL::0" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1548
 	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1549
	// 	Initialize saving
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1550
	encoder->StartSaveL (iThumbSize, TPtr8(0,0), 65536, KThumbnailJpegQuality);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1551
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1552
    LOG ( KEngineWrapperLogFile, "UpdateExifThumbnailL::1" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1553
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1554
	// 	Save in blocks
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1555
	TBitmapHandle bmBlock;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1556
	bmBlock.iData = new (ELeave) TUint32 [16 * 8];
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1557
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1558
    LOG ( KEngineWrapperLogFile, "UpdateExifThumbnailL::2" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1559
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1560
	for (TInt y = 0; y < iThumbSize.iHeight; y += 8)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1561
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1562
		for (TInt x = 0; x < iThumbSize.iWidth; x += 16)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1563
		{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1564
		
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1565
			TInt lastY = y + 8;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1566
			if (lastY >= iThumbSize.iHeight)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1567
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1568
				lastY = iThumbSize.iHeight - 1;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1569
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1570
			TInt lastX = x + 16;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1571
			if (lastX >= iThumbSize.iWidth)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1572
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1573
				lastX = iThumbSize.iWidth - 1;			
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1574
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1575
			
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1576
			TUint32 * pDOS = (TUint32 *)bmBlock.iData;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1577
			TUint32 * pSOS = iThumb + y * iThumbSize.iWidth + x;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1578
			
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1579
			for (TInt yy = y; yy < lastY; yy++ )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1580
			{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1581
			
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1582
				TUint32 * pD = pDOS;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1583
				pDOS += 16;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1584
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1585
				TUint32 * pS = pSOS;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1586
				pSOS += iThumbSize.iWidth;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1587
				
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1588
				for (TInt xx = x; xx < lastX; xx++ )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1589
				{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1590
					*pD++ = *pS++;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1591
				}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1592
			}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1593
		
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1594
		
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1595
			encoder->SaveBlock (bmBlock);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1596
		}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1597
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1598
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1599
    LOG ( KEngineWrapperLogFile, "UpdateExifThumbnailL::3" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1600
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1601
	delete (TUint32 *)bmBlock.iData;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1602
	bmBlock.iData = NULL;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1603
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1604
    LOG ( KEngineWrapperLogFile, "UpdateExifThumbnailL::4" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1605
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1606
	TPtrC8 thumbNail = encoder->Finalize();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1607
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1608
    LOG ( KEngineWrapperLogFile, "UpdateExifThumbnailL::5" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1609
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1610
	TPtrC8 exif = iExifParser->SaveL (thumbNail);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1611
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1612
    LOG ( KEngineWrapperLogFile, "UpdateExifThumbnailL::6" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1613
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1614
	CleanupStack::PopAndDestroy (); // encoder
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1615
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1616
	return exif;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1617
}    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1618
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1619
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1620
void CEngineWrapper::UpdateExifTagsL()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1621
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1622
    LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1623
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1624
    // DateTime 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1625
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- DateTime" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1626
    TBuf8<64> dateTimeBuf;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1627
    GetCurrentDateTime ( dateTimeBuf );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1628
    iExifParser->DeleteTag ( CExifParser::EIfd0, 0x0132);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1629
    iExifParser->AddTagL ( CExifParser::EIfd0, 0x0132, dateTimeBuf.PtrZ());
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1630
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1631
    TInt n = iMainEngine->NumFilters();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1632
    MImageFilter * filter = iMainEngine->Filter(n - 2);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1633
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1634
	TInt targetWidth = (TReal)(filter->ViewPortSize().iWidth * iSysPars->Scale()) + 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1635
	TInt targetHeight = (TReal)(filter->ViewPortSize().iHeight * iSysPars->Scale()) + 0.5;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1636
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1637
    // ImageWidth - not needed  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1638
    iExifParser->DeleteTag ( CExifParser::EIfd0, 0x0100);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1639
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1640
    // ImageHeight - not needed  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1641
    iExifParser->DeleteTag ( CExifParser::EIfd0, 0x0101);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1642
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1643
    // Orientation
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1644
    if ( !iExifParser->TagExist (CExifParser::EIfd0, 0x0112) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1645
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1646
    	LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- Orientation" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1647
    	iExifParser->AddTagL ( CExifParser::EIfd0, 0x0112, (TUint16)1);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1648
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1649
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1650
    // EXIF version 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1651
    TUint8 exifVersion [] = "0220";
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1652
    if ( !iExifParser->TagExist (CExifParser::ESubIfd, 0x9000) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1653
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1654
	   	LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- ExifVersion" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1655
	    iExifParser->AddTagL ( CExifParser::ESubIfd, 0x9000, TPtrC8 (exifVersion));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1656
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1657
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1658
    // FlashPixVersion
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1659
    TUint8 flashPixVersion [] = "0100";
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1660
    if ( !iExifParser->TagExist (CExifParser::ESubIfd, 0xA000) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1661
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1662
	    LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- FlashPixVersion" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1663
	    iExifParser->DeleteTag ( CExifParser::ESubIfd, 0xA000);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1664
	    iExifParser->AddTagL ( CExifParser::ESubIfd, 0xA000, TPtrC8 (flashPixVersion));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1665
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1666
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1667
    // ComponentsConfiguration
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1668
    TUint8 exifComponentsConfiguration [4] = {1,2,3,0};
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1669
    LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- ComponentsConfiguration" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1670
    iExifParser->DeleteTag ( CExifParser::ESubIfd, 0x9101);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1671
    iExifParser->AddTagL ( CExifParser::ESubIfd, 0x9101, TPtrC8(exifComponentsConfiguration, 4));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1672
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1673
    // ColorSpace 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1674
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- ColorSpace" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1675
    iExifParser->DeleteTag ( CExifParser::ESubIfd, 0xA001);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1676
    iExifParser->AddTagL ( CExifParser::ESubIfd, 0xA001, (TUint16)1);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1677
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1678
    // Interoperability index 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1679
    iExifParser->DeleteTag ( CExifParser::EInteroperability, 0x0001);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1680
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1681
    // PixelXResolution 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1682
    LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- PlaneXResolution" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1683
    iExifParser->DeleteTag ( CExifParser::ESubIfd, 0xA002);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1684
    iExifParser->AddTagL ( CExifParser::ESubIfd, 0xA002,(TUint32)targetWidth);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1685
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1686
    // PixelYResolution 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1687
    LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- PlaneYResolution" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1688
    iExifParser->DeleteTag ( CExifParser::ESubIfd, 0xA003);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1689
    iExifParser->AddTagL ( CExifParser::ESubIfd, 0xA003, (TUint32)targetHeight);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1690
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1691
    // FocalPlaneResolutionUnit
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1692
    iExifParser->DeleteTag ( CExifParser::ESubIfd, 0xA210);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1693
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1694
    // FocalPlaneXResolution 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1695
    iExifParser->DeleteTag ( CExifParser::ESubIfd, 0xA20E);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1696
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1697
    // FocalPlaneYResolution 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1698
    iExifParser->DeleteTag ( CExifParser::ESubIfd, 0xA20F);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1699
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1700
    // User Comment 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1701
    TBuf8<256> comment;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1702
    TUint8 KCharCode[8] = {0x41,0x53,0x43,0x49,0x49,0x00,0x00,0x00}; // ASCII char code
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1703
	comment.Append(TPtrC8(KCharCode, 8));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1704
    comment.AppendFormat(KImageEditorExifComment, my_version_major, my_version_minor, my_version_build);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1705
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1706
    LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- UserComment" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1707
    iExifParser->DeleteTag ( CExifParser::ESubIfd, 0x9286);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1708
    iExifParser->AddTagL ( CExifParser::ESubIfd, 0x9286, comment);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1709
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1710
    TBuf8<128> make;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1711
    TBuf8<128> model;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1712
    ImageEditorUtils::GetMakeAndModelL ( make, model );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1713
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1714
    // Make
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1715
    if ( !iExifParser->TagExist (CExifParser::EIfd0, 0x010F) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1716
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1717
    	LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- Make updated" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1718
	    iExifParser->AddTagL ( CExifParser::EIfd0, 0x010F, make.PtrZ());
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1719
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1720
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1721
    // Model
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1722
    if ( !iExifParser->TagExist (CExifParser::EIfd0, 0x0110) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1723
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1724
    	LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- Model updated" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1725
	    iExifParser->AddTagL ( CExifParser::EIfd0, 0x0110, model.PtrZ());
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1726
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1727
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1728
    // DateTimeOriginal
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1729
    if ( !iExifParser->TagExist (CExifParser::ESubIfd, 0x9003) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1730
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1731
    	LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- DateTimeOriginal updated" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1732
	    iExifParser->AddTagL ( CExifParser::ESubIfd, 0x9003, dateTimeBuf.PtrZ());
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1733
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1734
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1735
    // DateTimeDigitized
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1736
    if ( !iExifParser->TagExist (CExifParser::ESubIfd, 0x9004) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1737
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1738
    	LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- DateTimeDigitized updated" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1739
	    iExifParser->AddTagL ( CExifParser::ESubIfd, 0x9004, dateTimeBuf.PtrZ());
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1740
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1741
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1742
    // XResolution
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1743
    LOG ( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- XResolution" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1744
    if ( !iExifParser->TagExist (CExifParser::EIfd0, 0x011A) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1745
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1746
    	iExifParser->AddTagL ( CExifParser::EIfd0, 0x011A, (TUint32)300, (TUint32)1);	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1747
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1748
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1749
    // YResolution
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1750
    LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- YResolution" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1751
    if ( !iExifParser->TagExist (CExifParser::EIfd0, 0x011B) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1752
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1753
    	iExifParser->AddTagL ( CExifParser::EIfd0, 0x011B, (TUint32)300, (TUint32)1);	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1754
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1755
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1756
    // ResolutionUnit
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1757
    LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- ResolutionUnit" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1758
    if ( !iExifParser->TagExist (CExifParser::EIfd0, 0x0128) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1759
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1760
    	iExifParser->AddTagL ( CExifParser::EIfd0, 0x0128, (TUint16)2 ); 	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1761
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1762
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1763
    // YCbCrPositioning
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1764
    LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- YCbCrPositioning" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1765
    if ( !iExifParser->TagExist (CExifParser::EIfd0, 0x0213) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1766
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1767
    	iExifParser->AddTagL ( CExifParser::EIfd0, 0x0213, (TUint16)1 ); 	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1768
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1769
  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1770
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1771
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1772
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1773
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1774
void CEngineWrapper::GetCurrentDateTime (TDes8 & aDateTimeBuf) const
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1775
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1776
    // Time in microseconds since 0 AD nominal Gregorian
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1777
    TTime time;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1778
    // year-month-day-hour-minute-second-microsecond
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1779
    TDateTime dateTime;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1780
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1781
    // Get current local time
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1782
    time.HomeTime();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1783
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1784
    // Convert to fields
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1785
    dateTime = time.DateTime();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1786
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1787
    // Create descriptors for the components.
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1788
    // This is needed because the leading zeros 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1789
    // cannotbe suppressed.
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1790
    TBuf8<2> month;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1791
    TBuf8<2> day;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1792
    TBuf8<2> hour;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1793
    TBuf8<2> minute;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1794
    TBuf8<2> second;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1795
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1796
    if( TInt(dateTime.Month()) < 9 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1797
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1798
        month.AppendNum( 0 );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1799
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1800
    month.AppendNum( TInt(dateTime.Month()+1) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1801
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1802
    if( dateTime.Day() < 9 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1803
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1804
        day.AppendNum( 0 );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1805
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1806
    day.AppendNum( dateTime.Day()+1 );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1807
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1808
    if( dateTime.Hour() < 10 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1809
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1810
        hour.AppendNum( 0 );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1811
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1812
    hour.AppendNum( dateTime.Hour() );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1813
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1814
    if( dateTime.Minute() < 10 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1815
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1816
        minute.AppendNum( 0 );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1817
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1818
    minute.AppendNum( dateTime.Minute() );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1819
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1820
    if( dateTime.Second() < 10 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1821
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1822
        second.AppendNum( 0 );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1823
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1824
    second.AppendNum( dateTime.Second() );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1825
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1826
    // Format the time to the format
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1827
    // "YYYY:MM:DD HH:MM:SS"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1828
    _LIT8(KFormatTxt,"%d:%S:%S %S:%S:%S");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1829
    aDateTimeBuf.Format(
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1830
        KFormatTxt,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1831
        dateTime.Year(),
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1832
        &month, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1833
        &day, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1834
        &hour, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1835
        &minute, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1836
        &second
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1837
        );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1838
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1839
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1840
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1841
EXPORT_C void CEngineWrapper::SetBitmap (CFbsBitmap * aBitmap)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1842
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1843
	iScreenBitmap = aBitmap;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1844
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1845
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1846
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1847
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1848
EXPORT_C void CEngineWrapper::CreateExifThumbNailL ()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1849
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1850
    LOG( KEngineWrapperLogFile, "CEngineWrapper::CreateExifThumbNailL" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1851
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1852
#ifdef EXIF_SUPPORT    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1853
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1854
    //	Delete old thumbnail
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1855
    delete[] iThumb;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1856
    iThumb = NULL; 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1857
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1858
	//	Re-load the zoomed image if needed
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1859
	if ( iRenderScaleBuffer )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1860
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1861
		iMainEngine->FunctionL ( 0, _L("loadimage"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1862
		iRenderScaleBuffer = EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1863
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1864
	for ( TInt i = 0; i < iMainEngine->NumFilters(); ++i)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1865
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1866
		iMainEngine->FunctionL (i, _L("nop"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1867
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1868
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1869
	TReal scale = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1870
	TSize imagesize = iMainEngine->Filter(iMainEngine->NumFilters() - 3)->Rect().Size();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1871
	if (imagesize.iWidth > imagesize.iHeight)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1872
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1873
		scale = (TReal)imagesize.iWidth / KThumbnailMaxDimension;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1874
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1875
	else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1876
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1877
		scale = (TReal)imagesize.iHeight / KThumbnailMaxDimension;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1878
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1879
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1880
	//	Crete new thumbnail
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1881
	iThumbSize.iWidth = (TInt)((imagesize.iWidth / scale) + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1882
	iThumbSize.iHeight = (TInt)((imagesize.iHeight / scale) + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1883
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1884
	// Just ensure that dimension are never 0
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1885
	if (iThumbSize.iWidth == 0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1886
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1887
		iThumbSize.iWidth = 1;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1888
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1889
	if (iThumbSize.iHeight == 0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1890
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1891
		iThumbSize.iHeight = 1;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1892
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1893
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1894
    LOGFMT( KEngineWrapperLogFile, "iThumbSize.iWidth = %d", iThumbSize.iWidth);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1895
    LOGFMT( KEngineWrapperLogFile, "iThumbSize.iHeight = %d", iThumbSize.iHeight);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1896
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1897
	iThumb = new (ELeave) TUint32 [iThumbSize.iWidth * iThumbSize.iHeight];
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1898
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1899
	//	Set thumbnail size to buffer filter
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1900
	iCmd.Format( _L("width %d height %d"), iThumbSize.iWidth, iThumbSize.iHeight);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1901
	iMainEngine->FunctionL ( iMainEngine->NumFilters() - 1, iCmd );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1902
	iMainEngine->FunctionL ( iMainEngine->NumFilters() - 2, _L("nop"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1903
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1904
	//	Copy data to the new thumbnail
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1905
	TUint32 * pBuffer = (TUint32 *)iMainEngine->FunctionL (iMainEngine->NumFilters() - 1, _L("getbitmap"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1906
	Mem::Copy (iThumb, pBuffer, iThumbSize.iWidth * iThumbSize.iHeight * sizeof(TUint32));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1907
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1908
    LOG( KEngineWrapperLogFile, "EXIF thumbnail created!" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1909
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1910
#endif
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1911
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1912
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1913
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1914
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1915
TInt CEngineWrapper::ComputeRotationL ()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1916
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1917
	
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1918
	TInt angle = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1919
	TInt ind = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1920
	while ( ind < iMainEngine->NumFilters() )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1921
	{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1922
	    MImageFilter * filter = iMainEngine->Filter(ind);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1923
	    char * cmpstr = "rotate";
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1924
	    TPtrC8 type ( (const TUint8 *)filter->Type() );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1925
	    TPtrC8 typecmp ((const TUint8 *)cmpstr);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1926
	    if ( type == typecmp )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1927
	    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1928
	        angle += filter->CmdL(_L("getangle"));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1929
	    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1930
	    ind++;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1931
	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1932
	angle %= 360;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1933
	return angle;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1934
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1935
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1936
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1937
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1938
void CEngineWrapper::ComputeBoundingRectL()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1939
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1940
    MImageFilter * pFilter = iMainEngine->Filter(iMainEngine->NumFilters() - 3);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1941
    TReal relscale = pFilter->Scale();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1942
    TRect rect = pFilter->Rect();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1943
    TSize size = iMainEngine->Filter(0)->ViewPortSize();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1944
    rect.iTl.iX = (TInt)((rect.iTl.iX / relscale) + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1945
    rect.iTl.iY = (TInt)((rect.iTl.iY / relscale) + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1946
    rect.iBr.iX = (TInt)((rect.iBr.iX / relscale) + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1947
    rect.iBr.iY = (TInt)((rect.iBr.iY / relscale) + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1948
    TInt angle = ComputeRotationL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1949
 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1950
    if (angle == 90 || angle == 270)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1951
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1952
        iBoundingRect.iTl.iX = rect.iTl.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1953
        iBoundingRect.iTl.iY = rect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1954
        iBoundingRect.iBr.iX = rect.iBr.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1955
        iBoundingRect.iBr.iY = rect.iBr.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1956
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1957
    else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1958
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1959
        iBoundingRect = rect;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1960
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1961
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1962
    size = iBoundingRect.Size();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1963
    iPanX = (iBoundingRect.iTl.iX + iBoundingRect.iBr.iX) / 2;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1964
    iPanY = (iBoundingRect.iTl.iY + iBoundingRect.iBr.iY) / 2;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1965
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1966
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1967
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1968
// End of File