1.1 --- a/epoc32/include/imageprocessor/imageprocessor.h Wed Mar 31 12:27:01 2010 +0100
1.2 +++ b/epoc32/include/imageprocessor/imageprocessor.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -1,9 +1,9 @@
1.4 -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 // All rights reserved.
1.7 // This component and the accompanying materials are made available
1.8 -// 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
1.9 +// under the terms of "Eclipse Public License v1.0"
1.10 // which accompanies this distribution, and is available
1.11 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.13 //
1.14 // Initial Contributors:
1.15 // Nokia Corporation - initial contribution.
1.16 @@ -11,516 +11,305 @@
1.17 // Contributors:
1.18 //
1.19 // Description:
1.20 +// This is the public client API for the Image Processor Library
1.21 +//
1.22 //
1.23
1.24 -#ifndef ___IMAGEPROCESSOR_H__
1.25 -#define ___IMAGEPROCESSOR_H__
1.26 +/**
1.27 + @file
1.28 + @publishedAll
1.29 + @released
1.30 +*/
1.31
1.32 +#ifndef __IMAGE_PROCESSOR_H__
1.33 +#define __IMAGE_PROCESSOR_H__
1.34 +
1.35 +#include <e32base.h>
1.36 #include <gdi.h>
1.37 -#include <fbs.h>
1.38 +#include <icl/imagecodecdata.h>
1.39 +
1.40 +class RFs;
1.41 +class RFile;
1.42 +class TMMSource;
1.43 +class CFbsBitmap;
1.44 +class CImageFrame;
1.45 +class TSize;
1.46 +class TRgb;
1.47 +class CImagePanorama;
1.48
1.49 /**
1.50 -@internalTechnology
1.51 +@publishedAll
1.52 +@released
1.53 +Image processor namespace for image manipulation and processing.
1.54 */
1.55 -enum TImageBitmapUtilPanic
1.56 +namespace ImageProcessor
1.57 {
1.58 - ECorrupt
1.59 + class MImgProcessorObserver;
1.60 + class CImageProcessorImpl;
1.61 +
1.62 + class TEffect;
1.63 + class TPreview;
1.64 + class TOverlay;
1.65 + class TProgressInfo;
1.66 + class TInputInfo;
1.67 + class TOutputInfo;
1.68 +
1.69 +/**
1.70 +@publishedAll
1.71 +@released
1.72 +
1.73 +This class provides functions to process images. Those operations can be divided in two groups:
1.74 +- effects.
1.75 +- geometrical operations.
1.76 +
1.77 +Good examples of effects could be the Sepia effect applying shades of brown to an image, or the solarize effect
1.78 +that consists in reversing the tones of a picture and make it look like a negative.
1.79 +Good examples of geometrical operations could be Rotation or Flip.
1.80 +
1.81 +The image processor will decode and render an image:
1.82 +
1.83 +Inputs can be
1.84 +- compressed images (JPEG, GIF, PNG etc)
1.85 +- uncompressed images (CFbsBitmap and general pixel buffers e.g. YUV 4:2:0 Interleaved etc)
1.86 +
1.87 +Outputs can be
1.88 +- compressed images (JPEG, GIF, PNG etc)
1.89 +- uncompressed images (CFbsBitmap and general pixel buffers e.g. YUV 4:2:0 Interleaved etc)
1.90 +
1.91 +An intermediate generally low resolution uncompressed image providing a preview representation of the
1.92 +output of the processing is provided allowing applications to display the results of the operations
1.93 +applied without needing to fully render the image. Multiple previews are allowed.
1.94 +
1.95 +Images may be overlaid onto the main source image.
1.96 +
1.97 +The source image can be changed and the current effects and geometric oprations will be re-applied to the
1.98 +new image. The previews will be updated.
1.99 +*/
1.100 +class CImgProcessor : public CBase
1.101 + {
1.102 +public:
1.103 + /**
1.104 + Flags to control how the image is processed.
1.105 + */
1.106 + enum TOptions
1.107 + {
1.108 + /** No flag set
1.109 + */
1.110 + EOptionNone = 0x00,
1.111 + /** Effects, geometric operations and rendering are applied synchronously.
1.112 + The default is asynchronously.
1.113 + */
1.114 + EOptionSyncProcessing = 0x01,
1.115 + /** The Exif data from the source image is parsed and transferred to the
1.116 + destination image.
1.117 + */
1.118 + EOptionExifMetadataProcessing = 0x02
1.119 + };
1.120 +
1.121 + /**
1.122 + Flags to control the operations or transforms on an image.
1.123 + */
1.124 + enum TOperation
1.125 + {
1.126 + /** No operation.
1.127 + */
1.128 + EOperationNone = 0x0,
1.129 +
1.130 + /** Rotate 90 degrees clockwise.
1.131 + */
1.132 + EOperationRotate90 = 0x1,
1.133 +
1.134 + /** Rotate 180 degrees clockwise.
1.135 + */
1.136 + EOperationRotate180 = 0x2,
1.137 +
1.138 + /** Rotate 270 degrees clockwise.
1.139 + */
1.140 + EOperationRotate270 = 0x4,
1.141 +
1.142 + /** Horizontal flip (mirror over horizontal axis).
1.143 + */
1.144 + EOperationMirrorHorizontalAxis = 0x8,
1.145 +
1.146 + /** Horizontal flip (mirror over horizontal axis) then rotate 90 degrees clockwise.
1.147 + */
1.148 + EOperationMirrorHorizontalAxisRotate90 = 0x10,
1.149 +
1.150 + /** Vertical flip (mirror over vertical axis).
1.151 + */
1.152 + EOperationMirrorVerticalAxis = 0x20,
1.153 +
1.154 + /** Vertical flip (mirror over vertical axis) then rotate 90 degrees clockwise.
1.155 + */
1.156 + EOperationMirrorVerticalAxisRotate90 = 0x40
1.157 + };
1.158 +
1.159 + /**
1.160 + Possible states for the image processor.
1.161 + */
1.162 + enum TState
1.163 + {
1.164 + /** Image processor not initalized.
1.165 + */
1.166 + EUninitialized = 0,
1.167 + /** Image processor initalizing.
1.168 + */
1.169 + EInitializing,
1.170 + /** Image processor initalized.
1.171 + */
1.172 + EInitialized,
1.173 + /** Effect active.
1.174 + */
1.175 + EEffectActive,
1.176 + /** Image processor processing an image.
1.177 + */
1.178 + EProcessing,
1.179 + /** Preview initializing.
1.180 + */
1.181 + EPreviewInitializing,
1.182 + /** Preview Rendering.
1.183 + */
1.184 + EPreviewRendering,
1.185 + /** Count of valid states (boundary marker - not a true state).
1.186 + */
1.187 + EStatesCount
1.188 + };
1.189 +
1.190 + /**
1.191 + Events occurring during processing.
1.192 + */
1.193 + enum TEvent
1.194 + {
1.195 + /** The image processor is initializing.
1.196 + */
1.197 + EEventInitializing = 0,
1.198 + /** The image processor has finished initializing.
1.199 + */
1.200 + EEventInitializingComplete,
1.201 + /** Processing is in progress.
1.202 + */
1.203 + EEventProcessing,
1.204 + /** Processing is complete.
1.205 + */
1.206 + EEventProcessingComplete,
1.207 + /** Rendering is in progress.
1.208 + */
1.209 + EEventRendering,
1.210 + /** Event rendering is complete.
1.211 + */
1.212 + EEventRenderingComplete,
1.213 + /** The preview is initializing.
1.214 + */
1.215 + EEventPreviewInitializing,
1.216 + /** The preview has finished initializing.
1.217 + */
1.218 + EEventPreviewInitializingComplete,
1.219 + /** The preview rendering is in progress.
1.220 + */
1.221 + EEventPreviewRendering,
1.222 + /** The preview rendering is complete.
1.223 + */
1.224 + EEventPreviewRenderingComplete
1.225 + };
1.226 +
1.227 +public:
1.228 + IMPORT_C static CImgProcessor* NewL(RFs& aFileServerSession, MImgProcessorObserver& aObserver, TUid aImageProcessorPluginUid=KNullUid);
1.229 +
1.230 + IMPORT_C void SupportedEffectsL(RArray<TUid>& aEffects) const;
1.231 +
1.232 + IMPORT_C void SupportedInputFormatsL(RArray<TUid>& aFormats) const;
1.233 + IMPORT_C void SupportedInputSubFormatsL(TUid aFormat, RArray<TUid>& aSubFormats) const;
1.234 + IMPORT_C void SupportedInputImageFrameFormatsL(RArray<TUid>& aFormats) const;
1.235 + IMPORT_C void SupportedInputDisplayModesL(RArray<TDisplayMode>& aDisplayModes) const;
1.236 +
1.237 + IMPORT_C void SupportedOutputFormatsL(RArray<TUid>& aFormats) const;
1.238 + IMPORT_C void SupportedOutputSubFormatsL(TUid aFormat, RArray<TUid>& aSubFormats) const;
1.239 + IMPORT_C void SupportedOutputImageFrameFormatsL(RArray<TUid>& aFormats) const;
1.240 + IMPORT_C void SupportedOutputDisplayModesL(RArray<TDisplayMode>& aDisplayModes) const;
1.241 +
1.242 + IMPORT_C TUint64 SupportedOptions() const;
1.243 + IMPORT_C TUint SupportedOperations() const;
1.244 +
1.245 + IMPORT_C TUint64 Options() const;
1.246 + IMPORT_C TState State() const;
1.247 + IMPORT_C TSize CurrentSizeL() const;
1.248 + IMPORT_C TRgb BackgroundColorL() const;
1.249 +
1.250 + IMPORT_C TProgressInfo* ProgressInfoL();
1.251 + IMPORT_C TInputInfo* InputInfoL();
1.252 + IMPORT_C TOutputInfo* OutputInfoL();
1.253 +
1.254 + IMPORT_C TInt CalculatePixelBufferSizeL(TSize aSizeInPixels, TDisplayMode aDisplayMode, TUint32 aScanLineLength = 0) const;
1.255 + IMPORT_C TInt CalculatePixelBufferSizeL(TSize aSizeInPixels, const TUid& aFormat, TUint32 aScanLineLength = 0) const;
1.256 +
1.257 + IMPORT_C void CreateInputL(CFbsBitmap& aBitmap);
1.258 + IMPORT_C void CreateInputL(CImageFrame& aPixelBuffer);
1.259 + IMPORT_C void CreateInputL(const TSize& aSize, const TRgb& aColor);
1.260 +
1.261 + IMPORT_C void SetBackgroundColorL(const TRgb& aColor);
1.262 +
1.263 + IMPORT_C void SetInputRectL(const TRect& aRect);
1.264 +
1.265 + IMPORT_C void SetInputL(const TDesC& aFilename, const TUid& aFormat = KNullUid, const TUid& aSubFormat = KNullUid);
1.266 + IMPORT_C void SetInputL(RFile& aFile, const TUid& aFormat = KNullUid, const TUid& aSubFormat = KNullUid);
1.267 + IMPORT_C void SetInputL(TMMSource& aDrmFile, const TUid& aFormat = KNullUid, const TUid& aSubFormat = KNullUid);
1.268 + IMPORT_C void SetInputL(const TDesC8& aBuffer, const TUid& aFormat = KNullUid, const TUid& aSubFormat = KNullUid);
1.269 + IMPORT_C void SetInputL(const CFbsBitmap& aBitmap, const CFbsBitmap* aMask = NULL);
1.270 + IMPORT_C void SetInputL(const CImageFrame& aPixelBuffer);
1.271 + IMPORT_C void SetInputL(CImagePanorama& aPanorama);
1.272 +
1.273 + IMPORT_C void SetOptionsL(TUint64 aOptions);
1.274 + IMPORT_C void ApplyOperationL(CImgProcessor::TOperation aOperation);
1.275 +
1.276 + IMPORT_C void InputUpdatedL();
1.277 +
1.278 + IMPORT_C void ResetL();
1.279 +
1.280 + IMPORT_C void InitializeL();
1.281 + IMPORT_C void InitializeL(TUint64 aOptions);
1.282 +
1.283 + IMPORT_C void ProcessL();
1.284 + IMPORT_C void ProcessL(const TSize& aSize, TBool aMaintainAspectRatio);
1.285 + IMPORT_C void Cancel();
1.286 +
1.287 + IMPORT_C TEffect* EffectL(TUid aEffect);
1.288 +
1.289 + IMPORT_C TBool CanUndoL() const;
1.290 + IMPORT_C void UndoL();
1.291 + IMPORT_C void UndoAllL();
1.292 +
1.293 + IMPORT_C TBool CanRedoL() const;
1.294 + IMPORT_C void RedoL();
1.295 + IMPORT_C void RedoAllL();
1.296 +
1.297 + IMPORT_C TPreview* PreviewL(TInt aPreviewId);
1.298 +
1.299 + IMPORT_C TOverlay* OverlayL();
1.300 +
1.301 + IMPORT_C void SetOutputL(const TDesC& aFilename, const TUid& aFormat = KImageTypeJPGUid, const TUid& aSubFormat = KNullUid);
1.302 + IMPORT_C void SetOutputL(RFile& aFile, const TUid& aFormat = KImageTypeJPGUid, const TUid& aSubFormat = KNullUid);
1.303 + IMPORT_C void SetOutputL(RBuf8& aBuffer, const TUid& aFormat = KImageTypeJPGUid, const TUid& aSubFormat = KNullUid);
1.304 + IMPORT_C void SetOutputL(CImageFrame& aPixelBuffer);
1.305 + IMPORT_C void SetOutputL(CFbsBitmap& aBitmap, CFbsBitmap* aMask = NULL);
1.306 +
1.307 + IMPORT_C TAny* Extension(TUid aExtension);
1.308 +
1.309 + // framework utility functions
1.310 + IMPORT_C void ConvertMimeTypeToUidL(const TDesC8& aMimeType, TUid& aFormat, TUid& aSubFormat) const;
1.311 + IMPORT_C void ConvertFileExtensionToUidL(const TDesC& aFileExtension, TUid& aFormat, TUid& aSubFormat) const;
1.312 + IMPORT_C void ConvertUidToMimeTypeL(TDes8& aMimeType, const TUid& aFormat, const TUid& aSubFormat) const;
1.313 + IMPORT_C void ConvertUidToFileExtensionL(TDes& aFileExtension, const TUid& aFormat, const TUid& aSubFormat) const;
1.314 +
1.315 + IMPORT_C ~CImgProcessor();
1.316 +
1.317 +private:
1.318 + CImgProcessor();
1.319 + void ConstructL(RFs& aFileServerSession,MImgProcessorObserver& aObserver, TUid aPluginUid);
1.320 +
1.321 +private:
1.322 + CImageProcessorImpl* iImplementation;
1.323 };
1.324
1.325 -/**
1.326 -@publishedAll
1.327 -@released
1.328 + } // ImageProcessor
1.329
1.330 -Interface to colour conversion classes for various display modes.
1.331 -Manages the mapping between RGB/Greyscale values and the index
1.332 -into the color palette for the given display mode.
1.333 -*/
1.334 -class TColorConvertor
1.335 - {
1.336 -public:
1.337 - IMPORT_C static TColorConvertor* NewL(TDisplayMode aDisplayMode);
1.338 -
1.339 - /**
1.340 - Returns the colour index corresponding to the supplied RGB value.
1.341 - Operates in the context of the current display mode.
1.342 -
1.343 - This is a virtual function that each derived class must implement.
1.344 -
1.345 - @param aColor
1.346 - The colour in RGB format.
1.347 -
1.348 - @return The colour index.
1.349 - */
1.350 - virtual TInt ColorIndex(TRgb aColor) const = 0;
1.351 -
1.352 - /**
1.353 - Returns the RGB value corresponding to the supplied colour index.
1.354 - Operates in the context of the current display mode.
1.355 -
1.356 - This is a virtual function that each derived class must implement.
1.357 -
1.358 - @param aColorIndex
1.359 - The colour in RGB format.
1.360 -
1.361 - @return The RGB value.
1.362 - */
1.363 - virtual TRgb Color(TInt aColorIndex) const = 0;
1.364 -
1.365 - /**
1.366 - Gets an array of colour indices from a corresponding array of RGB values.
1.367 - Operates in the context of the current display mode.
1.368 -
1.369 - This is a virtual function that each derived class must implement.
1.370 -
1.371 - @param aIndexBuffer
1.372 - A pointer to the first element in destination array.
1.373 - @param aColorBuffer
1.374 - A pointer to the first element in the source array.
1.375 - @param aCount
1.376 - The number of elements to get.
1.377 - */
1.378 - virtual void ColorToIndex(TInt* aIndexBuffer,TRgb* aColorBuffer,TInt aCount) const = 0;
1.379 -
1.380 - inline static TInt RgbToMonochrome(TRgb aRgb);
1.381 - };
1.382 -
1.383 -
1.384 -/**
1.385 -@publishedAll
1.386 -@released
1.387 -
1.388 -Bitmap utility class.
1.389 -*/
1.390 -class TImageBitmapUtil
1.391 - {
1.392 -public:
1.393 - IMPORT_C TImageBitmapUtil();
1.394 - IMPORT_C void Begin();
1.395 - IMPORT_C TBool Begin(const TPoint& aPosition);
1.396 - IMPORT_C void End();
1.397 - IMPORT_C void SetBitmapL(CFbsBitmap* aBitmap);
1.398 - IMPORT_C void SetPixel(TUint32 aPixelIndex);
1.399 - IMPORT_C void SetPixels(TUint32* aPixelIndex,TInt aNumberOfPixels);
1.400 - IMPORT_C TBool SetPos(const TPoint& aPosition);
1.401 -
1.402 -private:
1.403 - union TDataPointer
1.404 - {
1.405 - TUint32* iWordPos;
1.406 - TUint8* iBytePos;
1.407 - };
1.408 -private:
1.409 - CFbsBitmap* iBitmap;
1.410 - TSize iSize;
1.411 - TPoint iPosition;
1.412 - TDataPointer iData;
1.413 - TDataPointer iBase;
1.414 - TInt iBpp;
1.415 - TInt iBppShift;
1.416 - TInt iPixelShift;
1.417 - TInt iPixelsPerWord;
1.418 - TInt iBitShift;
1.419 - TInt iScanlineWordLength;
1.420 - TUint32 iMask;
1.421 - TBool iWordAccess;
1.422 - };
1.423 -
1.424 -
1.425 -class CImageProcessor;
1.426 -class CImageProcessorExtension;
1.427 -
1.428 -/**
1.429 -@publishedAll
1.430 -@released
1.431 -
1.432 -Utility class providing static factory functions for creating instances of
1.433 -CImageProcessor derived classes.
1.434 -*/
1.435 -class ImageProcessorUtility
1.436 - {
1.437 -public:
1.438 - IMPORT_C static TInt ReductionFactor(const TSize& aOriginalSize,const TSize& aReducedSize);
1.439 - IMPORT_C static CImageProcessor* NewImageProcessorL(const CFbsBitmap& aBitmap,const TSize& aImageSize,TDisplayMode aImageDisplayMode, TBool aDisableErrorDiffusion);
1.440 - IMPORT_C static CImageProcessor* NewImageProcessorL(const CFbsBitmap& aBitmap,TInt aReductionFactor,TDisplayMode aImageDisplayMode, TBool aDisableErrorDiffusion);
1.441 - IMPORT_C static CImageProcessorExtension* ImageProcessorUtility::NewImageProcessorExtensionL(const CFbsBitmap& aBitmap,TInt aReductionFactor,TDisplayMode aImageDisplayMode, TBool aDisableErrorDiffusion);
1.442 -
1.443 -private:
1.444 - TBool static UseErrorDiffuser(const TDisplayMode& aBitmapDisplayMode, const TDisplayMode& aImageDisplayMode);
1.445 - TBool static IsMonochrome(const TDisplayMode& aBitmapDisplayMode, const TDisplayMode& aImageDisplayMode);
1.446 - };
1.447 -
1.448 -
1.449 -
1.450 -/**
1.451 -@publishedAll
1.452 -@released
1.453 -
1.454 -Interface to image processing classes.
1.455 -*/
1.456 -class CImageProcessor : public CBase
1.457 - {
1.458 -public:
1.459 - // Setup
1.460 -
1.461 - /**
1.462 - Initialises internal data structures prior to conversion.
1.463 -
1.464 - This is a virtual function that each derived class must implement.
1.465 -
1.466 - @param aBitmap
1.467 - A reference to a fully constucted bitmap with the required
1.468 - display mode and size.
1.469 - @param aImageRect
1.470 - The region of the image to convert.
1.471 - */
1.472 - virtual void PrepareL(CFbsBitmap& aBitmap,const TRect& aImageRect) = 0;
1.473 -
1.474 - /**
1.475 - Initialises internal data structures prior to the manipulation of the specified pixel block.
1.476 -
1.477 - This overloaded version allows specification of a block size
1.478 - for those formats which support blocked pixel data eg. JPEG
1.479 -
1.480 - This is a virtual function that each derived class must implement.
1.481 -
1.482 - @param aBitmap
1.483 - A reference to a fully constucted bitmap with the required
1.484 - display mode and size.
1.485 - @param aImageRect
1.486 - The region of the image to convert.
1.487 - @param aRgbBlockSize
1.488 - The size of the block to use.
1.489 - */
1.490 - virtual void PrepareL(CFbsBitmap& aBitmap,const TRect& aImageRect,const TSize& aRgbBlockSize) = 0;
1.491 -
1.492 - /**
1.493 - Sets the number of pixels by which to increment the current position in
1.494 - the Y-axis. This is used when rendering images supporting interlacing.
1.495 - eg GIF
1.496 -
1.497 - This is a virtual function that each derived class must implement.
1.498 -
1.499 - @param aYInc
1.500 - The number of pixels.
1.501 - */
1.502 - virtual void SetYPosIncrement(TInt aYInc) = 0;
1.503 -
1.504 - /**
1.505 - Sets the number times the current line should be repeated. The lines
1.506 - are repeated in the same direction as set by SetYPosIncrement(). This
1.507 - is used to fill blank lines when rendering interlaced images. eg GIF.
1.508 - @param aLineRepeat The number of times the current line should be repeated
1.509 - */
1.510 - virtual void SetLineRepeat(TInt aLineRepeat) = 0;
1.511 -
1.512 - /**
1.513 - Sets the pixel padding to the value specified by aNumberOfPixels.
1.514 -
1.515 - This is a virtual function that each derived class must implement.
1.516 -
1.517 - @param aNumberOfPixels
1.518 - The number of pixels to use for padding.
1.519 - */
1.520 - virtual void SetPixelPadding(TInt aNumberOfPixels) = 0;
1.521 -
1.522 - // Color pixel writing
1.523 -
1.524 - /**
1.525 - Sets the pixel at the current position to aColor.
1.526 -
1.527 - This is a virtual function that each derived class must implement.
1.528 -
1.529 - @post
1.530 - The current position is updated.
1.531 -
1.532 - @param aColor
1.533 - The RGB value to set the current pixel to.
1.534 -
1.535 - @return A boolean indicating if the operation was successful. ETrue if the operation succeeded,
1.536 - otherwise EFalse.
1.537 - */
1.538 - virtual TBool SetPixel(TRgb aColor) = 0;
1.539 -
1.540 - /**
1.541 - Sets aCount number of pixels to the value given by aColor, starting at
1.542 - the current position.
1.543 -
1.544 - This is a virtual function that each derived class must implement.
1.545 -
1.546 - @post
1.547 - On success, the current position is updated.
1.548 -
1.549 - @param aColor
1.550 - The RGB value to set the pixels to.
1.551 - @param aCount
1.552 - The number of pixels to set.
1.553 -
1.554 - @return A boolean indicating if the operation was successful. ETrue if the operation succeeded,
1.555 - otherwise EFalse.
1.556 - */
1.557 - virtual TBool SetPixelRun(TRgb aColor,TInt aCount) = 0;
1.558 -
1.559 - /**
1.560 - Updates the bitmap with colour information from the array of colour values.
1.561 -
1.562 - Uses the array of colour values supplied by aColorBuffer, whose length
1.563 - is specified by aBufferLength, to update successive pixels with values in the
1.564 - buffer, starting at the current position.
1.565 -
1.566 - This is a virtual function that each derived class must implement.
1.567 -
1.568 - @post
1.569 - The current position is updated.
1.570 -
1.571 - @param aColorBuffer
1.572 - A pointer to the first element in the array.
1.573 - @param aBufferLength
1.574 - The number of elements in the array.
1.575 -
1.576 - @return A boolean indicating if the operation was successful. ETrue if the operation succeeded,
1.577 - otherwise EFalse.
1.578 - */
1.579 - virtual TBool SetPixels(TRgb* aColorBuffer,TInt aBufferLength) = 0;
1.580 -
1.581 - /**
1.582 - Sets the current pixel block using the data supplied in aColorBuffer.
1.583 -
1.584 - Note:
1.585 - For use with image types that support blocking of pixels eg JPEG.
1.586 -
1.587 - This is a virtual function that each derived class must implement.
1.588 -
1.589 - @param aColorBuffer
1.590 - A pointer to a buffer representing a block of pixel color values.
1.591 -
1.592 - @return A boolean indicating if the operation was successful. ETrue if the operation succeeded,
1.593 - otherwise EFalse.
1.594 - */
1.595 - virtual TBool SetPixelBlock(TRgb* aColorBuffer) = 0;
1.596 -
1.597 - // Monochrome pixel writing
1.598 -
1.599 - /**
1.600 - Sets the pixel at the current position to aGray256.
1.601 -
1.602 - This is a virtual function that each derived class must implement.
1.603 -
1.604 - @post
1.605 - The current position is updated.
1.606 -
1.607 - @param aGray256
1.608 - The greyscale value to set the current pixel to.
1.609 -
1.610 - @return A boolean indicating if the operation was successful. ETrue if the operation succeeded,
1.611 - otherwise EFalse.
1.612 - */
1.613 - virtual TBool SetMonoPixel(TInt aGray256) = 0;
1.614 -
1.615 - /**
1.616 - Sets the number of pixels specified by aCount to the value given by aGray256, starting at
1.617 - the current position.
1.618 -
1.619 - This is a virtual function that each derived class must implement.
1.620 -
1.621 - @post
1.622 - The current position is updated.
1.623 -
1.624 - @param aGray256
1.625 - The greyscale value to set the pixels to.
1.626 - @param aCount
1.627 - The number of pixels to set.
1.628 -
1.629 - @return A boolean indicating if the operation was successful. ETrue if the operation succeeded,
1.630 - otherwise EFalse.
1.631 - */
1.632 - virtual TBool SetMonoPixelRun(TInt aGray256,TInt aCount) = 0;
1.633 -
1.634 - /**
1.635 - Updates the bitmap with greyscale information from the array of greyscale values.
1.636 -
1.637 - The array of values supplied by aGray256Buffer, whose length
1.638 - is specified in aBufferLength, is used to update successive pixels with the
1.639 - greyscales values.
1.640 -
1.641 - This is a virtual function that each derived class must implement.
1.642 -
1.643 - @post
1.644 - The current position is updated.
1.645 -
1.646 - @param aGray256Buffer
1.647 - A pointer to the first element in the array of greyscale values.
1.648 - @param aBufferLength
1.649 - The number of elements in the array.
1.650 -
1.651 - @return A boolean indicating if the operation was successful. ETrue if the operation succeeded,
1.652 - otherwise EFalse.
1.653 - */
1.654 - virtual TBool SetMonoPixels(TUint32* aGray256Buffer,TInt aBufferLength) = 0;
1.655 -
1.656 - /**
1.657 - Sets a specified number of pixels to the specified greyscale value.
1.658 -
1.659 - For image types which support blocking of pixels eg JPEG, the current
1.660 - pixel block is set using the data supplied in aGray256Buffer.
1.661 -
1.662 - This is a virtual function that each derived class must implement.
1.663 -
1.664 - @param aGray256Buffer
1.665 - A pointer to a buffer representing a block of pixel color values.
1.666 -
1.667 - @return A boolean indicating if the operation was successful. ETrue if the operation succeeded,
1.668 - otherwise EFalse.
1.669 - */
1.670 - virtual TBool SetMonoPixelBlock(TUint32* aGray256Buffer) = 0;
1.671 -
1.672 - // Processor flow control
1.673 -
1.674 - /**
1.675 - Sets the current position in the bitmap to aPosition.
1.676 -
1.677 - This is a virtual function that each derived class must implement.
1.678 -
1.679 - @param aPosition
1.680 - A reference to TPoint object defining the position to move to.
1.681 -
1.682 - @return A boolean indicating if the operation was successful. ETrue if the operation succeeded,
1.683 - otherwise EFalse.
1.684 - */
1.685 - virtual TBool SetPos(const TPoint& aPosition) = 0;
1.686 -
1.687 - /**
1.688 - Commits the changes made to the current bitmap by flushing the buffer.
1.689 -
1.690 - This is a virtual function that each derived class must implement.
1.691 -
1.692 - @post
1.693 - The current position is updated.
1.694 -
1.695 - @return A boolean indicating if the operation was successful. ETrue if the operation succeeded,
1.696 - otherwise EFalse.
1.697 - */
1.698 - virtual TBool FlushPixels() = 0;
1.699 -
1.700 -private:
1.701 - // Future proofing
1.702 - IMPORT_C virtual void ReservedVirtual1();
1.703 - IMPORT_C virtual void ReservedVirtual2();
1.704 - IMPORT_C virtual void ReservedVirtual3();
1.705 - IMPORT_C virtual void ReservedVirtual4();
1.706 - };
1.707 -
1.708 -/**
1.709 -@publishedAll
1.710 -@released
1.711 -
1.712 -Flag used to determine the type of transformation which is the result of
1.713 -single or multiple transformation operations requested via calls to
1.714 -COperationExtension::AddOperationL.
1.715 -
1.716 -8 unique orientations:
1.717 -
1.718 -@code
1.719 -normal 90 180 270
1.720 -00 10 01 00 11 01 10 11
1.721 -01 11 11 10 10 00 00 01
1.722 -
1.723 -V flip 90 180 270
1.724 -10 00 11 10 =Hflip =Hflip+90
1.725 -11 01 01 00
1.726 -
1.727 -H flip 90 180 270
1.728 -01 11 00 01 =Vflip =Vflip+90
1.729 -00 10 10 11
1.730 -@endcode
1.731 -
1.732 -@see COperationExtension::AddOperationL
1.733 -*/
1.734 -enum TTransformOptions
1.735 - {
1.736 - /** Normal Decode
1.737 - */
1.738 - EDecodeNormal = 0x11011000,
1.739 -
1.740 - /** Rotate 90 degrees.
1.741 - */
1.742 - EDecodeRotate90 = 0x10110001,
1.743 -
1.744 - /** Rotate 180 degrees.
1.745 - */
1.746 - EDecodeRotate180 = 0x00100111,
1.747 -
1.748 - /** Rotate 270 degrees.
1.749 - */
1.750 - EDecodeRotate270 = 0x01001110,
1.751 -
1.752 - /** Horizontal flip.
1.753 - */
1.754 - EDecodeHorizontalFlip = 0x10001101,
1.755 -
1.756 - /** Horizontal flip and rotate 90 degrees.
1.757 - */
1.758 - EDecodeHorizontalFlipRotate90 = 0x11100100,
1.759 -
1.760 - /** Vertical flip.
1.761 - */
1.762 - EDecodeVerticalFlip = 0x01110010,
1.763 -
1.764 - /** Vertical flip and rotate 90 degrees.
1.765 - */
1.766 - EDecodeVerticalFlipRotate90 = 0x00011011
1.767 - };
1.768 -
1.769 -
1.770 -/**
1.771 -@publishedAll
1.772 -@released
1.773 -
1.774 -Class that provides support for Framework Extensions.
1.775 -
1.776 -@see CImageProcessor
1.777 -@see CImageReadCodec
1.778 -@see CImageDecoderPlugin
1.779 -*/
1.780 -class CImageProcessorExtension : public CImageProcessor
1.781 - {
1.782 -public:
1.783 - IMPORT_C virtual ~CImageProcessorExtension();
1.784 - IMPORT_C void SetClippingRect(const TRect& aRect);
1.785 - IMPORT_C void SetScaling(TInt aScalingCoeff);
1.786 - IMPORT_C void SetScaling(const TSize& aDesiredSize);
1.787 - IMPORT_C void SetOperation(TTransformOptions aOperation);
1.788 - IMPORT_C void SetInitialScanlineSkipPadding(TInt aNumberOfScanlines);
1.789 -
1.790 -protected:
1.791 - IMPORT_C CImageProcessorExtension();
1.792 -
1.793 -protected:
1.794 - /** Clipping rectangle */
1.795 - TRect iClippingRect;
1.796 - /** Scaling coefficient */
1.797 - TInt iScalingCoeff;
1.798 - /** Desired size after scaling */
1.799 - TSize iDesiredSize;
1.800 - /** Operations to apply to image */
1.801 - TTransformOptions iOperation;
1.802 - /** Position in destination at which start rendering */
1.803 - TPoint iStartPosition;
1.804 - /** Position in destination at which rendering is complete */
1.805 - TPoint iEndPosition;
1.806 - /** An initial one-off number of scanlines to be skipped */
1.807 - TInt iNumberOfScanlinesToSkip;
1.808 - };
1.809 -
1.810 -inline TInt TColorConvertor::RgbToMonochrome(TRgb aRgb)
1.811 - {
1.812 - TInt value = aRgb.Internal();
1.813 - TInt r = value&0xFF0000;
1.814 - TInt g = value&0xFF00;
1.815 - value = (value&0xFF)<<16; // blue<<16
1.816 - value += r<<1; // + (red<<16)*2
1.817 - value += g<<(16+2-8); // + (green<<16)*4
1.818 - value += g<<(16+0-8); // + (green<<16)
1.819 - return value>>(16+3); // total/8
1.820 - }
1.821 -
1.822 -#endif //___IMAGEPROCESSOR_H__
1.823 +#endif //__IMAGE_PROCESSOR_H__