williamr@2: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @file williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: williamr@2: #ifndef CAMERAOVERLAY_H williamr@2: #define CAMERAOVERLAY_H williamr@2: williamr@2: #include williamr@2: #include williamr@2: williamr@2: class MCameraOverlay; williamr@2: class MCameraOverlay2; williamr@2: williamr@2: /** williamr@2: The current Version for the TOverlaySupportInfo class. williamr@2: @publishedPartner williamr@2: @prototype williamr@2: */ williamr@2: static const TUint KECamOverlaySupportInfoCurrentVersion = 1; williamr@2: williamr@2: /** williamr@2: The current Version for the TOverlayParameters class. williamr@2: @publishedPartner williamr@2: @prototype williamr@2: */ williamr@2: static const TUint KECamOverlayParametersCurrentVersion = 1; williamr@2: williamr@2: /** williamr@2: Constant used to specify that no specific viewfinder of the given type (either direct or client based) shall be considered. williamr@2: Rather, every viewfinder should be taken into consideration. williamr@2: @publishedPartner williamr@2: @prototype williamr@2: */ williamr@2: static const TInt KECamOverlayNoSpecificViewFinderHandle = -1; williamr@2: williamr@2: /** williamr@2: Special handle value used for TOverlaySupportInfo::iViewFinderHandle when TOverlaySupportInfo::iDesiredCameraMode is other williamr@2: than viewfinder mode but not EModeNone. williamr@2: If TOverlaySupportInfo::iDesiredCameraMode is EModeNone, this indicates that OverlaySupportInfo should be used williamr@2: as default, where support information was being provided to the client without distinguishing between different camera modes. williamr@2: Also used as default value for TOverlayParameters::iViewFinderHandle, when TOverlayParameters::iCurrentModes is not williamr@2: neglected. williamr@2: @publishedPartner williamr@2: @prototype williamr@2: */ williamr@2: static const TInt KECamOverlayInvalidViewFinderHandle = -2; williamr@2: williamr@2: /** williamr@2: This is the UID which is used to obtain the CCameraOverlay interface, williamr@2: via a call to CCamera::CustomInterface(). williamr@2: williamr@2: @see KECamOverlayUidValue williamr@2: @see CCamera::CCameraOverlay williamr@2: */ williamr@2: static const TUid KECamOverlayUid = {KECamOverlayUidValue}; williamr@2: williamr@2: williamr@2: /** williamr@2: This class provides support for image overlays. williamr@2: The client can use it to overlay an image onto the viewfinder, snapshots, still images and video. williamr@2: A client can create multiple overlays, where each overlay can be in a different format. williamr@2: The properties of an overlay can be changed after it has been created. williamr@2: williamr@2: @note This class provides a standardised client interface for the camera overlay. Classes cannot be derived from it. williamr@2: williamr@2: @note If the class methods leave, the output type parameter value is not guaranteed to be valid. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class CCamera::CCameraOverlay: public CBase williamr@2: { williamr@2: williamr@2: friend class CCamera; williamr@2: williamr@2: public: williamr@2: /** williamr@2: Overlay camera mode types williamr@2: williamr@2: Represents the possible camera modes in which the overlay could be used. williamr@2: Several types can be combined when returning ECam implementation support for various modes. williamr@2: */ williamr@2: enum TOverlayCameraMode williamr@2: { williamr@2: /** Overlays are not supported for any camera mode. */ williamr@2: EModeNone = 0x00, williamr@2: /** The image can be overlaid on captured images. williamr@2: The camera is in still image mode. This effectively means all the still image drive modes and williamr@2: its interpretation may be implementation-specific. williamr@2: Explicit definition of drive modes is recommended instead. williamr@2: */ williamr@2: EModeStillImage = 0x01, williamr@2: /** The image can be overlaid on a snapshot. williamr@2: The camera has snapshot functionality set on. williamr@2: */ williamr@2: EModeSnapshot = 0x02, williamr@2: /** williamr@2: The image can be overlaid on a viewfinder. williamr@2: The camera is displaying directly to viewfinder. williamr@2: This mode shall not be used if any of the viewfinder submodes is specified. williamr@2: @note Overlay visibility for different viewfinder modes (direct/client-based) is williamr@2: implementation-specific; viewfinder modes should be explicitly specified by clients instead. williamr@2: */ williamr@2: EModeViewfinder = 0x04, williamr@2: /** The image can be overlaid on a video frame. williamr@2: The camera is in video mode. */ williamr@2: EModeVideo = 0x08, williamr@2: /** williamr@2: The image is to be overlaid on direct viewfinder williamr@2: @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() williamr@2: */ williamr@2: EModeDirectViewfinder = 0x00010, williamr@2: /** williamr@2: The image is to be overlaid on client-based viewfinder williamr@2: @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() williamr@2: */ williamr@2: EModeClientViewfinder = 0x00020, williamr@2: /** williamr@2: The image is to be overlaid when Continuous Still Image driving mode is active. williamr@2: @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() williamr@2: */ williamr@2: EModeStillImageContinuous = 0x00080, williamr@2: /** williamr@2: The image is to be overlaid when Still Image Bracketing driving mode is active. williamr@2: @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() williamr@2: */ williamr@2: EModeStillImageBracket = 0x00100, williamr@2: /** williamr@2: The image is to be overlaid when Still Image Bracketing with Merge option driving mode is active. williamr@2: @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() williamr@2: */ williamr@2: EModeStillImageBracketMerge = 0x00200, williamr@2: /** williamr@2: The image is to be overlaid when Timed Still Image driving mode is active. williamr@2: @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() williamr@2: */ williamr@2: EModeStillImageTimed = 0x00400, williamr@2: /** williamr@2: The image is to be overlaid when Timed Still Image with Lapse option driving mode is active. williamr@2: @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() williamr@2: */ williamr@2: EModeStillImageTimeLapse = 0x00800, williamr@2: /** williamr@2: The image is to be overlaid when Still Image Burst driving mode is active. williamr@2: @note This value is available only to the API clients using CCamera::New2L() or CCamera::NewDuplicate2L() williamr@2: */ williamr@2: EModeStillImageBurst = 0x01000 williamr@2: }; williamr@2: williamr@2: /** williamr@2: Overlay types williamr@2: williamr@2: Type in which alpha value will be provided. williamr@2: */ williamr@2: enum TOverlayType williamr@2: { williamr@2: /** Does not support overlays. */ williamr@2: EOverlayNone = 0x00, williamr@2: /** Blending is on a per pixel basis, where the alpha value information is provided in the overlay bitmap itself. williamr@2: The alpha value is specified in each pixel of the bitmap (it is the alpha componenet of the TRgb object). The williamr@2: display mode of the bitmap should be such that alpha value is supported. TOverlayParameters::iAlphaValue is williamr@2: neglected in this case. */ williamr@2: EPerPixel = 0x01, williamr@2: /** Blending is on a per plane basis, where all pixels are affected by the same alpha value. The alpha value is williamr@2: provided through TOverlayParameters::iAlphaValue. */ williamr@2: EPerPlane = 0x02 williamr@2: }; williamr@2: williamr@2: /** williamr@2: Blending types williamr@2: williamr@2: Type of supported blending. williamr@2: */ williamr@2: enum TBlendingType williamr@2: { williamr@2: /** Does not support blending. */ williamr@2: EBlendNone, williamr@2: /** Supports only binary blending. If alpha value is 0xFF, it is opaque, otherwise transparent. */ williamr@2: EBinary, williamr@2: /** Full support for blending - all values in the range [0:255]. */ williamr@2: EFullRange, williamr@2: /** Supports only dynamic binary blending - williamr@2: allows values to be changed when overlay is being displayed. If alpha value is 0xFF, it is opaque, williamr@2: otherwise transparent. Since the blending is dynamic, SetModifiableOverlayBitmapL shall be used such that the williamr@2: bitmap could be changed by the implementation. */ williamr@2: EBinaryDynamic, williamr@2: /** Full support for dynamic blending - all values in the range [0:255] williamr@2: - allows values to be changed when overlay is being displayed. Since the blending is dynamic, williamr@2: SetModifiableOverlayBitmapL shall be used such that the bitmap could be changed by the implementation. */ williamr@2: EFullRangeDynamic williamr@2: }; williamr@2: williamr@2: /** williamr@2: Overlay support information characterizing the overlay functionality as a whole. williamr@2: @publishedPartner williamr@2: @prototype williamr@2: */ williamr@2: class TOverlaySupportInfo williamr@2: { williamr@2: public: williamr@2: IMPORT_C explicit TOverlaySupportInfo(); williamr@2: williamr@2: IMPORT_C TUint Size() const; williamr@2: IMPORT_C TUint Version() const; williamr@2: williamr@2: public: williamr@2: /** The camera modes that the ECam implementation supports when applying overlays. williamr@2: The modes are held as a bitwise logical OR of the relevant individual modes williamr@2: defined in CCamera::CCameraOverlay::TOverlayCameraMode. */ williamr@2: TUint iSupportedModes; williamr@2: /** The camera types that the ECam implementation supports when applying overlays. williamr@2: The types are held as a bitwise logical OR of the relevant individual types williamr@2: defined in CCamera::CCameraOverlay::TOverlayType. */ williamr@2: TUint iSupportedTypes; williamr@2: /** Represents blending type for EPerPlane overlay Type.*/ williamr@2: TBlendingType iPerPlane; williamr@2: /** Represents blending type for EPerPixel overlay Type.*/ williamr@2: TBlendingType iPerPixel; williamr@2: /** Whether overlapping overlays are supported. */ williamr@2: TBool iCanOverlap; williamr@2: williamr@2: /** This is an input parameter which the client needs to provide. It represents the specific camera mode for which williamr@2: the overlay support information is required. williamr@2: Default values for iDesiredCameraMode (that is, CCamera::CCameraOverlay::EModeNone) and iViewFinderHandle (that is, williamr@2: KECamOverlayInvalidViewFinderHandle) implies that the client is using the TOverlaySupportInfo as before and williamr@2: iSupportedModes will not be neglected. Refer to TOverlaySupportInfo(). williamr@2: */ williamr@2: TOverlayCameraMode iDesiredCameraMode; williamr@2: /** This is also another input parameter which the client needs to provide. It represents the specific viewfinder williamr@2: handle for which the overlay support information is required. williamr@2: If iViewFinderHandle is KECamOverlayNoSpecificViewFinderHandle, then generic overlay support is required which will williamr@2: be valid for every viewfinder handle of type iDesiredCameraMode. williamr@2: Default values for iDesiredCameraMode (that is, CCamera::CCameraOverlay::EModeNone) and iViewFinderHandle (that is, williamr@2: KECamOverlayInvalidViewFinderHandle) implies that the client is using the TOverlaySupportInfo as before and williamr@2: iSupportedModes will not be neglected. Refer to TOverlaySupportInfo(). williamr@2: */ williamr@2: TInt iViewFinderHandle; williamr@2: williamr@2: private: williamr@2: // reserved for future expansion williamr@2: TInt iReserved3; williamr@2: }; williamr@2: williamr@2: /** williamr@2: Overlay parameters characterizing a particular overlay. williamr@2: @publishedPartner williamr@2: @prototype williamr@2: */ williamr@2: class TOverlayParameters williamr@2: { williamr@2: public: williamr@2: IMPORT_C explicit TOverlayParameters(); williamr@2: williamr@2: IMPORT_C TUint Size() const; williamr@2: IMPORT_C TUint Version() const; williamr@2: williamr@2: public: williamr@2: /** The camera modes in which this image overlay can be used. williamr@2: The modes are held as a bitwise logical OR of the relevant individual modes williamr@2: defined in CCamera::CCameraOverlay::TOverlayCameraMode. */ williamr@2: TUint iCurrentModes; williamr@2: /** The camera types in which this image overlay can be used. williamr@2: The types are held as a bitwise logical OR of the relevant individual types williamr@2: defined in CCamera::CCameraOverlay::TOverlayType. */ williamr@2: TUint iCurrentTypes; williamr@2: /** This is the alpha value to be applied when iCurrentTypes contains type williamr@2: CCamera::CCameraOverlay::TOverlayType::EPerPlane. The alpha value for red, green and blue is packed into this williamr@2: TInt. The layout of this TInt is such that the most significant byte (from left side) is not used at all and the williamr@2: remaining three bytes (after the most significant byte) contains the alpha value for red, green and blue. williamr@2: Otherwise, if iCurrentTypes only contains type CCamera::CCameraOverlay::TOverlayType::EPerPixel, williamr@2: then iAlphaValue will not be used. */ williamr@2: TInt iAlphaValue; williamr@2: /** Top left corner within the original image, where the overlay image is to be blended. */ williamr@2: TPoint iPosition; williamr@2: /** The z-order of the overlay to indicate relative depth when several overlays are applied. williamr@2: Values are in the range 0 to 100. The overlay with iZOrder of 0 is the deepest.*/ williamr@2: TUint iZOrder; williamr@2: /** The handle for the viewfinder on which the overlay is supposed to be applied. Only one viewfinder handle can be passed. williamr@2: If KECamOverlayNoSpecificViewFinderHandle is provided by the client, then the overlay is supposed to be applied for every williamr@2: viewfinder handle of type as given by iCurrentModes. williamr@2: If KECamOverlayInvalidViewFinderHandle, then the default implementation is being used where williamr@2: TOverlayParameters::iCurrentModes will not be neglected and overlay will be applied for every viewfinder alongwith williamr@2: other camera modes. williamr@2: */ williamr@2: TInt iViewFinderHandle; williamr@2: private: williamr@2: // reserved for future expansion. williamr@2: TInt iReserved2; williamr@2: TInt iReserved3; williamr@2: // Reserved members which came into existence as a result of removing Tsize public member variable. williamr@2: TInt iReserved4; williamr@2: TInt iReserved5; williamr@2: }; williamr@2: williamr@2: public: williamr@2: williamr@2: IMPORT_C static CCameraOverlay* NewL(CCamera& aCamera); williamr@2: IMPORT_C ~CCameraOverlay(); williamr@2: IMPORT_C void GetOverlaySupport(TOverlaySupportInfo& aInfo); williamr@2: williamr@2: IMPORT_C TUint CreateOverlayL(const TOverlayParameters& aParameters, CFbsBitmap* aBitmap); williamr@2: IMPORT_C void ReleaseOverlay(TUint aOverlayHandle); williamr@2: williamr@2: IMPORT_C void SetOverlayBitmapL(TUint aOverlayHandle, const CFbsBitmap* aBitmap); williamr@2: IMPORT_C void SetModifiableOverlayBitmapL(TUint aOverlayHandle, CFbsBitmap* aBitmap); williamr@2: williamr@2: IMPORT_C void GetOverlayBitmapL(TUint aOverlayHandle, CFbsBitmap* aBitmap); williamr@2: IMPORT_C void GetOverlayParametersL(TUint aOverlayHandle, TOverlayParameters& aInfo); williamr@2: IMPORT_C void SetOverlayParametersL(TUint aOverlayHandle, const TOverlayParameters& aParameters); williamr@2: williamr@2: IMPORT_C void GetAllOverlaysInZOrderL(RArray& aOverlayHandles); williamr@2: IMPORT_C void SetAllOverlaysInZOrderL(const RArray& aOverlayHandles); williamr@2: williamr@2: IMPORT_C void GetAllOverlaysInZOrderL(TOverlayCameraMode aOverlayCameraMode, TInt aViewFinderHandle, RArray& aOverlayHandles) const; williamr@2: IMPORT_C void SetAllOverlaysInZOrderL(TOverlayCameraMode aOverlayCameraMode, TInt aViewFinderHandle, const RArray& aOverlayHandles); williamr@2: williamr@2: private: williamr@2: CCameraOverlay(CCamera& aOwner); williamr@2: void ConstructL(); williamr@2: williamr@2: private: williamr@2: CCamera& iOwner; williamr@2: MCameraOverlay* iImpl; // not owned williamr@2: MCameraOverlay2* iImpl2; // not owned williamr@2: }; williamr@2: williamr@2: #endif // CAMERAOVERLAY_H