epoc32/include/icl/imageprocessor.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     4
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef ___IMAGEPROCESSOR_H__
williamr@2
    17
#define ___IMAGEPROCESSOR_H__
williamr@2
    18
williamr@2
    19
#include <gdi.h>
williamr@2
    20
#include <fbs.h>
williamr@2
    21
williamr@2
    22
/**
williamr@2
    23
@internalTechnology
williamr@2
    24
*/
williamr@2
    25
enum TImageBitmapUtilPanic
williamr@2
    26
	{
williamr@2
    27
	ECorrupt
williamr@2
    28
	};
williamr@2
    29
williamr@2
    30
/**
williamr@2
    31
@publishedAll
williamr@2
    32
@released
williamr@2
    33
williamr@2
    34
Interface to colour conversion classes for various display modes.
williamr@2
    35
Manages the mapping between RGB/Greyscale values and the index
williamr@2
    36
into the color palette for the given display mode.
williamr@2
    37
*/
williamr@2
    38
class TColorConvertor
williamr@2
    39
	{
williamr@2
    40
public:
williamr@2
    41
	IMPORT_C static	TColorConvertor* NewL(TDisplayMode aDisplayMode);
williamr@2
    42
williamr@2
    43
	/**
williamr@2
    44
	Returns the colour index corresponding to the supplied RGB value.
williamr@2
    45
	Operates in the context of the current display mode.
williamr@2
    46
williamr@2
    47
	This is a virtual function that each derived class must implement.
williamr@2
    48
williamr@2
    49
	@param  aColor
williamr@2
    50
	        The colour in RGB format.
williamr@2
    51
	
williamr@2
    52
	@return The colour index.
williamr@2
    53
	*/
williamr@2
    54
	virtual TInt ColorIndex(TRgb aColor) const = 0;
williamr@2
    55
williamr@2
    56
	/**
williamr@2
    57
	Returns the RGB value corresponding to the supplied colour index.
williamr@2
    58
	Operates in the context of the current display mode.
williamr@2
    59
williamr@2
    60
	This is a virtual function that each derived class must implement.
williamr@2
    61
williamr@2
    62
	@param  aColorIndex
williamr@2
    63
	        The colour in RGB format.
williamr@2
    64
williamr@2
    65
	@return The RGB value.
williamr@2
    66
	*/
williamr@2
    67
	virtual TRgb Color(TInt aColorIndex) const = 0;
williamr@2
    68
williamr@2
    69
	/**
williamr@2
    70
	Gets an array of colour indices from a corresponding array of RGB values.
williamr@2
    71
	Operates in the context of the current display mode.
williamr@2
    72
williamr@2
    73
	This is a virtual function that each derived class must implement.
williamr@2
    74
williamr@2
    75
	@param  aIndexBuffer
williamr@2
    76
	        A pointer to the first element in destination array.
williamr@2
    77
	@param  aColorBuffer
williamr@2
    78
	        A pointer to the first element in the source array.
williamr@2
    79
	@param  aCount
williamr@2
    80
	        The number of elements to get.
williamr@2
    81
	*/
williamr@2
    82
	virtual void ColorToIndex(TInt* aIndexBuffer,TRgb* aColorBuffer,TInt aCount) const = 0;
williamr@2
    83
williamr@2
    84
	inline static TInt RgbToMonochrome(TRgb aRgb);
williamr@2
    85
	};
williamr@2
    86
williamr@2
    87
williamr@2
    88
/**
williamr@2
    89
@publishedAll
williamr@2
    90
@released
williamr@2
    91
williamr@2
    92
Bitmap utility class.
williamr@2
    93
*/
williamr@2
    94
