Shinya Kitaoka 810553
#pragma once
Shinya Kitaoka 810553
Toshihiro Shimizu 890ddd
#ifndef TVECTORIMAGE_INCLUDED
Toshihiro Shimizu 890ddd
#define TVECTORIMAGE_INCLUDED
Toshihiro Shimizu 890ddd
Shinya Kitaoka 262a92
#include <memory></memory>
Shinya Kitaoka 262a92
Toshihiro Shimizu 890ddd
#include "timage.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// da togliere spostando cose in altri file!!
Toshihiro Shimizu 890ddd
#include "traster.h"
Toshihiro Shimizu 890ddd
#include "tstream.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <set></set>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TVECTORIMAGE_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
Shinya Kitaoka 6f0974
//#define NEW_REGION_FILL
Toshihiro Shimizu 890ddd
#define DISEGNO_OUTLINE 0
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
// Forward declarations
Toshihiro Shimizu 890ddd
class TVectorImageP;
Toshihiro Shimizu 890ddd
class TStroke;
Toshihiro Shimizu 890ddd
class TRegion;
Toshihiro Shimizu 890ddd
class TRegionId;
Toshihiro Shimizu 890ddd
class TColorStyle;
Toshihiro Shimizu 890ddd
class TVectorRenderData;
Toshihiro Shimizu 890ddd
class TRegionId;
Toshihiro Shimizu 890ddd
class TFilledRegionInf;
Toshihiro Shimizu 890ddd
namespace TThread
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
class Mutex;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define REGION_COMPUTING_PRECISION 128.0
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
const double c_newAutocloseTolerance = 1.15;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class VIStroke;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
  TVectorImage: describe a vector image.
Toshihiro Shimizu 890ddd
    A vector image is a set of strokes and regions.
