Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef MESHBUILDER_H
Toshihiro Shimizu 890ddd
#define MESHBUILDER_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzCore includes
Toshihiro Shimizu 890ddd
#include "trasterimage.h"
Toshihiro Shimizu 890ddd
#include "tmeshimage.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TNZEXT_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
//    Mesh Image Builder  functions
Toshihiro Shimizu 890ddd
//********************************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct MeshBuilderOptions {
Shinya Kitaoka 120a6e
  int m_margin;               //!< Mesh margin to the original shape (in pixels)
Shinya Kitaoka 120a6e
  double m_targetEdgeLength;  //!< The target mesh edge length
Shinya Kitaoka 120a6e
  int m_targetMaxVerticesCount;  //!< The desired maximum vertices count
Shinya Kitaoka 120a6e
                                 //!< (the returned mesh could still be larger)
Shinya Kitaoka 120a6e
  TPixel64 m_transparentColor;   //!< Color to be used as transparent for
Shinya Kitaoka 38fd86
                                 //! boundaries recognition
Shinya Kitaoka 38fd86
  //!< (for fullcolor images only).
Shinya Kitaoka 120a6e
  //!< \note Transparent colors will be recognized as transparent
Shinya Kitaoka 120a6e
  //!< anyway
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=======================================================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Builds a mesh image from the specified raster.
Toshihiro Shimizu 890ddd
/*!
Shinya Kitaoka 120a6e
  This function extracts a TMeshImage type from the passed raster, using
Shinya Kitaoka 120a6e
  transparent
Toshihiro Shimizu 890ddd
  pixels to identify the mesh boundary.
Toshihiro Shimizu 890ddd
  \n\n
Shinya Kitaoka 120a6e
  The returned mesh image has coordinates in the original raster reference (ie
Shinya Kitaoka 120a6e
  origin at
Toshihiro Shimizu 890ddd
  the lower-left image corner, pixel metric)
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  \warning The resulting mesh image has  no dpi <\B>. Users \b must set it
Shinya Kitaoka 120a6e
  manually after
Toshihiro Shimizu 890ddd
           this function has been invoked.
Toshihiro Shimizu 890ddd
*/
Shinya Kitaoka 120a6e
DVAPI TMeshImageP buildMesh(const TRasterP &ras,
Shinya Kitaoka 120a6e
                            const MeshBuilderOptions &options);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // MESHBUILDER_H