class TImageBitmapUtil
williamr@2
    95
	{
williamr@2
    96
public:
williamr@2
    97
	IMPORT_C TImageBitmapUtil();
williamr@2
    98
	IMPORT_C void Begin();
williamr@2
    99
	IMPORT_C TBool Begin(const TPoint& aPosition);
williamr@2
   100
	IMPORT_C void End();
williamr@2
   101
	IMPORT_C void SetBitmapL(CFbsBitmap* aBitmap);
williamr@2
   102
	IMPORT_C void SetPixel(TUint32 aPixelIndex);
williamr@2
   103
	IMPORT_C void SetPixels(TUint32* aPixelIndex,TInt aNumberOfPixels);
williamr@2
   104
	IMPORT_C TBool SetPos(const TPoint& aPosition);
williamr@2
   105
	
williamr@2
   106
private:
williamr@2
   107
	union TDataPointer
williamr@2
   108
		{
williamr@2
   109
		TUint32* iWordPos;
williamr@2
   110
		TUint8* iBytePos;
williamr@2
   111
		};
williamr@2
   112
private:
williamr@2
   113
	CFbsBitmap* iBitmap;
williamr@2
   114
	TSize iSize;
williamr@2
   115
	TPoint iPosition;
williamr@2
   116
	TDataPointer iData;
williamr@2
   117
	TDataPointer iBase;
williamr@2
   118
	TInt iBpp;
williamr@2
   119
	TInt iBppShift;
williamr@2
   120
	TInt iPixelShift;
williamr@2
   121
	TInt iPixelsPerWord;
williamr@2
   122
	TInt iBitShift;
williamr@2
   123
	TInt iScanlineWordLength;
williamr@2
   124
	TUint32 iMask;
williamr@2
   125
	TBool iWordAccess;
williamr@2
   126
	};
williamr@2
   127
williamr@2
   128
williamr@2
   129
class CImageProcessor;
williamr@2
   130
class CImageProcessorExtension;
williamr@2
   131
williamr@2
   132
/**
williamr@2
   133
@publishedAll
williamr@2
   134
@released
williamr@2
   135
williamr@2
   136
Utility class providing static factory functions for creating instances of
williamr@2
   137
CImageProcessor derived classes.
williamr@2
   138
*/
williamr@2
   139
class ImageProcessorUtility
williamr@2
   140
	{
williamr@2
   141
public:
williamr@2
   142
	IMPORT_C static TInt ReductionFactor(const TSize& aOriginalSize,const TSize& aReducedSize);
williamr@2
   143
	IMPORT_C static CImageProcessor* NewImageProcessorL(const CFbsBitmap& aBitmap,const TSize& aImageSize,TDisplayMode aImageDisplayMode, TBool aDisableErrorDiffusion);
williamr@2
   144
	IMPORT_C static CImageProcessor* NewImageProcessorL(const CFbsBitmap& aBitmap,TInt aReductionFactor,TDisplayMode aImageDisplayMode, TBool aDisableErrorDiffusion);
williamr@2
   145
	IMPORT_C static CImageProcessorExtension* ImageProcessorUtility::NewImageProcessorExtensionL(const CFbsBitmap& aBitmap,TInt aReductionFactor,TDisplayMode aImageDisplayMode, TBool aDisableErrorDiffusion);
williamr@2
   146
	
williamr@2
   147
private:
williamr@2
   148
	TBool static UseErrorDiffuser(const TDisplayMode& aBitmapDisplayMode, const TDisplayMode& aImageDisplayMode);
williamr@2
   149
	TBool static IsMonochrome(const TDisplayMode& aBitmapDisplayMode, const TDisplayMode& aImageDisplayMode);
williamr@2
   150
	};
williamr@2
   151
williamr@2
   152
williamr@2
   153
williamr@2
   154
/**
williamr@2
   155
@publishedAll
williamr@2
   156
@released
williamr@2
   157
williamr@2
   158
Interface to image processing classes.
williamr@2
   159
*/
williamr@2
   160
