Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TFLASH_INCLUDED
Toshihiro Shimizu 890ddd
#define TFLASH_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//#include "tpixel.h"
Toshihiro Shimizu 890ddd
//#include "tgeometry.h"
Toshihiro Shimizu 890ddd
#include "timage.h"
Toshihiro Shimizu 890ddd
#include "tsound.h"
Toshihiro Shimizu 890ddd
#include "traster.h"
Toshihiro Shimizu 890ddd
#include "tproperty.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TVRENDER_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TQuadratic;
Toshihiro Shimizu 890ddd
class TSegment;
Toshihiro Shimizu 890ddd
class TVectorImage;
Toshihiro Shimizu 890ddd
class TStroke;
Toshihiro Shimizu 890ddd
class TRegion;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TColorFunction;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
namespace Tiio
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class SwfWriterProperties : public TPropertyGroup
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TEnumProperty m_lineQuality;
Toshihiro Shimizu 890ddd
	TBoolProperty m_isCompressed;
Toshihiro Shimizu 890ddd
	TBoolProperty m_autoplay;
Toshihiro Shimizu 890ddd
	TBoolProperty m_looping;
Toshihiro Shimizu 890ddd
	TBoolProperty m_preloader;
Toshihiro Shimizu 890ddd
	TIntProperty m_jpgQuality;
Toshihiro Shimizu 890ddd
	TStringProperty m_url;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	SwfWriterProperties();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
