1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/openvg/openvgrefimplementation/sfopenvg/test/inc/tiger.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,153 @@
1.4 +/*
1.5 +* Copyright (c) 2009 Symbian Foundation Ltd
1.6 +* This component and the accompanying materials are made available
1.7 +* under the terms of the License "Eclipse Public License v1.0"
1.8 +* which accompanies this distribution, and is available
1.9 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +*
1.11 +* Initial Contributors:
1.12 +* Symbian Foundation Ltd - initial contribution.
1.13 +*
1.14 +* Contributors:
1.15 +*
1.16 +* Description:
1.17 +* CTiger class declaration to render OpenVG tiger image
1.18 +*/
1.19 +
1.20 +#ifndef TIGER_H
1.21 +#define TIGER_H
1.22 +
1.23 +// INCLUDES
1.24 +#include <e32base.h> // for CBase definition
1.25 +#include <egl.h>
1.26 +#include <openvg.h>
1.27 +//#include <vgu.h>
1.28 +#include <eglosnativewindowtype.h>
1.29 +
1.30 +////////////////////////////////////////////
1.31 +//Copied from ri_package_11\samples\tiger\tiger.h
1.32 +extern const int KtigerCommandCount;
1.33 +extern const char KtigerCommands[];
1.34 +extern const float KtigerMinX;
1.35 +extern const float KtigerMaxX;
1.36 +extern const float KtigerMinY;
1.37 +extern const float KtigerMaxY;
1.38 +extern const int KtigerPointCount;
1.39 +extern const float KtigerPoints[];
1.40 +
1.41 +// CLASS DECLARATION
1.42 +
1.43 +/**
1.44 + * Class that does the actual OpenGL ES rendering.
1.45 + */
1.46 +typedef struct
1.47 +{
1.48 + VGFillRule m_fillRule;
1.49 + VGPaintMode m_paintMode;
1.50 + VGCapStyle m_capStyle;
1.51 + VGJoinStyle m_joinStyle;
1.52 + float m_miterLimit;
1.53 + float m_strokeWidth;
1.54 + VGPaint m_fillPaint;
1.55 + VGPaint m_strokePaint;
1.56 + VGPath m_path;
1.57 +} PathData;
1.58 +
1.59 +typedef struct
1.60 +{
1.61 + PathData* m_paths;
1.62 + int m_numPaths;
1.63 +} PS;
1.64 +
1.65 +/////////////////////////////////////////////////////////////
1.66 +
1.67 +class RWindow;
1.68 +
1.69 +class CTiger : public CBase
1.70 + {
1.71 + public: // Constructors and destructor
1.72 +
1.73 + /**
1.74 + * Factory method for creating a new CTiger object.
1.75 + */
1.76 + static CTiger* NewL( TUint aWidth, TUint aHeight);
1.77 +
1.78 + /**
1.79 + * Destructor. Does nothing.
1.80 + */
1.81 + virtual ~CTiger();
1.82 +
1.83 + public: // New functions
1.84 +
1.85 + /**
1.86 + * Initializes OpenGL ES, sets the vertex and color
1.87 + * arrays and pointers. Also selects the shading mode.
1.88 + */
1.89 + void AppInit( RWindow& aWindow, CFbsBitmap* aBitmapToDraw=NULL );
1.90 +
1.91 + /**
1.92 + * Called upon application exit. Does nothing.
1.93 + */
1.94 + void AppExit( void );
1.95 +
1.96 + /**
1.97 + * Notifies that the screen size has dynamically changed during execution of
1.98 + * this program. Resets the viewport to this new size.
1.99 + * @param aWidth New width of the screen.
1.100 + * @param aHeight New height of the screen.
1.101 + */
1.102 + void SetScreenSize( TUint aWidth, TUint aHeight );
1.103 +
1.104 + void AppRender( const TRect& aRect, CFbsBitmap* aDst=NULL);
1.105 +
1.106 + protected: // New functions
1.107 +
1.108 + /**
1.109 + * Standard constructor that must never Leave.
1.110 + * Stores the given screen width and height.
1.111 + * @param aWidth Width of the screen.
1.112 + * @param aHeight Height of the screen.
1.113 + */
1.114 + CTiger(TUint aWidth, TUint aHeight);
1.115 +
1.116 + /**
1.117 + * Second phase contructor. Does nothing.
1.118 + */
1.119 + void ConstructL( void );
1.120 +
1.121 + //fucntions copied from ri_package_11\samples\tiger\main.c - no attempt to Symbianise!!
1.122 + void PS_destruct(PS* ps);
1.123 + void render(int w, int h);
1.124 + void PS_render(PS* ps);
1.125 + PS* PS_construct(const char* commands, int commandCount, const float* points, int pointCount);
1.126 + void init(NativeWindowType window, CFbsBitmap* aBitmapToDraw=NULL);
1.127 + void CreateImage(CFbsBitmap* aBitmapToDraw);
1.128 + void renderFromBitmap(int w, int h);
1.129 +
1.130 +
1.131 + private: // Data
1.132 +
1.133 + /** Width of the screen */
1.134 + TUint iScreenWidth;
1.135 +
1.136 + /** Height of the screen */
1.137 + TUint iScreenHeight;
1.138 +
1.139 + private: //OpenVG structures
1.140 +
1.141 + //copied from ri_package_11\samples\tiger\main.c - no attempt to symbianise
1.142 + PS* iTiger;
1.143 + int iRenderWidth;
1.144 + int iRenderHeight;
1.145 + EGLDisplay iEgldisplay;
1.146 + EGLConfig iEglconfig;
1.147 + EGLSurface iEglsurface;
1.148 + EGLContext iEglcontext;
1.149 + TNativeWindowType iNativeWindowType;
1.150 + VGImage iImage;
1.151 + CFbsBitmap* iBitmapToDraw;
1.152 +
1.153 + };
1.154 +#endif // TIGER_H
1.155 +
1.156 +// End of File