Toshihiro Shimizu 890ddd
  \relates  TImage
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
class DVAPI TVectorImage : public TImage
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	class Imp;
Toshihiro Shimizu 890ddd
	int pickGroup(const TPointD &pos, bool onEnteredGroup) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 262a92
	std::unique_ptr<imp> m_imp;</imp>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	struct IntersectionBranch {
Toshihiro Shimizu 890ddd
		int m_strokeIndex;
Toshihiro Shimizu 890ddd
		int m_style;
Toshihiro Shimizu 890ddd
		double m_w;
Toshihiro Shimizu 890ddd
		UINT m_currInter;
Toshihiro Shimizu 890ddd
		UINT m_nextBranch;
Toshihiro Shimizu 890ddd
		bool m_gettingOut;
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
	//!if the vectorimage is loaded from disc, loaded=true
Toshihiro Shimizu 890ddd
	TVectorImage(bool loaded = false);
Toshihiro Shimizu 890ddd
	virtual ~TVectorImage();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TImage::Type getType() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return VECTOR;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*!Set valid regions flags
Toshihiro Shimizu 890ddd
	    call validateRegions() after region/stroke changes
Toshihiro Shimizu 890ddd
     */
Toshihiro Shimizu 890ddd
	void validateRegions(bool state = false);
Toshihiro Shimizu 890ddd
	//! Get valid regions flags
Toshihiro Shimizu 890ddd
	/*! Call validateRegions() after region/stroke changes
Toshihiro Shimizu 890ddd
     */
Toshihiro Shimizu 890ddd
	bool areValidRegions();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return a clone of image
Toshihiro Shimizu 890ddd
	TVectorImageP clone() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Create a new \b TImage
Toshihiro Shimizu 890ddd
	TImage *cloneImage() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Transform a stroke using an affine \b TAffine
Toshihiro Shimizu 890ddd
	void transform(const TAffine &aff, bool doChangeThickness = false);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	// usato solo in pli
Toshihiro Shimizu 890ddd
	//! Put a region in the regions' container
Toshihiro Shimizu 890ddd
	void putRegion(TRegion *region);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return the regions' count
Toshihiro Shimizu 890ddd
	UINT getRegionCount() const;
Toshihiro Shimizu 890ddd
	//! Get a region at index position
Toshihiro Shimizu 890ddd
	TRegion *getRegion(UINT index) const;
Toshihiro Shimizu 890ddd
	//! Get a region at \b TRegionId id
Toshihiro Shimizu 890ddd
	TRegion *getRegion(TRegionId) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! returns the region equivalent to region, 0 if does not exists.
Toshihiro Shimizu 890ddd
	TRegion *findRegion(const TRegion ®ion) const;
Toshihiro Shimizu 890ddd
	//calcola tutte le regioni che intersecano  rect(e qualcuna in piu' a volte...)
Toshihiro Shimizu 890ddd
	void findRegions(const TRectD &rect);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return the strokes' count
Toshihiro Shimizu 890ddd
	UINT getStrokeCount() const;
Toshihiro Shimizu 890ddd
	//! Get a \b TStroke stroke at index position
Toshihiro Shimizu 890ddd
	TStroke *getStroke(UINT index) const;
Toshihiro Shimizu 890ddd
	//! Get a \b VIStroke stroke at index position
Toshihiro Shimizu 890ddd
	VIStroke *getVIStroke(UINT index) const;
Toshihiro Shimizu 890ddd
	//! Get a \b VIStroke stroke at id
Toshihiro Shimizu 890ddd
	VIStroke *getStrokeById(int id) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Get the stroke index by id
Toshihiro Shimizu 890ddd
	int getStrokeIndexById(int id) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Get the stroke index by id
Toshihiro Shimizu 890ddd
	int getStrokeIndex(TStroke *stroke) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Group strokes in the \b fromIndex - \b toIndex range
Toshihiro Shimizu 890ddd
	/*! Only adjacent strokes can be grouped*/
Toshihiro Shimizu 890ddd
	void group(int fromIndex, int count);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Ungroup all the strokes in the group of index \b index.
Toshihiro Shimizu 890ddd
	/*! Return the number of ungroped stroke.*/
Toshihiro Shimizu 890ddd
	int ungroup(int index);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool isStrokeGrouped(UINT index) const { return getGroupDepth(index) > 0; }
Toshihiro Shimizu 890ddd
	//! Return a value grater of zero if stroke of index \b index is contained in a group
Toshihiro Shimizu 890ddd
	/*! The returned number is the depth of the nested group containing the stroke.*/
Toshihiro Shimizu 890ddd
	int getGroupDepth(UINT index) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! it says if two strokes are in the same group, even qhen the image is entered in a group.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool sameSubGroup(int strokeIndex0, int strokeIndex1) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int getCommonGroupDepth(int strokeIndex0, int strokeIndex1) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return -1 if two object are contained in the same group.
Toshihiro Shimizu 890ddd
	/*! Objects can be strokes or regions: they are identified by \b index1 and \b index2.
Toshihiro Shimizu 890ddd
		If objects aren't in the same group, the method return the number of equal level into the nested groups.*/
Toshihiro Shimizu 890ddd
	int areDifferentGroup(UINT index1, bool isRegion1, UINT index2, bool isRegion2) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//utility functions
Toshihiro Shimizu 890ddd
	//! Return true if two strokes has common parent groups.
Toshihiro Shimizu 890ddd
	bool sameParentGroupStrokes(UINT index1, UINT index2) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		int ret = areDifferentGroup(index1, false, index2, false);
Toshihiro Shimizu 890ddd
		return (ret == -1 || ret >= 1);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	//! Return true if two objects are contained into the same group.
Toshihiro Shimizu 890ddd
	bool sameGroup(UINT index1, UINT index2) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return areDifferentGroup(index1, false, index2, false) == -1;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	//! Return true if a stroke and a region have common parent groups.
Toshihiro Shimizu 890ddd
	bool sameGroupStrokeAndRegion(UINT strokeIndex, UINT regionIndex) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return areDifferentGroup(strokeIndex, false, regionIndex, true) == -1;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//entering and exiting groups
Toshihiro Shimizu 890ddd
	bool inCurrentGroup(int strokeIndex) const;
Toshihiro Shimizu 890ddd
	bool canEnterGroup(int strokeIndex) const;
Toshihiro Shimizu 890ddd
	bool selectable(int strokeIndex) const;
Toshihiro Shimizu 890ddd
	bool enterGroup(int index);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//return -1 if no possible to exit, otherwise a stroke index  which has same id of the exiting group
Toshihiro Shimizu 890ddd
	int exitGroup();
Toshihiro Shimizu 890ddd
	bool isEnteredGroupStroke(int index) const;
Toshihiro Shimizu 890ddd
	bool canMoveStrokes(int strokeIndex, int count, int moveBefore) const;
Toshihiro Shimizu 890ddd
	//returns depth of group inside.
Toshihiro Shimizu 890ddd
	int isInsideGroup() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int pickGroup(const TPointD &pos) const;
Toshihiro Shimizu 890ddd
	int getGroupByStroke(UINT index) const;
Toshihiro Shimizu 890ddd
	int getGroupByRegion(UINT index) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*! 
Toshihiro Shimizu 890ddd
      get the stroke nearest at point 
Toshihiro Shimizu 890ddd
      \note outw is stroke parameter w in [0,1]
Toshihiro Shimizu 890ddd
      \par p [input] is point nearest stroke
Toshihiro Shimizu 890ddd
      \par outw [output] is parameter of minimum in stroke
Toshihiro Shimizu 890ddd
      \par strokeIndex [output] is index of stroke in vector image
Toshihiro Shimizu 890ddd
      \par dist2 [output] is the square value of distance
Toshihiro Shimizu 890ddd
      \ret true if a value is found
Toshihiro Shimizu 890ddd
     */
Toshihiro Shimizu 890ddd
	bool getNearestStroke(
Toshihiro Shimizu 890ddd
		const TPointD &p,
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		// output
Toshihiro Shimizu 890ddd
		double &outw,
Toshihiro Shimizu 890ddd
		UINT &strokeIndex,
Toshihiro Shimizu 890ddd
		double &dist2,
Toshihiro Shimizu 890ddd
		bool inCurrentGroup = true) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Enable or disable the style of a stroke according to the \b enable param.
Toshihiro Shimizu 890ddd
	static void enableStrokeStyle(int index, bool enable);
Toshihiro Shimizu 890ddd
	//! Return true if the style of the stroke identified by \b index is enabled.
Toshihiro Shimizu 890ddd
	static bool isStrokeStyleEnabled(int index);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Remove the stroke of index \b index and if \b doComputeRegions is true recompute the regions
Toshihiro Shimizu 890ddd
	TStroke *removeStroke(int index, bool doComputeRegions = true);
Toshihiro Shimizu 890ddd
	//! Remove the strokes identified by indexes in the vector \b toBeRemoved
Toshihiro Shimizu 890ddd
	/*! If \b deleteThem is true strokes are really delete; 
Toshihiro Shimizu 890ddd
        if \b doComputeRegions is true recompute the regions*/
Shinya Kitaoka 3bfa54
	void removeStrokes(const std::vector<int> &tobeRemoved, bool deleteThem, bool recomputeRegions);</int>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Delete the \b TStroke stroke of index \b index
Toshihiro Shimizu 890ddd
	void deleteStroke(int index);
Toshihiro Shimizu 890ddd
	//! Delete the \b VIStroke stroke
Toshihiro Shimizu 890ddd
	void deleteStroke(VIStroke *stroke);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Add a stroke at the end of the vector; returns position of the stroke (or -1 if not added)
Toshihiro Shimizu 890ddd
	int addStroke(TStroke *, bool discardPoints = true);
Toshihiro Shimizu 890ddd
	int addStrokeToGroup(TStroke *stroke, int strokeIndex);
Toshihiro Shimizu 890ddd
	//! Replace the stroke at index \b index with \b newStroke
Toshihiro Shimizu 890ddd
	void replaceStroke(int index, TStroke *newStroke);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Insert a \b VIStroke \b vs at index \b strokeIndex
Toshihiro Shimizu 890ddd
	void insertStrokeAt(VIStroke *vs, int strokeIndex, bool recomputeRegions = true); //! Move \b count strokes starting from \b fromIndex before the stroke identified by the \b moveBefore index.
Toshihiro Shimizu 890ddd
	void moveStrokes(int fromIndex, int count, int moveBefore);
Toshihiro Shimizu 890ddd
	//! Find regions of a \b TVectorImage
Toshihiro Shimizu 890ddd
	void findRegions(bool fromSwf = false);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// Gmt. VA TOLTO IL PRIMA POSSIBILE.
Toshihiro Shimizu 890ddd
// E' una pessima cosa rendere platform dependent l'interfaccia pubblica di una
Toshihiro Shimizu 890ddd
// classe cosi' importante come la VectorImage
Toshihiro Shimizu 890ddd
#if defined(LINUX) || defined(MACOSX)
Toshihiro Shimizu 890ddd
	void render(const TVectorRenderData &rd, TRaster32P &ras);
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Make the rendering of the vector image, return a \b TRaster32P with the image rendered
Toshihiro Shimizu 890ddd
	TRaster32P render(bool onlyStrokes);
Toshihiro Shimizu 890ddd
	//! Return the region which contains \b p, if none regions contains \b p return 0
Toshihiro Shimizu 890ddd
	TRegion *getRegion(const TPointD &p);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Fill the region which contains \b p with \b styleId. it returns the  style of the region before filling or -1 if not filled.
Toshihiro Shimizu 890ddd
	int fill(const TPointD &p, int styleId, bool onlyEmpty = false);
Toshihiro Shimizu 890ddd
	//! Fill all the regions and strokes contained in \b selectArea or contained into the regions formed by the stroke \b s with the style \b styleId.
Toshihiro Shimizu 890ddd
	/*! If \b onlyUnfilled is true, only regions filled with the style 0 are filled with the new stile.
Toshihiro Shimizu 890ddd
		If \b fillAreas is true regions are filled.
Toshihiro Shimizu 890ddd
		If \b fillLines is true stroke are filled.*/
Toshihiro Shimizu 890ddd
	bool selectFill(const TRectD &selectArea, TStroke *s, int styleId, bool onlyUnfilled, bool fillAreas, bool fillLines);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Fill all regions contained in the \b stroke area with \b styleIndex
Toshihiro Shimizu 890ddd
	void areaFill(TStroke *stroke, int styleIndex, bool onlyUnfilled);
Toshihiro Shimizu 890ddd
	//! Fill the stroke which contains \b p with \b newStyleId; it returns the  style of stroke before filling or -1 if not filled.
Toshihiro Shimizu 890ddd
	int fillStrokes(const TPointD &p, int newStyleId);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return true if \b computeRegion method was called
Toshihiro Shimizu 890ddd
	bool isComputedRegionAlmostOnce() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return the image bounding box in the image coordinate system
Toshihiro Shimizu 890ddd
	TRectD getBBox() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Call the following method after stroke modification
Toshihiro Shimizu 890ddd
	//! \note you must specify, using the second argument, whether the modification was a reflection
Shinya Kitaoka 3bfa54
	void notifyChangedStrokes(const std::vector<int> &strokeIndexArray, const std::vector<tstroke *=""> &oldStrokeArray, bool areFlipped = false);</tstroke></int>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Call the following method after stroke modification
Toshihiro Shimizu 890ddd
	void notifyChangedStrokes(int strokeIndex, TStroke *oldStroke = 0, bool isFlipped = false);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 79e39b
	UINT getFillData(std::unique_ptr<intersectionbranch[]>& v);</intersectionbranch[]>
Shinya Kitaoka 79e39b
	void setFillData(std::unique_ptr<intersectionbranch[]> const& v, UINT size, bool doComputeRegions = true);</intersectionbranch[]>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void drawAutocloses(const TVectorRenderData &rd) const; //debug method
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*! Includes a (transformed) copy of imgs in this. If setSelected==true then selects imported strokes.
Toshihiro Shimizu 890ddd
		It also includes the color informations.
Toshihiro Shimizu 890ddd
		Try to assign the same stroke ids (if unused)
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	void enableRegionComputing(bool enabled, bool notIntersectingStrokes);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*! if enabled, region edges are joined together when possible. for flash render, should be disabled!
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
	void enableMinimizeEdges(bool enabled);
Toshihiro Shimizu 890ddd
	/*! Creates a new Image using the selected strokes. If removeFlag==true then removes selected strokes
Toshihiro Shimizu 890ddd
	    It includes (in the new image) the color informations too.
Toshihiro Shimizu 890ddd
		It mantains stroke ids. 
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	TVectorImageP splitSelected(bool removeFlag);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Merge the image with the \b img.
Toshihiro Shimizu 890ddd
	void mergeImage(const TVectorImageP &img, const TAffine &affine, bool sameStrokeId = true);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void mergeImage(const TVectorImageP &img, const TAffine &affine, const std::map<int, int=""> &styleTable, bool sameStrokeId = true);</int,>
Toshihiro Shimizu 890ddd
	//! Merge the image with the vector of image \b images.
Toshihiro Shimizu 890ddd
	void mergeImage(const std::vector<const *="" tvectorimage=""> &images);</const>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Insert the \b TVectorImageP \b img
Shinya Kitaoka 3bfa54
	void insertImage(const TVectorImageP &img, const std::vector<int> &dstIndices);</int>
Shinya Kitaoka 3bfa54
	TVectorImageP splitImage(const std::vector<int> &indices, bool removeFlag);</int>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return the used styles in the image
Toshihiro Shimizu 890ddd
	void getUsedStyles(std::set<int> &styles) const;</int>
Toshihiro Shimizu 890ddd
	//! Reassign all stroke's style
Toshihiro Shimizu 890ddd
	void reassignStyles(std::map<int, int=""> &table);</int,>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Transfer the stroke style of the \b sourceStroke in the \b sourceImage to the style
Toshihiro Shimizu 890ddd
	static void transferStrokeColors(TVectorImageP sourceImage,
Toshihiro Shimizu 890ddd
									 int sourceStroke,
Toshihiro Shimizu 890ddd
									 TVectorImageP destinationImage,
Toshihiro Shimizu 890ddd
									 int destinationStroke);
Toshihiro Shimizu 890ddd
	//! Set the edges of the stroke identified by \b strokeIndex with the styles \b leftColorIndex and \brightColorIndex.
Toshihiro Shimizu 890ddd
	void setEdgeColors(int strokeIndex, int leftColorIndex, int rightColorIndex);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*! This functions splits stroke with index 'strokeIndex' in n+1 strokes, where n is the size of vector sortedW, 
Toshihiro Shimizu 890ddd
	    cutting it in points w specified in sortedW. SortedW must be sorted in ascending order.
Toshihiro Shimizu 890ddd
		Resulting strokes are put in VectorImage in position strokeIndex,strokeIndex+1, ... strokeIndex+n.
Toshihiro Shimizu 890ddd
		Information on fill colors are maintened, as much as possible. */
Shinya Kitaoka 3bfa54
	void splitStroke(int strokeIndex, const std::vector<doublepair> &sortedWRanges);</doublepair>
Toshihiro Shimizu 890ddd
	VIStroke *joinStroke(int index1, int index2, int cpIndex1, int cpIndex2, bool isSmooth);
Toshihiro Shimizu 890ddd
	VIStroke *extendStroke(int index, const TThickPoint &p, int cpIndex, bool isSmooth);
Toshihiro Shimizu 890ddd
	/*! this method removes the parts  of the stroke that are not bounds of regions. only ending parts are removed. 
Toshihiro Shimizu 890ddd
  If the entire stroke is not bounding any region, it is kept entitely. 
Toshihiro Shimizu 890ddd
  it returns the original stroke (for undo)*/
Toshihiro Shimizu 890ddd
	TStroke *removeEndpoints(int strokeIndex);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*! this method replaces  the stroke at index with oldstroke. Oldstroke is supposed to contain
Toshihiro Shimizu 890ddd
   existing stroke. this method is used for undoing removeEndpoints . */
Toshihiro Shimizu 890ddd
	void restoreEndpoints(int index, TStroke *oldStroke);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Set the autoclose tolerance to the specified value.
Toshihiro Shimizu 890ddd
	void setAutocloseTolerance(double val);
Toshihiro Shimizu 890ddd
	//! Return the autoclose tolerance.
Toshihiro Shimizu 890ddd
	double getAutocloseTolerance() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//!forces the recomputing of all regions (it is actually done only after having loaded the vectorimage)
Toshihiro Shimizu 890ddd
	void recomputeRegionsIfNeeded();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*! Remove all image strokes and all image regions with style index contained in \b styleIds vector.*/
Shinya Kitaoka 3bfa54
	void eraseStyleIds(const std::vector<int> styleIds);</int>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TThread::Mutex *getMutex() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef _DEBUG
Toshihiro Shimizu 890ddd
	void checkIntersections();
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void computeRegion(const TPointD &p, int styleId);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 6f0974
#ifdef NEW_REGION_FILL
Shinya Kitaoka 6f0974
	void resetRegionFinder();
Shinya Kitaoka 6f0974
#endif
Shinya Kitaoka 6f0974
Toshihiro Shimizu 890ddd
private: //not implemented
Toshihiro Shimizu 890ddd
	TVectorImage(const TVectorImage &);
Toshihiro Shimizu 890ddd
	TVectorImage &operator=(const TVectorImage &);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI VIStroke *cloneVIStroke(VIStroke *vs);
Toshihiro Shimizu 890ddd
DVAPI void deleteVIStroke(VIStroke *vs);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void getClosingPoints(const TRectD &rect, double fac, const TVectorImageP &vi,
Shinya Kitaoka 3bfa54
							std::vector<std::pair<int, double="">> &startPoints,</std::pair<int,>
Shinya Kitaoka 3bfa54
							std::vector<std::pair<int, double="">> &endPoints);</std::pair<int,>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
template class DVAPI TSmartPointerT<tvectorimage>;</tvectorimage>
Toshihiro Shimizu 890ddd
template class DVAPI TDerivedSmartPointerT<tvectorimage, timage="">;</tvectorimage,>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TVectorImageP : public TDerivedSmartPointerT<tvectorimage, timage=""></tvectorimage,>
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TVectorImageP() {}
Toshihiro Shimizu 890ddd
	TVectorImageP(TVectorImage *image) : DerivedSmartPointer(image) {}
Toshihiro Shimizu 890ddd
	TVectorImageP(TImageP image) : DerivedSmartPointer(image) {}
Shinya Kitaoka 9f5a1b
#if !defined(_WIN32)
Toshihiro Shimizu 890ddd
	TVectorImageP(TImage *image) : DerivedSmartPointer(TImageP(image))
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
	operator TImageP()
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return TImageP(m_pointer);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// GMT: DA TOGLIERE. vedi sopra
Toshihiro Shimizu 890ddd
#ifdef LINUX
Toshihiro Shimizu 890ddd
DVAPI void hardRenderVectorImage(const TVectorRenderData &rd,
Toshihiro Shimizu 890ddd
								 TRaster32P &r,
Toshihiro Shimizu 890ddd
								 const TVectorImageP &vimg);
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TInputStreamInterface
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TInputStreamInterface() {}
Toshihiro Shimizu 890ddd
	virtual ~TInputStreamInterface() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual TInputStreamInterface &operator>>(double &) = 0;
Toshihiro Shimizu 890ddd
	virtual TInputStreamInterface &operator>>(int &) = 0;
Shinya Kitaoka 3bfa54
	virtual TInputStreamInterface &operator>>(std::string &) = 0;
Toshihiro Shimizu 890ddd
	virtual TInputStreamInterface &operator>>(UCHAR &) = 0;
Toshihiro Shimizu 890ddd
	virtual TInputStreamInterface &operator>>(USHORT &) = 0;
Toshihiro Shimizu 890ddd
	virtual TInputStreamInterface &operator>>(TRaster32P &) = 0;
Toshihiro Shimizu 890ddd
	virtual TInputStreamInterface &operator>>(TPixel32 &pixel);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual VersionNumber versionNumber() const { return VersionNumber(); }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TOutputStreamInterface
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TOutputStreamInterface() {}
Toshihiro Shimizu 890ddd
	virtual ~TOutputStreamInterface() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual TOutputStreamInterface &operator<<(double) = 0;
Toshihiro Shimizu 890ddd
	virtual TOutputStreamInterface &operator<<(int) = 0;
Shinya Kitaoka 3bfa54
	virtual TOutputStreamInterface &operator<<(std::string) = 0;
Toshihiro Shimizu 890ddd
	virtual TOutputStreamInterface &operator<<(UCHAR) = 0;
Toshihiro Shimizu 890ddd
	virtual TOutputStreamInterface &operator<<(USHORT) = 0;
Toshihiro Shimizu 890ddd
	virtual TOutputStreamInterface &operator<<(const TRaster32P &) = 0;
Toshihiro Shimizu 890ddd
	virtual TOutputStreamInterface &operator<<(const TPixel32 &pixel);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#if DISEGNO_OUTLINE == 1
Toshihiro Shimizu 890ddd
extern int CurrStrokeIndex;
Toshihiro Shimizu 890ddd
#include "tvectorimage.h"
Toshihiro Shimizu 890ddd
extern const TVectorImage *CurrVimg;
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#ifndef DISEGNO_OUTLINE
Toshihiro Shimizu 890ddd
   *&^&%^^$%&^%$(^(
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif