OpenToonz - An open-source full-featured 2D animation creation software
C
Remove unused tcg headers (#2432)
otakuto3a56fafb0c17
diff --git a/toonz/sources/include/tcg/auto.h b/toonz/sources/include/tcg/auto.hdeleted file mode 100644index ae4252a25..000000000--- a/toonz/sources/include/tcg/auto.h+++ /dev/null@@ -1,199 +0,0 @@-#pragma once--#ifndef TCG_AUTO_H-#define TCG_AUTO_H--#include "base.h"-#include "traits.h"--/* \file auto.h-- \brief This file contains template classes able to perform special- operations upon- instance destruction.-- \details These classes can be useful to enforce block-scoped operations at a- block's- entry point, considering that a block end can be far away, or the- function- could return abruptly at several different points.-*/--namespace tcg {--//*******************************************************************************-// tcg::auto_type definition-//*******************************************************************************--struct _auto_type {- mutable bool m_destruct;--public:- _auto_type(bool destruct) : m_destruct(destruct) {}- _auto_type(const _auto_type &other) : m_destruct(other.m_destruct) {- other.m_destruct = false;- }- _auto_type &operator=(const _auto_type &other) {- m_destruct = other.m_destruct, other.m_destruct = false;- return *this;- }-};--typedef const _auto_type &auto_type;--//*******************************************************************************-// tcg::auto_func definition-//*******************************************************************************--template <typename Op>-struct auto_zerary : public _auto_type {- Op m_op;--public:- auto_zerary(bool destruct = true) : _auto_type(destruct) {}- ~auto_zerary() {- if (this->m_destruct) m_op();- }-};--//----------------------------------------------------------------------template <typename Op, typename T = typename function_traits<Op>::arg1_type>-struct auto_unary : public _auto_type {- T m_arg1;- Op m_op;--public:- auto_unary(bool destruct = true) : _auto_type(destruct) {}- auto_unary(Op op, T arg, bool destruct = true)- : _auto_type(destruct), m_arg1(arg), m_op(op) {}- ~auto_unary() {- if (this->m_destruct) m_op(m_arg1);- }-};--//----------------------------------------------------------------------template <typename Op, typename T1 = typename function_traits<Op>::arg1_type,- typename T2 = typename function_traits<Op>::arg2_type>-struct auto_binary : public _auto_type {- T1 m_arg1;- T2 m_arg2;- Op m_op;--public:- auto_binary(bool destruct = true) : _auto_type(destruct) {}- auto_binary(Op op, T1 arg1, T2 arg2, bool destruct = true)- : _auto_type(destruct), m_arg1(arg1), m_arg2(arg2), m_op(op) {}- ~auto_binary() {- if (this->m_destruct) m_op(m_arg1, m_arg2);- }-};--//*******************************************************************************-// Helper functions-//*******************************************************************************--template <typename Op>-auto_zerary<Op> make_auto(Op op, bool destruct = true) {- return auto_zerary<Op>(op, destruct);-}--template <typename Op, typename T>-auto_unary<Op> make_auto(Op op, T &arg1, bool destruct = true) {- return auto_unary<Op>(op, arg1, destruct);-}--template <typename Op, typename T>-auto_unary<Op> make_auto(Op op, const T &arg1, bool destruct = true) {- return auto_unary<Op>(op, arg1, destruct);-}--template <typename Op, typename T1, typename T2>-auto_binary<Op> make_auto(Op op, T1 &arg1, T2 &arg2, bool destruct = true) {- return auto_binary<Op>(op, arg1, arg2, destruct);-}--template <typename Op, typename T1, typename T2>-auto_binary<Op> make_auto(Op op, const T1 &arg1, T2 &arg2,- bool destruct = true) {- return auto_binary<Op>(op, arg1, arg2, destruct);-}--template <typename Op, typename T1, typename T2>-auto_binary<Op> make_auto(Op op, T1 &arg1, const T2 &arg2,- bool destruct = true) {- return auto_binary<Op>(op, arg1, arg2, destruct);-}--template <typename Op, typename T1, typename T2>-auto_binary<Op> make_auto(Op op, const T1 &arg1, const T2 &arg2,- bool destruct = true) {- return auto_binary<Op>(op, arg1, arg2, destruct);-}--//*******************************************************************************-// tcg::auto_reset definition-//*******************************************************************************--template <typename T, T val>-class auto_reset {- typedef T var_type;--public:- var_type &m_var;--public:- auto_reset(var_type &var) : m_var(var) {}- ~auto_reset() { m_var = val; }--private:- auto_reset(const auto_reset &);- auto_reset &operator=(const auto_reset &);-};--//*******************************************************************************-// tcg::auto_backup definition-//*******************************************************************************--template <typename T>-struct auto_backup {- typedef T var_type;--public:- var_type m_backup;- var_type *m_original;--public:- auto_backup() : m_original() {}- auto_backup(var_type &original) : m_original(&original), m_backup(original) {}- auto_backup(var_type *original) : m_original(original) {- if (m_original) m_backup = *m_original;- }- ~auto_backup() {- if (m_original) *m_original = m_backup;- }-- void reset(T &original) {- m_original = &original;- m_backup = original;- }- void reset(T *original) {- m_original = original;- if (m_original) m_backup = *original;- }-- T *release() {- T *original = m_original;- m_original = 0;- return original;- }--private:- auto_backup(const auto_backup &);- auto_backup &operator=(const auto_backup &);-};--} // namespace tcg--#endif // TCG_AUTO_Hdiff --git a/toonz/sources/include/tcg/functional.h b/toonz/sources/include/tcg/functional.hdeleted file mode 100644index 19fa86721..000000000--- a/toonz/sources/include/tcg/functional.h+++ /dev/null@@ -1,61 +0,0 @@-#pragma once--#ifndef TCG_FUNCTIONAL_H-#define TCG_FUNCTIONAL_H--#include "traits.h"--// std includes-#include <functional>--//**********************************************************************************-// Logical functor combinators-//**********************************************************************************--namespace tcg {--template <typename Fn1, typename Fn2>-class unary_and- : public std::unary_function<typename function_traits<Fn1>::arg_type,- bool> {- Fn1 m_fn1;- Fn2 m_fn2;--public:- unary_and(const Fn1 &fn1, const Fn2 &fn2) : m_fn1(fn1), m_fn2(fn2) {}-- bool operator()(const typename function_traits<Fn1>::arg_type &t) const {- return m_fn1(t) && m_fn2(t);- }-};--template <typename Fn1, typename Fn2>-unary_and<Fn1, Fn2> and1(const Fn1 &fn1, const Fn2 &fn2) {- return unary_and<Fn1, Fn2>(fn1, fn2);-}--//------------------------------------------------------------------------------------template <typename Fn1, typename Fn2>-class unary_or- : public std::unary_function<typename function_traits<Fn1>::arg_type,- bool> {- Fn1 m_fn1;- Fn2 m_fn2;--public:- unary_or(const Fn1 &fn1, const Fn2 &fn2) : m_fn1(fn1), m_fn2(fn2) {}-- bool operator()(const typename function_traits<Fn1>::arg_type &t) const {- return m_fn1(t) || m_fn2(t);- }-};--template <typename Fn1, typename Fn2>-unary_or<Fn1, Fn2> or1(const Fn1 &fn1, const Fn2 &fn2) {- return unary_or<Fn1, Fn2>(fn1, fn2);-}--} // namespace tcg--#endif // TCG_FUNCTIONAL_Hdiff --git a/toonz/sources/include/tcg/hpp/image_iterator.hpp b/toonz/sources/include/tcg/hpp/image_iterator.hppdeleted file mode 100644index cc0e154ce..000000000--- a/toonz/sources/include/tcg/hpp/image_iterator.hpp+++ /dev/null@@ -1,249 +0,0 @@-#pragma once--#ifndef TCG_IMAGE_ITERATOR_HPP-#define TCG_IMAGE_ITERATOR_HPP--// tcg includes-#include "../image_iterator.h"-#include "../pixel_ops.h"--namespace tcg {--//***************************************************************************-// image_edge_iterator implementation-//***************************************************************************--template <typename It, _iei_adherence_policy _adherence>-template <typename Img>-image_edge_iterator<It, _adherence>::image_edge_iterator(const Img &img, int x,- int y, int dirX,- int dirY)- : m_lx_1(image_traits<Img>::width(img) - 1)- , m_ly_1(image_traits<Img>::height(img) - 1)- , m_wrap(image_traits<Img>::wrap(img))- , m_pos(x, y)- , m_dir(dirX, dirY)- , m_outsideColor(image_traits<Img>::outsideColor(img))- , m_elbowColor(m_outsideColor)- , m_pix(image_traits<Img>::pixel(img, x, y))- , m_turn(UNKNOWN) {- pixels(m_leftPix, m_rightPix);- colors(m_leftColor, m_rightColor);-}--//-----------------------------------------------------------------------------------------------template <typename It, _iei_adherence_policy _adherence>-inline void image_edge_iterator<It, _adherence>::pixels(iter pixLeft,- iter pixRight) {- if (m_dir.y)- if (m_dir.y > 0)- pixLeft = m_pix - 1, pixRight = m_pix;- else- pixLeft = m_pix - m_wrap, pixRight = pixLeft - 1;- else if (m_dir.x > 0)- pixLeft = m_pix, pixRight = m_pix - m_wrap;- else- pixRight = m_pix - 1, pixLeft = pixRight - m_wrap;-}--//-----------------------------------------------------------------------------------------------template <typename It, _iei_adherence_policy _adherence>-inline void image_edge_iterator<It, _adherence>::colors(- value_type &leftColor, value_type &rightColor) {- if (m_dir.y)- if (m_dir.y > 0) {- if (m_pos.y > m_ly_1)- leftColor = rightColor = m_outsideColor;- else {- leftColor = (m_pos.x > 0) ? *m_leftPix : m_outsideColor;- rightColor = (m_pos.x <= m_lx_1) ? *m_rightPix : m_outsideColor;- }- } else {- if (m_pos.y < 1)- leftColor = rightColor = m_outsideColor;- else {- leftColor = (m_pos.x <= m_lx_1) ? *m_leftPix : m_outsideColor;- rightColor = (m_pos.x > 0) ? *m_rightPix : m_outsideColor;- }- }- else if (m_dir.x > 0) {- if (m_pos.x > m_lx_1)- leftColor = rightColor = m_outsideColor;- else {- leftColor = (m_pos.y <= m_ly_1) ? *m_leftPix : m_outsideColor;- rightColor = (m_pos.y > 0) ? *m_rightPix : m_outsideColor;- }- } else {- if (m_pos.x < 1)- leftColor = rightColor = m_outsideColor;- else {- leftColor = (m_pos.y > 0) ? *m_leftPix : m_outsideColor;- rightColor = (m_pos.y <= m_ly_1) ? *m_rightPix : m_outsideColor;- }- }-}--//-----------------------------------------------------------------------------------------------template <typename It, _iei_adherence_policy _adherence>-inline void image_edge_iterator<It, _adherence>::turn(- const value_type &newLeftColor, const value_type &newRightColor,- policy<RIGHT_ADHERENCE>) {- if (newLeftColor == m_rightColor) {- if (newRightColor == m_leftColor)- turnAmbiguous(newLeftColor, newRightColor);- else- turnLeft();- } else {- if (newRightColor != m_rightColor)- turnRight();- else- m_turn = STRAIGHT;- }-- m_elbowColor = newLeftColor;-- pixels(m_leftPix, m_rightPix);-}--//-----------------------------------------------------------------------------------------------template <typename It, _iei_adherence_policy _adherence>-inline void image_edge_iterator<It, _adherence>::turn(- const value_type &newLeftColor, const value_type &newRightColor,- policy<LEFT_ADHERENCE>) {- if (newRightColor == m_leftColor) {- if (newLeftColor == m_rightColor)- turnAmbiguous(newLeftColor, newRightColor);- else- turnRight();- } else {- if (newLeftColor != m_leftColor)- turnLeft();- else- m_turn = STRAIGHT;- }-- m_elbowColor = newRightColor;-- pixels(m_leftPix, m_rightPix);-}--//-----------------------------------------------------------------------------------------------template <typename It, _iei_adherence_policy _adherence>-inline void image_edge_iterator<It, _adherence>::turnAmbiguous(- const value_type &newLeftColor, const value_type &newRightColor) {- UCHAR count1 = 0, count2 = 0;-- value_type val;-- // Check the 4x4 neighbourhood and connect the minority color- if (m_pos.x > 2) {- val = *(m_pix - 2);- if (val == m_leftColor)- ++count1;- else if (val == m_rightColor)- ++count2;-- val = *(m_pix - 2 - m_wrap);- if (val == m_leftColor)- ++count1;- else if (val == m_rightColor)- ++count2;- }-- if (m_pos.x < m_lx_1) {- val = *(m_pix + 1);- if (val == m_leftColor)- ++count1;- else if (val == m_rightColor)- ++count2;-- val = *(m_pix + 1 - m_wrap);- if (val == m_leftColor)- ++count1;- else if (val == m_rightColor)- ++count2;- }-- if (m_pos.y > 2) {- int wrap2 = m_wrap << 1;-- val = *(m_pix - wrap2);- if (val == m_leftColor)- ++count1;- else if (val == m_rightColor)- ++count2;-- val = *(m_pix - wrap2 - 1);- if (val == m_leftColor)- ++count1;- else if (val == m_rightColor)- ++count2;- }-- if (m_pos.y < m_ly_1) {- val = *(m_pix + m_wrap);- if (val == m_leftColor)- ++count1;- else if (val == m_rightColor)- ++count2;-- val = *(m_pix + m_wrap - 1);- if (val == m_leftColor)- ++count1;- else if (val == m_rightColor)- ++count2;- }-- // Minority connection - join the one with less count- if (count1 <= count2)- turnRight(); // Join m_leftColor == newRightColor- else if (count1 > count2)- turnLeft(); // Join m_rightColor == newLeftColor-- m_turn |= AMBIGUOUS;-}--//-----------------------------------------------------------------------------------------------template <typename It, _iei_adherence_policy _adherence>-void image_edge_iterator<It, _adherence>::advance(policy<RIGHT_ADHERENCE>) {- value_type newLeftColor = m_leftColor, newRightColor = m_rightColor;-- int pixAdd = m_dir.y * m_wrap + m_dir.x;-- m_pos.x += m_dir.x, m_pos.y += m_dir.y;- m_pix += pixAdd, m_leftPix += pixAdd, m_rightPix += pixAdd;- m_leftColor = newLeftColor;-- colors(newLeftColor, newRightColor);-- turn(newLeftColor, newRightColor);- colors(m_leftColor, m_rightColor);-}--//-----------------------------------------------------------------------------------------------template <typename It, _iei_adherence_policy _adherence>-void image_edge_iterator<It, _adherence>::advance(policy<LEFT_ADHERENCE>) {- value_type newLeftColor = m_leftColor, newRightColor = m_rightColor;-- int pixAdd = m_dir.y * m_wrap + m_dir.x;-- m_pos.x += m_dir.x, m_pos.y += m_dir.y;- m_pix += pixAdd, m_leftPix += pixAdd, m_rightPix += pixAdd;- m_rightColor = newRightColor;-- colors(newLeftColor, newRightColor);-- turn(newLeftColor, newRightColor);- colors(m_leftColor, m_rightColor);-}--} // namespace tcg--#endif // TCG_IMAGE_ITERATOR_HPPdiff --git a/toonz/sources/include/tcg/image_iterator.h b/toonz/sources/include/tcg/image_iterator.hdeleted file mode 100644index ba5494ed0..000000000--- a/toonz/sources/include/tcg/image_iterator.h+++ /dev/null@@ -1,255 +0,0 @@---#ifndef TCG_IMAGE_ITERATOR_H-#define TCG_IMAGE_ITERATOR_H--// tcg includes-#include "tcg_ptr.h"-#include "tcg_image_ops.h"-#include "tcg_point.h"--// STD includes-#include <iterator>--namespace tcg {--//*********************************************************************************************************-// Image Iterator class-//*********************************************************************************************************--/*!- The image_iterator class models an iterator accessing pixels of an image along- its rows.-*/--template <typename It>-class image_iterator : public iterator_traits<It>::inheritable_iterator_type {- typedef typename iterator_traits<It>::inheritable_iterator_type iter;--public:- typedef typename iter::iterator_category iterator_category;- typedef typename iter::value_type value_type;- typedef typename iter::difference_type difference_type;- typedef typename iter::pointer pointer;- typedef typename iter::reference reference;--public:- image_iterator() {}-- template <typename Img>- image_iterator(const Img &img, int x, int y)- : iter(image_traits<Img>::pixel(img, x, y))- , m_base(image_traits<Img>::pixel(img, 0, 0))- , m_lx(image_traits<Img>::width(img))- , m_ly(image_traits<Img>::height(img))- , m_wrap(image_traits<Img>::wrap(img))- , m_skew(m_wrap - lx) {}-- int x() const { return (iter::operator-(m_base)) % m_wrap; }- int y() const { return (iter::operator-(m_base)) / m_wrap; }-- image_iterator &operator++() {- iter::operator++();- if (x() >= m_lx) iter::operator+=(m_skew);- return *this;- }- image_iterator operator++(int) {- image_iterator it(*this);- operator++();- return it;- }-- image_iterator &operator--() {- iter::operator--();- if (x() < 0) iter::operator-=(m_skew);- return *this;- }- image_iterator operator--(int) {- image_iterator it(*this);- operator--();- return it;- }-- image_iterator &operator+=(difference_type d) {- int yCount = (x() + d) / m_lx;- iter::operator+=((d - yCount * m_lx) + yCount * m_wrap);- return *this;- }- image_iterator operator+(difference_type d) const {- image_iterator it(*this);- it += d;- return it;- }-- image_iterator operator-(difference_type d) const { return operator+(-d); }- image_iterator &operator-=(difference_type d) { return operator+=(-d); }-- difference_type operator-(const image_iterator &other) const {- return (x() - other.x()) + m_lx * (y() - other.y());- }-- reference operator[](difference_type d) const {- const image_iterator &it = operator+(d);- return *it;- }--protected:- iter m_base;- int m_lx, m_ly, m_wrap, m_skew;-};--//*********************************************************************************************************-// image_edge_iterator class-//*********************************************************************************************************--enum _iei_adherence_policy { LEFT_ADHERENCE, RIGHT_ADHERENCE };--/*!- The image_edge_iterator class models a forward iterator following the contour- of- an image area of uniform color.-*/--template <typename It, _iei_adherence_policy _adherence = RIGHT_ADHERENCE>-class image_edge_iterator {- typedef typename iterator_traits<It>::inheritable_iterator_type iter;--public:- typedef std::forward_iterator_tag iterator_category;- typedef typename iter::value_type value_type;- typedef typename iter::difference_type difference_type;- typedef typename iter::pointer pointer;- typedef typename iter::reference reference;--public:- enum { adherence = _adherence };-- enum Direction {- STRAIGHT = 0x0,- LEFT = 0x1,- RIGHT = 0x2,- AMBIGUOUS = 0x4,- UNKNOWN = 0x8,- AMBIGUOUS_LEFT = LEFT | AMBIGUOUS,- AMBIGUOUS_RIGHT = RIGHT | AMBIGUOUS- };--public:- image_edge_iterator() {}-- template <typename Img>- image_edge_iterator(const Img &img, int x, int y, int dirX, int dirY);-- const Point &pos() const { return m_pos; }- const Point &dir() const { return m_dir; }-- const value_type &leftColor() const { return m_leftColor; }- const value_type &rightColor() const { return m_rightColor; }-- const value_type &color() const { return color(policy<_adherence>()); }- const value_type &oppositeColor() const {- return oppositeColor(policy<_adherence>());- }- const value_type &elbowColor() const { return m_elbowColor; }-- iter leftPixel() const { return m_leftPix; }- iter rightPixel() const { return m_rightPix; }-- iter pixel() const { return pixel(policy<_adherence>()); }- iter oppositePixel() const { return oppositePixel(policy<_adherence>()); }-- Direction turn() const { return Direction(m_turn); }--public:- // Iterator functions-- bool operator==(const image_edge_iterator &it) const {- return (m_pos == it.m_pos) && (m_dir == it.m_dir);- }- bool operator!=(const image_edge_iterator &it) const {- return !operator==(it);- }-- image_edge_iterator &operator++() {- advance(policy<_adherence>());- return *this;- }- image_edge_iterator operator++(int) {- image_edge_iterator temp(*this);- operator++();- return temp;- }--private:- void pixels(iter pixLeft, iter pixRight);- void colors(value_type &leftColor, value_type &rightColor);-- void turnLeft() {- int temp = m_dir.x;- m_dir.x = -m_dir.y;- m_dir.y = temp;- m_turn = LEFT;- }- void turnRight() {- int temp = m_dir.x;- m_dir.x = m_dir.y;- m_dir.y = -temp;- m_turn = RIGHT;- }-- void turn(const value_type &newLeftColor, const value_type &newRightColor) {- turn(newLeftColor, newRightColor, policy<_adherence>());- }- void turnAmbiguous(const value_type &newLeftColor,- const value_type &newRightColor);--private:- template <_iei_adherence_policy>- struct policy {};-- const value_type &color(policy<LEFT_ADHERENCE>) const { return m_leftColor; }- const value_type &color(policy<RIGHT_ADHERENCE>) const {- return m_rightColor;- }-- const value_type &oppositeColor(policy<LEFT_ADHERENCE>) const {- return m_rightColor;- }- const value_type &oppositeColor(policy<RIGHT_ADHERENCE>) const {- return m_leftColor;- }-- iter pixel(policy<LEFT_ADHERENCE>) const { return m_leftPix; }- iter pixel(policy<RIGHT_ADHERENCE>) const { return m_rightPix; }-- iter oppositePixel(policy<LEFT_ADHERENCE>) const { return m_rightPix; }- iter oppositePixel(policy<RIGHT_ADHERENCE>) const { return m_leftPix; }-- void turn(const value_type &newLeftColor, const value_type &newRightColor,- policy<LEFT_ADHERENCE>);- void turn(const value_type &newLeftColor, const value_type &newRightColor,- policy<RIGHT_ADHERENCE>);-- void advance(policy<LEFT_ADHERENCE>);- void advance(policy<RIGHT_ADHERENCE>);--private:- int m_lx_1, m_ly_1, m_wrap;-- Point m_pos, m_dir;-- value_type m_leftColor, m_rightColor, m_outsideColor, m_elbowColor;- iter m_pix, m_leftPix, m_rightPix;-- int m_turn;-};--} // namespace tcg--#endif // TCG_IMAGE_ITERATOR_H--//=====================================================================================--#ifdef INCLUDE_HPP-#include "hpp/image_iterator.hpp"-#endif // INCLUDE_HPPdiff --git a/toonz/sources/include/tcg/rect.h b/toonz/sources/include/tcg/rect.hdeleted file mode 100644index 1b1bdb79f..000000000--- a/toonz/sources/include/tcg/rect.h+++ /dev/null@@ -1,276 +0,0 @@-#pragma once--#ifndef TCG_RECT_H-#define TCG_RECT_H--#include "point.h"-#include "size.h"--// STD includes-#include <limits>--namespace tcg {--//**********************************************************************************-// Bidimensional Rect class-//**********************************************************************************--template <typename T>-struct RectT {- T x0, y0, x1, y1;--public:- RectT() : x0((std::numeric_limits<T>::max)()), y0(x0), x1(-x0), y1(x1) {}- RectT(T x0_, T y0_, T x1_, T y1_) : x0(x0_), y0(y0_), x1(x1_), y1(y1_) {}- RectT(const PointT<T> &p0, const PointT<T> &p1)- : x0(p0.x), y0(p0.y), x1(p1.x), y1(p1.y) {}- RectT(const PointT<T> &p0, const SizeT<T> &size)- : x0(p0.x), y0(p0.y), x1(p0.x + size.w), y1(p0.y + size.h) {}-- bool empty() const { return (x1 <= x0) || (y1 <= y0); }-- PointT<T> p0() const { return PointT<T>(x0, y0); }- PointT<T> p1() const { return PointT<T>(x1, y1); }- PointT<T> center() const { return PointT<T>((x0 + x1) / 2, (y0 + y1) / 2); }-- T width() const { return x1 - x0; }- T height() const { return y1 - y0; }- SizeT<T> size() const { return SizeT<T>(width(), height()); }-- bool operator==(const RectT &other) const {- return x0 == other.x0 && y0 == other.y0 && x1 == other.x1 && y1 == other.y1;- }- bool operator!=(const RectT &other) const { return !operator==(other); }-- RectT &operator+=(const PointT<T> &p) {- x0 += p.x, y0 += p.y, x1 += p.x, y1 += p.y;- return *this;- }- RectT &operator-=(const PointT<T> &p) {- x0 -= p.x, y0 -= p.y, x1 -= p.x, y1 -= p.y;- return *this;- }-- friend RectT<T> operator+(const RectT<T> &r, const tcg::PointT<T> &p) {- return RectT<T>(r.x0 + p.x, r.y0 + p.y, r.x1 + p.x, r.y1 + p.y);- }- friend RectT<T> operator-(const RectT<T> &r, const tcg::PointT<T> &p) {- return RectT<T>(r.x0 - p.x, r.y0 - p.y, r.x1 - p.x, r.y1 - p.y);- }- friend RectT<T> operator+(const tcg::PointT<T> &p, const RectT<T> &r) {- return RectT<T>(p.x + r.x0, p.y + r.y0, p.x + r.x1, p.y + r.y1);- }- friend RectT<T> operator-(const tcg::PointT<T> &p, const RectT<T> &r) {- return RectT<T>(p.x - r.x0, p.y - r.y0, p.x - r.x1, p.y - r.y1);- }-- template <typename K>- RectT &operator*=(K k) {- x0 *= k, y0 *= k, x1 *= k, y1 *= k;- return *this;- }-- template <typename K>- friend RectT<T> operator*(const RectT<T> &r, K k) {- return RectT<T>(r.x0 * k, r.y0 * k, r.x1 * k, r.y1 * k);- }- template <typename K>- friend RectT<T> operator*(K k, const RectT<T> &r) {- return RectT<T>(k * r.x0, k * r.y0, k * r.x1, k * r.y1);- }-- RectT &operator|=(const RectT &other) {- if (x0 > other.x0) x0 = other.x0;- if (y0 > other.y0) y0 = other.y0;- if (x1 < other.x1) x1 = other.x1;- if (y1 < other.y1) y1 = other.y1;- return *this;- }-- RectT &operator&=(const RectT &other) {- if (x0 < other.x0) x0 = other.x0;- if (y0 < other.y0) y0 = other.y0;- if (x1 > other.x1) x1 = other.x1;- if (y1 > other.y1) y1 = other.y1;- return *this;- }-- RectT &operator|=(const PointT<T> &p) {- return operator|=(RectT(p.x, p.y, p.x, p.y));- }- RectT &operator&=(const PointT<T> &p) {- return operator&=(RectT(p.x, p.y, p.x, p.y));- }-- friend RectT<T> operator|(const RectT<T> &a, const RectT<T> &b) {- return RectT<T>(a) |= b;- }- friend RectT<T> operator&(const RectT<T> &a, const RectT<T> &b) {- return RectT<T>(a) &= b;- }-- friend RectT<T> operator|(const RectT<T> &r, const PointT<T> &p) {- return RectT<T>(r) |= p;- }- friend RectT<T> operator&(const RectT<T> &r, const PointT<T> &p) {- return RectT<T>(r) &= p;- }- friend RectT<T> operator|(const PointT<T> &p, const RectT<T> &r) {- return RectT<T>(r) |= p;- }- friend RectT<T> operator&(const PointT<T> &p, const RectT<T> &r) {- return RectT<T>(r) &= p;- }-};--//--------------------------------------------------------------------------typedef RectT<double> RectD;-typedef RectT<int> RectI;-typedef RectI Rect;--//**********************************************************************************-// Tridimensional Rect class-//**********************************************************************************--template <typename T>-struct Rect3T {- T x0, y0, z0, x1, y1, z1;--public:- Rect3T()- : x0((std::numeric_limits<T>::max)())- , y0(x0)- , z0(x0)- , x1(-x0)- , y1(x1)- , z1(x1) {}- Rect3T(T x0_, T y0_, T z0_, T x1_, T y1_, T z1_)- : x0(x0_), y0(y0_), z0(z0_), x1(x1_), y1(y1_), z1(z1_) {}- Rect3T(const Point3T<T> &p0, const Point3T<T> &p1)- : x0(p0.x), y0(p0.y), z0(p0.z) x1(p1.x), y1(p1.y), z1(p1.z) {}- Rect3T(const Point3T<T> &p0, const Size3T<T> &size)- : x0(p0.x)- , y0(p0.y)- , z0(p0.z)- , x1(p0.x + size.w)- , y1(p0.y + size.h)- , z1(p0.z + size.d) {}-- bool empty() const { return (x1 <= x0) || (y1 <= y0) || (z1 <= z0); }-- Point3T<T> p0() const { return Point3T<T>(x0, y0, z0); }- Point3T<T> p1() const { return Point3T<T>(x1, y1, z1); }- Point3T<T> center() const {- return Point3T<T>((x0 + x1) / 2, (y0 + y1) / 2, (z0 + z1) / 2);- }-- T width() const { return x1 - x0; }- T height() const { return y1 - y0; }- T depth() const { return z1 - z0; }- Size3T<T> size() const { return Size3T<T>(width(), height(), depth()); }-- bool operator==(const Rect3T &other) const {- return x0 == other.x0 && y0 == other.y0 && z0 == other.z0 &&- x1 == other.x1 && y1 == other.y1 && z1 == other.z1;- }- bool operator!=(const Rect3T &other) const { return !operator==(other); }-- Rect3T &operator+=(const Point3T<T> &p) {- x0 += p.x, y0 += p.y, z0 += p.z, x1 += p.x, y1 += p.y, z1 += p.z;- return *this;- }- Rect3T &operator-=(const Point3T<T> &p) {- x0 -= p.x, y0 -= p.y, z0 -= p.z, x1 -= p.x, y1 -= p.y, z1 -= p.z;- return *this;- }-- friend Rect3T<T> operator+(const Rect3T<T> &r, const tcg::Point3T<T> &p) {- return Rect3T<T>(r.x0 + p.x, r.y0 + p.y, r.z0 + p.z, r.x1 + p.x, r.y1 + p.y,- r.z1 + p.z);- }- friend Rect3T<T> operator-(const Rect3T<T> &r, const tcg::Point3T<T> &p) {- return Rect3T<T>(r.x0 - p.x, r.y0 - p.y, r.z0 - p.z, r.x1 - p.x, r.y1 - p.y,- r.z1 - p.z);- }- friend Rect3T<T> operator+(const tcg::Point3T<T> &p, const Rect3T<T> &r) {- return Rect3T<T>(p.x + r.x0, p.x + r.y0, p.x + r.z0, p.x + r.x1 + p.x, r.y1,- p.x + r.z1);- }- friend Rect3T<T> operator-(const tcg::Point3T<T> &p, const Rect3T<T> &r) {- return Rect3T<T>(p.x - r.x0, p.y - r.y0, p.z - r.z0, p.x - r.x1, p.y - r.y1,- p.z - r.z1);- }-- template <typename K>- Rect3T &operator*=(K k) {- x0 *= k, y0 *= k, z0 *= k, x1 *= k, y1 *= k, z1 *= k;- return *this;- }-- template <typename K>- friend Rect3T<T> operator*(const Rect3T<T> &r, K k) {- return RectT<T>(r.x0 * k, r.y0 * k, r.z0 * k, r.x1 * k, r.y1 * k, r.z1 * k);- }- template <typename K>- friend Rect3T<T> operator*(K k, const Rect3T<T> &r) {- return RectT<T>(k * r.x0, k * r.y0, k * r.z0, k * r.x1, k * r.y1, k * r.z1);- }-- Rect3T &operator|=(const Rect3T &other) {- if (x0 > other.x0) x0 = other.x0;- if (y0 > other.y0) y0 = other.y0;- if (z0 > other.z0) z0 = other.z0;- if (x1 < other.x1) x1 = other.x1;- if (y1 < other.y1) y1 = other.y1;- if (z1 < other.z1) z1 = other.z1;- return *this;- }-- Rect3T &operator&=(const Rect3T &other) {- if (x0 < other.x0) x0 = other.x0;- if (y0 < other.y0) y0 = other.y0;- if (z0 < other.z0) z0 = other.z0;- if (x1 > other.x1) x1 = other.x1;- if (y1 > other.y1) y1 = other.y1;- if (z1 > other.z1) z1 = other.z1;- return *this;- }-- Rect3T &operator|=(const Point3T<T> &p) {- return operator|=(RectT(p.x, p.y, p.z, p.x, p.y, p.z));- }- Rect3T &operator&=(const Point3T<T> &p) {- return operator&=(RectT(p.x, p.y, p.z, p.x, p.y, p.z));- }-- friend Rect3T<T> operator|(const Rect3T<T> &a, const Rect3T<T> &b) {- return Rect3T<T>(a) |= b;- }- friend Rect3T<T> operator&(const Rect3T<T> &a, const Rect3T<T> &b) {- return Rect3T<T>(a) &= b;- }-- friend Rect3T<T> operator|(const Rect3T<T> &r, const Point3T<T> &p) {- return Rect3T<T>(r) |= p;- }- friend Rect3T<T> operator&(const Rect3T<T> &r, const Point3T<T> &p) {- return Rect3T<T>(r) &= p;- }- friend Rect3T<T> operator|(const Point3T<T> &p, const Rect3T<T> &r) {- return Rect3T<T>(r) |= p;- }- friend Rect3T<T> operator&(const Point3T<T> &p, const Rect3T<T> &r) {- return Rect3T<T>(r) &= p;- }-};--//--------------------------------------------------------------------------typedef Rect3T<double> Rect3D;-typedef Rect3T<int> Rect3I;-typedef RectI Rect;--} // namespace tcg--#endif // TCG_RECT_Hdiff --git a/toonz/sources/include/tcg/size.h b/toonz/sources/include/tcg/size.hdeleted file mode 100644index c43d9d760..000000000--- a/toonz/sources/include/tcg/size.h+++ /dev/null@@ -1,218 +0,0 @@-#pragma once--#ifndef TCG_SIZE_H-#define TCG_SIZE_H--namespace tcg {--//**********************************************************************************-// Bidimensional size class-//**********************************************************************************--template <typename T>-struct SizeT {- typedef T value_type;--public:- T w, h;--public:- SizeT() : w(), h() {}- SizeT(T w_, T h_) : w(w_), h(h_) {}-- bool empty() const { return (w <= 0) || (h <= 0); }-- SizeT &operator+=(const SizeT &other) {- w += other.w, h += other.h;- return *this;- }- SizeT &operator-=(const SizeT &other) {- w -= other.w, h -= other.h;- return *this;- }-- friend SizeT<T> operator+(const SizeT<T> &a, const SizeT<T> &b) {- return SizeT<T>(a.w + b.w, a.h + b.h);- }-- friend SizeT<T> operator-(const SizeT<T> &a, const SizeT<T> &b) {- return SizeT<T>(a.w - b.w, a.h - b.h);- }-- template <typename K>- SizeT &operator*=(K k) {- w *= k, h *= k;- return *this;- }-- template <typename K>- SizeT &operator/=(K k) {- w /= k, h /= k;- return *this;- }-- template <typename K>- friend SizeT<T> operator*(K k, const SizeT<T> &a) {- return SizeT<T>(k * a.w, k * a.h);- }-- template <typename K>- friend SizeT<T> operator*(const SizeT<T> &a, K k) {- return SizeT<T>(a.w * k, a.h * k);- }-- template <typename K>- friend SizeT<T> operator/(const SizeT<T> &a, K k) {- return SizeT<T>(a.w / k, a.h / k);- }-- SizeT &operator&=(const SizeT &other) {- if (other.w < w) w = other.w;- if (other.h < h) h = other.h;-- return *this;- }-- SizeT &operator|=(const SizeT &other) {- if (other.w > w) w = other.w;- if (other.h > h) h = other.h;-- return *this;- }-- friend SizeT<T> operator&(const SizeT<T> &a, const SizeT<T> &b) {- SizeT<T> tmp(a);- return tmp &= b;- }- friend SizeT<T> operator|(const SizeT<T> &a, const SizeT<T> &b) {- SizeT<T> tmp(a);- return tmp |= b;- }-};--//--------------------------------------------------------------------------typedef SizeT<int> SizeI;-typedef SizeI Size;-typedef SizeT<double> SizeD;--//**********************************************************************************-// Tridimensional size class-//**********************************************************************************--template <typename T>-struct Size3T {- typedef T value_type;--public:- T w, h, d;--public:- Size3T() : w(), h(), d() {}- Size3T(T w_, T h_, T d_) : w(w_), h(h_), d(d_) {}-- bool empty() const { return (w <= 0) || (h <= 0) || (d <= 0); }-- Size3T &operator+=(const Size3T &other) {- w += other.w, h += other.h, d += other.d;- return *this;- }- Size3T &operator-=(const Size3T &other) {- w -= other.w, h -= other.h, d -= other.d;- return *this;- }-- friend Size3T<T> operator+(const Size3T<T> &a, const Size3T<T> &b) {- return SizeT<T>(a.w + b.w, a.h + b.h, a.d + b.d);- }-- friend Size3T<T> operator-(const Size3T<T> &a, const Size3T<T> &b) {- return SizeT<T>(a.w - b.w, a.h - b.h, a.d + b.d);- }-- template <typename K>- Size3T &operator*=(K k) {- w *= k, h *= k, d *= k;- return *this;- }-- template <typename K>- Size3T &operator/=(K k) {- w /= k, h /= k, d /= k;- return *this;- }-- template <typename K>- friend Size3T<T> operator*(K k, const Size3T<T> &a) {- return Size3T<T>(k * a.w, k * a.h, k * a.d);- }-- template <typename K>- friend Size3T<T> operator*(const Size3T<T> &a, K k) {- return Size3T<T>(a.w * k, a.h * k, a.d * k);- }-- template <typename K>- friend Size3T<T> operator/(const Size3T<T> &a, K k) {- return Size3T<T>(a.w / k, a.h / k, a.d / k);- }-- Size3T &operator&=(const Size3T &other) {- if (other.w < w) w = other.w;- if (other.h < h) h = other.h;- if (other.d < d) d = other.d;-- return *this;- }-- Size3T &operator|=(const Size3T &other) {- if (other.w > w) w = other.w;- if (other.h > h) h = other.h;- if (other.d > d) d = other.d;-- return *this;- }-- friend Size3T<T> operator&(const Size3T<T> &a, const Size3T<T> &b) {- Size3T<T> tmp(a);- return tmp &= b;- }- friend Size3T<T> operator|(const Size3T<T> &a, const Size3T<T> &b) {- Size3T<T> tmp(a);- return tmp |= b;- }-};--//--------------------------------------------------------------------------typedef Size3T<int> Size3I;-typedef Size3I Size3;-typedef Size3T<double> Size3D;--//**********************************************************************************-// N-dimensional size class-//**********************************************************************************--template <int N, typename T>-struct SizeN {- static const int size = N;- typedef T value_type;--public:- T span[N];--public:- SizeN() {}- SizeN(const T &t) { std::fill(span, span + N, t); }-- template <typename It>- SizeN(It begin, It end) {- std::copy(begin, end, span);- }-- // To be completed...-};--} // namespace tcg--#endif // TCG_SIZE_Hdiff --git a/toonz/sources/include/tcg/tcg_auto.h b/toonz/sources/include/tcg/tcg_auto.hdeleted file mode 100644index a2bec777d..000000000--- a/toonz/sources/include/tcg/tcg_auto.h+++ /dev/null@@ -1,3 +0,0 @@-#pragma once--#include "auto.h"diff --git a/toonz/sources/include/tcg/tcg_image_iterator.h b/toonz/sources/include/tcg/tcg_image_iterator.hdeleted file mode 100644index 3b93c0671..000000000--- a/toonz/sources/include/tcg/tcg_image_iterator.h+++ /dev/null@@ -1,3 +0,0 @@-#pragma once--#include "image_iterator.h"