class CImageProcessor : public CBase
williamr@2
   161
	{
williamr@2
   162
public:
williamr@2
   163
	// Setup
williamr@2
   164
williamr@2
   165
	/**
williamr@2
   166
	Initialises internal data structures prior to conversion.
williamr@2
   167
williamr@2
   168
	This is a virtual function that each derived class must implement.
williamr@2
   169
williamr@2
   170
	@param  aBitmap
williamr@2
   171
	        A reference to a fully constucted bitmap with the required
williamr@2
   172
	        display mode and size.
williamr@2
   173
	@param  aImageRect
williamr@2
   174
	        The region of the image to convert.
williamr@2
   175
	*/
williamr@2
   176
	virtual void PrepareL(CFbsBitmap& aBitmap,const TRect& aImageRect) = 0;
williamr@2
   177
williamr@2
   178
	/**
williamr@2
   179
	Initialises internal data structures prior to the manipulation of the specified pixel block.
williamr@2
   180
williamr@2
   181
	This overloaded version allows specification of a block size
williamr@2
   182
	for those formats which support blocked pixel data eg. JPEG
williamr@2
   183
williamr@2
   184
	This is a virtual function that each derived class must implement.
williamr@2
   185
williamr@2
   186
	@param  aBitmap
williamr@2
   187
	        A reference to a fully constucted bitmap with the required
williamr@2
   188
	        display mode and size.
williamr@2
   189
	@param  aImageRect
williamr@2
   190
	        The region of the image to convert.
williamr@2
   191
	@param  aRgbBlockSize
williamr@2
   192
	        The size of the block to use.
williamr@2
   193
	*/
williamr@2
   194
	virtual void PrepareL(CFbsBitmap& aBitmap,const TRect& aImageRect,const TSize& aRgbBlockSize) = 0;
williamr@2
   195
williamr@2
   196
	/**
williamr@2
   197
	Sets the number of pixels by which to increment the current position in
williamr@2
   198
	the Y-axis. This is used when rendering images supporting interlacing.
williamr@2
   199
	eg GIF
williamr@2
   200
williamr@2
   201
	This is a virtual function that each derived class must implement.
williamr@2
   202
williamr@2
   203
	@param  aYInc
williamr@2
   204
	        The number of pixels.
williamr@2
   205
	*/
williamr@2
   206
	virtual void SetYPosIncrement(TInt aYInc) = 0;
williamr@2
   207
williamr@2
   208
	/**
williamr@2
   209
	Sets the number times the current line should be repeated. The lines
williamr@2
   210
	are repeated in the same direction as set by SetYPosIncrement(). This
williamr@2
   211
	is used to fill blank lines when rendering interlaced images. eg GIF.
williamr@2
   212
	@param aLineRepeat The number of times the current line should be repeated
williamr@2
   213
	*/
williamr@2
   214
	virtual void SetLineRepeat(TInt aLineRepeat) = 0;
williamr@2
   215
williamr@2
   216
	/**
williamr@2
   217
	Sets the pixel padding to the value specified by aNumberOfPixels.
williamr@2
   218
williamr@2
   219
	This is a virtual function that each derived class must implement.
williamr@2
   220
williamr@2
   221
	@param  aNumberOfPixels
williamr@2
   222
	        The number of pixels to use for padding.
williamr@2
   223
	*/
williamr@2
   224
	virtual void SetPixelPadding(TInt aNumberOfPixels) = 0;
williamr@2
   225
williamr@2
   226
	// Color pixel writing
williamr@2
   227
williamr@2
   228
	/**
williamr@2
   229
	Sets the pixel at the current position to aColor.
williamr@2
   230
williamr@2
   231
	This is a virtual function that each derived class must implement.
williamr@2
   232
	
williamr@2
   233
	@post    
williamr@2
   234
	The current position is updated.
williamr@2
   235
williamr@2
   236
	@param  aColor
williamr@2
   237
	        The RGB value to set the current pixel to.
williamr@2
   238
williamr@2
   239
	@return A boolean indicating if the operation was successful. ETrue if the operation succeeded, 
williamr@2
   240
            otherwise EFalse.
williamr@2
   241
    */
williamr@2
   242
	virtual TBool SetPixel(TRgb aColor) = 0;
williamr@2
   243
williamr@2
   244
	/**
williamr@2
   245
	Sets aCount number of pixels to the value given by aColor, starting at
williamr@2
   246
	the current position.
williamr@2
   247
williamr@2
   248
	This is a virtual function that each derived class must implement.
williamr@2
   249
williamr@2
   250
	@post    
williamr@2
   251
	On success, the current position is updated.
williamr@2
   252
williamr@2
   253
	@param  aColor
williamr@2
   254
	        The RGB value to set the pixels to.
williamr@2
   255
	@param  aCount
williamr@2
   256
	        The number of pixels to set.
williamr@2
   257
williamr@2
   258
	@return A boolean indicating if the operation was successful. ETrue if the operation succeeded, 
williamr@2
   259
	        otherwise EFalse.
williamr@2
   260
	*/
williamr@2
   261
	virtual TBool SetPixelRun(TRgb aColor,TInt aCount) = 0;
williamr@2
   262
williamr@2
   263
	/**
williamr@2
   264
	Updates the bitmap with colour information from the array of colour values.
williamr@2
   265
williamr@2
   266
	Uses the array of colour values supplied by aColorBuffer, whose length
williamr@2
   267
	is specified by aBufferLength, to update successive pixels with values in the
williamr@2
   268
	buffer, starting at the current	position.
williamr@2
   269
williamr@2
   270
	This is a virtual function that each derived class must implement.
williamr@2
   271
	
williamr@2
   272
	@post   
williamr@2
   273
	The current position is updated.
williamr@2
   274
williamr@2
   275
	@param  aColorBuffer
williamr@2
   276
	        A pointer to the first element in the array.
williamr@2
   277
	@param  aBufferLength
williamr@2
   278
	        The number of elements in the array.
williamr@2
   279
williamr@2
   280
	@return A boolean indicating if the operation was successful. ETrue if the operation succeeded, 
williamr@2
   281
	        otherwise EFalse.
williamr@2
   282
	*/
williamr@2
   283
	virtual TBool SetPixels(TRgb* aColorBuffer,TInt aBufferLength) = 0;
williamr@2
   284
williamr@2
   285
    /**
williamr@2
   286
    Sets the current pixel block using the data supplied in aColorBuffer.
williamr@2
   287
williamr@2
   288
	Note:
williamr@2
   289
	For use with image types that support blocking of pixels eg JPEG.
williamr@2
   290
williamr@2
   291
	This is a virtual function that each derived class must implement.
williamr@2
   292
williamr@2
   293
	@param  aColorBuffer
williamr@2
   294
	        A pointer to a buffer representing a block of pixel color values.
williamr@2
   295
williamr@2
   296
	@return A boolean indicating if the operation was successful. ETrue if the operation succeeded, 
williamr@2
   297
	        otherwise EFalse.
williamr@2
   298
	*/
williamr@2
   299
	virtual TBool SetPixelBlock(TRgb* aColorBuffer) = 0;
williamr@2
   300
williamr@2
   301
	// Monochrome pixel writing
williamr@2
   302
williamr@2
   303
	/**
williamr@2
   304
	Sets the pixel at the current position to aGray256.
williamr@2
   305
williamr@2
   306
	This is a virtual function that each derived class must implement.
williamr@2
   307
williamr@2
   308
    @post   
williamr@2
   309
	The current position is updated.
williamr@2
   310
williamr@2
   311
	@param  aGray256
williamr@2
   312
	        The greyscale value to set the current pixel to.
williamr@2
   313
williamr@2
   314
	@return A boolean indicating if the operation was successful. ETrue if the operation succeeded, 
williamr@2
   315
	        otherwise EFalse.
williamr@2
   316
	*/
williamr@2
   317
	virtual TBool SetMonoPixel(TInt aGray256) = 0;
williamr@2
   318
williamr@2
   319
	/**
williamr@2
   320
	Sets the number of pixels specified by aCount to the value given by aGray256, starting at
williamr@2
   321
	the current position.
williamr@2
   322
williamr@2
   323
	This is a virtual function that each derived class must implement.
williamr@2
   324
	
williamr@2
   325
	@post   
williamr@2
   326
	The current position is updated.
williamr@2
   327
williamr@2
   328
	@param  aGray256
williamr@2
   329
	        The greyscale value to set the pixels to.
williamr@2
   330
	@param  aCount
williamr@2
   331
	        The number of pixels to set.
williamr@2
   332
williamr@2
   333
	@return A boolean indicating if the operation was successful. ETrue if the operation succeeded, 
williamr@2
   334
	        otherwise EFalse.
williamr@2
   335
	*/
williamr@2
   336
	virtual TBool SetMonoPixelRun(TInt aGray256,TInt aCount) = 0;
williamr@2
   337
williamr@2
   338
	/**
williamr@2
   339
	Updates the bitmap with greyscale information from the array of greyscale values.
williamr@2
   340
williamr@2
   341
	The array of values supplied by aGray256Buffer, whose length
williamr@2
   342
	is specified in aBufferLength, is used to update successive pixels with the
williamr@2
   343
	greyscales values.
williamr@2
   344
williamr@2
   345
	This is a virtual function that each derived class must implement.
williamr@2
   346
williamr@2
   347
	@post
williamr@2
   348
	The current position is updated.
williamr@2
   349
williamr@2
   350
	@param  aGray256Buffer
williamr@2
   351
	        A pointer to the first element in the array of greyscale values.
williamr@2
   352
	@param  aBufferLength
williamr@2
   353
	        The number of elements in the array.
williamr@2
   354
williamr@2
   355
	@return A boolean indicating if the operation was successful. ETrue if the operation succeeded, 
williamr@2
   356
	        otherwise EFalse.
williamr@2
   357
	*/
williamr@2
   358
	virtual TBool SetMonoPixels(TUint32* aGray256Buffer,TInt aBufferLength) = 0;
williamr@2
   359
williamr@2
   360
    /**
williamr@2
   361
    Sets a specified number of pixels to the specified greyscale value.
williamr@2
   362
williamr@2
   363
	For image types which support blocking of pixels eg JPEG, the current
williamr@2
   364
	pixel block is set using the data supplied in aGray256Buffer.
williamr@2
   365
williamr@2
   366
	This is a virtual function that each derived class must implement.
williamr@2
   367
williamr@2
   368
	@param  aGray256Buffer
williamr@2
   369
	        A pointer to a buffer representing a block of pixel color values.
williamr@2
   370
williamr@2
   371
	@return A boolean indicating if the operation was successful. ETrue if the operation succeeded, 
williamr@2
   372
	        otherwise EFalse.
williamr@2
   373
	*/
williamr@2
   374
	virtual TBool SetMonoPixelBlock(TUint32* aGray256Buffer) = 0;
williamr@2
   375
williamr@2
   376
	// Processor flow control
williamr@2
   377
williamr@2
   378
	/**
williamr@2
   379
	Sets the current position in the bitmap to aPosition.
williamr@2
   380
williamr@2
   381
	This is a virtual function that each derived class must implement.
williamr@2
   382
williamr@2
   383
	@param  aPosition
williamr@2
   384
	        A reference to TPoint object defining the position to move to.
williamr@2
   385
williamr@2
   386
	@return	A boolean indicating if the operation was successful. ETrue if the operation succeeded, 
williamr@2
   387
	        otherwise EFalse.
williamr@2
   388
	*/
williamr@2
   389
	virtual TBool SetPos(const TPoint& aPosition) = 0;
williamr@2
   390
williamr@2
   391
	/**
williamr@2
   392
	Commits the changes made to the current bitmap by flushing the buffer.
williamr@2
   393
williamr@2
   394
	This is a virtual function that each derived class must implement.
williamr@2
   395
williamr@2
   396
	@post
williamr@2
   397
	The current position is updated.
williamr@2
   398
williamr@2
   399
	@return	A boolean indicating if the operation was successful. ETrue if the operation succeeded, 
williamr@2
   400
	        otherwise EFalse.
williamr@2
   401
    */
williamr@2
   402
	virtual TBool FlushPixels() = 0;
williamr@2
   403
	
williamr@2
   404
private:
williamr@2
   405
	// Future proofing
williamr@2
   406
	IMPORT_C virtual void ReservedVirtual1();
williamr@2
   407
	IMPORT_C virtual void ReservedVirtual2();
williamr@2
   408
	IMPORT_C virtual void ReservedVirtual3();
williamr@2
   409
	IMPORT_C virtual void ReservedVirtual4();
williamr@2
   410
	};
