|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef CONVERT2FILLED_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
#define CONVERT2FILLED_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tfilepath.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tlevel_io.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tpalette.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "trasterimage.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "ttoonzimage.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TOONZLIB_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 |
class DVAPI Convert2Tlv
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
TLevelP m_level1;
|
|
Toshihiro Shimizu |
890ddd |
TLevel::Iterator m_it;
|
|
Toshihiro Shimizu |
890ddd |
TLevelReaderP m_lr1;
|
|
Toshihiro Shimizu |
890ddd |
TLevelReaderP m_lr2;
|
|
Toshihiro Shimizu |
890ddd |
TLevelWriterP m_lw;
|
|
Toshihiro Shimizu |
890ddd |
map<tpixel, int=""> m_colorMap;</tpixel,>
|
|
Toshihiro Shimizu |
890ddd |
TDimension m_size;
|
|
Toshihiro Shimizu |
890ddd |
int m_count;
|
|
Toshihiro Shimizu |
890ddd |
int m_from, m_to;
|
|
Toshihiro Shimizu |
890ddd |
TPalette *m_palette;
|
|
Toshihiro Shimizu |
890ddd |
int m_colorTolerance;
|
|
Toshihiro Shimizu |
890ddd |
int m_lastIndex, m_maxPaletteIndex;
|
|
Toshihiro Shimizu |
890ddd |
int m_antialiasType;
|
|
Toshihiro Shimizu |
890ddd |
int m_antialiasValue;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool m_isUnpaintedFromNAA;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void buildToonzRaster(TRasterCM32P &rout, const TRasterP &rin1, const TRasterP &rin2);
|
|
Toshihiro Shimizu |
890ddd |
void doFill(TRasterCM32P &rout, const TRaster32P &rin);
|
|
Toshihiro Shimizu |
890ddd |
void buildInksFromGrayTones(TRasterCM32P &rout, const TRasterP &rin);
|
|
Toshihiro Shimizu |
890ddd |
map<tpixel, int="">::const_iterator findNearestColor(const TPixel &color);</tpixel,>
|
|
Toshihiro Shimizu |
890ddd |
void buildInks(TRasterCM32P &rout, const TRaster32P &rin);
|
|
Toshihiro Shimizu |
890ddd |
TPalette *buildPalette();
|
|
Toshihiro Shimizu |
890ddd |
void removeAntialias(TRasterCM32P &r);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void buildInksForNAAImage(TRasterCM32P &rout, const TRaster32P &rin);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFilePath m_levelIn1, m_levelIn2, m_levelOut, m_palettePath;
|
|
Toshihiro Shimizu |
890ddd |
bool m_autoclose, m_premultiply;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// i livelli passati devono essere tif o png.
|
|
Toshihiro Shimizu |
890ddd |
// se filepath2=TFilePath(), viene creata una tlv unpainted, altrimenti painted.
|
|
Toshihiro Shimizu |
890ddd |
// nel secondo caso, i due livelli specificati (in qualsiasi ordine, la classe capisce da sola qual'e' l'unpainted e la painted)
|
|
Toshihiro Shimizu |
890ddd |
// devono contenere la versione painted e quella unpainted della stessa sequenza di immagini
|
|
Toshihiro Shimizu |
890ddd |
// la tlv e la tpl vengono salvate con il nome e il folder di filepath1.
|
|
Toshihiro Shimizu |
890ddd |
Convert2Tlv(const TFilePath &filepath1, const TFilePath &filepath2, const TFilePath &outFolder, const QString &outName,
|
|
Toshihiro Shimizu |
890ddd |
int from, int to, bool doAutoclose, const TFilePath &palettePath, int colorTolerance,
|
|
Toshihiro Shimizu |
890ddd |
int antialiasType, int antialiasValue, bool isUnpaintedFromNAA);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool init(string &errorMessage);
|
|
Toshihiro Shimizu |
890ddd |
int getFramesToConvertCount();
|
|
Toshihiro Shimizu |
890ddd |
bool abort();
|
|
Toshihiro Shimizu |
890ddd |
bool convertNext(string &errorMessage);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// gmt, 3/1/2013; making raster>toonzraster conversion available to scripts
|
|
Toshihiro Shimizu |
890ddd |
// it seems too complex to modify Convert2Tlv, that refer to file levels instead of memory levels.
|
|
Toshihiro Shimizu |
890ddd |
// RasterToToonzRasterConverter uses the same algorithms (more or less)
|
|
Toshihiro Shimizu |
890ddd |
// TODO: refactor the two classes
|
|
Toshihiro Shimizu |
890ddd |
// NOTE: you don't need to specify a palette (with RasterToToonzRasterConverter::setPalette()): in that case a suitable palette is generated
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI RasterToToonzRasterConverter
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPaletteP m_palette;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
RasterToToonzRasterConverter();
|
|
Toshihiro Shimizu |
890ddd |
~RasterToToonzRasterConverter();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setPalette(const TPaletteP &palette);
|
|
Toshihiro Shimizu |
890ddd |
const TPaletteP &getPalette() const { return m_palette; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TRasterCM32P convert(const TRasterP &inputRaster);
|
|
Toshihiro Shimizu |
890ddd |
TRasterCM32P convert(const TRasterP &inksInputRaster, const TRasterP &paintInputRaster);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TToonzImageP convert(const TRasterImageP &ri);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|