sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: //
sl@0: 
sl@0: #ifndef TESTSCREENCAPTURE_H_
sl@0: #define TESTSCREENCAPTURE_H_
sl@0: 
sl@0: struct TWsScsComposeScreenCommand
sl@0: 	{
sl@0: 	struct TrivialPoint
sl@0: 		{
sl@0: 		/**
sl@0: 		The x co-ordinate.
sl@0: 		*/
sl@0: 		TInt iX;
sl@0: 		/**
sl@0: 		The y co-ordinate.
sl@0: 		*/
sl@0: 		TInt iY;
sl@0: 		};
sl@0: 	struct TrivialRect
sl@0: 		{
sl@0: 		/**
sl@0: 		The x and y co-ordinates of the top left hand corner of the rectangle.
sl@0: 		*/
sl@0: 		TrivialPoint iTl;
sl@0: 		
sl@0: 		/**
sl@0: 		The x and y co-ordinates of the bottom right hand corner of the rectangle.
sl@0: 		*/
sl@0: 		TrivialPoint iBr;
sl@0: 		};
sl@0: 	inline TWsScsComposeScreenCommand(TUint aCommand, const TInt aHandle);
sl@0: 	inline TWsScsComposeScreenCommand(TUint aCommand, const TRect iAttributes);
sl@0: 	inline void ConvertTrivialRect(TRect& aRect);
sl@0: 	
sl@0: 	TUint iCommand;
sl@0: 	union Parameters
sl@0: 	{
sl@0: 	TInt iBitmapHandle;
sl@0: 	TrivialRect iExtent;
sl@0: 	} iParameter;
sl@0: 	};
sl@0: 
sl@0: /**
sl@0:  * Window Server client interface for screen capture.
sl@0:  * 
sl@0:  * All functions in MTestScreenCapture will automatically flush the client-server
sl@0:  * session buffer as part of their behavior.
sl@0:  * 
sl@0:  * @publishedPartner
sl@0:  * @prototype
sl@0:  */
sl@0: 
sl@0: class MTestScreenCapture
sl@0: {
sl@0: public:
sl@0: 	enum TWsTestScreenCaptureOpcodes
sl@0: 		{
sl@0: 		EWsScsInvalid = 0x00000000,
sl@0: 		EWsScsScreenCompose = 0x00000001,
sl@0: 		EWsScsTranslateExtent = 0x00000002,
sl@0: 		};
sl@0: 	
sl@0: 	enum	
sl@0: 		{
sl@0: 		KUidTestScreenCaptureIf =  0x10286504,
sl@0: 		ETypeId =	 KUidTestScreenCaptureIf 
sl@0: 		};
sl@0: public:
sl@0: 	/** Retrieves the composited screen content. 
sl@0: 	    A new composition is initiated and the result is copied in 
sl@0: 	    the bitmap created by user.
sl@0: 	    The only bitmap mode supported is EColor16MU.
sl@0: 
sl@0: 	    This function always causes a flush of the window server buffer.
sl@0: 	    
sl@0:  		@param aBitmap retturns the composited screen content.
sl@0:  		@param aTarget target rectangle to be filled in
sl@0: 		@return KErrNone if successful
sl@0: 		        KErrArgument if the size does not match the composition area size or
sl@0: 		        the display mode is not supported
sl@0: 	*/
sl@0: 	virtual TInt ComposeScreen(const CFbsBitmap& aBitmap) const = 0;
sl@0: 	/** Maps the source rectangle from application coordinate space to a
sl@0: 		target coordinate space. Since there may be scaling involved, the
sl@0: 		target rectangle may be larger or smaller than the source one, or
sl@0: 		even become empty.
sl@0: 
sl@0: 	    This function always causes a flush of the window server buffer.
sl@0: 	    
sl@0: 		@param aSource source rectangle
sl@0: 		@param aTarget target rectangle to be filled in
sl@0: 		@return KErrNone if successful, otherwise one of the system-wide error codes
sl@0: 		*/
sl@0: 	virtual TInt TranslateExtent(const TRect& aSource, TRect& aTarget) const = 0;
sl@0: 
sl@0: 	/** Retrieves the size of the composition area in pixels.
sl@0: 
sl@0: 	    This function always causes a flush of the window server buffer.
sl@0: 
sl@0: 		@param aSize returns the composition area size
sl@0: 		@return KErrNone if successful, otherwise one of the system-wide error codes
sl@0: 		*/
sl@0: 	virtual TInt GetCompositedSize(TSize& aSize) const = 0;
sl@0: };
sl@0: 
sl@0: inline TWsScsComposeScreenCommand::TWsScsComposeScreenCommand(TUint aCommand, const TInt aHandle): 
sl@0: 	iCommand(aCommand)
sl@0: 	{ iParameter.iBitmapHandle = aHandle; }
sl@0: 
sl@0: inline TWsScsComposeScreenCommand::TWsScsComposeScreenCommand(TUint aCommand, const TRect iAttributes): 
sl@0: 	iCommand(aCommand)
sl@0: 	{ 
sl@0: 	iParameter.iExtent.iTl.iX = iAttributes.iTl.iX; 
sl@0: 	iParameter.iExtent.iTl.iY = iAttributes.iTl.iY; 
sl@0: 	iParameter.iExtent.iBr.iX = iAttributes.iBr.iX; 
sl@0: 	iParameter.iExtent.iBr.iY = iAttributes.iBr.iY; 
sl@0: 	}
sl@0: inline void TWsScsComposeScreenCommand::ConvertTrivialRect(TRect& aRect)
sl@0: 	{
sl@0: 	aRect.iTl.iX = iParameter.iExtent.iTl.iX;
sl@0: 	aRect.iTl.iY = iParameter.iExtent.iTl.iY;
sl@0: 	aRect.iBr.iX = iParameter.iExtent.iBr.iX;
sl@0: 	aRect.iBr.iY = iParameter.iExtent.iBr.iY;
sl@0: 	}
sl@0: 
sl@0: #endif /*TESTSCREENCAPTURE_H_*/