Toshihiro Shimizu 890ddd
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "trastercm.h"
Toshihiro Shimizu 890ddd
#include "texception.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TROP_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
//===============================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//  Forward declarations
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TPalette;
Toshihiro Shimizu 890ddd
typedef TSmartPointerT<tpalette> TPaletteP;</tpalette>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
extern "C" {
Toshihiro Shimizu 890ddd
struct _RASTER;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//===============================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//********************************************************************************
Toshihiro Shimizu 890ddd
//    TRopException  definition
Toshihiro Shimizu 890ddd
//********************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TRopException : public TException
Toshihiro Shimizu 890ddd
{
Shinya Kitaoka 3bfa54
	std::string message;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 3bfa54
	TRopException(const std::string &s) : message(s) {}
Toshihiro Shimizu 890ddd
	~TRopException() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TString getMessage() const;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//********************************************************************************
Toshihiro Shimizu 890ddd
//    TRop  namespace
Toshihiro Shimizu 890ddd
//********************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! The TRop namespace provides various algorithms to operate with Toonz's raster types
Toshihiro Shimizu 890ddd
namespace TRop
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
enum ResampleFilterType {
Toshihiro Shimizu 890ddd
	None,
Toshihiro Shimizu 890ddd
	//! triangle filter
Toshihiro Shimizu 890ddd
	Triangle,
Toshihiro Shimizu 890ddd
	//! Mitchell-Netravali filter
Toshihiro Shimizu 890ddd
	Mitchell,
Toshihiro Shimizu 890ddd
	//! cubic convolution, a = .5
Toshihiro Shimizu 890ddd
	Cubic5,
Toshihiro Shimizu 890ddd
	//! cubic convolution, a = .75
Toshihiro Shimizu 890ddd
	Cubic75,
Toshihiro Shimizu 890ddd
	//! cubic convolution, a = 1
Toshihiro Shimizu 890ddd
	Cubic1,
Toshihiro Shimizu 890ddd
	//! Hann window, rad = 2
Toshihiro Shimizu 890ddd
	Hann2,
Toshihiro Shimizu 890ddd
	//! Hann window, rad = 3
Toshihiro Shimizu 890ddd
	Hann3,
Toshihiro Shimizu 890ddd
	//! Hamming window, rad = 2
Toshihiro Shimizu 890ddd
	Hamming2,
Toshihiro Shimizu 890ddd
	//! Hamming window, rad = 3
Toshihiro Shimizu 890ddd
	Hamming3,
Toshihiro Shimizu 890ddd
	//! Lanczos window, rad = 2
Toshihiro Shimizu 890ddd
	Lanczos2,
Toshihiro Shimizu 890ddd
	//! Lanczos window, rad = 3
Toshihiro Shimizu 890ddd
	Lanczos3,
Toshihiro Shimizu 890ddd
	//! Gaussian convolution
Toshihiro Shimizu 890ddd
	Gauss,
Toshihiro Shimizu 890ddd
	//! 'Quick' filter
Toshihiro Shimizu 890ddd
	ClosestPixel,
Toshihiro Shimizu 890ddd
	//! 'Quick' filter
Toshihiro Shimizu 890ddd
	Bilinear,
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	HowMany
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
enum ColorMask { RChan = 0x1,
Toshihiro Shimizu 890ddd
				 GChan = 0x2,
Toshihiro Shimizu 890ddd
				 BChan = 0x4,
Toshihiro Shimizu 890ddd
				 MChan = 0x8 };
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
enum ErodilateMaskType { ED_rectangular,
Toshihiro Shimizu 890ddd
						 ED_circular };
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Applies first order mappings to each of \b rin's channels.
Toshihiro Shimizu 890ddd
/*! \note The input and output rasters must have the same size and pixel type.
Toshihiro Shimizu 890ddd
            Supports rout == rin. */
Toshihiro Shimizu 890ddd
DVAPI void rgbmScale(TRasterP rout, TRasterP rin,
Toshihiro Shimizu 890ddd
					 const double *k, const double *a, const int *out0, const int *out1);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void rgbmScale(TRasterP rout, TRasterP rin,
Toshihiro Shimizu 890ddd
					 double kr, double kg, double kb, double km,
Toshihiro Shimizu 890ddd
					 double ar = 0.0, double ag = 0.0, double ab = 0.0, double am = 0.0);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*! Transforms each input channel interval into the corresponding channel interval,
Toshihiro Shimizu 890ddd
      cropping values if necessary.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
      Specified pointers are associated to int[5] arrays representing the 5-ple
Toshihiro Shimizu 890ddd
      (RGB, R, G, B, M) - where RGBM adjustment apply first. Then, Global apply
Toshihiro Shimizu 890ddd
      equally on RGB channels (but not on M).*/
Toshihiro Shimizu 890ddd
/*! \note The input and output rasters must have the same size and pixel type.
Toshihiro Shimizu 890ddd
            Supports rout == rin. */
Toshihiro Shimizu 890ddd
DVAPI void rgbmAdjust(TRasterP rout, TRasterP rin,
Toshihiro Shimizu 890ddd
					  const int *in0, const int *in1, const int *out0, const int *out1);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Make a checkoboard in \b rout
Toshihiro Shimizu 890ddd
/*! Two variables \b TPixel32 describe the checkboard color, 
Toshihiro Shimizu 890ddd
      \b TDimension are checkboard dimension and \b TPoinD the position
Toshihiro Shimizu 890ddd
  \include checkBoard_ex.cpp*/
Toshihiro Shimizu 890ddd
DVAPI void checkBoard(TRasterP rout, const TPixel32 &, const TPixel32 &, const TDimensionD &, const TPointD &);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Make the image over of the \b up raster on the \b dn raster and put the resulting raster in \b rout
Toshihiro Shimizu 890ddd
/*! \include over_ex1.cpp*/
Toshihiro Shimizu 890ddd
DVAPI void over(const TRasterP &out, const TRasterP &dn, const TRasterP &up);
Toshihiro Shimizu 890ddd
//! Make the image over of the \b up raster on the \b out raster starting from \b pos
Toshihiro Shimizu 890ddd
DVAPI void over(const TRasterP &out, const TRasterP &up, const TPoint &pos = TPoint());
Toshihiro Shimizu 890ddd
//! Make the image over of the \b up raster on the \b out raster
Toshihiro Shimizu 890ddd
DVAPI void over(const TRasterP &out, const TRasterP &up, const TAffine &aff,
Toshihiro Shimizu 890ddd
				ResampleFilterType filterType = Triangle);
Toshihiro Shimizu 890ddd
//! Make the image over of the \b up raster on the \b out raster starting from \b pos.
Toshihiro Shimizu 890ddd
//! Position \b pos must be already transformed using \b aff.
Toshihiro Shimizu 890ddd
DVAPI void over(const TRasterP &out, const TRasterP &up, const TPoint &pos, const TAffine &aff,
Toshihiro Shimizu 890ddd
				ResampleFilterType filterType = Triangle);
Toshihiro Shimizu 890ddd
//! Make the image over of the \b up raster on the \b dn raster using a \b mask and put the resulting raster in \b rout
Toshihiro Shimizu 890ddd
DVAPI void over(const TRasterP &out, const TRasterP &dn, const TRasterP &up, const TRasterGR8P &mask);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Make a coloring of \b rup with \b color and put the resulting raster in \b rout
Toshihiro Shimizu 890ddd
DVAPI void over(TRaster32P rout, const TRasterGR8P &rup, const TPixel32 &color);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void over(TRasterP rout, const TRasterCM32P &rup, TPalette *palette,
Toshihiro Shimizu 890ddd
				const TPoint &point = TPoint(), const TAffine &aff = TAffine());
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Apply the transformation \b aff to the raster \b in and put the resulting raster in \b rout
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
      It can be specified a resample filter type and a blur factor.
Toshihiro Shimizu 890ddd
    \include resample_ex.cpp
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
DVAPI void resample(const TRasterP &out, const TRasterP &in, const TAffine &aff,
Toshihiro Shimizu 890ddd
					ResampleFilterType filterType = Triangle, double blur = 1.);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Like the over function, but only uses closest_pixel filter
Toshihiro Shimizu 890ddd
DVAPI void quickPut(const TRasterP &out,
Toshihiro Shimizu 890ddd
					const TRasterP &up,
Toshihiro Shimizu 890ddd
					const TAffine &aff,
Toshihiro Shimizu 890ddd
					const TPixel32 &colorScale = TPixel::Black,
Toshihiro Shimizu 890ddd
					bool doPremultiply = false,
Toshihiro Shimizu 890ddd
					bool whiteTransp = false,
Toshihiro Shimizu 890ddd
					bool firstColumn = false,
Toshihiro Shimizu 890ddd
					bool doRasterDarkenBlendedView = false);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Like the over function but up image must be cmapped.
Toshihiro Shimizu 890ddd
/*! Only uses closest_pixel filter. 
Toshihiro Shimizu 890ddd
    GlobalMatte is the opacity, used for onionskinning
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void quickPut(const TRasterP &out, const TRasterCM32P &up, const TPaletteP &plt,
Toshihiro Shimizu 890ddd
					const TAffine &aff, const TPixel32 &globalColorScale = TPixel::Black, bool inksOnly = false);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// for trasparency check, ink check and paint check
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class CmappedQuickputSettings
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TPixel32 m_globalColorScale,
Toshihiro Shimizu 890ddd
		m_transpCheckPaint,
Toshihiro Shimizu 890ddd
		m_transpCheckBg,
Toshihiro Shimizu 890ddd
		m_transpCheckInk;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int m_inkIndex,
Toshihiro Shimizu 890ddd
		m_paintIndex;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool m_inksOnly,
Toshihiro Shimizu 890ddd
		m_transparencyCheck,
Toshihiro Shimizu 890ddd
		m_blackBgCheck;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	CmappedQuickputSettings()
Toshihiro Shimizu 890ddd
		: m_globalColorScale(TPixel32::Black), m_inksOnly(false), m_transparencyCheck(false), m_blackBgCheck(false), m_inkIndex(-1), m_paintIndex(-1) {}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void quickPut(const TRasterP &dn, const TRasterCM32P &upCM32, const TPaletteP &plt, const TAffine &aff,
Toshihiro Shimizu 890ddd
					const CmappedQuickputSettings &settings);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void quickResampleColorFilter(const TRasterP &dn, const TRasterP &up, const TAffine &aff,
Toshihiro Shimizu 890ddd
									const TPaletteP &plt, UCHAR colorMask);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void convolve_3_i(TRasterP rout, TRasterP rin, int dx, int dy, double conv[]);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void convolve_i(TRasterP rout, TRasterP rin, int dx, int dy, double conv[], int radius);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void fracmove(TRasterP rout, TRasterP rin, double dx, double dy);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Convert \b src raster in raster type \b dst
Toshihiro Shimizu 890ddd
DVAPI void convert(TRasterP dst, const TRasterP &src);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Copy \b src in \b dst
Toshihiro Shimizu 890ddd
DVAPI void copy(TRasterP dst, const TRasterP &src);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void brush(TRaster32P ras, const TPoint &a, const TPoint &b, int radius, const TPixel32 &color);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Get \b bbox of \b ras raster
Toshihiro Shimizu 890ddd
DVAPI void computeBBox(TRasterP ras, TRect &bbox);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Add background of color \b col to the \b ras raster
Toshihiro Shimizu 890ddd
DVAPI void addBackground(TRasterP ras, const TPixel32 &col);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Return true if \b ras is opaque
Toshihiro Shimizu 890ddd
DVAPI bool isOpaque(TRasterP ras);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Invert \b ras color in according with \b invRed, \b invGreen, \b invBlue, \b invMatte
Toshihiro Shimizu 890ddd
DVAPI void invert(TRasterP ras, bool invRed = true, bool invGreen = true, bool invBlue = true, bool invMatte = false);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Add \b rdown pixels to \b rup pixels in according with the factor \b v and put the resulting raster in \b rout
Toshihiro Shimizu 890ddd
DVAPI void add(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout, double v);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Add \b rdown pixels to \b rup pixels and put the resulting raster in \b rout
Toshihiro Shimizu 890ddd
DVAPI void add(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void colordodge(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void colorburn(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void screen(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Subtract \b rdown pixels to \b rup pixels and put the resulting raster in \b rout
Toshihiro Shimizu 890ddd
DVAPI void sub(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout, bool matte);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void mult(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout, int v, bool matte); //[-255..+255]
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void ropin(const TRasterP &source, const TRasterP &matte, const TRasterP &rout);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void ropout(const TRasterP &source, const TRasterP &matte, const TRasterP &rout);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void atop(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void txor(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void crossDissolve(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout, UCHAR v); //[0..255]
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void lighten(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void darken(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void ropmin(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout, bool matte);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void ropmax(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout);
Toshihiro Shimizu 890ddd
DVAPI void linearburn(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout);
Toshihiro Shimizu 890ddd
DVAPI void overlay(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Make a premultiply of all raster pixels
Toshihiro Shimizu 890ddd
DVAPI void premultiply(const TRasterP &ras);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Make a depremultiply of all raster pixels
Toshihiro Shimizu 890ddd
DVAPI void depremultiply(const TRasterP &ras);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! all white pixels are set to transparent
Toshihiro Shimizu 890ddd
DVAPI void whiteTransp(const TRasterP &ras);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI TRasterP shrink(TRasterP rin, int shrink);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Make a \b gamma correct in the \b raster
Toshihiro Shimizu 890ddd
DVAPI void gammaCorrect(TRasterP raster, double gamma);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Make a \b gamma correct in the \b raster
Toshihiro Shimizu 890ddd
DVAPI void gammaCorrectRGBM(TRasterP raster, double gammar, double gammag, double gammab, double gammam);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Return the pixel size of the \b blur border
Toshihiro Shimizu 890ddd
DVAPI int getBlurBorder(double blur);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Inserts antialias around jaggy lines. Threshold is a pixel distance intended from 0 to 256.
Toshihiro Shimizu 890ddd
//! Softness may vary from 0 to 100.
Toshihiro Shimizu 890ddd
DVAPI void antialias(const TRasterP &src, const TRasterP &dst, int threshold, int softness);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Performs despeckling by replacing the color of small uniform areas (those enclosable in a
Toshihiro Shimizu 890ddd
//! square of specified edge length) with that most occurring along the area border.
Toshihiro Shimizu 890ddd
DVAPI void majorityDespeckle(const TRasterP &ras, int sizeThreshold);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//!Make blur effect on \b srcRas raster and put the result in \b dstRas.
Toshihiro Shimizu 890ddd
DVAPI void blur(
Toshihiro Shimizu 890ddd
	const TRasterP &dstRas,
Toshihiro Shimizu 890ddd
	const TRasterP &srcRas,
Toshihiro Shimizu 890ddd
	double blur,
Toshihiro Shimizu 890ddd
	int dx, int dy,
Toshihiro Shimizu 890ddd
	bool useSSE = false);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct RaylitParams {
Toshihiro Shimizu 890ddd
	TPixel m_color;
Toshihiro Shimizu 890ddd
	T3DPoint m_lightOriginSrc;
Toshihiro Shimizu 890ddd
	T3DPoint m_lightOriginDst;
Toshihiro Shimizu 890ddd
	double m_smoothness;
Toshihiro Shimizu 890ddd
	double m_decay;
Toshihiro Shimizu 890ddd
	double m_intensity;
Toshihiro Shimizu 890ddd
	double m_scale;
Toshihiro Shimizu 890ddd
	bool m_invert;
Toshihiro Shimizu 890ddd
	bool m_includeInput;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Make raylit effect on \b srcRas raster and put the result in \b dstRas.
Toshihiro Shimizu 890ddd
DVAPI void raylit(const TRasterP &dstRas, const TRasterP &srcRas, const RaylitParams ¶ms);
Toshihiro Shimizu 890ddd
DVAPI void glassRaylit(const TRasterP &dstRas, const TRasterP &srcRas, const RaylitParams ¶ms);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void despeckle(const TRasterP &ras, int sizeThreshold, bool check, bool trasparentIsWhite = false);
Toshihiro Shimizu 890ddd
DVAPI void despeckle(const TRasterP &rout, const TRasterP &rin, int sizeThreshold, bool check);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Return a raster with r b channels swapped
Toshihiro Shimizu 890ddd
DVAPI TRaster32P copyAndSwapRBChannels(const TRaster32P &srcRaster);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//result in 'left'
Toshihiro Shimizu 890ddd
DVAPI void makeStereoRaster(const TRasterP &left, const TRasterP &right);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void setChannel(const TRasterP &rin, TRasterP rout, UCHAR chan, bool greytones);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
    Applies classical morphological erosion/dilation to the specified input raster.
Toshihiro Shimizu 890ddd
    \note Supports rin == rout.
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
DVAPI void erodilate(const TRasterP &rin, const TRasterP &rout,
Toshihiro Shimizu 890ddd
					 double radius, ErodilateMaskType type);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef TNZ_MACHINE_CHANNEL_ORDER_MRGB
Toshihiro Shimizu 890ddd
DVAPI void swapRBChannels(const TRaster32P &r);
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
///////////////////////////////////////
Toshihiro Shimizu 890ddd
//  Utilities for Toonz 4.6 porting  //
Toshihiro Shimizu 890ddd
///////////////////////////////////////
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Convert TRasterP in an old toonz raster!
Toshihiro Shimizu 890ddd
/*! Use the same buffer, not creates a new raster (the palette is new instead!)
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
DVAPI _RASTER *convertRaster50to46(const TRasterP &inRas, const TPaletteP &inPalette);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Release the old toonz raster.
Toshihiro Shimizu 890ddd
/*! If the \b doReleaseBuffer is true, the buffer is released
Toshihiro Shimizu 890ddd
    (the palette is always deleted!)
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
DVAPI void releaseRaster46(_RASTER *&r, bool doReleaseBuffer = false);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Read an image in the path \b filename and put it in an old toonz raster
Toshihiro Shimizu 890ddd
DVAPI _RASTER *readRaster46(const char *filename);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Retrieves the input raster from Toonz internal cache. Need to call it before using the raster.
Toshihiro Shimizu 890ddd
DVAPI void lockRaster(_RASTER *raster);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Surrenders the input raster's buffer to the cache. Should be called before inactivity periods.
Toshihiro Shimizu 890ddd
DVAPI void unlockRaster(_RASTER *raster);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
} // TRop namespace