Toshihiro Shimizu 890ddd
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 {
Toshihiro Shimizu 890ddd
	int m_margin;				  //!< Mesh margin to the original shape (in pixels)
Toshihiro Shimizu 890ddd
	double m_targetEdgeLength;	//!< The target mesh edge length
Toshihiro Shimizu 890ddd
	int m_targetMaxVerticesCount; //!< The desired maximum vertices count
Toshihiro Shimizu 890ddd
								  //!< (the returned mesh could still be larger)
Toshihiro Shimizu 890ddd
	TPixel64 m_transparentColor;  //!< Color to be used as transparent for boundaries recognition
Toshihiro Shimizu 890ddd
								  //!< (for fullcolor images only).
Toshihiro Shimizu 890ddd
								  //!< \note Transparent colors will be recognized as transparent
Toshihiro Shimizu 890ddd
								  //!< 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
/*!
Toshihiro Shimizu 890ddd
  This function extracts a TMeshImage type from the passed raster, using transparent
Toshihiro Shimizu 890ddd
  pixels to identify the mesh boundary.
Toshihiro Shimizu 890ddd
  \n\n
Toshihiro Shimizu 890ddd
  The returned mesh image has coordinates in the original raster reference (ie origin at
Toshihiro Shimizu 890ddd
  the lower-left image corner, pixel metric)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  \warning The resulting mesh image has  no dpi <\B>. Users \b must set it manually after
Toshihiro Shimizu 890ddd
           this function has been invoked.
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
DVAPI TMeshImageP buildMesh(const TRasterP &ras, const MeshBuilderOptions &options);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif // MESHBUILDER_H