|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Local includes
|
|
Toshihiro Shimizu |
890ddd |
#include "pixelselectors.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "runsmap.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// STD includes
|
|
Toshihiro Shimizu |
890ddd |
#include <stack></stack>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// tcg includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tcg/tcg_traits.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tcg/tcg_vertex.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tcg/tcg_edge.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tcg/tcg_face.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#define INCLUDE_HPP
|
|
Toshihiro Shimizu |
890ddd |
#include "tcg/tcg_mesh.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "raster_edge_iterator.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "borders_extractor.h"
|
|
Toshihiro Shimizu |
890ddd |
#undef INCLUDE_HPP
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "trop_borders.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
using namespace TRop::borders;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// Container Reader for Borders Reader
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
template <typename pixelselector=""></typename>
|
|
Toshihiro Shimizu |
890ddd |
class WrapperReader
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TRop::borders::BordersReader &m_reader;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
WrapperReader(TRop::borders::BordersReader &reader)
|
|
Toshihiro Shimizu |
890ddd |
: m_reader(reader) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void openContainer(const RasterEdgeIterator<pixelselector> &it)</pixelselector>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_reader.openContainer(it.pos(), it.dir(), it.rightColor(), it.leftColor());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
void addElement(const RasterEdgeIterator<pixelselector> &it)</pixelselector>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_reader.addElement(it.pos(), it.dir(), it.leftColor());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
void closeContainer() { m_reader.closeContainer(); }
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
} //namespace
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// Borders Extractor instantiations
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace TRop
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
namespace borders
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
template <typename pix=""></typename>
|
|
Toshihiro Shimizu |
890ddd |
void readBorders_simple(const TRasterPT<pix> &raster, BordersReader &reader, bool onlyCorners)</pix>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
typedef PixelSelector<pix> pixel_selector;</pix>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
pixel_selector selector(onlyCorners);
|
|
Toshihiro Shimizu |
890ddd |
WrapperReader<pixel_selector> wrapReader(reader);</pixel_selector>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
raster->lock();
|
|
Toshihiro Shimizu |
890ddd |
readBorders(raster, selector, wrapReader);
|
|
Toshihiro Shimizu |
890ddd |
raster->unlock();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void readBorders_simple(const TRasterGR8P &raster, BordersReader &reader,
|
|
Toshihiro Shimizu |
890ddd |
const TPixelGR8 &transparencyColor, bool onlyCorners)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
typedef PixelSelector<tpixelgr8> pixel_selector;</tpixelgr8>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
pixel_selector selector(onlyCorners, transparencyColor);
|
|
Toshihiro Shimizu |
890ddd |
WrapperReader<pixel_selector> wrapReader(reader);</pixel_selector>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
raster->lock();
|
|
Toshihiro Shimizu |
890ddd |
readBorders(raster, selector, wrapReader);
|
|
Toshihiro Shimizu |
890ddd |
raster->unlock();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void readBorders_simple(const TRasterGR16P &raster, BordersReader &reader,
|
|
Toshihiro Shimizu |
890ddd |
const TPixelGR16 &transparencyColor, bool onlyCorners)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
typedef PixelSelector<tpixelgr16> pixel_selector;</tpixelgr16>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
pixel_selector selector(onlyCorners, transparencyColor);
|
|
Toshihiro Shimizu |
890ddd |
WrapperReader<pixel_selector> wrapReader(reader);</pixel_selector>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
raster->lock();
|
|
Toshihiro Shimizu |
890ddd |
readBorders(raster, selector, wrapReader);
|
|
Toshihiro Shimizu |
890ddd |
raster->unlock();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void readBorders_simple(const TRasterCM32P &raster, BordersReader &reader,
|
|
Toshihiro Shimizu |
890ddd |
bool onlyCorners, int toneThreshold)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
typedef PixelSelector<tpixelcm32> pixel_selector;</tpixelcm32>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
pixel_selector selector(onlyCorners, toneThreshold);
|
|
Toshihiro Shimizu |
890ddd |
WrapperReader<pixel_selector> wrapReader(reader);</pixel_selector>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
raster->lock();
|
|
Toshihiro Shimizu |
890ddd |
readBorders(raster, selector, wrapReader);
|
|
Toshihiro Shimizu |
890ddd |
raster->unlock();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void readBorders_simple(const TRasterP &raster, BordersReader &reader, bool onlyCorners)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TRaster32P ras32(raster);
|
|
Toshihiro Shimizu |
890ddd |
if (ras32) {
|
|
Toshihiro Shimizu |
890ddd |
readBorders_simple(ras32, reader, onlyCorners);
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TRaster64P ras64(raster);
|
|
Toshihiro Shimizu |
890ddd |
if (ras64) {
|
|
Toshihiro Shimizu |
890ddd |
readBorders_simple(ras64, reader, onlyCorners);
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TRasterCM32P rasCM32(raster);
|
|
Toshihiro Shimizu |
890ddd |
if (rasCM32) {
|
|
Toshihiro Shimizu |
890ddd |
readBorders_simple(rasCM32, reader, onlyCorners);
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TRasterGR8P rasGR8(raster);
|
|
Toshihiro Shimizu |
890ddd |
if (rasGR8) {
|
|
Toshihiro Shimizu |
890ddd |
readBorders_simple(rasGR8, reader, onlyCorners);
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TRasterGR16P rasGR16(raster);
|
|
Toshihiro Shimizu |
890ddd |
if (rasGR16) {
|
|
Toshihiro Shimizu |
890ddd |
readBorders_simple(rasGR16, reader, onlyCorners);
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} //namespace TRop::borders
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// Meshes Extraction (MeshesReader::Imp)
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace TRop
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
namespace borders
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TRop::borders::ImageMeshesReader::Imp
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
Face m_outerFace;
|
|
Toshihiro Shimizu |
890ddd |
tcg::list<imagemeshp> m_meshes;</imagemeshp>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
std::stack<face *=""> m_facesStack;</face>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int m_facesCount, m_edgesCount;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
Imp() : m_facesCount(), m_edgesCount() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void clear()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(m_facesStack.empty());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_outerFace = Face();
|
|
Toshihiro Shimizu |
890ddd |
m_meshes.clear();
|
|
Toshihiro Shimizu |
890ddd |
m_facesCount = m_edgesCount = 0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// Meshes Extraction (MeshesReader)
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ImageMeshesReader::ImageMeshesReader()
|
|
Toshihiro Shimizu |
890ddd |
: m_imp(new Imp)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ImageMeshesReader::~ImageMeshesReader()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ImageMeshesReader::clear()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_imp->clear();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
const Face &ImageMeshesReader::outerFace() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_imp->m_outerFace;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Face &ImageMeshesReader::outerFace()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_imp->m_outerFace;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
const tcg::list<imagemeshp> &ImageMeshesReader::meshes() const</imagemeshp>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_imp->m_meshes;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
tcg::list<imagemeshp> &ImageMeshesReader::meshes()</imagemeshp>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_imp->m_meshes;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ImageMeshesReader::openFace(ImageMesh *mesh, int faceIdx)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Face &fc = mesh ? mesh->face(faceIdx) : m_imp->m_outerFace;
|
|
Toshihiro Shimizu |
890ddd |
fc.imageIndex() = m_imp->m_facesCount++;
|
|
Toshihiro Shimizu |
890ddd |
m_imp->m_facesStack.push(&fc);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ImageMeshesReader::addMesh(ImageMesh *mesh)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Face &fc = *m_imp->m_facesStack.top();
|
|
Toshihiro Shimizu |
890ddd |
fc.meshes().push_back(m_imp->m_meshes.push_back(mesh));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ImageMeshesReader::closeFace()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_imp->m_facesStack.pop();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ImageMeshesReader::closeEdge(ImageMesh *mesh, int edgeIdx)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
mesh->edge(edgeIdx).imageIndex() = m_imp->m_edgesCount++;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} // namespace TRop::borders
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// Meshes Extraction (traits)
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace tcg
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
using namespace TRop::borders;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Reader traits
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
template <typename pixel=""></typename>
|
|
Toshihiro Shimizu |
890ddd |
struct container_reader_traits<imagemeshesreadert<pixel>, ImageMesh::face_type> {</imagemeshesreadert<pixel>
|
|
Toshihiro Shimizu |
890ddd |
typedef ImageMeshesReaderT<pixel> meshes_reader_type;</pixel>
|
|
Toshihiro Shimizu |
890ddd |
typedef typename meshes_reader_type::value_type value_type;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
inline static void openContainer(meshes_reader_type &reader, ImageMesh *mesh, int faceIdx, const value_type &colorValue)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
reader.openFace(mesh, faceIdx, colorValue);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
inline static void addElement(meshes_reader_type &reader, ImageMesh *mesh) { reader.addMesh(mesh); }
|
|
Toshihiro Shimizu |
890ddd |
inline static void closeContainer(meshes_reader_type &reader) { reader.closeFace(); }
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
template <typename pixel=""></typename>
|
|
Toshihiro Shimizu |
890ddd |
struct container_reader_traits<imagemeshesreadert<pixel>, ImageMesh::edge_type> {</imagemeshesreadert<pixel>
|
|
Toshihiro Shimizu |
890ddd |
typedef ImageMeshesReaderT<pixel> meshes_reader_type;</pixel>
|
|
Toshihiro Shimizu |
890ddd |
typedef typename meshes_reader_type::raster_edge_iterator raster_edge_iterator;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
inline static void openContainer(meshes_reader_type &reader, const raster_edge_iterator &it)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
reader.openEdge(it);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
inline static void addElement(meshes_reader_type &reader, const raster_edge_iterator &it)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
reader.addVertex(it);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
inline static void closeContainer(meshes_reader_type &reader, ImageMesh *mesh, int edgeIdx)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
reader.closeEdge(mesh, edgeIdx);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
} //namespace tcg
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// Meshes Extraction (functions)
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace TRop
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
namespace borders
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
template <typename pix=""></typename>
|
|
Toshihiro Shimizu |
890ddd |
void readMeshes(const TRasterPT<pix> &raster, ImageMeshesReaderT<pix> &reader)</pix></pix>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
typedef PixelSelector<pix> pixel_selector;</pix>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
reader.clear();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
raster->lock();
|
|
Toshihiro Shimizu |
890ddd |
readMeshes<pixel_selector, imagemesh,="" imagemeshesreadert<pix="">>(raster, reader.pixelSelector(), reader);</pixel_selector,>
|
|
Toshihiro Shimizu |
890ddd |
raster->unlock();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Standard type instantiations
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
template DV_EXPORT_API class RasterEdgeIterator<pixelselector<tpixel32>>;</pixelselector<tpixel32>
|
|
Toshihiro Shimizu |
890ddd |
template DV_EXPORT_API class RasterEdgeIterator<pixelselector<tpixel64>>;</pixelselector<tpixel64>
|
|
Toshihiro Shimizu |
890ddd |
template DV_EXPORT_API class RasterEdgeIterator<pixelselector<tpixelgr8>>;</pixelselector<tpixelgr8>
|
|
Toshihiro Shimizu |
890ddd |
template DV_EXPORT_API class RasterEdgeIterator<pixelselector<tpixelgr16>>;</pixelselector<tpixelgr16>
|
|
Toshihiro Shimizu |
890ddd |
template DV_EXPORT_API class RasterEdgeIterator<pixelselector<tpixelcm32>>;</pixelselector<tpixelcm32>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
template DV_EXPORT_API void readMeshes<tpixel32>(const TRasterPT<tpixel32> &raster, ImageMeshesReaderT<tpixel32> &reader);</tpixel32></tpixel32></tpixel32>
|
|
Toshihiro Shimizu |
890ddd |
template DV_EXPORT_API void readMeshes<tpixel64>(const TRasterPT<tpixel64> &raster, ImageMeshesReaderT<tpixel64> &reader);</tpixel64></tpixel64></tpixel64>
|
|
Toshihiro Shimizu |
890ddd |
template DV_EXPORT_API void readMeshes<tpixelgr8>(const TRasterPT<tpixelgr8> &raster, ImageMeshesReaderT<tpixelgr8> &reader);</tpixelgr8></tpixelgr8></tpixelgr8>
|
|
Toshihiro Shimizu |
890ddd |
template DV_EXPORT_API void readMeshes<tpixelgr16>(const TRasterPT<tpixelgr16> &raster, ImageMeshesReaderT<tpixelgr16> &reader);</tpixelgr16></tpixelgr16></tpixelgr16>
|
|
Toshihiro Shimizu |
890ddd |
template DV_EXPORT_API void readMeshes<tpixelcm32>(const TRasterPT<tpixelcm32> &raster, ImageMeshesReaderT<tpixelcm32> &reader);</tpixelcm32></tpixelcm32></tpixelcm32>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} //namespace TRop::borders
|