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