williamr@2
   411
williamr@2
   412
/**
williamr@2
   413
@publishedAll
williamr@2
   414
@released
williamr@2
   415
williamr@2
   416
Flag used to determine the type of transformation which is the result of 
williamr@2
   417
single or multiple transformation operations requested via calls to
williamr@2
   418
COperationExtension::AddOperationL.
williamr@2
   419
williamr@2
   420
8 unique orientations:
williamr@2
   421
williamr@2
   422
@code
williamr@2
   423
normal  90      180     270
williamr@2
   424
00 10   01 00   11 01   10 11
williamr@2
   425
01 11   11 10   10 00   00 01
williamr@2
   426
williamr@2
   427
V flip  90      180     270
williamr@2
   428
10 00   11 10   =Hflip  =Hflip+90
williamr@2
   429
11 01   01 00
williamr@2
   430
williamr@2
   431
H flip  90      180     270
williamr@2
   432
01 11   00 01   =Vflip  =Vflip+90
williamr@2
   433
00 10   10 11
williamr@2
   434
@endcode
williamr@2
   435
williamr@2
   436
@see COperationExtension::AddOperationL
williamr@2
   437
*/
williamr@2
   438
enum TTransformOptions
williamr@2
   439
	{
williamr@2
   440
	/** Normal Decode
williamr@2
   441
	*/
williamr@2
   442
	EDecodeNormal = 0x11011000,
williamr@2
   443
williamr@2
   444
	/** Rotate 90 degrees.
williamr@2
   445
	*/
williamr@2
   446
	EDecodeRotate90	= 0x10110001,
williamr@2
   447
williamr@2
   448
	/** Rotate 180 degrees.
williamr@2
   449
	*/
williamr@2
   450
	EDecodeRotate180 = 0x00100111,
williamr@2
   451
williamr@2
   452
	/** Rotate 270 degrees.
williamr@2
   453
	*/
williamr@2
   454
	EDecodeRotate270 = 0x01001110,
williamr@2
   455
	
williamr@2
   456
	/** Horizontal flip.
williamr@2
   457
	*/
williamr@2
   458
	EDecodeHorizontalFlip = 0x10001101,
williamr@2
   459
	
williamr@2
   460
	/** Horizontal flip and rotate 90 degrees.
williamr@2
   461
	*/
williamr@2
   462
	EDecodeHorizontalFlipRotate90 = 0x11100100,
williamr@2
   463
williamr@2
   464
	/** Vertical flip.
williamr@2
   465
	*/
williamr@2
   466
	EDecodeVerticalFlip	= 0x01110010,
williamr@2
   467
williamr@2
   468
	/** Vertical flip and rotate 90 degrees.
williamr@2
   469
	*/
williamr@2
   470
	EDecodeVerticalFlipRotate90 = 0x00011011
williamr@2
   471
	};
williamr@2
   472
williamr@2
   473
williamr@2
   474
/**
williamr@2
   475
@publishedAll
williamr@2
   476
@released
williamr@2
   477
williamr@2
   478
Class that provides support for Framework Extensions.
williamr@2
   479
williamr@2
   480
@see CImageProcessor
williamr@2
   481
@see CImageReadCodec
williamr@2
   482
@see CImageDecoderPlugin
williamr@2
   483
*/
williamr@2
   484
class CImageProcessorExtension : public CImageProcessor
williamr@2
   485
	{
williamr@2
   486
public:
williamr@2
   487
	IMPORT_C virtual ~CImageProcessorExtension();
williamr@2
   488
	IMPORT_C void SetClippingRect(const TRect& aRect);
williamr@2
   489
	IMPORT_C void SetScaling(TInt aScalingCoeff);
williamr@2
   490
	IMPORT_C void SetScaling(const TSize& aDesiredSize);
williamr@2
   491
	IMPORT_C void SetOperation(TTransformOptions aOperation);
williamr@2
   492
	IMPORT_C void SetInitialScanlineSkipPadding(TInt aNumberOfScanlines);
williamr@2
   493
williamr@2
   494
protected:
williamr@2
   495
	IMPORT_C CImageProcessorExtension();
williamr@2
   496
williamr@2
   497
protected:
williamr@2
   498
	/** Clipping rectangle */
williamr@2
   499
	TRect iClippingRect;
williamr@2
   500
	/** Scaling coefficient */
williamr@2
   501
	TInt iScalingCoeff;
williamr@2
   502
	/** Desired size after scaling */
williamr@2
   503
	TSize iDesiredSize;
williamr@2
   504
	/** Operations to apply to image */
williamr@2
   505
	TTransformOptions iOperation;
williamr@2
   506
	/** Position in destination at which start rendering */
williamr@2
   507
	TPoint iStartPosition;
williamr@2
   508
	/** Position in destination at which rendering is complete */
williamr@2
   509
	TPoint iEndPosition;
williamr@2
   510
	/** An initial one-off number of scanlines to be skipped */
williamr@2
   511
	TInt iNumberOfScanlinesToSkip;
williamr@2
   512
	};
williamr@2
   513
   
williamr@2
   514
inline TInt TColorConvertor::RgbToMonochrome(TRgb aRgb)
williamr@2
   515
	{
williamr@2
   516
	TInt value = aRgb.Internal();
williamr@2
   517
	TInt r = value&0xFF0000;
williamr@2
   518
	TInt g = value&0xFF00;
williamr@2
   519
	value  = (value&0xFF)<<16;	// blue<<16
williamr@2
   520
	value += r<<1;     		// + (red<<16)*2
williamr@2
   521
	value += g<<(16+2-8);	// + (green<<16)*4
williamr@2
   522
	value += g<<(16+0-8);	// + (green<<16)
williamr@2
   523
	return value>>(16+3);	// total/8
williamr@2
   524
	}
williamr@2
   525
williamr@2
   526
#endif //___IMAGEPROCESSOR_H__