2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifndef TOONZIMAGE_UTILS_INCLUDED
|
|
|
|
#define TOONZIMAGE_UTILS_INCLUDED
|
|
|
|
|
|
|
|
#include "tpalette.h"
|
|
|
|
#include "trasterfx.h"
|
|
|
|
#include <set>
|
|
|
|
|
|
|
|
#undef DVAPI
|
|
|
|
#undef DVVAR
|
|
|
|
#ifdef TOONZLIB_EXPORTS
|
|
|
|
#define DVAPI DV_EXPORT_API
|
|
|
|
#define DVVAR DV_EXPORT_VAR
|
|
|
|
#else
|
|
|
|
#define DVAPI DV_IMPORT_API
|
|
|
|
#define DVVAR DV_IMPORT_VAR
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class TStroke;
|
|
|
|
class TVectorImageP;
|
|
|
|
class TColorStyle;
|
|
|
|
class TWidget;
|
|
|
|
class TFilePath;
|
|
|
|
class TTileSetCM32;
|
|
|
|
class TVectorPalette;
|
|
|
|
class TToonzImageP;
|
|
|
|
class TXshLevel;
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
namespace ToonzImageUtils {
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
DVAPI TRect convertWorldToRaster(const TRectD area, const TToonzImageP ti);
|
|
|
|
DVAPI TRectD convertRasterToWorld(const TRect area, const TToonzImageP ti);
|
|
|
|
|
|
|
|
// Disegna una ink stroke sulla toonzImage con il colore inkId.
|
|
|
|
// Se e' vero selective, disegna solo sulle zone senza altri ink.
|
|
|
|
// Se e' vero filled, riempe le parti chiuse (sempre con inkId).
|
|
|
|
// ritorna la bounding box (coordinate image) dell'area modificata
|
2016-06-15 18:43:10 +12:00
|
|
|
DVAPI TRect addInkStroke(const TToonzImageP &ti, TStroke *stroke, int inkId,
|
|
|
|
bool selective, bool filled, TRectD clip = TRectD(),
|
|
|
|
bool doAntialiasing = true);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
|
|
|
struct ChangeColorStrokeSettings {
|
2016-06-15 18:43:10 +12:00
|
|
|
TStroke *stroke;
|
|
|
|
int colorId;
|
|
|
|
int maskPaintId;
|
|
|
|
bool changeInk;
|
|
|
|
bool changePaint;
|
|
|
|
TRectD clip;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
DVAPI TRect changeColorStroke(const TToonzImageP &ti,
|
|
|
|
const ChangeColorStrokeSettings &settings);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Cancella gli ink in corrispondenza della stroke.
|
|
|
|
// Se maskInkId!=-1, cancella solo dove il vecchio ink e' uguale a maskInkId.
|
2016-06-15 18:43:10 +12:00
|
|
|
// void eraseInkStroke(const TToonzImageP &ti, TStroke *stroke, int maskInkId,
|
|
|
|
// TRectD clip=TRectD());
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// Cancella l'ink e/o il paint in corrispondenza della stroke, se
|
|
|
|
// maskStyleId!=-1, solo se
|
2016-03-19 06:57:51 +13:00
|
|
|
// sono uguali a maskStykeId (indipendentemente).
|
2016-06-15 18:43:10 +12:00
|
|
|
// DVAPI void eraseInkAndPaint(const TToonzImageP &ti, TStroke *stroke,
|
|
|
|
// int maskId, bool inkOnly, bool paintOnly,
|
|
|
|
// TRectD clip=TRectD());
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
// Cambia tutti gli ink della clip area con inkId.
|
2016-06-15 18:43:10 +12:00
|
|
|
// void changeInkRect (const TToonzImageP &ti, const TRectD &clip, int
|
|
|
|
// inkId);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
// cancella r ink, paint e inkAndPaint.
|
|
|
|
// Se lo styleId!=-1, cancella solo se sono uguali a questo stile
|
2016-06-15 18:43:10 +12:00
|
|
|
DVAPI TRect eraseRect(const TToonzImageP &ti, const TRectD &area, int maskId,
|
|
|
|
bool onInk, bool onPaint);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
DVAPI std::vector<TRect> paste(const TToonzImageP &ti,
|
|
|
|
const TTileSetCM32 *tileSet);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// DVAPI void updateRas32(const TToonzImageP &img, TRect clipRect=TRect());
|
|
|
|
// DVAPI void updateRas32(const TToonzImageP &img, const TTileSetCM32
|
|
|
|
// *tileSet);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
const TVectorPalette *getTCheckPalette();
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
DVAPI TToonzImageP vectorToToonzImage(
|
|
|
|
const TVectorImageP &vi, const TAffine &aff, TPalette *palette,
|
|
|
|
const TPointD &outputPos, const TDimension &outputSize,
|
|
|
|
const std::vector<TRasterFxRenderDataP> *fxs = 0,
|
|
|
|
bool transformThickness = false);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
DVAPI TPalette *loadTzPalette(const TFilePath &pltFile);
|
|
|
|
|
|
|
|
DVAPI void getUsedStyles(std::set<int> &styles, const TToonzImageP &ti);
|
2016-06-15 18:43:10 +12:00
|
|
|
DVAPI void scrambleStyles(const TToonzImageP &ti,
|
|
|
|
std::map<int, int> styleTable);
|
2016-04-19 19:32:17 +12:00
|
|
|
DVAPI std::string premultiply(const TFilePath &levelPath);
|
2016-06-15 18:43:10 +12:00
|
|
|
// DVAPI bool convertToTlv(const TFilePath& levelPathIn);
|
|
|
|
DVAPI void eraseImage(const TToonzImageP &ti, const TRaster32P &image,
|
|
|
|
const TPoint &pos, bool invert, bool eraseInk,
|
|
|
|
bool erasePaint, bool selective, int styleId);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|