openvg/openvgrefimplementation/sfopenvg/test/inc/tiger.h
author William Roberts <williamr@symbian.org>
Thu, 03 Jun 2010 17:39:46 +0100
branchNewGraphicsArchitecture
changeset 87 0709f76d91e5
parent 6 250ac10a3d98
permissions -rw-r--r--
Add MMP files to build libOpenVG_sw.lib which uses LINKAS to redirect to libOpenVG.dll (and the same for libEGL_sw.lib and libOpenVGU_sw.lib). Only the libEGL_sw.lib redirection isn't activated - this can't happen until there is a merged libEGL.dll which supports the OpenWF synchronisation and also implements the graphical support functions. The overall aim is to eliminate the *_sw.dll implementations, at least as a compile-time way of choosing a software-only implementation.The correct way to choose is to put the right set of libraries into a ROM with suitable renaming, and in the emulator to use the "switching DLL" technique to pick the right set. As the Symbian Foundation doesn't have any alternative implementations, we don't need the switching DLLs and we can build directly to the correct name.

/*
* Copyright (c) 2009 Symbian Foundation Ltd
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Symbian Foundation Ltd - initial contribution.
* 
* Contributors:
*
* Description:
* CTiger class declaration to render OpenVG tiger image
*/

#ifndef TIGER_H
#define TIGER_H

//  INCLUDES
#include <e32base.h> // for CBase definition
#include <egl.h>
#include <openvg.h>
//#include <vgu.h>
#include <eglosnativewindowtype.h>

////////////////////////////////////////////
//Copied from ri_package_11\samples\tiger\tiger.h
extern const int KtigerCommandCount;
extern const char KtigerCommands[];
extern const float KtigerMinX;
extern const float KtigerMaxX;
extern const float KtigerMinY;
extern const float KtigerMaxY;
extern const int KtigerPointCount;
extern const float KtigerPoints[];

// CLASS DECLARATION

/**
 * Class that does the actual OpenGL ES rendering.
 */
typedef struct
{
	VGFillRule		m_fillRule;
	VGPaintMode		m_paintMode;
	VGCapStyle		m_capStyle;
	VGJoinStyle		m_joinStyle;
	float			m_miterLimit;
	float			m_strokeWidth;
	VGPaint			m_fillPaint;
	VGPaint			m_strokePaint;
	VGPath			m_path;
} PathData;

typedef struct
{
	PathData*			m_paths;
	int					m_numPaths;
} PS;

/////////////////////////////////////////////////////////////

class RWindow;

class CTiger : public CBase
    {
    public:  // Constructors and destructor

        /**
         * Factory method for creating a new CTiger object.
         */
        static CTiger* NewL( TUint aWidth, TUint aHeight);

        /**
         * Destructor. Does nothing.
         */
        virtual ~CTiger();

    public: // New functions

        /**
         * Initializes OpenGL ES, sets the vertex and color
         * arrays and pointers. Also selects the shading mode.
         */
        void AppInit( RWindow& aWindow, CFbsBitmap* aBitmapToDraw=NULL );
        
        /**
         * Called upon application exit. Does nothing.
         */
        void AppExit( void );

        /**
         * Notifies that the screen size has dynamically changed during execution of
         * this program. Resets the viewport to this new size.
         * @param aWidth New width of the screen.
         * @param aHeight New height of the screen.
         */
        void SetScreenSize( TUint aWidth, TUint aHeight );
        
        void AppRender( const TRect& aRect, CFbsBitmap* aDst=NULL);

    protected: // New functions

        /**
         * Standard constructor that must never Leave.
         * Stores the given screen width and height.
         * @param aWidth Width of the screen.
         * @param aHeight Height of the screen.
         */
        CTiger(TUint aWidth, TUint aHeight);

        /**
         * Second phase contructor. Does nothing.
         */
        void ConstructL( void );
        
        //fucntions copied from ri_package_11\samples\tiger\main.c - no attempt to Symbianise!!
        void PS_destruct(PS* ps);
        void render(int w, int h);
        void PS_render(PS* ps);
        PS* PS_construct(const char* commands, int commandCount, const float* points, int pointCount);
        void init(NativeWindowType window, CFbsBitmap* aBitmapToDraw=NULL);
        void CreateImage(CFbsBitmap* aBitmapToDraw);
        void renderFromBitmap(int w, int h);
        

    private: // Data

        /** Width of the screen */
        TUint           iScreenWidth;

        /** Height of the screen */
        TUint           iScreenHeight;

    private: //OpenVG structures
    	
    	//copied from ri_package_11\samples\tiger\main.c - no attempt to symbianise
    	PS* 				iTiger;
    	int					iRenderWidth;
    	int					iRenderHeight;
    	EGLDisplay			iEgldisplay;
    	EGLConfig			iEglconfig;
    	EGLSurface			iEglsurface;
    	EGLContext			iEglcontext;
    	TNativeWindowType iNativeWindowType;
    	VGImage iImage;
    	CFbsBitmap* iBitmapToDraw;
   	
    };
#endif // TIGER_H

// End of File