//!	This class is an interface to Flash File Format (SWF) SDK.
Toshihiro Shimizu 890ddd
/*!	
Toshihiro Shimizu 890ddd
		Macromedia Flash File Format (SWF) SDK is an interface to write SWF files.
Toshihiro Shimizu 890ddd
		It includes a set of C++ classes that mirror the tag structure of SWF. 
Toshihiro Shimizu 890ddd
		There is a C++ class for each tag that SWF defines.
Toshihiro Shimizu 890ddd
		There are classes for creating movies, frames, circles, rectangles, text and bitmaps. 
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
class DVAPI TFlash
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	class Imp;
Toshihiro Shimizu 890ddd
	Imp *m_imp;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	static const wstring ConstantLines;
Toshihiro Shimizu 890ddd
	static const wstring MixedLines;
Toshihiro Shimizu 890ddd
	static const wstring VariableLines;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//enum LineQuality{_ConstantLines=0, _MixedLines, _VariableLines};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*
Toshihiro Shimizu 890ddd
	struct PropertiesForTab
Toshihiro Shimizu 890ddd
	  {
Toshihiro Shimizu 890ddd
    LineQuality m_lineQuality;
Toshihiro Shimizu 890ddd
		bool m_isCompressed;
Toshihiro Shimizu 890ddd
		bool m_stopAtStart;
Toshihiro Shimizu 890ddd
		bool m_looping;
Toshihiro Shimizu 890ddd
		bool m_loader;
Toshihiro Shimizu 890ddd
		int m_jpgQuality;
Toshihiro Shimizu 890ddd
		std::wstring m_url;
Toshihiro Shimizu 890ddd
		PropertiesForTab()
Toshihiro Shimizu 890ddd
		: m_lineQuality(_ConstantLines), m_isCompressed(true), m_stopAtStart(false), m_looping(true)
Toshihiro Shimizu 890ddd
		, m_loader(false), m_jpgQuality(90), m_url(std::wstring()) {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
    PropertiesForTab(LineQuality q, 
Toshihiro Shimizu 890ddd
		           bool isCompr, 
Toshihiro Shimizu 890ddd
							 bool stopAtStart, 
Toshihiro Shimizu 890ddd
							 bool looping, 
Toshihiro Shimizu 890ddd
							 bool loader, 
Toshihiro Shimizu 890ddd
							 int m_jpgQ, 
Toshihiro Shimizu 890ddd
							 std::wstring url)
Toshihiro Shimizu 890ddd
		: m_lineQuality(q), m_isCompressed(isCompr), m_stopAtStart(stopAtStart), m_looping(looping)
Toshihiro Shimizu 890ddd
		, m_loader(loader), m_jpgQuality(m_jpgQ), m_url(url) {if (m_jpgQ>99) m_jpgQ=99; else if (m_jpgQ<1) m_jpgQ=1;}
Toshihiro Shimizu 890ddd
		};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setProperties(const TFlash::PropertiesForTab& prop);*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		This constructor initialize internal main environment as follows:
Toshihiro Shimizu 890ddd
	 \li	frame index is set to -1,
Toshihiro Shimizu 890ddd
	 \li line thickness is set to 0,
Toshihiro Shimizu 890ddd
	 \li line color is set to black,
Toshihiro Shimizu 890ddd
	 \li strokes, regions and polylines are set to 0,
Toshihiro Shimizu 890ddd
	 \li sound environment is reset,
Toshihiro Shimizu 890ddd
	 \li palette pointer is reset,
Toshihiro Shimizu 890ddd
	 \li a new empty affine transformation is created.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	The object is associate with a drawing style wich have in general two colors, thickness of the stroke, 
Toshihiro Shimizu 890ddd
	smoothness of the gradient if any and type of the style that can be a texture, a line ,a solid style,
Toshihiro Shimizu 890ddd
	and radial or linear gradient. 
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		\param lx x-measure of the scene where the measure units are twips (a twips is an absolute length measure 
Toshihiro Shimizu 890ddd
		of about 1/1440 inch ). It is used passing it the camera width view.
Toshihiro Shimizu 890ddd
		\param ly y-measure of the scene where the measure units are twips. 
Toshihiro Shimizu 890ddd
			It is used passing the camera height view.
Toshihiro Shimizu 890ddd
		\param frameCount number of frames in the scene.
Toshihiro Shimizu 890ddd
		\param frameRate number of frame per second.
Toshihiro Shimizu 890ddd
		\param properties vector of swf properties as line and jpeg quality; 
Toshihiro Shimizu 890ddd
		       compression, looping, autoplay and preloading capabilities.   
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	TFlash(int lx, int ly, int frameCount, int frameRate, TPropertyGroup *properties, bool keepImages = true);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Deletes \p this object.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	~TFlash();
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Sets scene' background to \p bgColor. 
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//if set to false, it does not save the alpha channel; default is on true
Toshihiro Shimizu 890ddd
	void enableAlphaChannelForRaster(bool doSaveIt);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//default soundrate is at 5512
Toshihiro Shimizu 890ddd
	void setSoundRate(int soundrate);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	// Nota: per ora va chiamata una sola volta e prima di ogni altra cosa
Toshihiro Shimizu 890ddd
	void setBackgroundColor(const TPixel &bgColor);
Toshihiro Shimizu 890ddd
	//void setCameraDpi(double dpix, double dpiy, double inchFactor);
Toshihiro Shimizu 890ddd
	//void getCameraDpi(double &dpix, double &dpiy);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Sets the thickness pf the stroke for painting the object.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void setThickness(double thickness);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Sets the fill color of the drawing object.
Toshihiro Shimizu 890ddd
		Sets the type of style to Solid.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void setFillColor(const TPixel32 &color);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Sets the stroke color used to paint the object. 
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void setLineColor(const TPixel32 &color);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Sets the style to Texture.
Toshihiro Shimizu 890ddd
		Sets texture of the object.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void setTexture(const TRaster32P &texture);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Sets the affine transformation of the filling style with texture. 
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void setFillStyleMatrix(const TAffine &aff);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Sets parameters for filling with a gradient style.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void setGradientFill(bool isLinear, const TPixel &color1, const TPixel &color2, double smooth);
Toshihiro Shimizu 890ddd
	//void setProperties(TPropertyGroup* properties);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Draws a segment line.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void drawLine(const TPointD &a, const TPointD &b);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Draws a polygon given the vertices.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void drawPolygon(vector<vector<tquadratic *="">> &quads, int clippedShapes = 0); //first polyline outside, other are holes</vector<tquadratic>
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Draws a raster image.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	int drawRaster(TRaster32P r);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Draws a closed region. 
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void drawRegion(const TRegion &r, int clippedShapes = 0);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Draws a line given a stroke style.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void drawCenterline(const TStroke *s, bool drawAll);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Draws the outline of the stroke \p s.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	bool drawOutline(TStroke *s);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Draws the vector of segment lines \p segmentArray.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void drawSegments(const vector<tsegment> segmentArray, bool isGradientColor);</tsegment>
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Draws an array of boxes.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void drawquads(const vector<tquadratic> quadsArray);</tquadratic>
Toshihiro Shimizu 890ddd
	/*!this function puts objects in an image in current sprite;
Toshihiro Shimizu 890ddd
	useful for image patterns 
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	USHORT buildImage(const TImageP img, bool isMask);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Adds the image \p vi to the current data frame.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void draw(const TImageP vi, const TColorFunction *cf);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Initialize flash frame data and egins with frame \e frameIndex. 
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void beginFrame(int frameIndex);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Ends the flash frame data. 
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	int endFrame(bool isLast, int frameCountLoader, bool lastScene);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Draws a rectangle.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	int drawRectangle(const TRectD &rect);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Draws a polyline.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	int drawPolyline(vector<tpointd> &poly);</tpointd>
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Draws an ellipse.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	int drawEllipse(const TPointD ¢er, double radiusX, double radiusY);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Draws a point.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void drawDot(const TPointD ¢er, double radius);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Puts the current affine matrix on the stack of the affine tansformations.
Toshihiro Shimizu 890ddd
		This stacks contains the transfomation sequence.  
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void pushMatrix();
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Gets the matrix transformation from the stack and puts it 
Toshihiro Shimizu 890ddd
		in the current affine matrix. 
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void popMatrix();
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Multiplies current affine matrix by \p aff.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void multMatrix(const TAffine &aff);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Puts audio stream to the scene beginning from the frame \p offset.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void putSound(TSoundTrackP st, int offset);
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Write the flash movie to file.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void writeMovie(FILE *fp);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void drawPolygon(const list<tquadratic *=""> &poly, bool isOutline); // tolgo????</tquadratic>
Toshihiro Shimizu 890ddd
																	  /*!
Toshihiro Shimizu 890ddd
		Returns the quality of the line, i.e. 
Toshihiro Shimizu 890ddd
		"Low: Constant Thickness", "Medium: Mixed Thickness", "High: Variable Thickness".
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	wstring getLineQuality();
Toshihiro Shimizu 890ddd
	//void addPauseAtStart();
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Clears the tables of images used in the drawing.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void cleanCachedImages();
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Enables the mask layer.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void enableMask();
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Disables the mask layer.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void disableMask();
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Create a new vector image with new palette, used as a mask layer.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void beginMask();
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Puts current mask layer to the frame data.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void endMask();
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Draws appended polylines and clears the tables of temporary images. 
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void drawHangedObjects();
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Sets a global scale factor.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void setGlobalScale(const TAffine &aff);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	// not implemented
Toshihiro Shimizu 890ddd
	TFlash();
Toshihiro Shimizu 890ddd
	TFlash(const TFlash &);
Toshihiro Shimizu 890ddd
	TFlash &operator=(const TFlash &);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif