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