tahoma2d/toonz/sources/include/ext/meshbuilder.h

56 lines
1.8 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef MESHBUILDER_H
#define MESHBUILDER_H
// TnzCore includes
#include "trasterimage.h"
#include "tmeshimage.h"
#undef DVAPI
#undef DVVAR
#ifdef TNZEXT_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
//********************************************************************************************
// Mesh Image Builder functions
//********************************************************************************************
struct MeshBuilderOptions {
2016-06-15 18:43:10 +12:00
int m_margin; //!< Mesh margin to the original shape (in pixels)
double m_targetEdgeLength; //!< The target mesh edge length
int m_targetMaxVerticesCount; //!< The desired maximum vertices count
//!< (the returned mesh could still be larger)
TPixel64 m_transparentColor; //!< Color to be used as transparent for
2016-06-20 14:23:05 +12:00
//! boundaries recognition
//!< (for fullcolor images only).
2016-06-15 18:43:10 +12:00
//!< \note Transparent colors will be recognized as transparent
//!< anyway
2016-03-19 06:57:51 +13:00
};
//=======================================================================================
//! Builds a mesh image from the specified raster.
/*!
2016-06-15 18:43:10 +12:00
This function extracts a TMeshImage type from the passed raster, using
transparent
2016-03-19 06:57:51 +13:00
pixels to identify the mesh boundary.
\n\n
2016-06-15 18:43:10 +12:00
The returned mesh image has coordinates in the original raster reference (ie
origin at
2016-03-19 06:57:51 +13:00
the lower-left image corner, pixel metric)
2016-06-15 18:43:10 +12:00
\warning The resulting mesh image has <B> no dpi <\B>. Users \b must set it
manually after
2016-03-19 06:57:51 +13:00
this function has been invoked.
*/
2016-06-15 18:43:10 +12:00
DVAPI TMeshImageP buildMesh(const TRasterP &ras,
const MeshBuilderOptions &options);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
#endif // MESHBUILDER_H