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
Rozhuk Ivan ac51ab
/* FreeBSD defines atop() macro in standard includes. */
Rozhuk Ivan ac51ab
#undef atop
Rozhuk Ivan ac51ab
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
Shinya Kitaoka d1f6c4
class DVAPI TRopException final : public TException {
Shinya Kitaoka 120a6e
  std::string message;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TRopException(const std::string &s) : message(s) {}
Shinya Kitaoka 120a6e
  ~TRopException() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  TString getMessage() const override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//********************************************************************************
Toshihiro Shimizu 890ddd
//    TRop  namespace
Toshihiro Shimizu 890ddd
//********************************************************************************
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
//! The TRop namespace provides various algorithms to operate with Toonz's
Shinya Kitaoka 120a6e
//! raster types
Shinya Kitaoka 120a6e
namespace TRop {
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
enum ResampleFilterType {
Shinya Kitaoka 120a6e
  None,
Shinya Kitaoka 120a6e
  //! triangle filter
Shinya Kitaoka 120a6e
  Triangle,
Shinya Kitaoka 120a6e
  //! Mitchell-Netravali filter
Shinya Kitaoka 120a6e
  Mitchell,
Shinya Kitaoka 120a6e
  //! cubic convolution, a = .5
Shinya Kitaoka 120a6e
  Cubic5,
Shinya Kitaoka 120a6e
  //! cubic convolution, a = .75
Shinya Kitaoka 120a6e
  Cubic75,
Shinya Kitaoka 120a6e
  //! cubic convolution, a = 1
Shinya Kitaoka 120a6e
  Cubic1,
Shinya Kitaoka 120a6e
  //! Hann window, rad = 2
Shinya Kitaoka 120a6e
  Hann2,
Shinya Kitaoka 120a6e
  //! Hann window, rad = 3
Shinya Kitaoka 120a6e
  Hann3,
Shinya Kitaoka 120a6e
  //! Hamming window, rad = 2
Shinya Kitaoka 120a6e
  Hamming2,
Shinya Kitaoka 120a6e
  //! Hamming window, rad = 3
Shinya Kitaoka 120a6e
  Hamming3,
Shinya Kitaoka 120a6e
  //! Lanczos window, rad = 2
Shinya Kitaoka 120a6e
  Lanczos2,
Shinya Kitaoka 120a6e
  //! Lanczos window, rad = 3
Shinya Kitaoka 120a6e
  Lanczos3,
Shinya Kitaoka 120a6e
  //! Gaussian convolution
Shinya Kitaoka 120a6e
  Gauss,
Shinya Kitaoka 120a6e
  //! 'Quick' filter
Shinya Kitaoka 120a6e
  ClosestPixel,
Shinya Kitaoka 120a6e
  //! 'Quick' filter
Shinya Kitaoka 120a6e
  Bilinear,
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  HowMany
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
enum ColorMask { RChan = 0x1, GChan = 0x2, BChan = 0x4, MChan = 0x8 };
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
enum ErodilateMaskType { ED_rectangular, 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. */
Shinya Kitaoka 120a6e
DVAPI void rgbmScale(TRasterP rout, TRasterP rin, const double *k,
Shinya Kitaoka 120a6e
                     const double *a, const int *out0, const int *out1);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void rgbmScale(TRasterP rout, TRasterP rin, double kr, double kg,
Shinya Kitaoka 120a6e
                     double kb, double km, double ar = 0.0, double ag = 0.0,
Shinya Kitaoka 120a6e
                     double ab = 0.0, double am = 0.0);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
/*! Transforms each input channel interval into the corresponding channel
Shinya Kitaoka 120a6e
   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. */
Shinya Kitaoka 120a6e
DVAPI void rgbmAdjust(TRasterP rout, TRasterP rin, const int *in0,
Shinya Kitaoka 120a6e
                      const int *in1, const int *out0, const int *out1);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Make a checkoboard in \b rout
Shinya Kitaoka 120a6e
/*! 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*/
Shinya Kitaoka 120a6e
DVAPI void checkBoard(TRasterP rout, const TPixel32 &, const TPixel32 &,
Shinya Kitaoka 120a6e
                      const TDimensionD &, const TPointD &);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
//! Make the image over of the \b up raster on the \b dn raster and put the
Shinya Kitaoka 120a6e
//! 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);
Shinya Kitaoka 120a6e
//! Make the image over of the \b up raster on the \b out raster starting from
Shinya Kitaoka 120a6e
//! \b pos
Shinya Kitaoka 120a6e
DVAPI void over(const TRasterP &out, const TRasterP &up,
Shinya Kitaoka 120a6e
                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,
Shinya Kitaoka 120a6e
                ResampleFilterType filterType = Triangle);
Shinya Kitaoka 120a6e
//! Make the image over of the \b up raster on the \b out raster starting from
Shinya Kitaoka 120a6e
//! \b pos.
Toshihiro Shimizu 890ddd
//! Position \b pos must be already transformed using \b aff.
Shinya Kitaoka 120a6e
DVAPI void over(const TRasterP &out, const TRasterP &up, const TPoint &pos,
Shinya Kitaoka 120a6e
                const TAffine &aff, ResampleFilterType filterType = Triangle);
Shinya Kitaoka 120a6e
//! Make the image over of the \b up raster on the \b dn raster using a \b mask
Shinya Kitaoka 120a6e
//! and put the resulting raster in \b rout
Shinya Kitaoka 120a6e
DVAPI void over(const TRasterP &out, const TRasterP &dn, const TRasterP &up,
Shinya Kitaoka 120a6e
                const TRasterGR8P &mask);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
//! Make a coloring of \b rup with \b color and put the resulting raster in \b
Shinya Kitaoka 120a6e
//! 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,
Shinya Kitaoka 120a6e
                const TPoint &point = TPoint(), const TAffine &aff = TAffine());
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
//! Apply the transformation \b aff to the raster \b in and put the resulting
Shinya Kitaoka 120a6e
//! 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,
Shinya Kitaoka 120a6e
                    ResampleFilterType filterType = Triangle, double blur = 1.);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Like the over function, but only uses closest_pixel filter
Shinya Kitaoka 120a6e
DVAPI void quickPut(const TRasterP &out, const TRasterP &up, const TAffine &aff,
Shinya Kitaoka 120a6e
                    const TPixel32 &colorScale = TPixel::Black,
Shinya Kitaoka 120a6e
                    bool doPremultiply = false, bool whiteTransp = false,
Shinya Kitaoka 120a6e
                    bool firstColumn               = false,
Shinya Kitaoka 120a6e
                    bool doRasterDarkenBlendedView = false);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Like the over function but up image must be cmapped.
Shinya Kitaoka 120a6e
/*! Only uses closest_pixel filter.
Toshihiro Shimizu 890ddd
    GlobalMatte is the opacity, used for onionskinning
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void quickPut(const TRasterP &out, const TRasterCM32P &up,
Shinya Kitaoka 120a6e
                    const TPaletteP &plt, const TAffine &aff,
Shinya Kitaoka 120a6e
                    const TPixel32 &globalColorScale = TPixel::Black,
Shinya Kitaoka 120a6e
                    bool inksOnly                    = false);
Toshihiro Shimizu 890ddd
luz paz 6454c4
// for transparency check, ink check and paint check
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class CmappedQuickputSettings {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TPixel32 m_globalColorScale, m_transpCheckPaint, m_transpCheckBg,
Shinya Kitaoka 120a6e
      m_transpCheckInk;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_inkIndex, m_paintIndex;
Toshihiro Shimizu 890ddd
Jeremy Bullock ff7b10
  bool m_inksOnly, m_transparencyCheck, m_blackBgCheck, m_isOnionSkin;
Jeremy Bullock ff7b10
  int m_gapCheckIndex = -1;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  CmappedQuickputSettings()
Shinya Kitaoka 120a6e
      : m_globalColorScale(TPixel32::Black)
Shinya Kitaoka 120a6e
      , m_inksOnly(false)
Shinya Kitaoka 120a6e
      , m_transparencyCheck(false)
Shinya Kitaoka 120a6e
      , m_blackBgCheck(false)
Jeremy Bullock ff7b10
      , m_isOnionSkin(false)
Jeremy Bullock ff7b10
      , m_gapCheckIndex(-1)
Shinya Kitaoka 120a6e
      , m_inkIndex(-1)
Shinya Kitaoka 120a6e
      , m_paintIndex(-1) {}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void quickPut(const TRasterP &dn, const TRasterCM32P &upCM32,
Shinya Kitaoka 120a6e
                    const TPaletteP &plt, const TAffine &aff,
Shinya Kitaoka 120a6e
                    const CmappedQuickputSettings &settings);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void quickResampleColorFilter(const TRasterP &dn, const TRasterP &up,
Shinya Kitaoka 120a6e
                                    const TAffine &aff, const TPaletteP &plt,
Shinya Kitaoka 120a6e
                                    UCHAR colorMask);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void convolve_3_i(TRasterP rout, TRasterP rin, int dx, int dy,
Shinya Kitaoka 120a6e
                        double conv[]);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void convolve_i(TRasterP rout, TRasterP rin, int dx, int dy,
Shinya Kitaoka 120a6e
                      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
Shinya Kitaoka 120a6e
DVAPI void brush(TRaster32P ras, const TPoint &a, const TPoint &b, int radius,
Shinya Kitaoka 120a6e
                 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
Shinya Kitaoka 120a6e
//! Invert \b ras color in according with \b invRed, \b invGreen, \b invBlue, \b
Shinya Kitaoka 120a6e
//! invMatte
Shinya Kitaoka 120a6e
DVAPI void invert(TRasterP ras, bool invRed = true, bool invGreen = true,
Shinya Kitaoka 120a6e
                  bool invBlue = true, bool invMatte = false);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
//! Add \b rdown pixels to \b rup pixels in according with the factor \b v and
Shinya Kitaoka 120a6e
//! put the resulting raster in \b rout
Shinya Kitaoka 120a6e
DVAPI void add(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout,
Shinya Kitaoka 120a6e
               double v);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Add \b rdown pixels to \b rup pixels and put the resulting raster in \b rout
Shinya Kitaoka 120a6e
DVAPI void add(const TRasterP &rup, const TRasterP &rdown,
Shinya Kitaoka 120a6e
               const TRasterP &rout);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void colordodge(const TRasterP &rup, const TRasterP &rdown,
Shinya Kitaoka 120a6e
                      const TRasterP &rout);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void colorburn(const TRasterP &rup, const TRasterP &rdown,
Shinya Kitaoka 120a6e
                     const TRasterP &rout);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void screen(const TRasterP &rup, const TRasterP &rdown,
Shinya Kitaoka 120a6e
                  const TRasterP &rout);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
//! Subtract \b rdown pixels to \b rup pixels and put the resulting raster in \b
Shinya Kitaoka 120a6e
//! rout
Shinya Kitaoka 120a6e
DVAPI void sub(const TRasterP &rup, const TRasterP &rdown, const TRasterP &rout,
Shinya Kitaoka 120a6e
               bool matte);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void mult(const TRasterP &rup, const TRasterP &rdown,
Shinya Kitaoka 120a6e
                const TRasterP &rout, int v, bool matte);  //[-255..+255]
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void ropin(const TRasterP &source, const TRasterP &matte,
Shinya Kitaoka 120a6e
                 const TRasterP &rout);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void ropout(const TRasterP &source, const TRasterP &matte,
Shinya Kitaoka 120a6e
                  const TRasterP &rout);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void atop(const TRasterP &rup, const TRasterP &rdown,
Shinya Kitaoka 120a6e
                const TRasterP &rout);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void txor(const TRasterP &rup, const TRasterP &rdown,
Shinya Kitaoka 120a6e
                const TRasterP &rout);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void crossDissolve(const TRasterP &rup, const TRasterP &rdown,
Shinya Kitaoka 120a6e
                         const TRasterP &rout, UCHAR v);  //[0..255]
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void lighten(const TRasterP &rup, const TRasterP &rdown,
Shinya Kitaoka 120a6e
                   const TRasterP &rout);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void darken(const TRasterP &rup, const TRasterP &rdown,
Shinya Kitaoka 120a6e
                  const TRasterP &rout);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void ropmin(const TRasterP &rup, const TRasterP &rdown,
Shinya Kitaoka 120a6e
                  const TRasterP &rout, bool matte);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void ropmax(const TRasterP &rup, const TRasterP &rdown,
Shinya Kitaoka 120a6e
                  const TRasterP &rout);
Shinya Kitaoka 120a6e
DVAPI void linearburn(const TRasterP &rup, const TRasterP &rdown,
Shinya Kitaoka 120a6e
                      const TRasterP &rout);
Shinya Kitaoka 120a6e
DVAPI void overlay(const TRasterP &rup, const TRasterP &rdown,
Shinya Kitaoka 120a6e
                   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
shun_iwasawa 927bc0
// called from meshtexturizer in order to remove unwanted black contour
shun_iwasawa 927bc0
// appears at the border of the plastic-deformed texture.
shun_iwasawa 927bc0
// this function will "expand" color channels of the border pixels to
shun_iwasawa 927bc0
// neighbor full-transparent pixels.
shun_iwasawa 927bc0
// by doing this the linear interpolation at the border pixels will not
shun_iwasawa 927bc0
// decay color info and can get ideal antialiased result
shun_iwasawa 927bc0
DVAPI void expandColor(const TRaster32P &ras32, bool precise);
shun_iwasawa 927bc0
Toshihiro Shimizu 890ddd
//! all white pixels are set to transparent
Toshihiro Shimizu 890ddd
DVAPI void whiteTransp(const TRasterP &ras);
Toshihiro Shimizu 890ddd
shun_iwasawa 2c0f50
//! apply color filter and semi-transparency of column to the render result
shun_iwasawa 2c0f50
//  implemented in toperators.cpp
shun_iwasawa 2c0f50
DVAPI void applyColorScale(const TRasterP &ras, const TPixel32 &colorScale);
shun_iwasawa 2c0f50
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
Shinya Kitaoka 120a6e
DVAPI void gammaCorrectRGBM(TRasterP raster, double gammar, double gammag,
Shinya Kitaoka 120a6e
                            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
Shinya Kitaoka 120a6e
//! Inserts antialias around jaggy lines. Threshold is a pixel distance intended
Shinya Kitaoka 120a6e
//! from 0 to 256.
Toshihiro Shimizu 890ddd
//! Softness may vary from 0 to 100.
Shinya Kitaoka 120a6e
DVAPI void antialias(const TRasterP &src, const TRasterP &dst, int threshold,
Shinya Kitaoka 120a6e
                     int softness);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
//! Performs despeckling by replacing the color of small uniform areas (those
Shinya Kitaoka 120a6e
//! enclosable in a
Shinya Kitaoka 120a6e
//! square of specified edge length) with that most occurring along the area
Shinya Kitaoka 120a6e
//! border.
Toshihiro Shimizu 890ddd
DVAPI void majorityDespeckle(const TRasterP &ras, int sizeThreshold);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
//! Make blur effect on \b srcRas raster and put the result in \b dstRas.
Shinya Kitaoka 120a6e
DVAPI void blur(const TRasterP &dstRas, const TRasterP &srcRas, double blur,
Shinya Kitaoka 120a6e
                int dx, int dy, bool useSSE = false);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct RaylitParams {
Shinya Kitaoka 120a6e
  TPixel m_color;
Shinya Kitaoka 120a6e
  T3DPoint m_lightOriginSrc;
Shinya Kitaoka 120a6e
  T3DPoint m_lightOriginDst;
Shinya Kitaoka 120a6e
  double m_smoothness;
Shinya Kitaoka 120a6e
  double m_decay;
Shinya Kitaoka 120a6e
  double m_intensity;
Shinya Kitaoka 120a6e
  double m_scale;
Shinya Kitaoka 120a6e
  bool m_invert;
Shinya Kitaoka 120a6e
  bool m_includeInput;
shun-iwasawa 255f14
  double m_radius;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! Make raylit effect on \b srcRas raster and put the result in \b dstRas.
Shinya Kitaoka 120a6e
DVAPI void raylit(const TRasterP &dstRas, const TRasterP &srcRas,
Shinya Kitaoka 120a6e
                  const RaylitParams ¶ms);
Shinya Kitaoka 120a6e
DVAPI void glassRaylit(const TRasterP &dstRas, const TRasterP &srcRas,
Shinya Kitaoka 120a6e
                       const RaylitParams ¶ms);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void despeckle(const TRasterP &ras, int sizeThreshold, bool check,
Shinya Kitaoka 120a6e
                     bool trasparentIsWhite = false);
Shinya Kitaoka 120a6e
DVAPI void despeckle(const TRasterP &rout, const TRasterP &rin,
Shinya Kitaoka 120a6e
                     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
Shinya Kitaoka 120a6e
// result in 'left'
Toshihiro Shimizu 890ddd
DVAPI void makeStereoRaster(const TRasterP &left, const TRasterP &right);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
DVAPI void setChannel(const TRasterP &rin, TRasterP rout, UCHAR chan,
Shinya Kitaoka 120a6e
                      bool greytones);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Shinya Kitaoka 120a6e
    Applies classical morphological erosion/dilation to the specified input
Shinya Kitaoka 120a6e
   raster.
Toshihiro Shimizu 890ddd
    \note Supports rin == rout.
Toshihiro Shimizu 890ddd
  */
Shinya Kitaoka 120a6e
DVAPI void erodilate(const TRasterP &rin, const TRasterP &rout, double radius,
Shinya Kitaoka 120a6e
                     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!)
shun-iwasawa 84ffc5
 */
Shinya Kitaoka 120a6e
DVAPI _RASTER *convertRaster50to46(const TRasterP &inRas,
Shinya Kitaoka 120a6e
                                   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
Shinya Kitaoka 120a6e
//! Retrieves the input raster from Toonz internal cache. Need to call it before
Shinya Kitaoka 120a6e
//! using the raster.
Toshihiro Shimizu 890ddd
DVAPI void lockRaster(_RASTER *raster);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
//! Surrenders the input raster's buffer to the cache. Should be called before
Shinya Kitaoka 120a6e
//! inactivity periods.
Toshihiro Shimizu 890ddd
DVAPI void unlockRaster(_RASTER *raster);
Toshihiro Shimizu 890ddd
shun-iwasawa 84ffc5
}  // namespace TRop