Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Clear out references to flash and linetest

Jeremy Bullock175c6b712219
diff --git a/toonz/sources/colorfx/colorfxutils.cpp b/toonz/sources/colorfx/colorfxutils.cpp
index 1073cd2e0..85ebcdb4e 100644
--- a/toonz/sources/colorfx/colorfxutils.cpp
+++ b/toonz/sources/colorfx/colorfxutils.cpp
@@ -3,7 +3,6 @@
#include "colorfxutils.h"
#include "drawutil.h"
#include "tregion.h"
-#include "tflash.h"
RubberDeform::RubberDeform() : m_pPolyOri(0), m_polyLoc() {}
@@ -100,276 +99,3 @@ void RubberDeform::refinePoly(const double rf) {
}
m_polyLoc = tmpv;
}
-
-// ------------------- SFlashUtils -------------------------------------------
-
-void SFlashUtils::computeOutline(const TRegion *region,
- TRegionOutline::PointVector &polyline) const {
- if (!region) return;
-
- const double pixelSize = 1.0;
- polyline.clear();
-
- std::vector<TPointD> polyline2d;
-
- int edgeSize = region->getEdgeCount();
-
- for (int i = 0; i < edgeSize; i++) {
- TEdge &edge = *region->getEdge(i);
- stroke2polyline(polyline2d, *edge.m_s, pixelSize, edge.m_w0, edge.m_w1);
- }
- int pointNumber = polyline2d.size();
- polyline.reserve(pointNumber);
- for (int j = 0; j < pointNumber; j++) {
- polyline.push_back(T3DPointD(polyline2d[j], 0.0));
- }
-}
-
-void SFlashUtils::computeRegionOutline() {
- if (!m_r) return;
-
- int subRegionNumber = m_r->getSubregionCount();
- TRegionOutline::PointVector app;
-
- m_ro.m_exterior.clear();
- computeOutline(m_r, app);
-
- m_ro.m_exterior.push_back(app);
- m_ro.m_interior.clear();
- m_ro.m_interior.reserve(subRegionNumber);
- for (int i = 0; i < subRegionNumber; i++) {
- app.clear();
- computeOutline(m_r->getSubregion(i), app);
- m_ro.m_interior.push_back(app);
- }
-
- m_ro.m_bbox = m_r->getBBox();
-}
-
-void SFlashUtils::PointVector2QuadsArray(const std::vector<T3DPointD> &pv,
- std::vector<TQuadratic *> &quadArray,
- std::vector<TQuadratic *> &toBeDeleted,
- const bool isRounded) const {
- int nbPv = pv.size();
- quadArray.clear();
-
- if (isRounded) {
- if (nbPv <= 2) {
- if (nbPv == 1) {
- TPointD p0, p1, p2;
- p0 = TPointD(pv[0].x, pv[0].y);
- p1 = TPointD(pv[0].x, pv[0].y);
- p2 = TPointD(pv[0].x, pv[0].y);
- quadArray.push_back(new TQuadratic(p0, p1, p2));
- toBeDeleted.push_back(quadArray.back());
- }
- if (nbPv == 2) {
- TPointD p0, p1, p2;
- p0 = TPointD(pv[0].x, pv[0].y);
- p1 = TPointD((pv[0].x + pv[1].x) / 2, (pv[0].y + pv[1].y) / 2);
- p2 = TPointD(pv[1].x, pv[1].y);
- quadArray.push_back(new TQuadratic(p0, p1, p2));
- toBeDeleted.push_back(quadArray.back());
- }
- return;
- }
-
- for (int i = 0; i < (nbPv - 2); i++) {
- TPointD p0, p1, p2;
- p0 = TPointD((pv[i].x + pv[i + 1].x) / 2, (pv[i].y + pv[i + 1].y) / 2);
- p1 = TPointD(pv[i + 1].x, pv[i + 1].y);
- p2 = TPointD((pv[i + 1].x + pv[i + 2].x) / 2,
- (pv[i + 1].y + pv[i + 2].y) / 2);
- quadArray.push_back(new TQuadratic(p0, p1, p2));
- toBeDeleted.push_back(quadArray.back());
- }
- TPointD p0, p1, p2;
- p0 = TPointD((pv[nbPv - 2].x + pv[nbPv - 1].x) / 2,
- (pv[nbPv - 2].y + pv[nbPv - 1].y) / 2);
- p1 = TPointD(pv[nbPv - 1].x, pv[nbPv - 1].y);
- p2 = TPointD((pv[0].x + pv[1].x) / 2, (pv[0].y + pv[1].y) / 2);
- quadArray.push_back(new TQuadratic(p0, p1, p2));
- toBeDeleted.push_back(quadArray.back());
- } else {
- for (int i = 0; i < (nbPv - 1); i++) {
- TPointD p0, p1, p2;
- p0 = TPointD(pv[i].x, pv[i].y);
- p2 = TPointD(pv[i + 1].x, pv[i + 1].y);
- p1 = TPointD((p0.x + p2.x) * 0.5, (p0.y + p2.y) * 0.5);
- quadArray.push_back(new TQuadratic(p0, p1, p2));
- toBeDeleted.push_back(quadArray.back());
- }
- TPointD p0, p1, p2;
- p0 = TPointD(pv[nbPv - 1].x, pv[nbPv - 1].y);
- p2 = TPointD(pv[0].x, pv[0].y);
- p1 = TPointD((p0.x + p2.x) * 0.5, (p0.y + p2.y) * 0.5);
- quadArray.push_back(new TQuadratic(p0, p1, p2));
- toBeDeleted.push_back(quadArray.back());
- }
-}
-
-void SFlashUtils::drawRegionOutline(TFlash &flash, const bool isRounded) const {
- if (!m_r) return;
-
- std::vector<std::vector<TQuadratic *>> quads;
- std::vector<TQuadratic *> toBeDeleted;
- std::vector<TQuadratic *> quadArray;
- PointVector2QuadsArray(*(m_ro.m_exterior.begin()), quadArray, toBeDeleted,
- isRounded);
- quads.push_back(quadArray);
-
- TRegionOutline::Boundary::const_iterator iinter = m_ro.m_interior.begin();
- TRegionOutline::Boundary::const_iterator iinter_end = m_ro.m_interior.end();
- for (; iinter != iinter_end; iinter++) {
- PointVector2QuadsArray(*iinter, quadArray, toBeDeleted, isRounded);
- quads.push_back(quadArray);
- }
-
- flash.drawPolygon(quads);
- clearPointerContainer(toBeDeleted);
-}
-
-int SFlashUtils::nbDiffVerts(const std::vector<TPointD> &pv) const {
- std::vector<TPointD> lpv;
- if (pv.size() == 0) return 0;
- lpv.push_back(pv[0]);
- for (int i = 1; i < (int)pv.size(); i++) {
- bool isDiff = true;
- for (int j = 0; j < (int)lpv.size() && isDiff; j++)
- isDiff = lpv[j] == pv[i] ? false : isDiff;
- if (isDiff) {
- lpv.push_back(pv[i]);
- }
- }
- return lpv.size();
-}
-
-void SFlashUtils::Triangle2Quad(std::vector<TPointD> &p) const {
- TPointD e;
- int i, j;
- i = j = -1;
- if (p[0] == p[1]) {
- i = 0;
- j = 1;
- e = p[2] - p[3];
- } else if (p[0] == p[2]) {
- } else if (p[0] == p[3]) {
- i = 0;
- j = 3;
- e = p[2] - p[1];
- } else if (p[1] == p[2]) {
- i = 1;
- j = 2;
- e = p[3] - p[0];
- } else if (p[1] == p[3]) {
- } else if (p[2] == p[3]) {
- i = 2;
- j = 3;
- e = p[0] - p[1];
- }
- e = normalize(e);
- p[j] = p[i] + e * 0.001;
-}
-
-void SFlashUtils::drawGradedPolyline(TFlash &flash, std::vector<TPointD> &pvv,
- const TPixel32 &c1,
- const TPixel32 &c2) const {
- std::vector<TPointD> pv;
- pv = pvv;
- int nbDV = nbDiffVerts(pv);
- if (nbDV < 3 || nbDV > 4) return;
- if (nbDV == 3) Triangle2Quad(pv);
-
- // Direction Of polyline
- TPointD u = pv[0] - pv[1];
- TPointD up = (pv[0] + pv[1]) * 0.5;
- u = normalize(u);
- u = rotate90(u);
- TPointD up1 = up + u;
- TPointD up2 = up - u;
- double d1 = (tdistance(up1, pv[2]) + tdistance(up1, pv[3])) * 0.5;
- double d2 = (tdistance(up2, pv[2]) + tdistance(up2, pv[3])) * 0.5;
-
- std::vector<TPointD> lpv;
- if (d1 > d2) {
- lpv = pv;
- } else {
- lpv.push_back(pv[1]);
- lpv.push_back(pv[0]);
- lpv.push_back(pv[3]);
- lpv.push_back(pv[2]);
- }
-
- // Transformation of gradient square
- const double flashGrad = 16384.0; // size of gradient square
- flash.setGradientFill(true, c1, c2, 0);
- TPointD p0((lpv[0] + lpv[3]) * 0.5);
- TPointD p1((lpv[1] + lpv[2]) * 0.5);
- double lv = (tdistance(p0, p1));
- double lh = 0.5 * (tdistance(lpv[0], lpv[3]) + tdistance(lpv[1], lpv[2]));
- TPointD center =
- 0.25 * lpv[0] + 0.25 * lpv[1] + 0.25 * lpv[2] + 0.25 * lpv[3];
- TPointD e(p0 - p1);
-
- double angle = rad2degree(atan(e));
- angle = angle <= 0 ? 270 + angle : angle - 90;
- TRotation rM(angle);
- TTranslation tM(center.x, center.y);
- TScale sM(lh / (flashGrad), lv / (flashGrad));
-
- flash.setFillStyleMatrix(tM * sM * rM);
- flash.drawPolyline(pv);
-}
-
-//------------------------------------------------------------
-
-//------------------------------------------------------------
-void SFlashUtils::drawGradedRegion(TFlash &flash, std::vector<TPointD> &pvv,
- const TPixel32 &c1, const TPixel32 &c2,
- const TRegion &r) const {
- std::vector<TPointD> pv;
- pv = pvv;
- int nbDV = nbDiffVerts(pv);
- if (nbDV < 3 || nbDV > 4) return;
- if (nbDV == 3) Triangle2Quad(pv);
-
- // Direction Of polyline
- TPointD u = pv[0] - pv[1];
- TPointD up = (pv[0] + pv[1]) * 0.5;
- u = normalize(u);
- u = rotate90(u);
- TPointD up1 = up + u;
- TPointD up2 = up - u;
- double d1 = (tdistance(up1, pv[2]) + tdistance(up1, pv[3])) * 0.5;
- double d2 = (tdistance(up2, pv[2]) + tdistance(up2, pv[3])) * 0.5;
-
- std::vector<TPointD> lpv;
- if (d1 > d2) {
- lpv = pv;
- } else {
- lpv.push_back(pv[1]);
- lpv.push_back(pv[0]);
- lpv.push_back(pv[3]);
- lpv.push_back(pv[2]);
- }
-
- // Transformation of gradient square
- const double flashGrad = 16384.0; // size of gradient square
- flash.setGradientFill(true, c1, c2, 0);
- TPointD p0((lpv[0] + lpv[3]) * 0.5);
- TPointD p1((lpv[1] + lpv[2]) * 0.5);
- double lv = (tdistance(p0, p1));
- double lh = 0.5 * (tdistance(lpv[0], lpv[3]) + tdistance(lpv[1], lpv[2]));
- TPointD center =
- 0.25 * lpv[0] + 0.25 * lpv[1] + 0.25 * lpv[2] + 0.25 * lpv[3];
- TPointD e(p0 - p1);
-
- double angle = rad2degree(atan(e));
- angle = angle <= 0 ? 270 + angle : angle - 90;
- TRotation rM(angle);
- TTranslation tM(center.x, center.y);
- TScale sM(lh / (flashGrad), lv / (flashGrad));
-
- flash.setFillStyleMatrix(tM * sM * rM);
- flash.drawRegion(r);
-}
diff --git a/toonz/sources/colorfx/colorfxutils.h b/toonz/sources/colorfx/colorfxutils.h
index 3683a00a4..f626640c8 100644
--- a/toonz/sources/colorfx/colorfxutils.h
+++ b/toonz/sources/colorfx/colorfxutils.h
@@ -31,31 +31,4 @@ public:
void deform(const double n);
};
-class SFlashUtils {
- void computeOutline(const TRegion *region,
- TRegionOutline::PointVector &polyline) const;
- void PointVector2QuadsArray(const std::vector<T3DPointD> &pv,
- std::vector<TQuadratic *> &quadArray,
- std::vector<TQuadratic *> &toBeDeleted,
- const bool isRounded) const;
- int nbDiffVerts(const std::vector<TPointD> &pv) const;
- void Triangle2Quad(std::vector<TPointD> &p) const;
-
-public:
- const TRegion *m_r;
- TRegionOutline m_ro;
-
- SFlashUtils(){};
- SFlashUtils(const TRegion *r) : m_r(r){};
- virtual ~SFlashUtils(){};
-
- void computeRegionOutline();
- void drawRegionOutline(TFlash &flash, const bool isRounded = true) const;
- void drawGradedPolyline(TFlash &flash, std::vector<TPointD> &pv,
- const TPixel32 &c1, const TPixel32 &c2) const;
- void drawGradedRegion(TFlash &flash, std::vector<TPointD> &pv,
- const TPixel32 &c1, const TPixel32 &c2,
- const TRegion &r) const;
-};
-
#endif
diff --git a/toonz/sources/colorfx/regionstyles.cpp b/toonz/sources/colorfx/regionstyles.cpp
index 65b2ba27b..b88011028 100644
--- a/toonz/sources/colorfx/regionstyles.cpp
+++ b/toonz/sources/colorfx/regionstyles.cpp
@@ -5,7 +5,6 @@
#include "tcolorfunctions.h"
#include "trandom.h"
#include "colorfxutils.h"
-#include "tflash.h"
#include "tregion.h"
#include "tcurves.h"
#include "tmathutil.h"
@@ -159,16 +158,6 @@ void MovingSolidColor::drawRegion(const TColorFunction *cf,
TSolidColorStyle::drawRegion(cf, true, boundary);
}
-//------------------------------------------------------------
-
-void MovingSolidColor::drawRegion(TFlash &flash, const TRegion *r) const {
- SFlashUtils rdf(r);
- rdf.computeRegionOutline();
- m_regionOutlineModifier->modify(rdf.m_ro);
- flash.setFillColor(getMainColor());
- rdf.drawRegionOutline(flash, false);
-}
-
//***************************************************************************
// ShadowStyle implementation
//***************************************************************************
@@ -431,122 +420,6 @@ glEnd();
//------------------------------------------------------------
-/*
-int ShadowStyle::drawPolyline(TFlash& flash, std::vector<T3DPointD> &polyline,
- TPointD
-shadowDirection, const bool isDraw) const
-{
- int i;
- int stepNumber;
- double distance;
-
- TPointD v1,v2,diff,midPoint,ratio;
- double len;
-
-
- TRegionOutline::PointVector::iterator it;
- TRegionOutline::PointVector::iterator it_b = polyline.begin();
- TRegionOutline::PointVector::iterator it_e = polyline.end();
-
-
- std::vector<TSegment> segmentArray;
-
- v1.x = polyline.back().x;
- v1.y = polyline.back().y;
-
- for(it = it_b; it!= it_e; ++it)
- {
- v2.x = it->x;
- v2.y = it->y;
- if (v1==v2)
- continue;
-
-
- diff = normalize(rotate90(v2-v1));
- len=diff*shadowDirection;
-
- if(len>0)
- {
- distance = tdistance(v1,v2)*m_density;
-
- ratio= (v2-v1)*(1.0/distance);
- midPoint=v1;
- stepNumber= (int)distance;
-
- for(i=0; i<stepNumber;i++ )
- {
- std::vector<TSegment> sa;
-
- TPointD p0=midPoint;
- TPointD p1=midPoint+(shadowDirection*len*m_len*0.5);
- TPointD p2=midPoint+(shadowDirection*len*m_len);
-
- segmentArray.push_back(TSegment(p1,p0));
- segmentArray.push_back(TSegment(p1,p2));
-
- midPoint += ratio;
- }
-
- }
-
- v1=v2;
- }
-
-
- if ( isDraw && segmentArray.size()>0 ) {
- flash.setLineColor(m_shadowColor);
- flash.drawSegments(segmentArray, true);
- }
-
- if ( segmentArray.size()>0 )
- return 1;
- return 0;
-}
-
-void ShadowStyle::drawRegion( TFlash& flash, const TRegion* r) const
-{
- SFlashUtils rdf(r);
- rdf.computeRegionOutline();
-
- TRegionOutline::Boundary::iterator regions_it;
- TRegionOutline::Boundary::iterator regions_it_b =
-rdf.m_ro.m_exterior->begin();
- TRegionOutline::Boundary::iterator regions_it_e = rdf.m_ro.m_exterior->end();
-
-
-// In the GL version the shadow lines are not croped into the filled region.
-// This is the reason why I don't calculate the number of shadow lines.
-// int nbDraw=0;
-// for( regions_it = regions_it_b ; regions_it!= regions_it_e; ++regions_it)
-// nbDraw+=drawPolyline(flash,*regions_it, m_shadowDirection,false);
-
-// regions_it_b = rdf.m_ro.m_interior->begin();
-// regions_it_e = rdf.m_ro.m_interior->end();
-// for( regions_it = regions_it_b ; regions_it!= regions_it_e; ++regions_it)
-// nbDraw+=drawPolyline(flash,*regions_it,-m_shadowDirection,false);
-
-
-// Only the bbox rectangle is croped.
- flash.drawRegion(*r,1);
- flash.setFillColor(getMainColor());
- flash.drawRectangle(rdf.m_ro.m_bbox);
-
- regions_it_b = rdf.m_ro.m_exterior->begin();
- regions_it_e = rdf.m_ro.m_exterior->end();
- for( regions_it = regions_it_b ; regions_it!= regions_it_e; ++regions_it)
- drawPolyline(flash,*regions_it, m_shadowDirection);
-
- regions_it_b = rdf.m_ro.m_interior->begin();
- regions_it_e = rdf.m_ro.m_interior->end();
- for( regions_it = regions_it_b ; regions_it!= regions_it_e; ++regions_it)
- drawPolyline(flash,*regions_it,-m_shadowDirection);
-
-
-}
-*/
-
-//------------------------------------------------------------
-
TPixel32 ShadowStyle::getColorParamValue(int index) const {
return index == 0 ? m_shadowColor : TSolidColorStyle::getMainColor();
}
@@ -711,63 +584,6 @@ void drawShadowLine(TPixel32 shadowColor, TPixel32 color, TPointD v1,
glEnd();
}
-
-int drawShadowLine(TFlash &flash, TPixel32 shadowColor, TPixel32 color,
- TPointD v1, TPointD v2, TPointD diff1, TPointD diff2,
- const bool isDraw = true) {
- int nbDraw = 0;
-
- v1 = v1 + diff1;
- v2 = v2 + diff2;
- diff1 = -diff1;
- diff2 = -diff2;
-
- TPointD vv1, vv2, ovv1, ovv2;
- TPixel32 oc;
- double r1, r2;
- double t = 0.0;
- bool isFirst = true;
- flash.setThickness(0.0);
- SFlashUtils sfu;
- for (; t <= 1; t += 0.1) {
- if (isFirst) {
- r1 = t * t * t;
- r2 = 1 - r1;
- oc = TPixel32((int)(color.r * r2 + shadowColor.r * r1),
- (int)(color.g * r2 + shadowColor.g * r1),
- (int)(color.b * r2 + shadowColor.b * r1),
- (int)(color.m * r2 + shadowColor.m * r1));
- ovv1 = v1 + t * diff1;
- ovv2 = v2 + t * diff2;
- isFirst = false;
- } else {
- r1 = t * t * t;
- r2 = 1 - r1;
- TPixel32 c((int)(color.r * r2 + shadowColor.r * r1),
- (int)(color.g * r2 + shadowColor.g * r1),
- (int)(color.b * r2 + shadowColor.b * r1),
- (int)(color.m * r2 + shadowColor.m * r1));
- vv1 = (v1 + t * diff1);
- vv2 = (v2 + t * diff2);
-
- std::vector<TPointD> pv;
- pv.push_back(ovv1);
- pv.push_back(ovv2);
- pv.push_back(vv2);
- pv.push_back(vv1);
-
- int nbDV = nbDiffVerts(pv);
- if (nbDV >= 3 && nbDV <= 4) nbDraw++;
-
- if (isDraw) sfu.drawGradedPolyline(flash, pv, oc, c);
-
- oc = c;
- ovv1 = vv1;
- ovv2 = vv2;
- }
- }
- return nbDraw;
-}
}
//------------------------------------------------------------
@@ -900,97 +716,6 @@ void ShadowStyle2::drawRegion(const TColorFunction *cf, const bool antiAliasing,
stenc->disableMask();
}
-//------------------------------------------------------------
-
-int ShadowStyle2::drawPolyline(TFlash &flash, std::vector<T3DPointD> &polyline,
- TPointD shadowDirection,
- const bool isDraw) const {
- int nbDraw = 0;
-
- TPointD v0, v1, diff;
- double len1, len2;
- TPixel32 color, shadowColor;
- color = TSolidColorStyle::getMainColor();
- shadowColor = m_shadowColor;
-
- TRegionOutline::PointVector::iterator it;
- TRegionOutline::PointVector::iterator it_b = polyline.begin();
- TRegionOutline::PointVector::iterator it_e = polyline.end();
-
- int size = polyline.size();
- std::vector<double> lens(size);
- v0.x = polyline.back().x;
- v0.y = polyline.back().y;
- int count = 0;
- for (it = it_b; it != it_e; ++it) {
- v1.x = it->x;
- v1.y = it->y;
- if (v1 != v0) {
- diff = normalize(rotate90(v1 - v0));
- len1 = diff * shadowDirection;
- if (len1 < 0) len1 = 0;
- lens[count++] = len1;
- } else
- lens[count++] = 0;
-
- v0 = v1;
- }
-
- double firstVal = lens.front();
- for (count = 0; count != size - 1; count++) {
- lens[count] = (lens[count] + lens[count + 1]) * 0.5;
- }
- lens[size - 1] = (lens[size - 1] + firstVal) * 0.5;
-
- for (count = 0; count != size - 1; count++) {
- v0.x = polyline[count].x;
- v0.y = polyline[count].y;
- v1.x = polyline[count + 1].x;
- v1.y = polyline[count + 1].y;
- len1 = lens[count];
- len2 = lens[count + 1];
-
- if (v0 != v1 && len1 >= 0 && len2 >= 0 && (len1 + len2) > 0)
- nbDraw += drawShadowLine(flash, shadowColor, color, v0, v1,
- shadowDirection * len1 * m_shadowLength,
- shadowDirection * len2 * m_shadowLength, isDraw);
- }
- v0.x = polyline[count].x;
- v0.y = polyline[count].y;
- v1.x = polyline.front().x;
- v1.y = polyline.front().y;
- len1 = lens[count];
- len2 = lens[0];
- if (v0 != v1 && len1 >= 0 && len2 >= 0 && (len1 + len2) > 0)
- nbDraw += drawShadowLine(flash, shadowColor, color, v0, v1,
- shadowDirection * len1 * m_shadowLength,
- shadowDirection * len2 * m_shadowLength, isDraw);
-
- return nbDraw;
-}
-
-//------------------------------------------------------------
-
-void ShadowStyle2::drawRegion(TFlash &flash, const TRegion *r) const {
- SFlashUtils rdf(r);
- rdf.computeRegionOutline();
-
- TRegionOutline::Boundary::iterator regions_it;
- TRegionOutline::Boundary::iterator regions_it_b = rdf.m_ro.m_exterior.begin();
- TRegionOutline::Boundary::iterator regions_it_e = rdf.m_ro.m_exterior.end();
-
- int nbDraw = 0;
- for (regions_it = regions_it_b; regions_it != regions_it_e; ++regions_it)
- nbDraw += drawPolyline(flash, *regions_it, m_shadowDirection, false);
-
- flash.drawRegion(*r, nbDraw + 1);
- flash.setFillColor(getMainColor());
- flash.drawRectangle(rdf.m_ro.m_bbox);
-
- for (regions_it = regions_it_b; regions_it != regions_it_e; ++regions_it)
- drawPolyline(flash, *regions_it, m_shadowDirection);
-}
-
//***************************************************************************
// RubberModifier implementation
//***************************************************************************
@@ -1129,16 +854,6 @@ void TRubberFillStyle::drawRegion(const TColorFunction *cf,
TSolidColorStyle::drawRegion(cf, true, boundary);
}
-void TRubberFillStyle::drawRegion(TFlash &flash, const TRegion *r) const {
- SFlashUtils rdf(r);
- rdf.computeRegionOutline();
- m_regionOutlineModifier->modify(rdf.m_ro);
- flash.setFillColor(getMainColor());
- rdf.drawRegionOutline(flash);
- // If Valentina prefers the angled version use this
- // rdf.drawRegionOutline(flash,false);
-}
-
//***************************************************************************
// TPointShadowFillStyle implementation
//***************************************************************************
@@ -1363,47 +1078,6 @@ void TPointShadowFillStyle::shadowOnEdge_parallel(const TPointD &p0,
//------------------------------------------------------------
-int TPointShadowFillStyle::shadowOnEdge_parallel(
- TFlash &flash, const TPointD &p0, const TPointD &p1, const TPointD &p2,
- TRandom &rnd, const double radius, const bool isDraw) const {
- int nbDraw = 0;
-
- if (p0 == p1 || p1 == p2) return 0;
-
- TPointD diff = normalize(rotate90(p1 - p0));
- double len1 = diff * m_shadowDirection;
- len1 = std::max(0.0, len1);
-
- diff = normalize(rotate90(p2 - p1));
- double len2 = diff * m_shadowDirection;
- len2 = std::max(0.0, len2);
-
- if ((len1 + len2) > 0) {
- TPointD la = p1 + m_shadowDirection * len1 * m_shadowSize;
- TPointD lb = p2 + m_shadowDirection * len2 * m_shadowSize;
- double t = triangleArea(p1, p2, lb) + triangleArea(p2, lb, la);
- int nb = (int)(m_density * t);
- for (int i = 0; i < nb; i++) {
- double q = rnd.getUInt(1001) / 1000.0;
- double r = rnd.getUInt(1001) / 1000.0;
- r = r * r;
- TPointD u = p1 + (p2 - p1) * q;
- u = u +
- r * (len1 * (1.0 - q) + len2 * q) * m_shadowDirection * m_shadowSize;
- nbDraw++;
- if (isDraw) {
- flash.setFillColor(TPixel32(m_shadowColor.r, m_shadowColor.g,
- m_shadowColor.b, (int)((1.0 - r) * 255)));
- flash.drawEllipse(u, radius, radius);
- // flash.drawDot(u,radius);
- }
- }
- }
- return nbDraw;
-}
-
-//------------------------------------------------------------
-
void TPointShadowFillStyle::deleteSameVerts(
TRegionOutline::Boundary::iterator &rit, std::vector<T3DPointD> &pv) const {
pv.clear();
@@ -1490,65 +1164,6 @@ void TPointShadowFillStyle::drawRegion(const TColorFunction *cf,
stenc->disableMask();
}
-//------------------------------------------------------------
-
-void TPointShadowFillStyle::drawRegion(TFlash &flash, const TRegion *r) const {
- SFlashUtils rdf(r);
- rdf.computeRegionOutline();
-
- TRegionOutline::Boundary::iterator regions_it;
- TRegionOutline::Boundary::iterator regions_it_b = rdf.m_ro.m_exterior.begin();
- TRegionOutline::Boundary::iterator regions_it_e = rdf.m_ro.m_exterior.end();
-
- TPixel32 color = m_shadowColor;
- TRandom rnd;
- rnd.reset();
-
- double sizes[2] = {0.15, 10.0};
- double radius = (sizes[0] + (sizes[1] - sizes[0]) * m_pointSize * 0.01);
-
- int nbDraw = 0;
- for (regions_it = regions_it_b; regions_it != regions_it_e; ++regions_it) {
- std::vector<T3DPointD> pv;
- deleteSameVerts(regions_it, pv);
- if (pv.size() < 3) continue;
- std::vector<T3DPointD>::iterator it_beg = pv.begin();
- std::vector<T3DPointD>::iterator it_end = pv.end();
- std::vector<T3DPointD>::iterator it_last = it_end - 1;
- std::vector<T3DPointD>::iterator it0, it1, it2;
- for (it1 = it_beg; it1 != it_end; it1++) {
- it0 = it1 == it_beg ? it_last : it1 - 1;
- it2 = it1 == it_last ? it_beg : it1 + 1;
- nbDraw += shadowOnEdge_parallel(
- flash, TPointD(it0->x, it0->y), TPointD(it1->x, it1->y),
- TPointD(it2->x, it2->y), rnd, radius, false);
- }
- }
-
- rnd.reset();
- flash.drawRegion(*r, nbDraw + 1); // +1 bbox
- flash.setFillColor(getMainColor());
- flash.drawRectangle(rdf.m_ro.m_bbox);
-
- flash.setThickness(0.0);
- for (regions_it = regions_it_b; regions_it != regions_it_e; ++regions_it) {
- std::vector<T3DPointD> pv;
- deleteSameVerts(regions_it, pv);
- if (pv.size() < 3) continue;
- std::vector<T3DPointD>::iterator it_beg = pv.begin();
- std::vector<T3DPointD>::iterator it_end = pv.end();
- std::vector<T3DPointD>::iterator it_last = it_end - 1;
- std::vector<T3DPointD>::iterator it0, it1, it2;
- for (it1 = it_beg; it1 != it_end; it1++) {
- it0 = it1 == it_beg ? it_last : it1 - 1;
- it2 = it1 == it_last ? it_beg : it1 + 1;
- shadowOnEdge_parallel(flash, TPointD(it0->x, it0->y),
- TPointD(it1->x, it1->y), TPointD(it2->x, it2->y),
- rnd, radius, true);
- }
- }
-}
-
//***************************************************************************
// TDottedFillStyle implementation
//***************************************************************************
@@ -1742,32 +1357,6 @@ int TDottedFillStyle::nbClip(const double LDotDist, const bool LIsShifted,
return nbClipLayers;
}
-//------------------------------------------------------------
-
-void TDottedFillStyle::drawRegion(TFlash &flash, const TRegion *r) const {
- double LDotDist = std::max(m_dotDist, 0.1);
- double LDotSize = m_dotSize;
- bool LIsShifted = m_isShifted;
- TRectD bbox(r->getBBox());
-
- flash.setFillColor(TPixel::Black);
- flash.drawRegion(*r, true);
- int nClip = nbClip(LDotDist, LIsShifted, bbox);
-
- flash.drawRegion(*r, nClip);
-
- flash.setFillColor(getMainColor());
- flash.drawRectangle(bbox);
- flash.setFillColor(m_pointColor);
-
- int i = 0;
- for (double y = bbox.y0; y <= bbox.y1; y += LDotDist, ++i) {
- double x = LIsShifted && (i % 2) == 1 ? bbox.x0 + LDotDist / 2.0 : bbox.x0;
- for (; x <= bbox.x1; x += LDotDist)
- flash.drawEllipse(TPointD(x, y), LDotSize, LDotSize);
- }
-}
-
//***************************************************************************
// TCheckedFillStyle implementation
//***************************************************************************
@@ -2084,55 +1673,6 @@ int TCheckedFillStyle::nbClip(const TRectD &bbox) const {
return nbClip;
}
-//------------------------------------------------------------
-
-void TCheckedFillStyle::drawRegion(TFlash &flash, const TRegion *r) const {
- TRectD bbox(r->getBBox());
-
- // flash.drawRegion(*r,true);
- flash.drawRegion(*r, nbClip(bbox));
-
- flash.setFillColor(getMainColor());
- flash.drawRectangle(bbox);
-
- flash.setFillColor(m_pointColor);
- // Horizontal Lines
- double lx = bbox.x1 - bbox.x0;
- double ly = bbox.y1 - bbox.y0;
- double beg = bbox.y0;
- double end = bbox.y1;
- beg = m_HAngle <= 0 ? beg : beg - lx * tan(degree2rad(m_HAngle));
- end = m_HAngle >= 0 ? end : end - lx * tan(degree2rad(m_HAngle));
- double dist = m_HDist / cos(degree2rad(m_HAngle));
- for (double y = beg; y <= end; y += dist) {
- TPointD p0, p1, p2, p3;
- getHThickline(TPointD(bbox.x0, y), lx, p0, p1, p2, p3);
- std::vector<TPointD> v;
- v.push_back(p0);
- v.push_back(p1);
- v.push_back(p2);
- v.push_back(p3);
- flash.drawPolyline(v);
- }
-
- // Vertical lines
- beg = bbox.x0;
- end = bbox.x1;
- beg = (-m_VAngle) <= 0 ? beg : beg - ly * tan(degree2rad(-m_VAngle));
- end = (-m_VAngle) >= 0 ? end : end - ly * tan(degree2rad(-m_VAngle));
- dist = m_VDist / cos(degree2rad(-m_VAngle));
- for (double x = beg; x <= end; x += dist) {
- TPointD p0, p1, p2, p3;
- getVThickline(TPointD(x, bbox.y0), ly, p0, p1, p2, p3);
- std::vector<TPointD> v;
- v.push_back(p0);
- v.push_back(p1);
- v.push_back(p2);
- v.push_back(p3);
- flash.drawPolyline(v);
- }
-}
-
//***************************************************************************
// ArtisticModifier implementation
//***************************************************************************
@@ -2339,16 +1879,6 @@ void ArtisticSolidColor::drawRegion(const TColorFunction *cf,
TSolidColorStyle::drawRegion(cf, true, boundary);
}
-//------------------------------------------------------------
-
-void ArtisticSolidColor::drawRegion(TFlash &flash, const TRegion *r) const {
- SFlashUtils rdf(r);
- rdf.computeRegionOutline();
- m_regionOutlineModifier->modify(rdf.m_ro);
- flash.setFillColor(getMainColor());
- rdf.drawRegionOutline(flash, false);
-}
-
//***************************************************************************
// TChalkFillStyle implementation
//***************************************************************************
@@ -2558,69 +2088,6 @@ void TChalkFillStyle::drawRegion(const TColorFunction *cf,
stenc->disableMask();
}
-//------------------------------------------------------------
-
-void TChalkFillStyle::drawRegion(TFlash &flash, const TRegion *r) const {
- TPixel32 bgColor = TSolidColorStyle::getMainColor();
-
- double minDensity;
- double maxDensity;
-
- getParamRange(0, minDensity, maxDensity);
-
- double r1 = (m_density - minDensity) / (maxDensity - minDensity);
- double r2 = 1.0 - r1;
-
- TPixel32 color((int)(bgColor.r * r2 + m_color0.r * r1),
- (int)(bgColor.g * r2 + m_color0.g * r1),
- (int)(bgColor.b * r2 + m_color0.b * r1),
- (int)(bgColor.m * r2 + m_color0.m * r1));
-
- flash.setFillColor(color);
- flash.drawRegion(*r);
-
- /*
- SFlashUtils rdf(r);
- rdf.computeRegionOutline();
-
-TRandom rnd;
-
-const bool isTransparent=m_color0.m<255;
-
- TRegionOutline::Boundary& exter=*(rdf.m_ro.m_exterior);
- TRegionOutline::Boundary& inter=*(rdf.m_ro.m_interior);
-
-TPixel32 color0=m_color0;
-
- double lx=rdf.m_ro.m_bbox.x1-rdf.m_ro.m_bbox.x0;
- double ly=rdf.m_ro.m_bbox.y1-rdf.m_ro.m_bbox.y0;
-
-// cioe' imposta una densita' tale, per cui in una regione che ha bbox 200x200
-// inserisce esattamente m_density punti
-int pointNumber= (int)(m_density*((lx*ly)*0.000025));
-
-flash.drawRegion(*r,pointNumber+1); // -1 i don't know why
-
-flash.setFillColor(getMainColor());
-flash.drawRectangle(TRectD(TPointD(rdf.m_ro.m_bbox.x0,rdf.m_ro.m_bbox.y0),
- TPointD(rdf.m_ro.m_bbox.x1,rdf.m_ro.m_bbox.y1)));
-
-flash.setThickness(0.0);
-for( int i=0;i< pointNumber; i++ ) {
- TPixel32 tmpcolor=color0;
- double shiftx=rdf.m_ro.m_bbox.x0+rnd.getFloat()*lx;
- double shifty=rdf.m_ro.m_bbox.y0+rnd.getFloat()*ly;
- tmpcolor.m=(UCHAR)(tmpcolor.m*rnd.getFloat());
- flash.setFillColor(tmpcolor);
- flash.pushMatrix();
- TTranslation tM(shiftx, shifty);
- flash.multMatrix(tM);
- flash.drawRectangle(TRectD(TPointD(-1,-1),TPointD(1,1)));
- flash.popMatrix();
- }
-*/
-}
-
//***************************************************************************
// TChessFillStyle implementation
//***************************************************************************
@@ -2866,50 +2333,6 @@ void TChessFillStyle::drawRegion(const TColorFunction *cf,
glDeleteLists(chessId, 1);
}
-//------------------------------------------------------------
-
-void TChessFillStyle::drawRegion(TFlash &flash, const TRegion *r) const {
- TRectD bbox(r->getBBox());
-
- TPointD vert[4];
- vert[0].x = -0.5;
- vert[0].y = 0.5;
- vert[1].x = -0.5;
- vert[1].y = -0.5;
- vert[2].x = 0.5;
- vert[2].y = -0.5;
- vert[3].x = 0.5;
- vert[3].y = 0.5;
-
- TRotation rotM(m_Angle);
- TScale scaleM(m_HDist, m_VDist);
- for (int i = 0; i < 4; i++) vert[i] = rotM * scaleM * vert[i];
-
- int nbClip = 1; // just for the getMainColor() rectangle
- std::vector<TPointD> grid;
- makeGrid(bbox, rotM, grid, nbClip);
-
- // flash.drawRegion(*r,true);
- flash.drawRegion(*r, nbClip);
-
- flash.setFillColor(getMainColor());
- flash.drawRectangle(bbox);
-
- flash.setFillColor(m_pointColor);
-
- std::vector<TPointD>::const_iterator it = grid.begin();
- std::vector<TPointD>::const_iterator ite = grid.end();
- for (; it != ite; it++) {
- TTranslation trM(it->x, it->y);
- std::vector<TPointD> lvert;
- lvert.push_back(trM * vert[0]);
- lvert.push_back(trM * vert[1]);
- lvert.push_back(trM * vert[2]);
- lvert.push_back(trM * vert[3]);
- flash.drawPolyline(lvert);
- }
-}
-
//***************************************************************************
// TStripeFillStyle implementation
//***************************************************************************
@@ -3249,57 +2672,6 @@ int TStripeFillStyle::nbClip(const TRectD &bbox) const {
//------------------------------------------------------------
-void TStripeFillStyle::drawRegion(TFlash &flash, const TRegion *r) const {
- TRectD bbox(r->getBBox());
-
- // flash.drawRegion(*r,true);
- flash.drawRegion(*r, nbClip(bbox)); // -1 i don't know why
-
- flash.setFillColor(getMainColor());
- flash.drawRectangle(bbox);
-
- flash.setFillColor(m_pointColor);
- // Horizontal Lines
- if (fabs(m_Angle) != 90) {
- double lx = bbox.x1 - bbox.x0;
- // double ly=bbox.y1-bbox.y0;
- double beg = bbox.y0;
- double end = bbox.y1;
- beg = m_Angle <= 0 ? beg : beg - lx * tan(degree2rad(m_Angle));
- end = m_Angle >= 0 ? end : end - lx * tan(degree2rad(m_Angle));
- double dist = m_Dist / cos(degree2rad(m_Angle));
- for (double y = beg; y <= end; y += dist) {
- TPointD p0, p1, p2, p3;
- getThickline(TPointD(bbox.x0, y), lx, p0, p1, p2, p3);
- std::vector<TPointD> v;
- v.push_back(p0);
- v.push_back(p1);
- v.push_back(p2);
- v.push_back(p3);
- flash.drawPolyline(v);
- }
- } else {
- double beg = bbox.x0;
- double end = bbox.x1;
- double y0 = bbox.y0;
- double y1 = bbox.y1;
- for (double x = beg; x <= end; x += m_Dist) {
- TPointD p0(x, y0);
- TPointD p1(x + m_Thickness, y0);
- TPointD p2(x, y1);
- TPointD p3(x + m_Thickness, y1);
- std::vector<TPointD> v;
- v.push_back(p0);
- v.push_back(p1);
- v.push_back(p3);
- v.push_back(p2);
- flash.drawPolyline(v);
- }
- }
-}
-
-//------------------------------------------------------------
-
void TStripeFillStyle::makeIcon(const TDimension &d) {
// Saves the values of member variables and sets the right icon values
double LDist = m_Dist;
@@ -3581,89 +2953,6 @@ void TLinGradFillStyle::drawRegion(const TColorFunction *cf,
stenc->disableMask();
}
-//------------------------------------------------------------
-
-// It is the new version, which uses XPos, YPos, Smooth parameters.
-// There is a gap between the flat and graded regions. This is the reason,
-// why the old version (without XPos, YPos, Smooth parameters) is used.
-void TLinGradFillStyle::drawRegion(TFlash &flash, const TRegion *r) const {
- TRectD bbox(r->getBBox());
- std::vector<TPointD> rect;
-
- TPointD center((bbox.x1 + bbox.x0) / 2.0, (bbox.y1 + bbox.y0) / 2.0);
- center = center + TPointD(m_XPos * 0.01 * (bbox.x1 - bbox.x0) * 0.5,
- m_YPos * 0.01 * (bbox.y1 - bbox.y0) * 0.5);
- double l = tdistance(TPointD(bbox.x0, bbox.y0), TPointD(bbox.x1, bbox.y1));
-
- TAffine M(TTranslation(center) * TRotation(m_Angle));
-
- rect.push_back(M * TPointD(-m_Size, l));
- rect.push_back(M * TPointD(-m_Size, -l));
- rect.push_back(M * TPointD(m_Size, -l));
- rect.push_back(M * TPointD(m_Size, l));
-
- flash.setThickness(0.0);
-
- SFlashUtils sfu;
- sfu.drawGradedRegion(flash, rect, m_pointColor, getMainColor(), *r);
-}
-
-/*
-// --- Old version ---
-void TLinGradFillStyle::drawRegion(TFlash& flash, const TRegion* r) const
-{
- flash.drawRegion(*r,1);
- TRectD bbox(r->getBBox());
- TPointD p0,p1,p2,p3;
- p0=TPointD(bbox.x0,bbox.y0);
- p1=TPointD(bbox.x0,bbox.y1);
- p2=TPointD(bbox.x1,bbox.y0);
- p3=TPointD(bbox.x1,bbox.y1);
- std::vector<TPointD> pv;
- if ( fabs(m_Angle)!=90 ) {
- double tga=tan(degree2rad(fabs(m_Angle)));
- double lx=bbox.x1-bbox.x0;
- double ly=bbox.y1-bbox.y0;
- double ax=lx/(tga*tga+1);
- double bx=lx-ax;
- double mx=ax*tga;
- double rlylx=ly/lx;
- double ay=ax*rlylx;
- double by=bx*rlylx;
- double my=mx*rlylx;
- if ( m_Angle<=0.0) {
- p0=p0+TPointD(-my,by);
- p1=p1+TPointD(bx,mx);
- p2=p2+TPointD(-bx,-mx);
- p3=p3+TPointD(my,-by);
- } else {
- p0=p0+TPointD(bx,-mx);
- p1=p1+TPointD(-my,-by);
- p2=p2+TPointD(my,by);
- p3=p3+TPointD(-bx,mx);
- }
- pv.push_back(p0);
- pv.push_back(p1);
- pv.push_back(p3);
- pv.push_back(p2);
- } else {
- if ( m_Angle==-90 ) {
- pv.push_back(p1);
- pv.push_back(p3);
- pv.push_back(p2);
- pv.push_back(p0);
- } else {
- pv.push_back(p0);
- pv.push_back(p2);
- pv.push_back(p3);
- pv.push_back(p1);
- }
- }
- SFlashUtils sfu;
- sfu.drawGradedPolyline(flash,pv,m_pointColor,getMainColor());
-}
-*/
-
//***************************************************************************
// TRadGradFillStyle implementation
//***************************************************************************
@@ -3901,27 +3190,6 @@ void TRadGradFillStyle::drawRegion(const TColorFunction *cf,
stenc->disableMask();
}
-//------------------------------------------------------------
-
-void TRadGradFillStyle::drawRegion(TFlash &flash, const TRegion *r) const {
- TRectD bbox(r->getBBox());
- double lx = bbox.x1 - bbox.x0;
- double ly = bbox.y1 - bbox.y0;
- double r1 = 0.5 * std::max(lx, ly) * m_Radius * 0.01;
- if (m_Smooth < 50) r1 *= (0.3 * ((100 - m_Smooth) / 50.0) + 0.7);
- TPointD center((bbox.x1 + bbox.x0) / 2.0, (bbox.y1 + bbox.y0) / 2.0);
- center = center + TPointD(m_XPos * 0.01 * lx * 0.5, m_YPos * 0.01 * ly * 0.5);
-
- flash.setThickness(0.0);
- TPixel32 mc(getMainColor());
- flash.setGradientFill(false, m_pointColor, mc, m_Smooth);
- const double flashGrad = 16384.0; // size of gradient square
- TTranslation tM(center.x, center.y);
- TScale sM(2.0 * r1 / (flashGrad), 2.0 * r1 / (flashGrad));
- flash.setFillStyleMatrix(tM * sM);
- flash.drawRegion(*r);
-}
-
//***************************************************************************
// TCircleStripeFillStyle implementation
//***************************************************************************
@@ -4205,44 +3473,6 @@ void TCircleStripeFillStyle::drawRegion(const TColorFunction *cf,
stenc->disableMask();
}
-//------------------------------------------------------------
-
-void TCircleStripeFillStyle::drawRegion(TFlash &flash, const TRegion *r) const {
- TRectD bbox(r->getBBox());
-
- double lx = bbox.x1 - bbox.x0;
- double ly = bbox.y1 - bbox.y0;
- TPointD center((bbox.x1 + bbox.x0) * 0.5, (bbox.y1 + bbox.y0) * 0.5);
- center.x = center.x + m_XPos * 0.01 * 0.5 * lx;
- center.y = center.y + m_YPos * 0.01 * 0.5 * ly;
-
- double maxDist = 0.0;
- maxDist = std::max(tdistance(center, TPointD(bbox.x0, bbox.y0)), maxDist);
- maxDist = std::max(tdistance(center, TPointD(bbox.x0, bbox.y1)), maxDist);
- maxDist = std::max(tdistance(center, TPointD(bbox.x1, bbox.y0)), maxDist);
- maxDist = std::max(tdistance(center, TPointD(bbox.x1, bbox.y1)), maxDist);
-
- int nbClip = 2;
- double d = m_Dist;
- for (; d <= maxDist; d += m_Dist) nbClip++;
- flash.setFillColor(TPixel::Black);
- flash.drawRegion(*r, nbClip);
-
- flash.setFillColor(getMainColor());
- flash.drawRectangle(bbox);
-
- flash.setFillColor(m_pointColor);
- flash.setLineColor(m_pointColor);
- flash.setThickness(0.0);
- d = m_Thickness / 2.0;
- flash.drawEllipse(center, d, d);
-
- flash.setFillColor(TPixel32(0, 0, 0, 0));
- flash.setLineColor(m_pointColor);
- flash.setThickness(m_Thickness / 2.0);
- for (d = m_Dist; d <= maxDist; d += m_Dist) flash.drawEllipse(center, d, d);
-}
-
//***************************************************************************
// TMosaicFillStyle implementation
//***************************************************************************
@@ -4535,39 +3765,6 @@ void TMosaicFillStyle::drawRegion(const TColorFunction *cf,
stenc->disableMask();
}
-//------------------------------------------------------------
-
-void TMosaicFillStyle::drawRegion(TFlash &flash, const TRegion *r) const {
- TRectD bbox(r->getBBox());
-
- std::vector<TPointD> pos;
- int posLX, posLY;
- TRandom rand;
- TPointD quad[4];
-
- preaprePos(bbox, pos, posLX, posLY, rand);
-
- if (pos.size() <= 0) return;
-
- int nbClip = (posLX - 1) * (posLY - 1) + 1;
- flash.drawRegion(*r, nbClip);
-
- flash.setFillColor(TSolidColorStyle::getMainColor());
- flash.setThickness(0);
- flash.drawRectangle(bbox);
- for (int y = 0; y < (posLY - 1); y++)
- for (int x = 0; x < (posLX - 1); x++)
- if (getQuad(x, y, posLX, posLY, pos, quad, rand)) {
- std::vector<TPointD> lvert;
- lvert.push_back(quad[0]);
- lvert.push_back(quad[1]);
- lvert.push_back(quad[2]);
- lvert.push_back(quad[3]);
- flash.setFillColor(m_pointColor[rand.getInt(0, 4)]);
- flash.drawPolyline(lvert);
- }
-}
-
//***************************************************************************
// TPatchFillStyle implementation
//***************************************************************************
@@ -4912,90 +4109,3 @@ int TPatchFillStyle::nbClip(const int lX, const int lY,
}
return nbC;
}
-
-//------------------------------------------------------------
-
-void TPatchFillStyle::drawFlashQuad(TFlash &flash, const TPointD *quad) const {
- std::vector<TPointD> lvert;
- lvert.push_back(quad[0]);
- lvert.push_back(quad[1]);
- lvert.push_back(quad[2]);
- lvert.push_back(quad[3]);
- flash.drawPolyline(lvert);
-
- double r = tdistance(quad[0], quad[1]) / 2.0;
- flash.drawEllipse(quad[0] * 0.5 + quad[1] * 0.5, r, r);
- flash.drawEllipse(quad[2] * 0.5 + quad[3] * 0.5, r, r);
-}
-
-//------------------------------------------------------------
-
-void TPatchFillStyle::drawFlashTriangle(TFlash &flash, const TPointD &p1,
- const TPointD &p2,
- const TPointD &p3) const {
- std::vector<TPointD> lvert;
- lvert.push_back(p1);
- lvert.push_back(p2);
- lvert.push_back(p3);
- flash.drawPolyline(lvert);
-}
-
-//------------------------------------------------------------
-
-void TPatchFillStyle::drawRegion(TFlash &flash, const TRegion *r) const {
- TRectD bbox(r->getBBox());
-
- std::vector<TPointD> pos;
- int posLX, posLY;
- TRandom rand;
- TPointD quad[4];
-
- preaprePos(bbox, pos, posLX, posLY, rand);
- if (pos.size() <= 0) return;
- flash.drawRegion(*r, nbClip(posLX, posLY, pos));
-
- flash.setThickness(0.0);
- int x;
- for (x = 2; x < (posLX - 2); x += 2)
- for (int y = 1; y < posLY; y++) {
- std::vector<TPointD> lvert;
- if ((x % 4) == 2) {
- lvert.push_back(pos[(x - 1) * posLY + y]);
- lvert.push_back(pos[(x)*posLY + y]);
- lvert.push_back(pos[(x + 1) * posLY + y]);
- lvert.push_back(pos[(x + 2) * posLY + y]);
- lvert.push_back(pos[(x + 1) * posLY + y - 1]);
- lvert.push_back(pos[(x)*posLY + y - 1]);
- } else {
- lvert.push_back(pos[(x - 1) * posLY + y - 1]);
- lvert.push_back(pos[(x)*posLY + y - 1]);
- lvert.push_back(pos[(x + 1) * posLY + y - 1]);
- lvert.push_back(pos[(x + 2) * posLY + y - 1]);
- lvert.push_back(pos[(x + 1) * posLY + y]);
- lvert.push_back(pos[(x)*posLY + y]);
- }
- flash.setFillColor(m_pointColor[rand.getInt(0, 6)]);
- flash.drawPolyline(lvert);
- }
-
- flash.setFillColor(TSolidColorStyle::getMainColor());
- flash.setThickness(0.0);
- double thickn = tcrop(m_thickness, 0.0, 100.0) * 0.01 * 5.0;
- if (thickn > 0.001)
- for (x = 0; x < (posLX - 1); x++) {
- int nb = x % 4;
- for (int y = 0; y < posLY; y++) {
- if (getQuadLine(pos[x * posLY + y], pos[(x + 1) * posLY + y], thickn,
- quad))
- drawFlashQuad(flash, quad);
- if (y > 0 && nb == 1)
- if (getQuadLine(pos[x * posLY + y], pos[(x + 1) * posLY + y - 1],
- thickn, quad))
- drawFlashQuad(flash, quad);
- if (y < (posLY - 1) && nb == 3)
- if (getQuadLine(pos[x * posLY + y], pos[(x + 1) * posLY + y + 1],
- thickn, quad))
- drawFlashQuad(flash, quad);
- }
- }
-}
diff --git a/toonz/sources/colorfx/regionstyles.h b/toonz/sources/colorfx/regionstyles.h
index e20d5697c..a9e888208 100644
--- a/toonz/sources/colorfx/regionstyles.h
+++ b/toonz/sources/colorfx/regionstyles.h
@@ -75,7 +75,6 @@ public:
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
protected:
void loadData(TInputStreamInterface &is) override;
@@ -124,11 +123,6 @@ public:
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- // it is too slow and if the region is too complex, some flash readers
- // (IExplorer) crash.
- // So it's better drawing it as a normal solid color
- // void drawRegion( TFlash& flash, const TRegion* r) const;
-
protected:
void loadData(TInputStreamInterface &is) override;
void saveData(TOutputStreamInterface &os) const override;
@@ -177,7 +171,6 @@ public:
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
protected:
void loadData(TInputStreamInterface &is) override;
@@ -187,8 +180,6 @@ private:
void drawPolyline(const TColorFunction *cf,
const std::vector<T3DPointD> &polyline,
TPointD shadowDirection) const;
- int drawPolyline(TFlash &flash, std::vector<T3DPointD> &polyline,
- TPointD shadowDirection, const bool isDraw = true) const;
};
//============================================================
@@ -241,7 +232,6 @@ public:
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
protected:
void loadData(TInputStreamInterface &is) override;
@@ -296,7 +286,6 @@ void setMainColor(const TPixel32 &color){ m_shadowColor=color; }
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
protected:
void loadData(TInputStreamInterface &is) override;
@@ -307,9 +296,6 @@ private:
const TPointD &c) const;
void shadowOnEdge_parallel(const TPointD &p0, const TPointD &p1,
const TPointD &p2, TRandom &rnd) const;
- int shadowOnEdge_parallel(TFlash &flash, const TPointD &p0, const TPointD &p1,
- const TPointD &p2, TRandom &rnd,
- const double radius, const bool isDraw) const;
void deleteSameVerts(TRegionOutline::Boundary::iterator &rit,
std::vector<T3DPointD> &pv) const;
@@ -354,7 +340,6 @@ void setMainColor(const TPixel32 &color){ m_pointColor=color; }
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
int getTagId() const override { return 1130; };
QString getDescription() const override {
@@ -408,7 +393,6 @@ void setMainColor(const TPixel32 &color){ m_pointColor=color; }
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
int getTagId() const override { return 1131; };
QString getDescription() const override {
@@ -478,7 +462,6 @@ public:
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
protected:
void loadData(TInputStreamInterface &is) override;
@@ -520,7 +503,6 @@ void setMainColor(const TPixel32 &color){ m_color0=color; }
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
QString getDescription() const override {
return QCoreApplication::translate("TChalkFillStyle", "Chalk");
@@ -571,7 +553,6 @@ void setMainColor(const TPixel32 &color){ m_pointColor=color; }
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
int getTagId() const override { return 1136; };
QString getDescription() const override {
@@ -623,7 +604,6 @@ void setMainColor(const TPixel32 &color){ m_pointColor=color; }
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
int getTagId() const override { return 1137; };
QString getDescription() const override {
@@ -679,7 +659,6 @@ void setMainColor(const TPixel32 &color){ m_pointColor=color; }
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
int getTagId() const override { return 1138; };
QString getDescription() const override {
@@ -733,7 +712,6 @@ public:
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
int getTagId() const override { return 1139; };
QString getDescription() const override {
@@ -782,7 +760,6 @@ void setMainColor(const TPixel32 &color){ m_pointColor=color; }
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
int getTagId() const override { return 1140; };
QString getDescription() const override {
@@ -839,7 +816,6 @@ void setMainColor(const TPixel32 &color){ m_pointColor[0]=color; }
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
int getTagId() const override { return 1141; };
QString getDescription() const override {
@@ -890,7 +866,6 @@ public:
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
int getTagId() const override { return 1142; };
QString getDescription() const override {
@@ -904,9 +879,6 @@ private:
TPointD *quad) const;
void drawGLQuad(const TPointD *quad) const;
int nbClip(const int lX, const int lY, const std::vector<TPointD> &v) const;
- void drawFlashQuad(TFlash &flash, const TPointD *quad) const;
- void drawFlashTriangle(TFlash &flash, const TPointD &p1, const TPointD &p2,
- const TPointD &p3) const;
protected:
void loadData(TInputStreamInterface &is) override;
diff --git a/toonz/sources/colorfx/strokestyles.cpp b/toonz/sources/colorfx/strokestyles.cpp
index 8c47fa7d5..910df8202 100644
--- a/toonz/sources/colorfx/strokestyles.cpp
+++ b/toonz/sources/colorfx/strokestyles.cpp
@@ -3,12 +3,12 @@
// TnzCore includes
#include "tcolorfunctions.h"
#include "trandom.h"
-#include "tflash.h"
#include "tcurves.h"
#include "tvectorrenderdata.h"
#include "tmathutil.h"
#include "colorfxutils.h"
#include "tpixelutils.h"
+#include "tconvert.h"
// tcg includes
#include "tcg/tcg_misc.h"
@@ -44,9 +44,6 @@ public:
TStrokeProp *clone(const TStroke *stroke) const override;
void draw(const TVectorRenderData &rd) override;
- void draw(TFlash &flash) override {
- getColorStyle()->drawStroke(flash, getStroke());
- }
};
//-----------------------------------------------------------------------------
@@ -195,44 +192,6 @@ void TFurStrokeStyle::setParamValue(int index, double value) {
updateVersionNumber();
}
-//-----------------------------------------------------------------------------
-
-void TFurStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const {
- // TStroke *stroke = getStroke();
- double length = stroke->getLength();
-
- double s = 0.0;
- double ds = 4;
- double vs = 1;
- TRandom rnd;
- flash.setLineColor(m_color);
- vector<TSegment> segmentsArray;
-
- while (s <= length) {
- double w = stroke->getParameterAtLength(s);
- TThickPoint pos = stroke->getThickPoint(w);
- TPointD pos1 = (TPointD)pos;
-
- TPointD u = stroke->getSpeed(w);
- if (norm2(u) == 0.0) {
- s += 0.5;
- continue;
- }
- u = normalize(u);
- TPointD v = rotate90(u);
-
- double length = m_length * pos.thick;
- vs = -vs;
-
- double q = 0.01 * (rnd.getFloat() * 2 - 1);
- segmentsArray.push_back(
- TSegment(pos1, pos1 + length * ((m_cs + q) * u + (vs * m_sn) * v)));
- s += ds;
- }
-
- flash.drawSegments(segmentsArray, true);
-}
-
//-----------------------------------------------------------------------------
void TFurStrokeStyle::computeData(Points &positions, const TStroke *stroke,
const TColorFunction *cf) const {
@@ -446,124 +405,6 @@ void TChainStrokeStyle::drawStroke(const TColorFunction *cf, Points &data,
glDeleteLists(ringId, 1);
}
-//-----------------------------------------------------------------------------
-
-void TChainStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const {
- // TStroke *stroke = getStroke();
- double length = stroke->getLength();
-
- // spessore della catena = spessore "medio" dello stroke
- double thickness =
- 0.25 *
- (stroke->getThickPoint(0).thick + stroke->getThickPoint(1.0 / 3.0).thick +
- stroke->getThickPoint(2.0 / 3.0).thick + stroke->getThickPoint(1).thick);
-
- if (thickness < 2) {
- TCenterLineStrokeStyle *appStyle =
- new TCenterLineStrokeStyle(m_color, 0x0, thickness);
- appStyle->drawStroke(flash, stroke);
- delete appStyle;
- return;
- }
-
- assert(thickness);
- double ringHeight = thickness;
- double ringWidth = 1.5 * ringHeight;
- double ringDistance = 2 * 1.2 * ringWidth;
-
- double joinPos = 0.45 * ringWidth;
- // const int ringId = 124;
- double a = .6, b = .6;
-
- TScale scaleM(ringWidth, ringHeight);
- vector<TPointD> chain;
- chain.push_back(scaleM * TPointD(1, b)); // 0
- chain.push_back(scaleM * TPointD(a, 1)); // 1
- chain.push_back(scaleM * TPointD(-a, 1)); // 2
- chain.push_back(scaleM * TPointD(-1, b)); // 3
- chain.push_back(scaleM * TPointD(-1, -b)); // 4
- chain.push_back(scaleM * TPointD(-a, -1)); // 5
- chain.push_back(scaleM * TPointD(a, -1)); // 6
- chain.push_back(scaleM * TPointD(1, -b)); // 7
- chain.push_back(scaleM * TPointD(1, b)); // 8
-
- /*
-chain.push_back( TPointD(1, b)); //0
-chain.push_back( TPointD( a, 1)); //1
-chain.push_back( TPointD(-a, 1)); //2
-chain.push_back( TPointD(-1, b)); //3
-chain.push_back( TPointD(-1,-b)); //4
-chain.push_back( TPointD(-a,-1)); //5
-chain.push_back( TPointD( a,-1)); //6
-chain.push_back( TPointD( 1,-b)); //7
-chain.push_back( TPointD(1, b)); //8
-*/
-
- vector<TSegment> chainS;
- chainS.push_back(TSegment(chain[0], chain[1]));
- chainS.push_back(TSegment(chain[1], chain[2]));
- chainS.push_back(TSegment(chain[2], chain[3]));
- chainS.push_back(TSegment(chain[3], chain[4]));
- chainS.push_back(TSegment(chain[4], chain[5]));
- chainS.push_back(TSegment(chain[5], chain[6]));
- chainS.push_back(TSegment(chain[6], chain[7]));
- chainS.push_back(TSegment(chain[7], chain[0]));
-
- flash.setLineColor(m_color);
-
- TPointD oldPos;
- bool firstRing = true;
- double s = 0;
- while (s <= length) {
- double w = stroke->getParameterAtLength(s);
- // if(w<0) {s+=0.1; continue;} // per tamponare il baco della
- // getParameterAtLength()
- TThickPoint pos = stroke->getThickPoint(w);
- TPointD u = stroke->getSpeed(w);
- if (norm2(u) == 0) {
- s += 0.1;
- continue;
- } // non dovrebbe succedere mai, ma per prudenza....
- u = normalize(u);
- // TPointD v = rotate90(u);
-
- TTranslation translM(pos.x, pos.y);
- TRotation rotM(rad2degree(atan(u)));
- TAffine tM = translM * rotM;
-
- // With direct transformation
- vector<TSegment> lchainS;
- for (int i = 0; i < 8; i++)
- lchainS.push_back(TSegment(tM * chain[i], tM * chain[i + 1]));
- flash.drawSegments(lchainS, false);
-
- /*
-// With TFlash transformations
-flash.pushMatrix();
-flash.multMatrix(translM);
-flash.multMatrix(rotM);
-// flash.multMatrix(scaleM);
-flash.drawSegments(chainS,false);
-// if (chainId==-1)
-// chainId=flash.drawSegments(chainS,false);
-// else
-// flash.drawShape(chainId);
-flash.popMatrix();
-*/
-
- if (!firstRing) {
- TPointD q = pos - u * joinPos;
- vector<TSegment> sv;
- sv.push_back(TSegment(oldPos, q));
- flash.drawSegments(sv, false);
- } else
- firstRing = false;
-
- oldPos = pos + u * joinPos;
- s += ringDistance;
- }
-}
-
//=============================================================================
TSprayStrokeStyle::TSprayStrokeStyle()
@@ -731,68 +572,6 @@ void TSprayStrokeStyle::drawStroke(const TColorFunction *cf,
}
}
-//-----------------------------------------------------------------------------
-
-void TSprayStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const {
- double length = stroke->getLength();
- double step = 4;
-
- double blend = m_blend; // distanza che controlla da dove il gessetto
- // comincia il fade out (0, 1)
- double intensity = m_intensity; // quanti punti vengono disegnati ad ogni
- // step
- double radius = m_radius;
- double decay = 1 - blend;
- bool fill = 0;
- TPointD pos1;
- TRandom rnd;
- TPixel32 color = m_color;
- TPixelD dcolor;
- dcolor = toPixelD(color);
-
- double s = 0;
- while (s <= length) {
- double w = stroke->getParameterAtLength(s);
- // if(w<0) {s+=0.1; continue;} // per tamponare il baco della
- // getParameterAtLength()
- TThickPoint pos = stroke->getThickPoint(w);
- TPointD u = stroke->getSpeed(w);
- double normu = norm2(u);
- if (normu == 0) {
- s += 0.1;
- continue;
- } // non dovrebbe succedere mai, ma per prudenza....
- u = normalize(u);
- TPointD v = rotate90(u);
- TPointD shift;
- for (int i = 0; i < intensity; i++) {
- double vrandnorm = (0.5 - rnd.getFloat()) * 2;
- double randomv = vrandnorm * pos.thick;
- double randomu = (0.5 - rnd.getFloat()) * step;
- shift = u * randomu + v * randomv;
- pos1 = pos + shift;
- double mod = fabs(vrandnorm);
- TPixelD ldcolor = dcolor;
- ldcolor.m = mod < decay ? rnd.getFloat() * dcolor.m
- : rnd.getFloat() * (1 - mod) * dcolor.m;
- TPixel32 lcolor;
- lcolor = toPixel32(ldcolor);
- if (fill) {
- flash.setFillColor(lcolor);
- double r = radius * pos.thick * rnd.getFloat();
- flash.drawEllipse(pos1, r, r);
- } else {
- flash.setLineColor(lcolor);
- flash.setFillColor(TPixel32(0, 0, 0, 0));
- flash.setThickness(0.5);
- double r = radius * pos.thick * rnd.getFloat();
- flash.drawEllipse(pos1, r, r);
- }
- }
- s += step;
- }
-}
-
//=============================================================================
TGraphicPenStrokeStyle::TGraphicPenStrokeStyle()
@@ -932,50 +711,6 @@ void TGraphicPenStrokeStyle::drawStroke(const TColorFunction *cf,
}
}
-//-----------------------------------------------------------------------------
-
-void TGraphicPenStrokeStyle::drawStroke(TFlash &flash,
- const TStroke *stroke) const
-
-{
- // TStroke *stroke = getStroke();
- vector<TSegment> segmentsArray;
- double length = stroke->getLength();
- double step = 10;
- TPointD pos1, pos2;
- TRandom rnd;
- double intensity = m_intensity;
- flash.setLineColor(m_color);
-
- double s = 0;
- while (s <= length) {
- double w = stroke->getParameterAtLength(s);
- // if(w<0) {s+=0.1; continue;} // per tamponare il baco della
- // getParameterAtLength()
- TThickPoint pos = stroke->getThickPoint(w);
- TPointD u = stroke->getSpeed(w);
- double normu = norm2(u);
- if (normu == 0) {
- s += 0.1;
- continue;
- } // non dovrebbe succedere mai, ma per prudenza....
- u = normalize(u);
- TPointD v = rotate90(u);
- TPointD shift;
- for (int i = 0; i < intensity; i++) {
- double randomv = (0.5 - rnd.getFloat()) * pos.thick;
- double randomu = (0.5 - rnd.getFloat()) * step;
- shift = randomu * u + randomv * v;
- pos1 = pos + shift + v * (pos.thick);
- pos2 = pos + shift - v * (pos.thick);
- segmentsArray.push_back(TSegment(pos1, pos2));
- }
- s += step;
- }
-
- flash.drawSegments(segmentsArray, false);
-}
-
//=============================================================================
namespace {
@@ -1225,128 +960,6 @@ void TDottedLineStrokeStyle::drawStroke(const TColorFunction *cf,
}
}
-//-----------------------------------------------------------------------------
-
-void TDottedLineStrokeStyle::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- // TStroke *stroke = getStroke();
- double length = stroke->getLength();
-
- double step = 5.0;
- double linemax = m_line;
- double inmax = m_in / 100;
- double outmax = m_out / 100;
- double blankmax = m_blank;
- double total = 0;
- TRandom rnd;
-
- TPixel32 color = m_color;
- TPixel32 color_transp(color.r, color.g, color.b, 0);
-
- TPointD oldPos1, oldPos2, oldPos3, oldPos4, pos1, pos2, pos3, pos4;
- bool firstRing = true;
- double s = 0;
- double meter = 0;
- double center = 0;
- double slopetmp = 0;
- double minthickness = MINTHICK;
- double thickness = 0;
- SFlashUtils sfu;
- flash.setThickness(0.0);
- while (s <= length) {
- double w = stroke->getParameterAtLength(s);
- if (w < 0) {
- s += 0.1;
- continue;
- } // per tamponare il baco della getParameterAtLength()
- TThickPoint pos = stroke->getThickPoint(w);
- double line = 0, in = 0, out = 0, blank = 0;
- if (pos.thick < MINTHICK)
- thickness = minthickness;
- else
- thickness = pos.thick;
-
- if (meter >= total) {
- meter = 0;
-
- line = linemax * (1 + rnd.getFloat()) * thickness;
- if (line > length - s) line = length - s;
- in = inmax * line;
- out = outmax * line;
- line = line - in - out;
- blank = blankmax * (1 + rnd.getFloat()) * thickness;
- /* --- OLD Version ---
-line=linemax*(1+rnd.getFloat());
-in=inmax*(1+rnd.getFloat())*pos.thick;
-out=outmax*(1+rnd.getFloat())*pos.thick;
-blank=blankmax*(1+rnd.getFloat())*pos.thick;
-*/
- if (in + out > length) {
- in = rnd.getFloat() * (length / 2);
- out = length - in;
- line = 0;
- }
- total = in + line + out + blank;
- } else if (meter > in + line + out + step) {
- s += step;
- meter += step;
- continue;
- }
- TPointD u = stroke->getSpeed(w);
- if (norm2(u) == 0) {
- s += 0.1;
- continue;
- } // non dovrebbe succedere mai, ma per prudenza....
- u = normalize(u);
- double slope = 0;
- if (s <= length - out) {
- slope = get_line_slope(meter, in, line, out);
- slopetmp = slope;
- } else
- slope = (length - s) * (slopetmp / out);
- TPointD v = rotate90(u) * (pos.thick) * slope;
- if (pos.thick * slope < 1)
- center = 0.0;
- else
- center = 0.5;
- pos1 = pos + v;
- pos2 = pos + v * 0.5;
- pos3 = pos - v * 0.5;
- pos4 = pos - v;
- if (firstRing) {
- firstRing = false;
- } else {
- vector<TPointD> pv;
- pv.push_back(oldPos1);
- pv.push_back(pos1);
- pv.push_back(pos2);
- pv.push_back(oldPos2);
- sfu.drawGradedPolyline(flash, pv, color_transp, color);
-
- pv.clear();
- pv.push_back(oldPos2);
- pv.push_back(pos2);
- pv.push_back(pos3);
- pv.push_back(oldPos3);
- flash.setFillColor(color);
- flash.drawPolyline(pv);
-
- pv.clear();
- pv.push_back(oldPos3);
- pv.push_back(pos3);
- pv.push_back(pos4);
- pv.push_back(oldPos4);
- sfu.drawGradedPolyline(flash, pv, color, color_transp);
- }
- oldPos1 = pos1;
- oldPos2 = pos2;
- oldPos3 = pos3;
- oldPos4 = pos4;
- s += step;
- meter += step;
- }
-}
-
//=============================================================================
TRopeStrokeStyle::TRopeStrokeStyle()
@@ -1523,81 +1136,6 @@ glEndList();
// glDeleteLists(rope_id,1);
}
-//-----------------------------------------------------------------------------
-
-void TRopeStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const {
- // TStroke *stroke = getStroke();
- double length = stroke->getLength();
-
- // spessore della catena = spessore "medio" dello stroke
-
- double step = 10.0;
- double bend;
- double bump;
- double bump_max = step / 4;
-
- TPixel32 color = m_color;
- TPixel32 blackcolor(TPixel32::Black);
-
- TPointD oldPos1, oldPos2;
- bool firstRing = true;
- double s = 0;
- while (s <= length) {
- double w = stroke->getParameterAtLength(s);
- if (w < 0) {
- s += 0.1;
- continue;
- } // per tamponare il baco della getParameterAtLength()
- TThickPoint pos = stroke->getThickPoint(w);
- TPointD u = stroke->getSpeed(w);
- if (norm2(u) == 0) {
- s += 0.1;
- continue;
- } // non dovrebbe succedere mai, ma per prudenza....
- u = normalize(u);
- bend = pos.thick * m_bend;
- bump = pos.thick * 0.3;
- if (bump >= bump_max) bump = bump_max;
- TPointD v = rotate90(u) * pos.thick;
- TPointD v1 = v * 0.2;
- if (firstRing) {
- firstRing = false;
- } else {
- const int nbpp = 8;
- TPointD pp[nbpp];
- pp[0] = (pos + (bend + bump) * u + v - v1);
- pp[1] = (pos + (bend)*u + v);
- pp[2] = (oldPos1 + (bump)*u + v1);
- pp[3] = (oldPos1);
- pp[4] = (oldPos2);
- pp[5] = (oldPos2 + bump * u - v1);
- pp[6] = (pos + u * (-bend) - v);
- pp[7] = (pos + u * (bump - bend) - v + v1);
-
- vector<TPointD> pv;
- int i;
- for (i = 0; i < nbpp; i++) pv.push_back(pp[i]);
-
- flash.setFillColor(color);
- flash.drawPolyline(pv);
-
- vector<TSegment> sv;
- for (i = 0; i < (nbpp - 1); i++) sv.push_back(TSegment(pp[i], pp[i + 1]));
- flash.setThickness(1.0);
- flash.setLineColor(blackcolor);
- flash.drawSegments(sv, false);
- }
- oldPos1 = pos + (bend + bump) * u + v - v1;
- oldPos2 = pos + u * (bump - bend) - v + v1;
- s += step;
- }
-
- vector<TSegment> sv;
- sv.push_back(TSegment(oldPos1, oldPos2));
- flash.setLineColor(blackcolor);
- flash.drawSegments(sv, false);
-}
-
//=============================================================================
TCrystallizeStrokeStyle::TCrystallizeStrokeStyle()
@@ -1743,86 +1281,6 @@ void TCrystallizeStrokeStyle::drawStroke(const TColorFunction *cf,
}
}
-//-----------------------------------------------------------------------------
-
-void TCrystallizeStrokeStyle::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- double length = stroke->getLength();
- double step = 10.0;
- double period = m_period * step;
- double counter = 0;
- double opacity = m_opacity;
- TRandom rnd;
- // const double flashGrad=16384.0;
-
- TPixel32 color = m_color;
-
- TPixelD dcolor = toPixelD(color);
- vector<TPointD> points1;
- vector<TPointD> points2;
- double s = 0;
- while (s <= length) {
- double w = stroke->getParameterAtLength(s);
- if (w < 0) {
- s += 0.1;
- continue;
- } // per tamponare il baco della getParameterAtLength()
- TThickPoint pos = stroke->getThickPoint(w);
- TPointD u = stroke->getSpeed(w);
- if (norm2(u) == 0) {
- s += 0.1;
- continue;
- } // non dovrebbe succedere mai, ma per prudenza....
- u = normalize(u);
- TPointD v = rotate90(u) * (pos.thick / 2);
- points1.push_back(pos + v * (1 + rnd.getFloat()) + u * 2 * rnd.getFloat());
- points2.push_back(pos - v * (1 + rnd.getFloat()) - u * 2 * rnd.getFloat());
- s += step;
- }
-
- // Just for the polygon grading function
- // SRegionDrawInFlash rdf;
- SFlashUtils sfu;
- TPixelD ldcolorPrev = dcolor;
- ldcolorPrev.m = (opacity + (0.0 / period) * rnd.getFloat()) * dcolor.m;
- flash.setThickness(0.0);
- for (int i = 0; i < (int)(points1.size() - 1); i++) {
- if (counter > period) counter = 0;
- TPixelD ldcolor = dcolor;
- ldcolor.m = (opacity + (counter / period) * rnd.getFloat()) * dcolor.m;
-
- TPixel32 lcolorPrev;
- lcolorPrev = toPixel32(ldcolorPrev);
- TPixel32 lcolor;
- lcolor = toPixel32(ldcolor);
-
- vector<TPointD> tpv;
- tpv.push_back(points1[i]);
- tpv.push_back(points2[i]);
- tpv.push_back(points2[i + 1]);
- tpv.push_back(points1[i + 1]);
-
- // Solid Color version
- // flash.setFillColor(blend(lcolorPrev,lcolor,0.5));
- // flash.drawPolyline(tpv);
- sfu.drawGradedPolyline(flash, tpv, lcolorPrev, lcolor);
-
- counter += step;
- ldcolorPrev = ldcolor;
- }
-
- counter = 0;
- vector<TSegment> tsv1, tsv2;
- for (int j = 1; j < (int)points1.size(); j++) {
- tsv1.push_back(TSegment(points1[j - 1], points1[j]));
- tsv2.push_back(TSegment(points2[j - 1], points2[j]));
- }
- flash.setThickness(1.0);
- flash.setLineColor(color);
- flash.drawSegments(tsv1, false);
- flash.drawSegments(tsv2, false);
-}
-
//=============================================================================
namespace {
@@ -1837,7 +1295,6 @@ public:
TPixel32 color;
Stripe();
void drawpolygon();
- void drawpolygon(TFlash &flash);
void drawlines(TPixel32 blackcolor);
void addToSegment(vector<TSegment> *sv, vector<TSegment> &scontour,
TPixel32 *colors);
@@ -1862,32 +1319,6 @@ void Stripe::drawpolygon() {
glEnd();
}
-void Stripe::drawpolygon(TFlash &flash) {
- vector<TPointD> pv;
- pv.push_back(oldpos1);
- pv.push_back(oldpos2);
- pv.push_back(pos2);
- pv.push_back(pos1);
- flash.setThickness(0);
- flash.setFillColor(color);
- flash.drawPolyline(pv);
-
- // Draws the black contour
- flash.setThickness(0.5);
- flash.setLineColor(TPixel32::Black);
- vector<TSegment> sv;
- sv.push_back(TSegment(oldpos1, pos1));
- sv.push_back(TSegment(oldpos2, pos2));
- flash.drawSegments(sv, false);
-
- // It is better, but the flash.drawLine() is missing in my SDK
- /* flash.setThickness(0.5);
-flash.setLineColor(TPixel32::Black);
- flash.drawLine(oldpos1,pos1);
- flash.drawLine(oldpos2,pos2);
-*/
-}
-
void Stripe::addToSegment(vector<TSegment> *sv, vector<TSegment> &scontour,
TPixel32 *colors) {
TPointD p0 = (oldpos1 + oldpos2) * 0.5;
@@ -2051,88 +1482,7 @@ void TBraidStrokeStyle::drawStroke(const TColorFunction *cf,
colors[k] = m_colors[k];
}
TPixel32 blackcolor = TPixel32::Black;
- if (cf) blackcolor = (*(cf))(blackcolor);
-
- for (k = 0; k < 3; k++) {
- Stripe tmp;
- tmp.phase = (ntick * k) / 3;
- tmp.color = colors[k];
- braid.push_back(tmp);
- }
-
- for (int z = 0; z < ntick; z++) {
- double tmpsin = sin(z * freq);
- ssin.push_back(tmpsin);
- }
- while (s <= length) {
- count++;
- double w = stroke->getParameterAtLength(s);
- if (w < 0) {
- s += 0.1;
- continue;
- } // per tamponare il baco della getParameterAtLength()
- TThickPoint pos = stroke->getThickPoint(w);
- TPointD u = stroke->getSpeed(w);
- if (norm2(u) == 0) {
- s += 0.1;
- continue;
- } // non dovrebbe succedere mai, ma per prudenza....
- u = normalize(u);
- TPointD v = rotate90(u) * pos.thick;
- TPointD v1 = v * stripethickness;
- v = v * 0.5;
- // int modper=(int)s%(int)period;
- if (firstRing) {
- firstRing = false;
- swap = 0;
- for (int j = 0; j < (int)braid.size(); j++) {
- int tmp = (count + braid[j].phase) % ntick;
- braid[j].oldpos1 = pos + v * ssin[tmp];
- braid[j].oldpos2 = pos + v * ssin[tmp] + v1;
- }
- } else {
- for (int i = 0; i < (int)braid.size(); i++) {
- int tmp = (count + braid[i].phase) % ntick;
- braid[i].pos1 = pos + v * ssin[tmp];
- braid[i].pos2 = pos + v * ssin[tmp] + v1;
- braid[i].drawpolygon();
- braid[i].drawlines(blackcolor);
- braid[i].oldpos1 = pos + v * ssin[tmp];
- braid[i].oldpos2 = pos + v * ssin[tmp] + v1;
- }
- }
- s += step;
- swap += step;
- if (swap > (period / 3.0)) {
- swapcount++;
- std::swap(braid[0], braid[1 + (swapcount & 1)]);
- swap -= period / 3.0;
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-
-void TBraidStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const {
- double length = stroke->getLength();
- const int ntick = 162;
- const double stripethickness = 0.3;
- int period = (int)(101 - m_period) * 20;
- double step = period / (double)ntick;
- double freq = M_2PI / ntick;
- int swapcount = 0;
- int count = 0;
- bool firstRing = true;
- double s = 0;
- double swap;
- vector<Stripe> braid;
- vector<double> ssin;
- int k = 0;
- TPixel32 colors[3];
-
- for (k = 0; k < 3; k++) colors[k] = m_colors[k];
-
- TPixel32 blackcolor = TPixel32::Black;
+ if (cf) blackcolor = (*(cf))(blackcolor);
for (k = 0; k < 3; k++) {
Stripe tmp;
@@ -2145,7 +1495,6 @@ void TBraidStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const {
double tmpsin = sin(z * freq);
ssin.push_back(tmpsin);
}
-
while (s <= length) {
count++;
double w = stroke->getParameterAtLength(s);
@@ -2177,9 +1526,8 @@ void TBraidStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const {
int tmp = (count + braid[i].phase) % ntick;
braid[i].pos1 = pos + v * ssin[tmp];
braid[i].pos2 = pos + v * ssin[tmp] + v1;
-
- braid[i].drawpolygon(flash);
-
+ braid[i].drawpolygon();
+ braid[i].drawlines(blackcolor);
braid[i].oldpos1 = pos + v * ssin[tmp];
braid[i].oldpos2 = pos + v * ssin[tmp] + v1;
}
@@ -2320,68 +1668,6 @@ void TSketchStrokeStyle::drawStroke(const TColorFunction *cf,
glColor4d(0, 0, 0, 1);
}
-//-----------------------------------------------------------------------------
-
-void TSketchStrokeStyle::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- double length = stroke->getLength();
- if (length <= 0) return;
- vector<TQuadratic> quadsArray;
-
- int count = (int)(length * m_density);
-
- double maxDw = std::min(1.0, 20.0 / length);
- double minDw = 1.0 / length;
- TPixel color(m_color.r, m_color.g, m_color.b, m_color.m);
- flash.setLineColor(color);
-
- TRandom rnd;
-
- for (int i = 0; i < count; i++) {
- double r = rnd.getFloat();
- double dw = (1 - r) * minDw + r * maxDw;
- double wmin = dw, wmax = 1 - dw;
- if (wmin >= wmax) continue;
- r = rnd.getFloat();
- double w = (1 - r) * wmin + r * wmax;
-
- double w0 = w - dw;
- double w1 = w + dw;
-
- TThickPoint p0 = stroke->getThickPoint(w0);
- TThickPoint p1 = stroke->getThickPoint(w1);
- double d01 = tdistance(p0, p1);
- if (d01 == 0) continue;
-
- // int count = (int)(d01);
-
- TPointD v0 = stroke->getSpeed(w0);
- TPointD v1 = stroke->getSpeed(w1);
-
- if (norm2(v0) == 0 || norm2(v1) == 0)
- continue; // non dovrebbe succedere mai, ma....
- v0 = rotate90(normalize(v0));
- v1 = rotate90(normalize(v1));
-
- double delta = 0.5 * (rnd.getFloat() - 0.5) * (p0.thick + p1.thick);
- double d = 0.1 * d01;
- double delta0 = delta - d;
- double delta1 = delta + d;
-
- TPointD v = rotate90(normalize(stroke->getSpeed(0.5 * (w0 + w1))));
- TPointD p = stroke->getPoint(0.5 * (w0 + w1));
- double delta_t = 0.5 * (delta0 + delta1);
- // quadsArray.push_back(TSegment(p0 + v0*delta0, p1 + v1*delta1));
- TPointD pp0 = p0 + v0 * delta0;
- TPointD pp2 = p1 + v1 * delta1;
- TPointD pp1 = 2 * (p + v * delta_t) -
- 0.5 * (pp0 + pp2); // punto p1 ottenuto imponendo che la quad
- // passi per il punto p in t=.5
- quadsArray.push_back(TQuadratic(pp0, pp1, pp2));
- }
- flash.drawquads(quadsArray);
-}
-
//=============================================================================
TBubbleStrokeStyle::TBubbleStrokeStyle()
@@ -2445,40 +1731,6 @@ void TBubbleStrokeStyle::drawStroke(const TColorFunction *cf,
}
}
-//-----------------------------------------------------------------------------
-
-void TBubbleStrokeStyle::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- double length = stroke->getLength();
- if (length <= 0) return;
-
- TRandom rnd(0);
- static int count = 0;
- count++;
-
- TPixel32 color0 = m_color0;
- TPixel32 color1 = m_color1;
-
- for (double s = 0; s < length; s += 5) {
- TPointD p = stroke->getPointAtLength(s);
- double w = stroke->getParameterAtLength(s);
- if (w < 0) {
- s += 0.1;
- continue;
- } // per tamponare il baco della getParameterAtLength()
- TThickPoint pos = stroke->getThickPoint(w);
- int toff = rnd.getInt(0, 999);
- int t = (count + toff) % 1000;
- TRandom rnd2(t >> 2);
- p += 2 * TPointD(-0.5 + rnd2.getFloat(), -0.5 + rnd2.getFloat());
- double r = (t & ((int)(pos.thick)));
- flash.setThickness(0.5);
- flash.setLineColor(blend(color0, color1, rnd.getFloat()));
- flash.setFillColor(TPixel32(0, 0, 0, 0));
- flash.drawEllipse(p, r, r);
- }
-}
-
//=============================================================================
TTissueStrokeStyle::TTissueStrokeStyle()
@@ -2638,77 +1890,6 @@ void TTissueStrokeStyle::drawStroke(const TColorFunction *cf, PointMatrix &data,
}
}
-//-----------------------------------------------------------------------------
-
-void TTissueStrokeStyle::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- double length = stroke->getLength();
- double step = 5.0;
- double border = m_border;
- TPointD pos1, oldPos1;
- TRandom rnd;
- double increment = 0.0;
- int intensity = (int)m_density + 2;
- vector<TPointD> points;
- vector<TPointD> oldpoints;
- TPixel32 color = m_color;
-
- flash.setLineColor(m_color);
- flash.setThickness(1.0);
- double s = 0;
- bool firstRing = true;
- while (s <= length) {
- double w = stroke->getParameterAtLength(s);
- if (w < 0) {
- s += 0.1;
- continue;
- } // per tamponare il baco della getParameterAtLength()
- TThickPoint pos = stroke->getThickPoint(w);
- TPointD u = stroke->getSpeed(w);
- if (norm2(u) == 0) {
- s += 0.1;
- continue;
- } // non dovrebbe succedere mai, ma per prudenza....
- u = normalize(u);
- TPointD v = rotate90(u);
- increment = (2 * pos.thick) / (intensity - 1);
- for (int i = 1; i < intensity - 1; i++) {
- pos1 = pos + v * (-pos.thick + i * increment);
- points.push_back(pos1);
- }
- if (firstRing) {
- firstRing = false;
- } else {
- flash.setThickness(1.5);
- vector<TSegment> sv;
- for (int i = 1; i < intensity - 1; i++) {
- pos1 = points[i - 1];
- oldPos1 = oldpoints[i - 1];
- sv.push_back(TSegment(oldPos1, pos1));
- }
- flash.drawSegments(sv, false);
-
- if (increment > 1) {
- sv.clear();
- double startpoint = -step - increment / 2.0;
- for (int j = 1; j < step / increment + 1; j++) {
- TPointD p0 = points[0] - v * border * increment * rnd.getFloat() +
- u * (startpoint + j * (increment));
- TPointD p1 = points[intensity - 3] +
- v * border * increment * rnd.getFloat() +
- u * (startpoint + j * (increment));
- // vector<TSegment> sv;
- sv.push_back(TSegment(p0, p1));
- }
- flash.drawSegments(sv, false);
- }
- }
- oldpoints = points;
- points.clear();
- s += step;
- }
-}
-
//=============================================================================
TBiColorStrokeStyle::TBiColorStrokeStyle()
@@ -2792,35 +1973,6 @@ void TBiColorStrokeStyle::drawStroke(const TColorFunction *cf,
glEnd();
}
-//-----------------------------------------------------------------------------
-
-void TBiColorStrokeStyle::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- TOutlineUtil::OutlineParameter param;
- param.m_lengthStep = std::max(10.0, m_parameter);
- TStrokeOutline outline;
- TOutlineStyle::computeOutline(stroke, outline, param);
- const std::vector<TOutlinePoint> &v = outline.getArray();
- if (v.empty()) return;
-
- TPixel32 color0 = m_color0;
- TPixel32 color1 = m_color1;
- flash.setThickness(0.0);
- // Just for the polygon grading function
- SFlashUtils sfu;
- for (UINT i = 0; i < (v.size() - 3); i += 2) {
- vector<TPointD> plv;
- plv.push_back(TPointD(v[i].x, v[i].y));
- plv.push_back(TPointD(v[i + 2].x, v[i + 2].y));
- plv.push_back(TPointD(v[i + 3].x, v[i + 3].y));
- plv.push_back(TPointD(v[i + 1].x, v[i + 1].y));
- // flash.setFillColor(blend(color0,color1,0.5));
- // flash.drawPolyline(plv);
- // graded multipolygons
- sfu.drawGradedPolyline(flash, plv, color0, color1);
- }
-}
-
//=============================================================================
TNormal2StrokeStyle::TNormal2StrokeStyle()
@@ -3065,60 +2217,6 @@ void TNormal2StrokeStyle::drawStroke(const TColorFunction *cf,
glDisable(GL_LIGHT0);
}
-//-----------------------------------------------------------------------------
-
-void TNormal2StrokeStyle::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- // TStroke *stroke = getStroke();
- // double length = stroke->getLength();
- // double step=10.0;
- TPointD pos1, pos2, pos3, pos4, oldPos1, oldPos2, oldPos3, oldPos4;
-
- TOutlineUtil::OutlineParameter param;
- param.m_lengthStep = 10.0;
- TStrokeOutline outline;
- TOutlineStyle::computeOutline(stroke, outline, param);
- const std::vector<TOutlinePoint> &v = outline.getArray();
-
- TPixel32 color = m_color;
- TPixelD dcolor;
- dcolor = toPixelD(color);
-
- TPixel32 color1;
- TPixelD dcolor1(0.5 * dcolor.r, 0.5 * dcolor.g, 0.5 * dcolor.b, 1.0);
- color1 = toPixel32(dcolor1);
-
- dcolor = TPixelD(dcolor.r + (1.0 - dcolor.r) * m_metal,
- dcolor.g + (1.0 - dcolor.g) * m_metal,
- dcolor.b + (1.0 - dcolor.b) * m_metal, dcolor.m);
- color = toPixel32(dcolor);
- flash.setThickness(0.0);
-
- SFlashUtils sfu;
- for (int i = 0; i <= (int)(v.size() - 4); i += 2) {
- TPointD olda(v[i].x, v[i].y);
- TPointD oldb(v[i + 1].x, v[i + 1].y);
- TPointD oldcenter = 0.5 * (olda + oldb);
- TPointD a(v[i + 2].x, v[i + 2].y);
- TPointD b(v[i + 3].x, v[i + 3].y);
- TPointD center = 0.5 * (a + b);
-
- vector<TPointD> vpl;
- vpl.push_back(olda);
- vpl.push_back(a);
- vpl.push_back(center);
- vpl.push_back(oldcenter);
- sfu.drawGradedPolyline(flash, vpl, color1, color);
-
- vpl.clear();
- vpl.push_back(oldb);
- vpl.push_back(b);
- vpl.push_back(center);
- vpl.push_back(oldcenter);
- sfu.drawGradedPolyline(flash, vpl, color1, color);
- }
-}
-
//=============================================================================
namespace {
@@ -3605,106 +2703,6 @@ void TBlendStrokeStyle2::drawStroke(const TColorFunction *cf,
glEnd();
}
-//-----------------------------------------------------------------------------
-
-void TBlendStrokeStyle2::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- // TStroke *stroke = getStroke();
- double length = stroke->getLength();
- double step = 10.0;
- TPointD pos1, pos2, pos3, pos4, oldPos1, oldPos2, oldPos3, oldPos4;
- double oldintslope;
- TPixel32 color = m_color;
-
- double lblend = m_blend;
- // For the Flash version, to simplify the grading.
- lblend = 1.0;
-
- TPixelD dcolor;
- dcolor = toPixelD(color);
- bool firstRing = true;
- double s = 0;
- // double maxfactor=2*lblend/step; //max definisce il numero di intervalli in
- // cui la regione viene divisa
- // per evitare il problema del blend poco efficiente sui triangoli
-
- vector<TPointD> vp1, vp2;
- vector<TPixelD> vdc1, vdc2;
-
- flash.setThickness(0);
- SFlashUtils sfu;
- while (s <= length) {
- double w = stroke->getParameterAtLength(s);
- if (w < 0) {
- s += 0.1;
- continue;
- } // per tamponare il baco della getParameterAtLength()
- TThickPoint pos = stroke->getThickPoint(w);
- TPointD u = stroke->getSpeed(w);
- if (norm2(u) == 0) {
- s += 0.1;
- continue;
- } // non dovrebbe succedere mai, ma per prudenza....
- u = normalize(u);
- TPointD v = rotate90(u) * pos.thick;
- TPointD v1 = v * (1 - lblend);
- pos1 = pos + v;
- pos2 = pos + v1;
- pos3 = pos - v1;
- pos4 = pos - v;
- double intslope =
- get_inout_intensityslope(m_in, 1 - m_out, s / length) * dcolor.m;
- if (firstRing) {
- firstRing = false;
- } else {
- vp1.clear();
- vp2.clear();
- vdc1.clear();
- vdc2.clear();
-
- // The Flash version has been simplified. Only one direction grading!
-
- vdc1.push_back(TPixelD(dcolor.r, dcolor.g, dcolor.b, 0));
- vp1.push_back(oldPos1);
- vdc2.push_back(TPixelD(dcolor.r, dcolor.g, dcolor.b, 0));
- vp2.push_back(pos1);
- vdc1.push_back(TPixelD(dcolor.r, dcolor.g, dcolor.b, oldintslope));
- vp1.push_back(oldPos2);
- vdc2.push_back(TPixelD(dcolor.r, dcolor.g, dcolor.b, intslope));
- vp2.push_back(pos2);
- vdc1.push_back(TPixelD(dcolor.r, dcolor.g, dcolor.b, oldintslope));
- vp1.push_back(oldPos3);
- vdc2.push_back(TPixelD(dcolor.r, dcolor.g, dcolor.b, intslope));
- vp2.push_back(pos3);
- vdc1.push_back(TPixelD(dcolor.r, dcolor.g, dcolor.b, 0));
- vp1.push_back(oldPos4);
- vdc2.push_back(TPixelD(dcolor.r, dcolor.g, dcolor.b, 0));
- vp2.push_back(pos4);
-
- vector<TPointD> vpl;
- vpl.push_back(vp1[0]);
- vpl.push_back(vp1[3]);
- vpl.push_back(vp2[3]);
- vpl.push_back(vp2[0]);
-
- TPixel32 col[4];
- col[0] = toPixel32(vdc1[1]);
- col[1] = toPixel32(vdc1[2]);
- col[2] = toPixel32(vdc2[2]);
- col[3] = toPixel32(vdc2[1]);
-
- sfu.drawGradedPolyline(flash, vpl, blend(col[0], col[1], 0.5),
- blend(col[2], col[3], 0.5));
- }
- oldPos1 = pos1;
- oldPos2 = pos2;
- oldPos3 = pos3;
- oldPos4 = pos4;
- oldintslope = intslope;
- s += step;
- }
-}
-
//=============================================================================
TTwirlStrokeStyle::TTwirlStrokeStyle()
@@ -3849,82 +2847,20 @@ void TTwirlStrokeStyle::drawStroke(const TColorFunction *cf, Doubles &data,
tglColor(blend(color, blackcolor, data[i + 4]));
glBegin(GL_LINES);
app.x = data[i - 5];
- app.y = data[i - 4];
- tglVertex(app);
- app.x = data[i];
- app.y = data[i + 1];
- tglVertex(app);
- glEnd();
- glBegin(GL_LINES);
- app.x = data[i - 3];
- app.y = data[i - 2];
- tglVertex(app);
- app.x = data[i + 2];
- app.y = data[i + 3];
- tglVertex(app);
- glEnd();
- }
-}
-
-//-----------------------------------------------------------------------------
-
-void TTwirlStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const {
- double length = stroke->getLength();
- double step = 5.0;
- double period = 10 * (102 - m_period);
- double hperiod = period / 2;
- double blendval = 0;
- TRandom rnd;
- TPixel32 blackcolor = TPixel32::Black;
- TPixel32 color = m_color;
- blackcolor.m = m_color.m;
-
- vector<TPointD> points1;
- vector<TPointD> points2;
- vector<double> vblend;
- double s = 0;
- while (s <= length) {
- double w = stroke->getParameterAtLength(s);
- if (w < 0) {
- s += 0.1;
- continue;
- } // per tamponare il baco della getParameterAtLength()
- TThickPoint pos = stroke->getThickPoint(w);
- TPointD u = stroke->getSpeed(w);
- if (norm2(u) == 0) {
- s += 0.1;
- continue;
- } // non dovrebbe succedere mai, ma per prudenza....
- u = normalize(u);
- TPointD v = rotate90(u) * (pos.thick);
- double shift = sin((M_PI / hperiod) * s);
- points1.push_back(pos + v * shift);
- points2.push_back(pos - v * shift);
- blendval = get_inout_intensityslope(
- m_blend, 1.0 - m_blend, (s - ((int)(s / hperiod) * hperiod)) / hperiod);
- vblend.push_back(blendval);
- s += step;
- }
-
- SFlashUtils sfu;
- for (int i = 1; i < (int)points1.size(); i++) {
- vector<TPointD> vp;
- vp.push_back(points1[i - 1]);
- vp.push_back(points2[i - 1]);
- vp.push_back(points2[i]);
- vp.push_back(points1[i]);
- flash.setThickness(0.0);
- sfu.drawGradedPolyline(flash, vp, blend(blackcolor, color, vblend[i - 1]),
- blend(blackcolor, color, vblend[i]));
- // flash.setFillColor(blend(blackcolor, color , vblend[i-1]));
- // flash.drawPolyline(vp);
-
- vector<TSegment> sv;
- sv.push_back(TSegment(points1[i - 1], points1[i]));
- sv.push_back(TSegment(points2[i - 1], points2[i]));
- flash.setThickness(1.0);
- flash.setLineColor(blend(color, blackcolor, vblend[i - 1]));
- flash.drawSegments(sv, false);
+ app.y = data[i - 4];
+ tglVertex(app);
+ app.x = data[i];
+ app.y = data[i + 1];
+ tglVertex(app);
+ glEnd();
+ glBegin(GL_LINES);
+ app.x = data[i - 3];
+ app.y = data[i - 2];
+ tglVertex(app);
+ app.x = data[i + 2];
+ app.y = data[i + 3];
+ tglVertex(app);
+ glEnd();
}
}
@@ -3950,42 +2886,6 @@ void TSawToothStrokeStyle::computeOutline(
//-----------------------------------------------------------------------------
-void TSawToothStrokeStyle::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- TOutlineUtil::OutlineParameter param;
- param.m_lengthStep = std::max(20.0, m_parameter);
- TStrokeOutline outline;
- TOutlineStyle::computeOutline(stroke, outline, param);
- const std::vector<TOutlinePoint> &v = outline.getArray();
- if (v.empty()) return;
-
- TPixel32 color = m_color;
- flash.setThickness(0.0);
- flash.setFillColor(color);
-
- if (v.empty()) return;
- double old[2];
- int counter = 0;
- for (UINT i = 0; i < v.size() - 2; i += 2) {
- if (0 != v[i].stepCount) {
- if (counter) {
- vector<TPointD> plv;
- // flash.setFillColor(color);
-
- plv.push_back(TPointD(old[0], old[1]));
- plv.push_back(TPointD(v[i].x, v[i].y));
- plv.push_back(TPointD(v[i + 1].x, v[i + 1].y));
- flash.drawPolyline(plv);
- }
- old[0] = v[i].x;
- old[1] = v[i].y;
- counter++;
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-
void TSawToothStrokeStyle::drawStroke(const TColorFunction *cf,
TStrokeOutline *outline,
const TStroke *stroke) const {
@@ -4326,79 +3226,6 @@ void TMultiLineStrokeStyle2::drawStroke(const TColorFunction *cf,
glDisable(GL_POLYGON_SMOOTH);
}
-//-----------------------------------------------------------------------------
-
-void TMultiLineStrokeStyle2::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- // TStroke *stroke = getStroke();
- double length = stroke->getLength();
- double step = 4.0;
- int maxlength = (int)m_length;
- double factor = 0;
- TRandom rnd;
- TPixel32 color0, color1;
- color0 = m_color0;
- color1 = m_color1;
-
- vector<myLineData> LineData;
- myLineData Data;
- double s = 0;
- double strokethick = m_thick;
- while (s <= length) {
- double w = stroke->getParameterAtLength(s);
- if (w < 0) {
- s += 0.1;
- continue;
- } // per tamponare il baco della getParameterAtLength()
- Data.p = stroke->getThickPoint(w);
- Data.u = stroke->getSpeed(w);
- if (norm2(Data.u) == 0) {
- s += 0.1;
- continue;
- } // non dovrebbe succedere mai, ma per prudenza....
- Data.u = normalize(Data.u);
- Data.v = rotate90(Data.u) * Data.p.thick;
- LineData.push_back(Data);
- s += step;
- }
-
- for (int i = 0; i < m_intensity * LineData.size(); i++) {
- int start = rnd.getInt(0, LineData.size());
- int end = start + maxlength + rnd.getInt(0, maxlength);
- if (end > (int)LineData.size()) end = LineData.size();
- double halfcount = (end - start) / 2.0;
- double vshift = (0.5 - rnd.getFloat());
- flash.setThickness(0.0);
- flash.setFillColor(blend(color0, color1, rnd.getFloat()));
- vector<TSegment> sv;
- int j;
- for (j = 0; j < (end - start); j++) {
- if (j < halfcount)
- factor = j / halfcount;
- else
- factor = 1 - (j - halfcount) / halfcount;
- float rand = rnd.getFloat();
- TPointD p0 =
- (LineData[j + start].p +
- LineData[j + start].v *
- (vshift - strokethick * factor * (1 - m_noise * (1 - rand))));
- TPointD p1 =
- (LineData[j + start].p +
- LineData[j + start].v *
- (vshift + strokethick * factor * (1 - m_noise * (1 - rand))));
- sv.push_back(TSegment(p0, p1));
- }
- for (j = 0; j < ((int)sv.size() - 1); j++) {
- vector<TPointD> pv;
- pv.push_back(sv[j].getP0());
- pv.push_back(sv[j].getP1());
- pv.push_back(sv[j + 1].getP1());
- pv.push_back(sv[j + 1].getP0());
- flash.drawPolyline(pv);
- }
- }
-}
-
//=============================================================================
TZigzagStrokeStyle::TZigzagStrokeStyle()
@@ -4652,52 +3479,6 @@ glEnd();
// drawBLines(rects);
}
-//-----------------------------------------------------------------------------
-
-void TZigzagStrokeStyle::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- if (!stroke) return;
- double length = stroke->getLength();
- if (length <= 0) return;
-
- setRealMinMax();
- // e.g minimum translation length is the half of the thickness
- const double minTranslLength = 0.7;
-
- int first = 1;
- TThickPoint pos;
- TThickPoint pos1;
- TRandom rnd;
- RectVector rects;
-
- for (double s = 0.0; s <= length; first = -first) {
- if (getZigZagPosition(stroke, rnd, s, first, minTranslLength, pos, pos1)) {
- TRectD rec(pos.x, pos.y, pos1.x, pos1.y);
- rects.push_back(rec);
- }
- s += m_minDist + (m_maxDist - m_minDist) * (double)rnd.getUInt(101) * 0.01;
- }
- if (getZigZagPosition(stroke, rnd, length - TConsts::epsilon, first,
- minTranslLength, pos, pos1)) {
- TRectD rec(pos.x, pos.y, pos1.x, pos1.y);
- rects.push_back(rec);
- }
-
- flash.setLineColor(m_color);
- vector<TSegment> segmentsArray;
-
- flash.setThickness(m_thickness);
- RectVector::const_iterator rvi = rects.begin();
- for (; rvi != (rects.end() - 1); rvi++) {
- RectVector::const_iterator rvii = rvi + 1;
- TPointD p0((rvi->x0 + rvi->x1) / 2.0, (rvi->y0 + rvi->y1) / 2.0);
- TPointD p1((rvii->x0 + rvii->x1) / 2.0, (rvii->y0 + rvii->y1) / 2.0);
- segmentsArray.push_back(TSegment(p0, p1));
- }
-
- flash.drawSegments(segmentsArray, false);
-}
-
//=============================================================================
TSinStrokeStyle::TSinStrokeStyle()
@@ -4829,83 +3610,6 @@ void TSinStrokeStyle::drawStroke(const TColorFunction *cf,
glEnd();
}
-//-----------------------------------------------------------------------------
-
-void TSinStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const {
- double length = stroke->getLength();
- double step = 5.0;
-
- double frequency = m_frequency / 100;
- ;
- vector<TPointD> points;
-
- double s = 0;
- // bool firstRing = true;
- double thick = 1 - m_thick;
- while (s <= length) {
- double w = stroke->getParameterAtLength(s);
- // if(w<0) {s+=0.1; continue;} // per tamponare il baco della
- // getParameterAtLength()
- TThickPoint pos = stroke->getThickPoint(w);
- TPointD u = stroke->getSpeed(w);
- double normu = norm2(u);
- if (normu == 0) {
- s += 0.1;
- continue;
- } // non dovrebbe succedere mai, ma per prudenza....
- u = normalize(u);
- TPointD v = rotate90(u);
- double sinvalue = sin(frequency * s);
- points.push_back(pos + v * pos.thick * sinvalue);
- points.push_back(pos + v * thick * pos.thick * sinvalue);
- s += step;
- }
-
- // Polyline version
- flash.setThickness(0.0);
- flash.setFillColor(m_color);
- for (int i = 0; i < ((int)points.size() - 2); i += 2) {
- vector<TPointD> plv;
- plv.push_back(points[i]);
- plv.push_back(points[i + 1]);
- plv.push_back(points[i + 3]);
- plv.push_back(points[i + 2]);
- flash.drawPolyline(plv);
- }
-
- // Quadratic version
- /* flash.setThickness(m_thick);
-vector<TPointD> pp;
-for( int i=0; i<(int)(points.size()-1); i+=2 )
- pp.push_back(TPointD((points[i]+points[i+1])*0.5));
-
-if ( pp.size()<=2 ) {
- if ( pp.size()==2 ) {
- vector<TSegment> sv;
- sv.push_back(TSegment(pp[0],pp[1]));
- flash.setLineColor(m_color);
- flash.drawSegments(sv,false);
- }
- return;
-}
-
-vector<TQuadratic> qv;
-qv.push_back(TQuadratic(pp[i],pp[i]*0.75+pp[i+1]*0.25,(pp[i]+pp[i+1])*0.5));
-for( i=1; i<(int)(pp.size()-1); i++ ) {
- TPointD p0=((pp[i-1]+pp[i])*0.5);
- TPointD p1=pp[i];
- TPointD p2=((pp[i]+pp[i+1])*0.5);
- qv.push_back(TQuadratic(p0,p1,p2));
-}
-int n=pp.size()-1;
-qv.push_back(TQuadratic((pp[n-1]+pp[n])*0.5,pp[n-1]*0.25+pp[n]*0.75,pp[n]));
-
-flash.setLineColor(m_color);
-flash.setThickness(m_thick);
-flash.drawquads(qv);
-*/
-}
-
//=============================================================================
TFriezeStrokeStyle2::TFriezeStrokeStyle2()
@@ -5068,111 +3772,6 @@ void TFriezeStrokeStyle2::drawStroke(const TColorFunction *cf,
glEnd();
}
-//-----------------------------------------------------------------------------
-
-void TFriezeStrokeStyle2::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- // TStroke *stroke = getStroke();
- double length = stroke->getLength();
-
- double s = 0.01;
- double lastS = 0;
- double phi = 0;
- double lastW = 0;
- double thick = 1 - m_thick;
- vector<TPointD> points;
- while (s <= length) {
- double w = stroke->getParameterAtLength(s);
- if (w < lastW) {
- s += 0.1;
- continue;
- }
- lastW = w;
- TThickPoint pos = stroke->getThickPoint(w);
- TPointD u = normalize(stroke->getSpeed(w));
- TPointD v = rotate90(u);
-
- double thickness = pos.thick; // 5; //(1-t)*40 + t * 10;
-
- if (thickness > 0) {
- double omega = M_PI / thickness;
-
- double q = 0.5 * (1 - cos(phi));
- double theta = M_PI_2 - M_PI * m_parameter * q;
- double r = thickness * sin(phi);
- double r1 = r * thick;
- double costheta = cos(theta);
- double sintheta = sin(theta);
- points.push_back(pos + u * (r * costheta) + v * (r * sintheta));
- points.push_back(pos + u * (r1 * costheta) + v * (r1 * sintheta));
- phi += (s - lastS) * omega;
- lastS = s;
- } else {
- points.push_back(pos);
- points.push_back(pos);
- }
-
- double ds = 0.5;
- s += ds;
- }
-
- // Polyline version
- flash.setThickness(0.0);
- flash.setFillColor(m_color);
- for (int i = 0; i < ((int)points.size() - 2); i += 2) {
- vector<TPointD> plv;
- plv.push_back(points[i]);
- plv.push_back(points[i + 1]);
- plv.push_back(points[i + 3]);
- plv.push_back(points[i + 2]);
- flash.drawPolyline(plv);
- }
-
- /*
-vector<TPointD> pp;
-for( int i=0; i<((int)points.size()-1); i+=2 )
- pp.push_back(TPointD((points[i]+points[i+1])*0.5));
-
-// Quadratic version
-
-if ( pp.size()<=2 ) {
- if ( pp.size()==2 ) {
- vector<TSegment> sv;
- sv.push_back(TSegment(pp[0],pp[1]));
- flash.setLineColor(m_color);
- flash.drawSegments(sv,false);
- }
- return;
-}
-
-vector<TQuadratic> qv;
-qv.push_back(TQuadratic(pp[i],pp[i]*0.75+pp[i+1]*0.25,(pp[i]+pp[i+1])*0.5));
-for( i=1; i<(int)(pp.size()-1); i++ ) {
- TPointD p0=((pp[i-1]+pp[i])*0.5);
- TPointD p1=pp[i];
- TPointD p2=((pp[i]+pp[i+1])*0.5);
- qv.push_back(TQuadratic(p0,p1,p2));
-}
-int n=pp.size()-1;
-qv.push_back(TQuadratic((pp[n-1]+pp[n])*0.5,pp[n-1]*0.25+pp[n]*0.75,pp[n]));
-
-flash.setLineColor(m_color);
-flash.setThickness(m_thick);
-flash.drawquads(qv);
-
-*/
- // Segment version
- /*
-flash.setThickness(m_thick);
-flash.setLineColor(m_color);
- for( i=0; i<(int)(pp.size()-1); i++ ) {
- vector<TSegment> sv;
- sv.push_back(TSegment(pp[i],pp[i+1]));
- flash.drawSegments(sv,false);
- }
-*/
-}
-
//=============================================================================
TDualColorStrokeStyle2::TDualColorStrokeStyle2(TPixel32 color0, TPixel32 color1,
@@ -5266,45 +3865,6 @@ void TDualColorStrokeStyle2::drawStroke(const TColorFunction *cf,
//-----------------------------------------------------------------------------
-void TDualColorStrokeStyle2::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- TOutlineUtil::OutlineParameter param;
- param.m_lengthStep = m_parameter;
- TStrokeOutline outline;
- TOutlineStyle::computeOutline(stroke, outline, param);
- const std::vector<TOutlinePoint> &v = outline.getArray();
- if (v.empty()) return;
-
- TPixel32 colorv[2] = {m_color0, m_color1};
- int colorindex = 0;
- flash.setThickness(0.0);
- flash.setFillColor(TPixel32(0, 0, 0, 255));
- for (UINT i = 0; i < (v.size() - 2); i += 2) {
- vector<TPointD> tpv;
- tpv.push_back(TPointD(v[i].x, v[i].y));
- tpv.push_back(TPointD(v[i + 1].x, v[i + 1].y));
- tpv.push_back(TPointD(v[i + 3].x, v[i + 3].y));
- tpv.push_back(TPointD(v[i + 2].x, v[i + 2].y));
-
- if (0 != v[i].stepCount) {
- colorindex++;
- flash.setFillColor(colorv[colorindex & 1]);
- }
- flash.drawPolyline(tpv);
-
- /* --- testing ---
-vector<TSegment> s;
-s.push_back(TSegment(tpv[0],tpv[1]));
-s.push_back(TSegment(tpv[1],tpv[2]));
-s.push_back(TSegment(tpv[2],tpv[3]));
-s.push_back(TSegment(tpv[3],tpv[0]));
-flash.drawSegments(s,false);
-*/
- }
-}
-
-//-----------------------------------------------------------------------------
-
int TDualColorStrokeStyle2::getParamCount() const { return 1; }
//-----------------------------------------------------------------------------
@@ -5431,47 +3991,6 @@ void TLongBlendStrokeStyle2::drawStroke(const TColorFunction *cf,
//-----------------------------------------------------------------------------
-void TLongBlendStrokeStyle2::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- TPixel32 color0, color1;
- color0 = m_color0;
- color1 = m_color1;
-
- UINT i;
- TOutlineUtil::OutlineParameter param;
- double lParameter =
- m_parameter >= 20.0 || m_parameter < 0.0 ? 10.0 : m_parameter;
- param.m_lengthStep = lParameter;
- TStrokeOutline outline;
- TOutlineStyle::computeOutline(stroke, outline, param);
- const std::vector<TOutlinePoint> &v = outline.getArray();
- if (v.empty()) return;
-
- flash.setThickness(0.0);
-
- int mystepCount = 0;
- double totallength = stroke->getLength();
- double ntick = totallength / lParameter + 1;
- SFlashUtils sfu;
- TPixel32 col0, col1;
- col0 = col1 = color0;
- for (i = 2; i < v.size(); i += 2) {
- if (0 != v[i].stepCount) {
- col1 = blend(color0, color1, (double)mystepCount / ntick);
- mystepCount++;
- }
- vector<TPointD> plv;
- plv.push_back(TPointD(v[i - 2].x, v[i - 2].y));
- plv.push_back(TPointD(v[i - 1].x, v[i - 1].y));
- plv.push_back(TPointD(v[i + 1].x, v[i + 1].y));
- plv.push_back(TPointD(v[i].x, v[i].y));
- sfu.drawGradedPolyline(flash, plv, col0, col1);
- col0 = col1;
- }
-}
-
-//-----------------------------------------------------------------------------
-
int TLongBlendStrokeStyle2::getParamCount() const { return 1; }
//-----------------------------------------------------------------------------
@@ -5980,28 +4499,6 @@ void TMatrioskaStrokeProp::draw(const TVectorRenderData &rd) {
glPopMatrix();
}
-//------------------------------------------------------------------------------------------
-
-void TMatrioskaStrokeProp::draw(TFlash &flash) {
- int strokeId,
- strokeNumber =
- (int)(m_colorStyle->getParamValue(TColorStyle::double_tag(), 0)) - 1;
- if ((UINT)strokeNumber != m_appStrokes.size()) {
- recomputeStrokes(m_stroke, m_appStrokes, strokeNumber);
- }
-
- m_colorStyle->TOutlineStyle::drawStroke(flash, m_stroke);
-
- TSolidColorStyle appStyle(m_colorStyle->getColorParamValue(1));
-
- for (strokeId = strokeNumber - 1; strokeId >= 0; strokeId--) {
- if ((m_appStrokes.size() - strokeId) & 1)
- appStyle.TOutlineStyle::drawStroke(flash, m_appStrokes[strokeId]);
- else
- m_colorStyle->TOutlineStyle::drawStroke(flash, m_appStrokes[strokeId]);
- }
-}
-
//-----------------------------------------------------------------------------
TMatrioskaStrokeProp::~TMatrioskaStrokeProp() {
diff --git a/toonz/sources/colorfx/strokestyles.h b/toonz/sources/colorfx/strokestyles.h
index c60436969..6337f4710 100644
--- a/toonz/sources/colorfx/strokestyles.h
+++ b/toonz/sources/colorfx/strokestyles.h
@@ -86,7 +86,6 @@ public:
const TColorFunction *cf) const override;
void drawStroke(const TColorFunction *cf, Points &positions,
const TStroke *stroke) const override;
- void drawStroke(TFlash &rd, const TStroke *stroke) const override;
QString getDescription() const override {
return QCoreApplication::translate("TFurStrokeStyle", "Herringbone");
@@ -142,7 +141,6 @@ public:
const TColorFunction *cf) const override;
void drawStroke(const TColorFunction *cf, Points &positions,
const TStroke *stroke) const override;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void loadData(TInputStreamInterface &is) override { is >> m_color; }
void saveData(TOutputStreamInterface &os) const override { os << m_color; }
@@ -180,7 +178,6 @@ public:
void drawStroke(const TColorFunction *cf,
const TStroke *stroke) const override;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void loadData(TInputStreamInterface &is) override {
is >> m_color >> m_blend >> m_intensity >> m_radius;
@@ -225,7 +222,6 @@ public:
const TColorFunction *cf) const override;
void drawStroke(const TColorFunction *cf, DrawmodePointsMatrix &data,
const TStroke *stroke) const override;
- void drawStroke(TFlash &flash, const TStroke *s) const override;
void loadData(TInputStreamInterface &is) override {
is >> m_color >> m_intensity;
@@ -249,7 +245,6 @@ public:
const TColorFunction *cf) const override;
void drawStroke(const TColorFunction *cf, Points &positions,
const TStroke *stroke) const override;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void invalidate() {}
@@ -295,7 +290,6 @@ public:
const TColorFunction *cf) const override;
void drawStroke(const TColorFunction *cf, Points &positions,
const TStroke *stroke) const override;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void invalidate() {}
@@ -339,7 +333,6 @@ public:
const TColorFunction *cf) const override;
void drawStroke(const TColorFunction *cf, Points &positions,
const TStroke *stroke) const override;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void invalidate() {}
@@ -385,7 +378,6 @@ public:
void drawStroke(const TColorFunction *cf,
const TStroke *stroke) const override;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void invalidate() {}
@@ -455,7 +447,6 @@ public:
void drawStroke(const TColorFunction *cf,
const TStroke *stroke) const override;
- void drawStroke(TFlash &fl, const TStroke *s) const override;
void loadData(TInputStreamInterface &is) override {
is >> m_color >> m_density;
@@ -501,7 +492,6 @@ public:
void drawStroke(const TColorFunction *cf,
const TStroke *stroke) const override;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void loadData(TInputStreamInterface &is) override {
is >> m_color0 >> m_color1;
@@ -533,7 +523,6 @@ public:
const TColorFunction *cf) const override;
void drawStroke(const TColorFunction *cf, PointMatrix &data,
const TStroke *stroke) const override;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void invalidate() {}
@@ -578,7 +567,6 @@ public:
const TStroke *stroke) const override;
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &boundary) const override;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
bool isRegionStyle() const override { return false; }
bool isStrokeStyle() const override { return true; }
@@ -631,7 +619,6 @@ public:
TRegionOutline &boundary) const override;
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline,
const TStroke *stroke) const override;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
bool isRegionStyle() const override { return false; }
bool isStrokeStyle() const override { return true; }
@@ -731,7 +718,6 @@ public:
const TColorFunction *cf) const override;
void drawStroke(const TColorFunction *cf, PointsAndDoubles &data,
const TStroke *stroke) const override;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void invalidate() {}
@@ -782,7 +768,6 @@ public:
void drawStroke(const TColorFunction *cf, Doubles &data,
const TStroke *stroke) const override;
// void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void invalidate() {}
@@ -829,7 +814,6 @@ public:
TRegionOutline &boundary) const override {}
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline,
const TStroke *stroke) const override;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
bool isRegionStyle() const override { return false; }
bool isStrokeStyle() const override { return true; }
@@ -881,7 +865,6 @@ public:
void drawStroke(const TColorFunction *cf, BlendAndPoints &data,
const TStroke *stroke) const override;
// void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void invalidate() {}
@@ -952,7 +935,6 @@ public:
void drawStroke(const TColorFunction *cf, Points &positions,
const TStroke *stroke) const override;
// void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void invalidate() {}
@@ -1001,7 +983,6 @@ public:
void drawStroke(const TColorFunction *cf, Points &positions,
const TStroke *stroke) const override;
// void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void invalidate() {}
@@ -1065,7 +1046,6 @@ public:
void drawStroke(const TColorFunction *cf, std::vector<TPointD> &positions,
const TStroke *stroke) const override;
// void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void loadData(TInputStreamInterface &is) override {
is >> m_color >> m_parameter >> m_thick;
@@ -1097,7 +1077,6 @@ public:
TRegionOutline &boundary) const override {}
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline,
const TStroke *stroke) const override;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
bool isRegionStyle() const override { return false; }
bool isStrokeStyle() const override { return true; }
@@ -1160,7 +1139,6 @@ public:
TRegionOutline &boundary) const override {}
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline,
const TStroke *stroke) const override;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
bool isRegionStyle() const override { return false; }
bool isStrokeStyle() const override { return true; }
@@ -1288,7 +1266,6 @@ public:
TStrokeProp *clone(const TStroke *stroke) const override;
void draw(const TVectorRenderData &rd) override;
- void draw(TFlash &flash) override;
};
class TMatrioskaStrokeStyle final : public TSolidColorStyle {
diff --git a/toonz/sources/common/tfx/binaryFx.cpp b/toonz/sources/common/tfx/binaryFx.cpp
index ff608354b..3efc62427 100644
--- a/toonz/sources/common/tfx/binaryFx.cpp
+++ b/toonz/sources/common/tfx/binaryFx.cpp
@@ -3,7 +3,6 @@
// TnzCore includes
#include "tstream.h"
#include "trop.h"
-#include "tflash.h"
// TnzBase includes
#include "tdoubleparam.h"
@@ -527,24 +526,6 @@ public:
const TRenderSettings &info) override {
return TRasterFx::memorySize(rect, info.m_bpp);
}
-
- void compute(TFlash &flash, int frame) override {
- if (m_matte.isConnected()) {
- flash.pushMatrix();
- flash.beginMask();
- ((TRasterFxP)(m_matte.getFx()))->compute(flash, frame);
- flash.endMask();
- flash.popMatrix();
- }
-
- if (m_source.isConnected()) {
- flash.pushMatrix();
- flash.enableMask();
- ((TRasterFxP)(m_source.getFx()))->compute(flash, frame);
- flash.disableMask();
- flash.popMatrix();
- }
- }
};
//==================================================================
diff --git a/toonz/sources/common/tfx/unaryFx.cpp b/toonz/sources/common/tfx/unaryFx.cpp
index 5ff358492..86260d3da 100644
--- a/toonz/sources/common/tfx/unaryFx.cpp
+++ b/toonz/sources/common/tfx/unaryFx.cpp
@@ -5,7 +5,6 @@
#include "tdoubleparam.h"
#include "tnotanimatableparam.h"
#include "trasterfx.h"
-#include "tflash.h"
#include "tfxparam.h"
#include "tparamset.h"
@@ -15,13 +14,6 @@
TGeometryFx::TGeometryFx() { setName(L"Geometry"); }
-//--------------------------------------------------
-
-void TGeometryFx::compute(TFlash &flash, int frame) {
- flash.multMatrix(getPlacement(frame));
- TRasterFx::compute(flash, frame);
-}
-
//---------------------------------------------------------------
void TGeometryFx::doCompute(TTile &tile, double frame,
@@ -139,26 +131,6 @@ TFx *NaAffineFx::clone(bool recursive) const {
//--------------------------------------------------
-void NaAffineFx::compute(TFlash &flash, int frame) {
- TGeometryFx::compute(flash, frame);
-}
-
-//==================================================
-
-void TRasterFx::compute(TFlash &flash, int frame) {
- for (int i = getInputPortCount() - 1; i >= 0; i--) {
- TFxPort *port = getInputPort(i);
-
- if (port->isConnected() && !port->isaControlPort()) {
- flash.pushMatrix();
- ((TRasterFxP)(port->getFx()))->compute(flash, frame);
- flash.popMatrix();
- }
- }
-}
-
-//--------------------------------------------------
-
FX_IDENTIFIER_IS_HIDDEN(NaAffineFx, "naAffineFx")
//==================================================================
diff --git a/toonz/sources/common/tiio/tiio_std.cpp b/toonz/sources/common/tiio/tiio_std.cpp
index 3221abed8..c54dd1680 100644
--- a/toonz/sources/common/tiio/tiio_std.cpp
+++ b/toonz/sources/common/tiio/tiio_std.cpp
@@ -4,7 +4,6 @@
#include "tiio_bmp.h"
#include "tiio_std.h"
#include "tfiletype.h"
-#include "tflash.h"
using namespace Tiio;
using namespace TFileType;
diff --git a/toonz/sources/common/tvectorimage/tsweepboundary.cpp b/toonz/sources/common/tvectorimage/tsweepboundary.cpp
index 3e4e3d95f..7b0fb2618 100644
--- a/toonz/sources/common/tvectorimage/tsweepboundary.cpp
+++ b/toonz/sources/common/tvectorimage/tsweepboundary.cpp
@@ -389,7 +389,6 @@ inline bool getOutputOutlines(LinkedQuadraticList &inputBoundaries,
// int count=0;
while (!inputBoundaries.empty()) {
- // outputOutlines.push_back(TFlash::Polyline());
vector<TPointD> v;
LinkedQuadraticList::iterator it = inputBoundaries.begin();
// std::advance(it, count+1);
diff --git a/toonz/sources/common/tvrender/tcolorstyles.cpp b/toonz/sources/common/tvrender/tcolorstyles.cpp
index 1f1c89a28..98d0da473 100644
--- a/toonz/sources/common/tvrender/tcolorstyles.cpp
+++ b/toonz/sources/common/tvrender/tcolorstyles.cpp
@@ -9,7 +9,6 @@
#include "tconvert.h"
#include "tofflinegl.h"
#include "tpixelutils.h"
-#include "tflash.h"
#include "tcolorstyles.h"
//*****************************************************************************
@@ -476,43 +475,6 @@ static double computeAverageThickness(const TStroke *s, double &minThickness,
return resThick / (s->getControlPointCount() - 4);
}
-void TColorStyle::drawStroke(TFlash &flash, const TStroke *s) const {
- bool isCenterline = false;
- double minThickness, maxThickness = 0;
- std::wstring quality = flash.getLineQuality();
- double thickness = computeAverageThickness(s, minThickness, maxThickness);
- if (minThickness == maxThickness && minThickness == 0) return;
- if (quality == TFlash::ConstantLines)
- isCenterline = true;
- else if (quality == TFlash::MixedLines &&
- (maxThickness == 0 || minThickness / maxThickness > 0.5))
- isCenterline = true;
- else if (quality == TFlash::VariableLines &&
- maxThickness - minThickness <
- 0.16) // Quando si salva il pli, si approssima al thick.
- // L'errore di approx e' sempre 0.1568...
- isCenterline = true;
- // else assert(false);
-
- flash.setFillColor(getAverageColor());
- // flash.setFillColor(TPixel::Red);
-
- TStroke *saux = const_cast<TStroke *>(s);
- if (isCenterline) {
- saux->setAverageThickness(thickness);
- flash.setThickness(s->getAverageThickness());
- flash.setLineColor(getAverageColor());
- flash.drawCenterline(s, false);
- } else {
- saux->setAverageThickness(0);
- if (!flash.drawOutline(saux)) {
- flash.setThickness(thickness);
- flash.setLineColor(getAverageColor());
- flash.drawCenterline(s, false);
- }
- }
-}
-
//-----------------------------------------------------------------------------
// Format: _123 |global name
// _123 = flag; optional (*)
diff --git a/toonz/sources/common/tvrender/tflash.cpp b/toonz/sources/common/tvrender/tflash.cpp
deleted file mode 100644
index df77e14c5..000000000
--- a/toonz/sources/common/tvrender/tflash.cpp
+++ /dev/null
@@ -1,407 +0,0 @@
-
-
-#include "tflash.h"
-//#include "tstroke.h"
-#include "tcurves.h"
-#include "tregion.h"
-#include "tstrokeprop.h"
-#include "tregionprop.h"
-
-#include "tpalette.h"
-#include "tvectorimage.h"
-#include "tmachine.h"
-#include "trasterimage.h"
-#include "tsimplecolorstyles.h"
-#include "tcolorfunctions.h"
-#include "tsop.h"
-#include "tropcm.h"
-#include "tsweepboundary.h"
-#include "tiio_jpg_util.h"
-#include "zlib.h"
-//#include "trop.h"
-#include "ttoonzimage.h"
-#include "tconvert.h"
-#include "timage_io.h"
-#include "tsystem.h"
-#include <stack>
-#include <fstream>
-
-#if !defined(TNZ_LITTLE_ENDIAN)
-TNZ_LITTLE_ENDIAN undefined !!
-#endif
-
- int Tw = 0;
-
-static bool areTwEqual(double x, double y) {
- assert(Tw != 0);
-
- return (int)(Tw * x) == (int)(Tw * y);
-}
-
-static bool areTwEqual(TPointD p0, TPointD p1) {
- assert(Tw != 0);
-
- return areTwEqual(p0.x, p1.x) && areTwEqual(p0.y, p1.y);
-}
-//-------------------------------------------------------------------
-
-const std::wstring TFlash::ConstantLines = L"Low: Constant Thickness";
-const std::wstring TFlash::MixedLines = L"Medium: Mixed Thickness";
-const std::wstring TFlash::VariableLines = L"High: Variable Thickness";
-
-Tiio::SwfWriterProperties::SwfWriterProperties()
- : m_lineQuality("Curve Quality")
- , m_isCompressed("File Compression", true)
- , m_autoplay("Autoplay", true)
- , m_looping("Looping", true)
- , m_jpgQuality("Jpg Quality", 0, 100, 90)
- , m_url("URL", std::wstring())
- , m_preloader("Insert Preloader", false) {
- m_lineQuality.addValue(TFlash::MixedLines);
- m_lineQuality.addValue(TFlash::ConstantLines);
- m_lineQuality.addValue(TFlash::VariableLines);
-
- bind(m_lineQuality);
- bind(m_isCompressed);
- bind(m_autoplay);
- bind(m_looping);
- bind(m_jpgQuality);
- bind(m_url);
- bind(m_preloader);
-
- TEnumProperty::Range range = m_lineQuality.getRange();
-}
-
-//-------------------------------------------------------------------
-
-enum PolyType {
- None,
- Centerline,
- Solid,
- Texture,
- LinearGradient,
- RadialGradient
-};
-
-class PolyStyle {
-public:
- PolyType m_type;
- TPixel32 m_color1; // only if type!=Texture
- TPixel32 m_color2; // only if type==LinearGradient || type==RadialGradient
- double m_smooth; // only if type==RadialGradient
- double m_thickness; // only if type==Centerline
- TAffine m_matrix; // only if type==Texture
- TRaster32P m_texture; // only if type==Texture
- // bool m_isRegion; //only if type!=Centerline
- // bool m_isHole; //only if type!=Centerline && m_isRegion==true
- PolyStyle()
- : m_type(None)
- , m_color1()
- , m_color2()
- , m_smooth(0)
- , m_thickness(0)
- , m_matrix()
- , m_texture() /*, m_isRegion(false), m_isHole(false)*/ {}
- bool operator==(const PolyStyle &p) const;
- bool operator<(const PolyStyle &p) const;
-};
-
-class FlashPolyline {
-public:
- UINT m_depth;
- bool m_skip;
- bool m_toBeDeleted;
- bool m_isPoint;
- std::vector<TQuadratic *> m_quads;
- PolyStyle m_fillStyle1;
- PolyStyle m_fillStyle2;
- PolyStyle m_lineStyle;
- // PolyStyle m_bgStyle;
- FlashPolyline()
- : m_depth(0)
- , m_skip(false)
- , m_toBeDeleted(false)
- , m_isPoint(false)
- , m_fillStyle1()
- , m_fillStyle2()
- , m_lineStyle() {}
- bool operator<(const FlashPolyline &p) const { return m_depth < p.m_depth; }
-};
-
-class biPoint {
-public:
- TPointD p0, p1;
-
- biPoint(TPointD _p0, TPointD _p1) : p0(_p0), p1(_p1) {}
- biPoint() {}
- bool operator<(const biPoint &b) const {
- biPoint aux;
- aux.p0.x = areTwEqual(p0.x, b.p0.x) ? p0.x : b.p0.x;
- aux.p0.y = areTwEqual(p0.y, b.p0.y) ? p0.y : b.p0.y;
- aux.p1.x = areTwEqual(p1.x, b.p1.x) ? p1.x : b.p1.x;
- aux.p1.y = areTwEqual(p1.y, b.p1.y) ? p1.y : b.p1.y;
-
- return (p0.x == aux.p0.x)
- ? ((p0.y == aux.p0.y) ? ((p1.x == aux.p1.x) ? (p1.y < aux.p1.y)
- : (p1.x < aux.p1.x))
- : (p0.y < aux.p0.y))
- : p0.x < aux.p0.x;
- }
- void revert() { std::swap(p0, p1); }
-};
-
-class wChunk {
-public:
- double w0, w1;
- wChunk(double _w0, double _w1) : w0(_w0), w1(_w1) {}
- bool operator<(const wChunk &b) const { return (w1 < b.w0); }
-};
-
-//-------------------------------------------------------------------
-
-const int c_soundRate = 5512; // 5512; //11025
-const int c_soundBps = 16;
-const bool c_soundIsSigned = false;
-const int c_soundChannelNum = 1;
-const int c_soundCompression = 3; // per compatibilita' con MAC!!!
-
-//-------------------------------------------------------------------
-
-class FlashImageData {
-public:
- FlashImageData(TAffine aff, TImageP img, const TColorFunction *cf,
- bool isMask, bool isMasked)
- : m_aff(aff)
- , m_img(img)
- , m_cf(cf)
- , m_isMask(isMask)
- , m_isMasked(isMasked) {
- assert(!isMask || !isMasked);
- }
- TAffine m_aff;
- const TColorFunction *m_cf;
- bool m_isMask, m_isMasked;
- TImageP m_img;
-};
-
-static double computeAverageThickness(const TStroke *s) {
- int count = s->getControlPointCount();
- double resThick = 0;
- int i;
-
- for (i = 0; i < s->getControlPointCount(); i++) {
- double thick = s->getControlPoint(i).thick;
- if (i >= 2 && i < s->getControlPointCount() - 2) resThick += thick;
- }
- if (count < 6) return s->getControlPoint(count / 2 + 1).thick;
-
- return resThick / (s->getControlPointCount() - 4);
-}
-
-static void putquads(const TStroke *s, double w0, double w1,
- std::vector<TQuadratic *> &quads) {
- int chunkIndex0, chunkIndex1, i;
- double dummy;
- bool ret;
-
- ret = s->getChunkAndT(w0, chunkIndex0, dummy);
- assert(!ret);
- ret = s->getChunkAndT(w1, chunkIndex1, dummy);
- assert(!ret);
- assert(chunkIndex0 <= chunkIndex1);
-
- for (i = chunkIndex0; i <= chunkIndex1; i++)
- quads.push_back((TQuadratic *)s->getChunk(i));
-}
-
-//-------------------------------------------------------------------
-
-static void computeOutlineBoundary(std::vector<TStroke *> &outlines,
- std::list<FlashPolyline> &polylinesArray,
- const TPixel &color) {
- UINT size = polylinesArray.size();
-
- std::vector<std::vector<TQuadratic *>> quads;
- computeSweepBoundary(outlines, quads);
-
- outlines.clear();
- std::list<FlashPolyline>::iterator it = polylinesArray.begin();
- std::advance(it, size);
- for (int i = 0; i < (int)quads.size(); i++) {
- std::vector<TQuadratic *> &q = quads[i];
-
- polylinesArray.push_back(FlashPolyline());
- polylinesArray.back().m_quads = quads[i];
- polylinesArray.back().m_toBeDeleted = true;
- polylinesArray.back().m_fillStyle1.m_type = Solid;
- polylinesArray.back().m_fillStyle1.m_color1 = color;
- }
-}
-
-//-------------------------------------------------------------------
-
-// TFlash::drawSegments and TFlash::drawquads cannot be inline defined
-// since size of TSegment and TQuadratic are unkown in the header
-
-void TFlash::drawSegments(const std::vector<TSegment> segmentArray,
- bool isGradientColor) {}
-
-void TFlash::drawquads(const std::vector<TQuadratic> quadsArray) {}
-
-//-------------------------------------------------------------------
-
-bool PolyStyle::operator==(const PolyStyle &p) const {
- if (m_type != p.m_type) return false;
-
- switch (m_type) {
- case Centerline:
- return m_thickness == p.m_thickness && m_color1 == p.m_color1;
- case Solid:
- return m_color1 == p.m_color1;
- case Texture:
- return m_matrix == p.m_matrix &&
- m_texture.getPointer() == p.m_texture.getPointer();
- case LinearGradient:
- case RadialGradient:
- return m_color1 == p.m_color1 && m_color2 == p.m_color2 &&
- m_matrix == p.m_matrix && m_smooth == p.m_smooth;
- default:
- assert(false);
- return false;
- }
-}
-
-//-------------------------------------------------------------------
-
-static bool affineMinorThen(const TAffine &m0, const TAffine &m1) {
- if (m0.a11 == m1.a11) {
- if (m0.a12 == m1.a12) {
- if (m0.a13 == m1.a13) {
- if (m0.a21 == m1.a21) {
- if (m0.a22 == m1.a22)
- return m0.a23 < m1.a23;
- else
- return m0.a22 < m1.a22;
- } else
- return m0.a21 < m1.a21;
- } else
- return m0.a13 < m1.a13;
- } else
- return m0.a12 < m1.a12;
- } else
- return m0.a11 < m1.a11;
-}
-
-//-------------------------------------------------------------------
-
-bool PolyStyle::operator<(const PolyStyle &p) const {
- if (m_type == p.m_type) switch (m_type) {
- case Centerline:
- return (m_thickness == p.m_thickness) ? m_color1 < p.m_color1
- : m_thickness < p.m_thickness;
- case Solid:
- return m_color1 < p.m_color1;
- case Texture:
- return m_texture.getPointer() <
- p.m_texture.getPointer(); // ignoro la matrice!!!!
- case LinearGradient:
- case RadialGradient:
- return (m_smooth == p.m_smooth)
- ? ((m_color1 == p.m_color1)
- ? ((m_color2 == p.m_color2)
- ? affineMinorThen(m_matrix, p.m_matrix)
- : m_color2 < p.m_color2)
- : m_color1 < p.m_color1)
- : m_smooth < p.m_smooth;
- default:
- assert(false);
- return false;
- }
- else
- return m_type < p.m_type;
-}
-
-//-------------------------------------------------------------------
-
-static void computeQuadChain(const TEdge &e,
- std::vector<TQuadratic *> &quadArray,
- std::vector<TQuadratic *> &toBeDeleted) {
- int chunk_b, chunk_e, chunk = -1;
- double t_b, t_e, w0, w1;
- TThickQuadratic *q_b = 0, *q_e = 0;
- TThickQuadratic dummy;
- bool reversed = false;
-
- if (e.m_w0 > e.m_w1) {
- reversed = true;
- w0 = e.m_w1;
- w1 = e.m_w0;
- } else {
- w0 = e.m_w0;
- w1 = e.m_w1;
- }
-
- if (w0 == 0.0)
- chunk_b = 0;
- else {
- if (e.m_s->getChunkAndT(w0, chunk, t_b)) assert(false);
- q_b = new TThickQuadratic();
- toBeDeleted.push_back(q_b);
- e.m_s->getChunk(chunk)->split(t_b, dummy, *q_b);
- chunk_b = chunk + 1;
- }
-
- if (w1 == 1.0)
- chunk_e = e.m_s->getChunkCount() - 1;
- else {
- if (e.m_s->getChunkAndT(w1, chunk_e, t_e)) assert(false);
- q_e = new TThickQuadratic();
- toBeDeleted.push_back(q_e);
- if (chunk_e == chunk) {
- if (q_b) {
- t_e = q_b->getT(e.m_s->getChunk(chunk)->getPoint(t_e));
- q_b->split(t_e, *q_e, dummy);
- } else
- e.m_s->getChunk(0)->split(t_e, *q_e, dummy);
-
- if (!reversed)
- quadArray.push_back(q_e);
- else {
- quadArray.push_back(
- new TQuadratic(q_e->getP2(), q_e->getP1(), q_e->getP0()));
- toBeDeleted.push_back(quadArray.back());
- }
- return;
- }
- e.m_s->getChunk(chunk_e)->split(t_e, *q_e, dummy);
- chunk_e--;
- }
-
- int i;
- assert(chunk_e >= chunk_b - 1);
-
- if (reversed) {
- if (q_e) {
- q_e->reverse();
- quadArray.push_back(q_e);
- }
- for (i = chunk_e; i >= chunk_b; i--) {
- const TThickQuadratic *qAux = e.m_s->getChunk(i);
- quadArray.push_back(
- new TQuadratic(qAux->getP2(), qAux->getP1(), qAux->getP0()));
- toBeDeleted.push_back(quadArray.back());
- }
-
- if (q_b) {
- q_b->reverse();
- quadArray.push_back(q_b);
- }
- } else {
- if (q_b) quadArray.push_back(q_b);
- for (i = chunk_b; i <= chunk_e; i++)
- quadArray.push_back((TQuadratic *)e.m_s->getChunk(i));
- if (q_e) quadArray.push_back(q_e);
- }
-}
-
-//-------------------------------------------------------------------
diff --git a/toonz/sources/common/tvrender/tregionprop.cpp b/toonz/sources/common/tvrender/tregionprop.cpp
index 998895027..c7925ca0c 100644
--- a/toonz/sources/common/tvrender/tregionprop.cpp
+++ b/toonz/sources/common/tvrender/tregionprop.cpp
@@ -13,7 +13,6 @@
#include "tsimplecolorstyles.h"
//#include "tcurveutil.h"
//#include "tdebugmessage.h"
-//#include "tflash.h"
#ifndef _WIN32
#define CALLBACK
@@ -199,23 +198,3 @@ TRegionProp *OutlineRegionProp::clone(const TRegion *region) const {
const TColorStyle *OutlineRegionProp::getColorStyle() const {
return m_colorStyle.getPointer();
}
-
-//-------------------------------------------------------------------
-
-void OutlineRegionProp::draw(TFlash &flash) {
- m_colorStyle->drawRegion(flash, getRegion());
-
- /*
-
-//flash.setColor(m_colorStyle->getMainColor());
-m_colorStyle->setFill(flash);
-
-//rd.setTexture(m_colorStyle->getMainColor());
-
-for (i=0; i<(int)r->getEdgeCount(); i++)
- computeQuadChain(*r->getEdge(i), quadArray, toBeDeleted);
-
-flash.drawPolygon(quadArray);
-clearPointerContainer(toBeDeleted);
-*/
-}
diff --git a/toonz/sources/common/tvrender/tsimplecolorstyles.cpp b/toonz/sources/common/tvrender/tsimplecolorstyles.cpp
index 1ff627035..16ea11e7c 100644
--- a/toonz/sources/common/tvrender/tsimplecolorstyles.cpp
+++ b/toonz/sources/common/tvrender/tsimplecolorstyles.cpp
@@ -14,7 +14,6 @@
#include "tstrokeprop.h"
#include "ttessellator.h"
#include "tcolorfunctions.h"
-#include "tflash.h"
#include "tofflinegl.h"
#include "drawutil.h"
#include "trop.h"
@@ -607,15 +606,6 @@ void TSolidColorStyle::drawRegion(const TColorFunction *cf,
//-----------------------------------------------------------------------------
-void TSolidColorStyle::drawRegion(TFlash &flash, const TRegion *r) const {
- flash.setFillColor(getMainColor());
- flash.setLineColor(TPixel::Transparent);
- flash.setThickness(0);
- flash.drawRegion(*r);
-}
-
-//-----------------------------------------------------------------------------
-
//=============================================================================
void TSolidColorStyle::drawStroke(const TColorFunction *cf,
@@ -712,12 +702,6 @@ int TSolidColorStyle::getTagId() const { return 3; }
//-----------------------------------------------------------------------------
-void TSolidColorStyle::setFill(TFlash &flash) const {
- flash.setFillColor(getMainColor());
-}
-
-//-----------------------------------------------------------------------------
-
void TSolidColorStyle::loadData(TInputStreamInterface &is) {
TPixel32 color;
is >> color;
@@ -744,17 +728,6 @@ TColorStyle *TCenterLineStrokeStyle::clone() const {
return new TCenterLineStrokeStyle(*this);
}
-//-----------------------------------------------------------------------------
-
-void TCenterLineStrokeStyle::drawStroke(TFlash &flash, const TStroke *s) const {
- if (m_width == 0) return;
-
- flash.setThickness(m_width);
- flash.setLineColor(getAverageColor());
- flash.drawCenterline(s, true);
- flash.setThickness(0);
-}
-
//------------------------------------------------------------------------------------
void TCenterLineStrokeStyle::drawStroke(const TColorFunction *cf,
@@ -1286,40 +1259,6 @@ void TRasterImagePatternStrokeStyle::drawStroke(
glDisable(GL_BLEND);
}
-//---------------------------------------------------------------------------------------------------------------
-
-void TRasterImagePatternStrokeStyle::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- flash.drawHangedObjects();
- if (m_level->getFrameCount() == 0) {
- // if( rd.m_clippingRect!=TRect() && !
- // convert(rd.m_aff*stroke->getBBox()).overlaps( rd.m_clippingRect ) )
- // return;
- TCenterLineStrokeStyle *appStyle =
- new TCenterLineStrokeStyle(TPixel32(255, 0, 0, 255), 0x0, 2.0);
- // flash.pushMatrix();
- // flash.multMatrix(rd.m_aff);
- appStyle->drawStroke(flash, stroke);
- // glPopMatrix();
- return;
- }
-
- std::vector<TAffine> transformations;
- computeTransformations(transformations, stroke);
- assert(m_level->begin() != m_level->end());
- TLevel::Iterator lit = m_level->begin();
-
- for (UINT i = 0; i < transformations.size(); i++) {
- TRasterImageP img = m_level->frame(lit->first);
- if (++lit == m_level->end()) lit = m_level->begin();
- assert(img);
- flash.pushMatrix();
- flash.multMatrix(transformations[i] * TScale(2.0));
- flash.buildImage(img.getPointer(), false);
- flash.popMatrix();
- }
-}
-
//-----------------------------------------------------------------------------
void TRasterImagePatternStrokeStyle::loadData(TInputStreamInterface &is) {
@@ -1728,81 +1667,6 @@ void TVectorImagePatternStrokeStyle::drawStroke(
}
}
-//---------------------------------------------------------------------------------------------------------------
-
-void TVectorImagePatternStrokeStyle::drawStroke(TFlash &flash,
- const TStroke *stroke) const {
- flash.drawHangedObjects();
-
- const int frameCount = m_level->getFrameCount();
- if (frameCount == 0) {
- // if( rd.m_clippingRect!=TRect() && !
- // convert(rd.m_aff*stroke->getBBox()).overlaps( rd.m_clippingRect ) )
- // return;
- TCenterLineStrokeStyle *appStyle =
- new TCenterLineStrokeStyle(TPixel32(255, 0, 0, 255), 0x0, 2.0);
- // flash.pushMatrix();
- // flash.multMatrix(rd.m_aff);
- appStyle->drawStroke(flash, stroke);
- // glPopMatrix();
- return;
- }
- UINT cpCount = stroke->getControlPointCount();
- UINT sampleStep = (cpCount < 10) ? 1 : (UINT)((double)cpCount / 10.0);
-
- double thickSum = 0;
- UINT count = 0;
- for (UINT cp = 0; cp < cpCount; cp += sampleStep) {
- thickSum += stroke->getControlPoint(cp).thick;
- count++;
- }
- double averageThick = thickSum / (double)count;
-
- if (averageThick < 2.0) return;
- const double length = stroke->getLength();
- assert(m_level->begin() != m_level->end());
- TLevel::Iterator lit = m_level->begin();
- double s = 0;
-
- while (s < length) {
- TFrameId fid = lit->first;
- TVectorImageP img = m_level->frame(fid);
- if (++lit == m_level->end()) lit = m_level->begin();
- assert(img);
- if (img->getType() != TImage::VECTOR) return;
- double t = stroke->getParameterAtLength(s);
- TThickPoint p = stroke->getThickPoint(t);
- TPointD v = stroke->getSpeed(t);
- double ang = rad2degree(atan(v)) + m_rotation;
- TRectD bbox = img->getBBox();
- TPointD center = 0.5 * (bbox.getP00() + bbox.getP11());
- // double rx = bbox.getLx() * 0.5;
- double ry = bbox.getLy() * 0.5;
- if (ry * ry < 1e-5) ry = p.thick;
- double sc = p.thick / ry;
- if (sc < 0.0001) sc = 0.0001;
- TAffine aff =
- TTranslation(p) * TRotation(ang) * TScale(sc) * TTranslation(-center);
- // TVectorRenderData rd2(rd, rd.m_aff * aff);
- // c'era un crash se, dopo aver fatto new color, si selezionava un pattern
- // e si disegnava (stack overflow). Ora r2 prende la palette
- // dell'immagine caricata
- TVectorImage *imgPointer = img.getPointer();
-
- // TVectorRenderData rd2(rd.m_aff * aff,rd.m_clippingRect,
- // img->getPalette(),rd.m_cf,rd.m_antiAliasing);
-
- flash.pushMatrix();
- flash.multMatrix(aff);
- flash.buildImage(imgPointer, false);
- // flash.draw(imgPointer, 0);
- flash.popMatrix();
-
- double ds = std::max(2.0, sc * bbox.getLx() + m_space);
- s += ds;
- }
-}
-
//-----------------------------------------------------------------------------
void TVectorImagePatternStrokeStyle::loadData(TInputStreamInterface &is) {
diff --git a/toonz/sources/common/tvrender/tstrokeprop.cpp b/toonz/sources/common/tvrender/tstrokeprop.cpp
index e6d399b7f..518df3e63 100644
--- a/toonz/sources/common/tvrender/tstrokeprop.cpp
+++ b/toonz/sources/common/tvrender/tstrokeprop.cpp
@@ -12,7 +12,6 @@
//#include "tstrokeutil.h"
//#include "tstroke.h"
-//#include "tflash.h"
//=============================================================================
@@ -73,11 +72,6 @@ void TSimpleStrokeProp::draw(
glPopMatrix();
}
-//-----------------------------------------------------------------------------
-
-void TSimpleStrokeProp::draw(TFlash &flash) {
- getColorStyle()->drawStroke(flash, getStroke());
-}
//=============================================================================
TRasterImagePatternStrokeProp::TRasterImagePatternStrokeProp(
@@ -131,12 +125,6 @@ void TRasterImagePatternStrokeProp::draw(
m_colorStyle->drawStroke(rd, m_transformations, m_stroke);
}
-//-----------------------------------------------------------------------------
-
-void TRasterImagePatternStrokeProp::draw(TFlash &flash) {
- getColorStyle()->drawStroke(flash, getStroke());
-}
-
//-----------------------------------------------------------------------------
//=============================================================================
@@ -191,30 +179,6 @@ void TVectorImagePatternStrokeProp::draw(
m_colorStyle->drawStroke(rd, m_transformations, m_stroke);
}
-//-----------------------------------------------------------------------------
-
-void TVectorImagePatternStrokeProp::draw(TFlash &flash) {
- getColorStyle()->drawStroke(flash, getStroke());
-}
-
-//-----------------------------------------------------------------------------
-
-/*
-void TSimpleStrokeProp::draw(TFlash &flash)
-{
- // fintissima!!!! quella vera deve risalire per m_colorStyle->drawStroke()
- // come la sua sorellina di sopra
- int i, n = m_stroke->getControlPointCount();
- flash.setColor(m_colorStyle->getMainColor());
- for(i=0;i<n-1;i++)
- {
- TPointD a = m_stroke->getControlPoint(i);
- TPointD b = m_stroke->getControlPoint(i+1);
- flash.drawLine(a,b);
- }
-}
-*/
-
//=============================================================================
OutlineStrokeProp::OutlineStrokeProp(const TStroke *stroke,
@@ -290,19 +254,3 @@ void OutlineStrokeProp::draw(const TVectorRenderData &rd) {
}
//=============================================================================
-
-void OutlineStrokeProp::draw(TFlash &flash) {
- m_colorStyle->drawStroke(flash, getStroke());
-}
-
-//=============================================================================
-
-/* ora e' virtuale pura
-void TStrokeProp::draw(TFlash &flash)
-{
-getColorStyle()->drawStroke(flash, getStroke());
-}
-
-*/
-
-//=============================================================================
diff --git a/toonz/sources/common/tvrender/tvectorbrushstyle.cpp b/toonz/sources/common/tvrender/tvectorbrushstyle.cpp
index 5afd44335..bd1d44a3e 100644
--- a/toonz/sources/common/tvrender/tvectorbrushstyle.cpp
+++ b/toonz/sources/common/tvrender/tvectorbrushstyle.cpp
@@ -39,7 +39,6 @@ public:
TStrokeProp *clone(const TStroke *stroke) const override;
void draw(const TVectorRenderData &rd) override;
- void draw(TFlash &flash) override {}
const TColorStyle *getColorStyle() const override;
diff --git a/toonz/sources/include/tcolorstyles.h b/toonz/sources/include/tcolorstyles.h
index 66784edca..40a298f28 100644
--- a/toonz/sources/include/tcolorstyles.h
+++ b/toonz/sources/include/tcolorstyles.h
@@ -30,7 +30,6 @@ class TRegion;
class TStrokeProp;
class TRegionProp;
class TVectorRenderData;
-class TFlash;
class TInputStreamInterface;
class TOutputStreamInterface;
class TRasterStyleFx;
@@ -368,11 +367,6 @@ etc...
virtual QString getParamNames(int index)
const; //!< Return the string that identifies the \a index-th parameter.
- // Drawing-related functions
-
- virtual void drawStroke(TFlash &flash, const TStroke *stroke)
- const; //!< Draws the supplied stroke in flash.
-
// I/O-related functions
virtual int getTagId()
diff --git a/toonz/sources/include/tflash.h b/toonz/sources/include/tflash.h
deleted file mode 100644
index 15ef86694..000000000
--- a/toonz/sources/include/tflash.h
+++ /dev/null
@@ -1,106 +0,0 @@
-#pragma once
-
-#ifndef TFLASH_INCLUDED
-#define TFLASH_INCLUDED
-
-//#include "tpixel.h"
-//#include "tgeometry.h"
-#include "timage.h"
-#include "tsound.h"
-#include "traster.h"
-#include "tproperty.h"
-
-#undef DVAPI
-#undef DVVAR
-#ifdef TVRENDER_EXPORTS
-#define DVAPI DV_EXPORT_API
-#define DVVAR DV_EXPORT_VAR
-#else
-#define DVAPI DV_IMPORT_API
-#define DVVAR DV_IMPORT_VAR
-#endif
-
-//=========================================================
-
-class TQuadratic;
-class TSegment;
-class TVectorImage;
-class TStroke;
-class TRegion;
-
-class TColorFunction;
-
-//=========================================================
-
-namespace Tiio {
-
-class SwfWriterProperties final : public TPropertyGroup {
-public:
- TEnumProperty m_lineQuality;
- TBoolProperty m_isCompressed;
- TBoolProperty m_autoplay;
- TBoolProperty m_looping;
- TBoolProperty m_preloader;
- TIntProperty m_jpgQuality;
- TStringProperty m_url;
-
- SwfWriterProperties();
-};
-}
-
-class DVAPI TFlash {
-public:
- static const std::wstring ConstantLines;
- static const std::wstring MixedLines;
- static const std::wstring VariableLines;
-
- TFlash(int lx, int ly, int frameCount, int frameRate,
- TPropertyGroup *properties, bool keepImages = true) {}
- ~TFlash() {}
- void enableAlphaChannelForRaster(bool doSaveIt) {}
- void setSoundRate(int soundrate) {}
- void setBackgroundColor(const TPixel &bgColor) {}
- void setThickness(double thickness) {}
- void setFillColor(const TPixel32 &color) {}
- void setLineColor(const TPixel32 &color) {}
- void setTexture(const TRaster32P &texture) {}
- void setFillStyleMatrix(const TAffine &aff) {}
- void setGradientFill(bool isLinear, const TPixel &color1,
- const TPixel &color2, double smooth) {}
- void drawLine(const TPointD &a, const TPointD &b) {}
- void drawPolygon(std::vector<std::vector<TQuadratic *>> &quads,
- int clippedShapes = 0) {}
- int drawRaster(TRaster32P r) { return 0; }
- void drawRegion(const TRegion &r, int clippedShapes = 0) {}
- void drawCenterline(const TStroke *s, bool drawAll) {}
- bool drawOutline(TStroke *s) { return false; }
- void drawSegments(const std::vector<TSegment> segmentArray,
- bool isGradientColor);
- void drawquads(const std::vector<TQuadratic> quadsArray);
- USHORT buildImage(const TImageP img, bool isMask) { return 0; }
- void draw(const TImageP vi, const TColorFunction *cf) {}
- void beginFrame(int frameIndex) {}
- int endFrame(bool isLast, int frameCountLoader, bool lastScene) { return 0; }
- int drawRectangle(const TRectD &rect) { return 0; }
- int drawPolyline(std::vector<TPointD> &poly) { return 0; }
- int drawEllipse(const TPointD &center, double radiusX, double radiusY) {
- return 0;
- }
- void drawDot(const TPointD &center, double radius) {}
- void pushMatrix() {}
- void popMatrix() {}
- void multMatrix(const TAffine &aff) {}
- void putSound(TSoundTrackP st, int offset) {}
- void writeMovie(FILE *fp) {}
- void drawPolygon(const std::list<TQuadratic *> &poly, bool isOutline) {}
- std::wstring getLineQuality() { return nullptr; }
- void cleanCachedImages() {}
- void enableMask() {}
- void disableMask() {}
- void beginMask() {}
- void endMask() {}
- void drawHangedObjects() {}
- void setGlobalScale(const TAffine &aff) {}
-};
-
-#endif
diff --git a/toonz/sources/include/toonz/imagestyles.h b/toonz/sources/include/toonz/imagestyles.h
index a2c0b1ef0..fc4c913f9 100644
--- a/toonz/sources/include/toonz/imagestyles.h
+++ b/toonz/sources/include/toonz/imagestyles.h
@@ -145,10 +145,8 @@ public:
TRegionOutline &outline) const override;
// void drawRegion( const TVectorRenderData &rd, TRegionOutline &boundary )
// const;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline,
const TStroke *stroke) const override;
- // void drawStroke(TFlash& flash, const TStroke* s) const;
TRasterStyleFx *getRasterStyleFx() override { return this; }
@@ -165,7 +163,6 @@ public:
int getTagId() const override;
// static TRaster32P loadTexture(const TFilePath &path);
- void setFill(TFlash &flash) const override;
bool isPaintStyle() const override { return true; }
bool isInkStyle() const override { return true; }
diff --git a/toonz/sources/include/toonz/stage.h b/toonz/sources/include/toonz/stage.h
index 95c68008f..96b596522 100644
--- a/toonz/sources/include/toonz/stage.h
+++ b/toonz/sources/include/toonz/stage.h
@@ -24,7 +24,6 @@ class TXsheet;
class TXshSimpleLevel;
class TXshLevel;
class TFrameId;
-class TFlash;
class OnionSkinMask;
class TFx;
class TXshColumn;
diff --git a/toonz/sources/include/toonz/stagevisitor.h b/toonz/sources/include/toonz/stagevisitor.h
index 98935d329..f5cbdf4e0 100644
--- a/toonz/sources/include/toonz/stagevisitor.h
+++ b/toonz/sources/include/toonz/stagevisitor.h
@@ -33,7 +33,6 @@ class TXsheet;
class TXshSimpleLevel;
class TXshLevel;
class TFrameId;
-class TFlash;
class OnionSkinMask;
class TFx;
class TXshColumn;
diff --git a/toonz/sources/include/toonz/tcolumnfx.h b/toonz/sources/include/toonz/tcolumnfx.h
index 38a0c9b6e..c55466368 100644
--- a/toonz/sources/include/toonz/tcolumnfx.h
+++ b/toonz/sources/include/toonz/tcolumnfx.h
@@ -101,7 +101,6 @@ public:
const TRenderSettings &info) override;
void doCompute(TTile &tile, double frame,
const TRenderSettings &info) override;
- void compute(TFlash &flash, int frame) override;
void saveData(TOStream &os) override;
void loadData(TIStream &is) override;
@@ -160,7 +159,6 @@ public:
TAffine getDpiAff(int frame);
void doCompute(TTile &tile, double frame, const TRenderSettings &) override;
- void compute(TFlash &flash, int frame) override;
const TPersistDeclaration *getDeclaration() const override;
std::string getPluginId() const override;
diff --git a/toonz/sources/include/trasterfx.h b/toonz/sources/include/trasterfx.h
index c1dab566c..7bc98c2f9 100644
--- a/toonz/sources/include/trasterfx.h
+++ b/toonz/sources/include/trasterfx.h
@@ -29,7 +29,6 @@
// Forward declarations
-class TFlash;
class TPalette;
//===================================================================
@@ -244,8 +243,6 @@ public:
virtual void compute(TTile &tile, double frame, const TRenderSettings &info);
- virtual void compute(TFlash &flash, int frame);
-
void allocateAndCompute(TTile &tile, const TPointD &pos,
const TDimension &size, TRasterP templateRas,
double frame, const TRenderSettings &info);
@@ -341,7 +338,6 @@ public:
void doCompute(TTile &tile, double frame,
const TRenderSettings &info) override;
- void compute(TFlash &flash, int frame) override;
bool doGetBBox(double frame, TRectD &bbox,
const TRenderSettings &info) override;
@@ -406,8 +402,6 @@ public:
return true;
}
- void compute(TFlash &flash, int frame) override;
-
TAffine getPlacement(double frame) override { return m_aff; }
TAffine getParentPlacement(double frame) override { return TAffine(); }
diff --git a/toonz/sources/include/tregionprop.h b/toonz/sources/include/tregionprop.h
index bdbd6eaab..82de99bfe 100644
--- a/toonz/sources/include/tregionprop.h
+++ b/toonz/sources/include/tregionprop.h
@@ -28,8 +28,6 @@ class TVectorRenderData;
class TInputStreamInterface;
class TOutputStreamInterface;
-class TFlash;
-
template <class T>
class TRasterPT;
class TPixelRGBM32;
@@ -56,8 +54,6 @@ public:
//! Note: update internal data if isRegionChanged()
virtual void draw(const TVectorRenderData &rd) = 0;
- virtual void draw(TFlash &){};
-
const TRegion *getRegion() const { return m_region; }
virtual const TColorStyle *getColorStyle() const = 0;
@@ -88,7 +84,6 @@ public:
OutlineRegionProp(const TRegion *region, const TOutlineStyleP regionStyle);
void draw(const TVectorRenderData &rd) override;
- void draw(TFlash &rd) override;
const TColorStyle *getColorStyle() const override;
diff --git a/toonz/sources/include/tsimplecolorstyles.h b/toonz/sources/include/tsimplecolorstyles.h
index 4185a98e7..f99208806 100644
--- a/toonz/sources/include/tsimplecolorstyles.h
+++ b/toonz/sources/include/tsimplecolorstyles.h
@@ -32,7 +32,6 @@ class TRegionProp;
class TRegionOutline;
class TTessellator;
class TColorFunction;
-class TFlash;
class TVectorImage;
//=================================================
@@ -117,15 +116,9 @@ public:
virtual void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &outline) const = 0;
- virtual void drawRegion(TFlash &, const TRegion *) const {};
virtual void drawStroke(const TColorFunction *cf, TStrokeOutline *outline,
const TStroke *stroke) const = 0;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override {
- TColorStyle::drawStroke(flash, stroke);
- }
- virtual void setFill(TFlash &) const {};
-
protected:
// Not assignable
TOutlineStyle &operator=(const TOutlineStyle &);
@@ -164,13 +157,10 @@ public:
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
TRegionOutline &outline) const override;
- void drawRegion(TFlash &flash, const TRegion *r) const override;
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline,
const TStroke *s) const override;
- void setFill(TFlash &flash) const override;
-
int getTagId() const override;
private:
@@ -204,7 +194,6 @@ public:
void drawStroke(const TColorFunction *cf,
const TStroke *stroke) const override;
- void drawStroke(TFlash &flash, const TStroke *s) const override;
bool hasMainColor() const override { return true; }
TPixel32 getMainColor() const override { return m_color; }
@@ -258,7 +247,6 @@ public:
void drawStroke(const TVectorRenderData &rd,
const std::vector<TAffine> &positions,
const TStroke *stroke) const;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void invalidate(){};
@@ -335,7 +323,6 @@ public:
void drawStroke(const TVectorRenderData &rd,
const std::vector<TAffine> &positions,
const TStroke *stroke) const;
- void drawStroke(TFlash &flash, const TStroke *stroke) const override;
void invalidate(){};
diff --git a/toonz/sources/include/tstroke.h b/toonz/sources/include/tstroke.h
index 0cd1e9124..cff106e19 100644
--- a/toonz/sources/include/tstroke.h
+++ b/toonz/sources/include/tstroke.h
@@ -32,7 +32,6 @@ class TColorStyle;
class TThickQuadratic;
class TStrokeProp;
class TSegment;
-class TFlash;
//===================================================================
@@ -409,7 +408,6 @@ public:
TThread::Mutex *getMutex() { return &m_mutex; }
virtual void draw(const TVectorRenderData &rd) = 0;
- virtual void draw(TFlash &flash) = 0;
virtual const TColorStyle *getColorStyle() const = 0;
diff --git a/toonz/sources/include/tstrokeprop.h b/toonz/sources/include/tstrokeprop.h
index 978005648..62bf12370 100644
--- a/toonz/sources/include/tstrokeprop.h
+++ b/toonz/sources/include/tstrokeprop.h
@@ -23,7 +23,6 @@ class TVectorRenderData;
// class TStroke;
class TColorStyle;
class TSimpleStrokeStyle;
-class TFlash;
class TRasterImagePatternStrokeStyle;
class TVectorImagePatternStrokeStyle;
class TCenterLineStrokeStyle;
@@ -43,7 +42,6 @@ public:
TStrokeProp *clone(const TStroke *stroke) const override;
void draw(const TVectorRenderData &rd) override;
- void draw(TFlash &flash) override;
};
//=============================================================================
@@ -62,7 +60,6 @@ public:
TStrokeProp *clone(const TStroke *stroke) const override;
void draw(const TVectorRenderData &rd) override;
- void draw(TFlash &flash) override;
};
//=============================================================================
@@ -81,7 +78,6 @@ public:
TStrokeProp *clone(const TStroke *stroke) const override;
void draw(const TVectorRenderData &rd) override;
- void draw(TFlash &flash) override;
};
//=============================================================================
@@ -99,7 +95,6 @@ public:
TStrokeProp *clone(const TStroke *stroke) const override;
void draw(const TVectorRenderData &rd) override;
- void draw(TFlash &flash) override;
};
//=============================================================================
diff --git a/toonz/sources/include/tsweepboundary.h b/toonz/sources/include/tsweepboundary.h
index 01f18796c..f21ad6136 100644
--- a/toonz/sources/include/tsweepboundary.h
+++ b/toonz/sources/include/tsweepboundary.h
@@ -6,7 +6,6 @@
#include <vector>
//#include "tstroke.h"
//#include "tcurves.h"
-//#include "tflash.h"
// bool computeSweepBoundary( const std::vector<TStroke*> &strokes,
// std::vector<
diff --git a/toonz/sources/stdfx/iwa_particlesengine.cpp b/toonz/sources/stdfx/iwa_particlesengine.cpp
index 48e1b3832..b508dafad 100644
--- a/toonz/sources/stdfx/iwa_particlesengine.cpp
+++ b/toonz/sources/stdfx/iwa_particlesengine.cpp
@@ -9,7 +9,6 @@
#include "tsystem.h"
#include "timagecache.h"
#include "tconvert.h"
-#include "tflash.h"
#include "trasterimage.h"
@@ -503,7 +502,6 @@ void Iwa_Particles_Engine::normalize_values(struct particles_values &values,
/*-----------------------------------------------------------------*/
void Iwa_Particles_Engine::render_particles(
- TFlash *flash, /*- 0 が入ってくる -*/
TTile *tile, /*- 結果を格納するTile -*/
std::vector<TRasterFxPort *> part_ports, /*- テクスチャ素材画像のポート -*/
const TRenderSettings &ri,
@@ -824,7 +822,7 @@ void Iwa_Particles_Engine::render_particles(
part.lifetime <=
part.genlifetime) // This last... shouldn't always be?
{
- do_render(flash, &part, tile, part_ports, porttiles, ri, p_size,
+ do_render(&part, tile, part_ports, porttiles, ri, p_size,
p_offset, last_frame[part.level], partLevel, values,
opacity_range, dist_frame, partScales, &baseImgTile);
}
@@ -842,7 +840,7 @@ void Iwa_Particles_Engine::render_particles(
part.lifetime > 0 &&
part.lifetime <= part.genlifetime) // Same here..?
{
- do_render(flash, &part, tile, part_ports, porttiles, ri, p_size,
+ do_render(&part, tile, part_ports, porttiles, ri, p_size,
p_offset, last_frame[part.level], partLevel, values,
opacity_range, dist_frame, partScales, &baseImgTile);
}
@@ -869,7 +867,7 @@ void Iwa_Particles_Engine::render_particles(
-----------------------------------------------------------------*/
void Iwa_Particles_Engine::do_render(
- TFlash *flash, Iwa_Particle *part, TTile *tile,
+ Iwa_Particle *part, TTile *tile,
std::vector<TRasterFxPort *> part_ports, std::map<int, TTile *> porttiles,
const TRenderSettings &ri, TDimension &p_size, TPointD &p_offset,
int lastframe, std::vector<TLevelP> partLevel,
@@ -966,32 +964,6 @@ void Iwa_Particles_Engine::do_render(
/*- 縮小済みのParticleのサイズ -*/
partResolution = TDimensionD(tceil(bbox.getLx()), tceil(bbox.getLy()));
- if (flash) {
- if (!partLevel[part->level]->frame(ndx)) {
- if (part_ports[0]->isConnected()) {
- TTile auxTile;
- /*- テクスチャは出力タイルと同じbpcにする -*/
- (*part_ports[0])
- ->allocateAndCompute(auxTile, p_offset, p_size, tile->getRaster(),
- ndx, ri);
- partLevel[part->level]->setFrame(ndx,
- TRasterImageP(auxTile.getRaster()));
- }
- }
-
- flash->pushMatrix();
-
- const TAffine aff;
-
- flash->multMatrix(scaleM * aff.place(0, 0, part->x, part->y));
-
- {
- TColorFader cf(TPixel32::Red, .5);
- flash->draw(partLevel[part->level]->frame(ndx), &cf);
- }
-
- flash->popMatrix();
- } else {
TRasterP ras;
std::string alias;
@@ -1098,7 +1070,7 @@ void Iwa_Particles_Engine::do_render(
else {
throw TException("ParticlesFx: unsupported Pixel Type");
}
- }
+
}
/*-----------------------------------------------------------------*/
diff --git a/toonz/sources/stdfx/iwa_particlesengine.h b/toonz/sources/stdfx/iwa_particlesengine.h
index c8e2e802a..6dac76199 100644
--- a/toonz/sources/stdfx/iwa_particlesengine.h
+++ b/toonz/sources/stdfx/iwa_particlesengine.h
@@ -79,13 +79,13 @@ public:
const TRenderSettings &ri);
void render_particles(
- TFlash *flash, TTile *tile, std::vector<TRasterFxPort *> part_ports,
+ TTile *tile, std::vector<TRasterFxPort *> part_ports,
const TRenderSettings &ri, TDimension &p_size, TPointD &p_offset,
std::map<int, TRasterFxPort *> ctrl_ports, std::vector<TLevelP> partLevel,
float dpi, int curr_frame, int shrink, double startx, double starty,
double endx, double endy, std::vector<int> lastframe, unsigned long fxId);
- void do_render(TFlash *flash, Iwa_Particle *part, TTile *tile,
+ void do_render(Iwa_Particle *part, TTile *tile,
std::vector<TRasterFxPort *> part_ports,
std::map<int, TTile *> porttiles, const TRenderSettings &ri,
TDimension &p_size, TPointD &p_offset, int lastframe,
diff --git a/toonz/sources/stdfx/iwa_particlesfx.cpp b/toonz/sources/stdfx/iwa_particlesfx.cpp
index c217ed059..ea5a5634e 100644
--- a/toonz/sources/stdfx/iwa_particlesfx.cpp
+++ b/toonz/sources/stdfx/iwa_particlesfx.cpp
@@ -9,7 +9,6 @@
#include "tpalette.h"
#include "tvectorimage.h"
#include "tvectorrenderdata.h"
-#include "tflash.h"
#include "texception.h"
#include "trasterimage.h"
#include "drawutil.h"
@@ -549,13 +548,11 @@ void Iwa_TiledParticlesFx::doCompute(TTile &tile, double frame,
TTile tileIn;
if (TRaster32P raster32 = tile.getRaster()) {
- TFlash *flash = 0;
- myEngine.render_particles(flash, &tile, part_ports, ri, p_size, p_offset,
+ myEngine.render_particles(&tile, part_ports, ri, p_size, p_offset,
ctrl_ports, partLevel, 1, (int)frame, 1, 0, 0, 0,
0, lastframe, getIdentifier());
} else if (TRaster64P raster64 = tile.getRaster()) {
- TFlash *flash = 0;
- myEngine.render_particles(flash, &tile, part_ports, ri, p_size, p_offset,
+ myEngine.render_particles(&tile, part_ports, ri, p_size, p_offset,
ctrl_ports, partLevel, 1, (int)frame, 1, 0, 0, 0,
0, lastframe, getIdentifier());
} else
@@ -564,13 +561,6 @@ void Iwa_TiledParticlesFx::doCompute(TTile &tile, double frame,
//------------------------------------------------------------------
-void Iwa_TiledParticlesFx::compute(TFlash &flash, int frame) {
- // Particles is currently disabled in Flash...
- return;
-}
-
-//------------------------------------------------------------------
-
void Iwa_TiledParticlesFx::compatibilityTranslatePort(int major, int minor,
std::string &portName) {
VersionNumber version(major, minor);
diff --git a/toonz/sources/stdfx/iwa_particlesfx.h b/toonz/sources/stdfx/iwa_particlesfx.h
index ee46c1f60..026ad8dea 100644
--- a/toonz/sources/stdfx/iwa_particlesfx.h
+++ b/toonz/sources/stdfx/iwa_particlesfx.h
@@ -162,7 +162,6 @@ public:
void doDryCompute(TRectD &rect, double frame,
const TRenderSettings &info) override;
void doCompute(TTile &tile, double frame, const TRenderSettings &ri) override;
- void compute(TFlash &flash, int frame) override;
void getParamUIs(TParamUIConcept *&concepts, int &length) override;
diff --git a/toonz/sources/stdfx/particlesengine.cpp b/toonz/sources/stdfx/particlesengine.cpp
index 636c79a32..c7445b2c0 100644
--- a/toonz/sources/stdfx/particlesengine.cpp
+++ b/toonz/sources/stdfx/particlesengine.cpp
@@ -11,7 +11,6 @@
#include "tsystem.h"
#include "timagecache.h"
#include "tconvert.h"
-#include "tflash.h"
#include "trasterimage.h"
@@ -411,7 +410,7 @@ void Particles_Engine::normalize_values(struct particles_values &values,
/*-----------------------------------------------------------------*/
void Particles_Engine::render_particles(
- TFlash *flash, TTile *tile, std::vector<TRasterFxPort *> part_ports,
+ TTile *tile, std::vector<TRasterFxPort *> part_ports,
const TRenderSettings &ri, TDimension &p_size, TPointD &p_offset,
std::map<int, TRasterFxPort *> ctrl_ports, std::vector<TLevelP> partLevel,
float dpi, int curr_frame, int shrink, double startx, double starty,
@@ -621,7 +620,7 @@ void Particles_Engine::render_particles(
part.lifetime <=
part.genlifetime) // This last... shouldn't always be?
{
- do_render(flash, &part, tile, part_ports, porttiles, ri, p_size,
+ do_render(&part, tile, part_ports, porttiles, ri, p_size,
p_offset, last_frame[part.level], partLevel, values,
opacity_range, dist_frame, partScales);
}
@@ -633,7 +632,7 @@ void Particles_Engine::render_particles(
if (dist_frame <= part.trail && part.scale && part.lifetime > 0 &&
part.lifetime <= part.genlifetime) // Same here..?
{
- do_render(flash, &part, tile, part_ports, porttiles, ri, p_size,
+ do_render(&part, tile, part_ports, porttiles, ri, p_size,
p_offset, last_frame[part.level], partLevel, values,
opacity_range, dist_frame, partScales);
}
@@ -649,7 +648,7 @@ void Particles_Engine::render_particles(
//-----------------------------------------------------------------
/*- render_particles から呼ばれる。粒子の数だけ繰り返し -*/
void Particles_Engine::do_render(
- TFlash *flash, Particle *part, TTile *tile,
+ Particle *part, TTile *tile,
std::vector<TRasterFxPort *> part_ports, std::map<int, TTile *> porttiles,
const TRenderSettings &ri, TDimension &p_size, TPointD &p_offset,
int lastframe, std::vector<TLevelP> partLevel,
@@ -711,35 +710,6 @@ void Particles_Engine::do_render(
/*- 縮小済みのParticleのサイズ -*/
partResolution = TDimensionD(tceil(bbox.getLx()), tceil(bbox.getLy()));
- if (flash) {
- if (!partLevel[part->level]->frame(ndx)) {
- if (part_ports[0]->isConnected()) {
- TTile auxTile;
- TRaster32P tmp;
- tmp = TRaster32P(p_size);
- (*part_ports[0])
- ->allocateAndCompute(auxTile, p_offset, p_size, tmp, ndx, ri);
- partLevel[part->level]->setFrame(ndx,
- TRasterImageP(auxTile.getRaster()));
- }
- }
-
- flash->pushMatrix();
-
- const TAffine aff;
-
- flash->multMatrix(scaleM * aff.place(0, 0, part->x, part->y));
-
- // if(curr_opacity!=1.0 || part->gencol.fadecol || part->fincol.fadecol ||
- // part->foutcol.fadecol)
- {
- TColorFader cf(TPixel32::Red, .5);
- flash->draw(partLevel[part->level]->frame(ndx), &cf);
- }
- // flash->draw(partLevel->frame(ndx), 0);
-
- flash->popMatrix();
- } else {
TRasterP ras;
std::string alias;
@@ -837,7 +807,7 @@ void Particles_Engine::do_render(
TRop::over(tileRas, rfinalpart, M);
else
throw TException("ParticlesFx: unsupported Pixel Type");
- }
+
}
/*-----------------------------------------------------------------*/
diff --git a/toonz/sources/stdfx/particlesengine.h b/toonz/sources/stdfx/particlesengine.h
index 955607c93..88b721a90 100644
--- a/toonz/sources/stdfx/particlesengine.h
+++ b/toonz/sources/stdfx/particlesengine.h
@@ -34,13 +34,13 @@ public:
const TRenderSettings &ri);
void render_particles(
- TFlash *flash, TTile *tile, std::vector<TRasterFxPort *> part_ports,
+ TTile *tile, std::vector<TRasterFxPort *> part_ports,
const TRenderSettings &ri, TDimension &p_size, TPointD &p_offset,
std::map<int, TRasterFxPort *> ctrl_ports, std::vector<TLevelP> partLevel,
float dpi, int curr_frame, int shrink, double startx, double starty,
double endx, double endy, std::vector<int> lastframe, unsigned long fxId);
- void do_render(TFlash *flash, Particle *part, TTile *tile,
+ void do_render(Particle *part, TTile *tile,
std::vector<TRasterFxPort *> part_ports,
std::map<int, TTile *> porttiles, const TRenderSettings &ri,
TDimension &p_size, TPointD &p_offset, int lastframe,
diff --git a/toonz/sources/stdfx/particlesfx.cpp b/toonz/sources/stdfx/particlesfx.cpp
index bcd8a88a7..3cb9d983e 100644
--- a/toonz/sources/stdfx/particlesfx.cpp
+++ b/toonz/sources/stdfx/particlesfx.cpp
@@ -6,7 +6,6 @@
#include "tpalette.h"
#include "tvectorimage.h"
#include "tvectorrenderdata.h"
-#include "tflash.h"
#include "texception.h"
#include "trasterimage.h"
#include "drawutil.h"
@@ -487,13 +486,11 @@ void ParticlesFx::doCompute(TTile &tile, double frame,
TTile tileIn;
if (TRaster32P raster32 = tile.getRaster()) {
- TFlash *flash = 0;
- myEngine.render_particles(flash, &tile, part_ports, ri, p_size, p_offset,
+ myEngine.render_particles(&tile, part_ports, ri, p_size, p_offset,
ctrl_ports, partLevel, 1, (int)frame, 1, 0, 0, 0,
0, lastframe, getIdentifier());
} else if (TRaster64P raster64 = tile.getRaster()) {
- TFlash *flash = 0;
- myEngine.render_particles(flash, &tile, part_ports, ri, p_size, p_offset,
+ myEngine.render_particles(&tile, part_ports, ri, p_size, p_offset,
ctrl_ports, partLevel, 1, (int)frame, 1, 0, 0, 0,
0, lastframe, getIdentifier());
} else
@@ -502,13 +499,6 @@ void ParticlesFx::doCompute(TTile &tile, double frame,
//------------------------------------------------------------------
-void ParticlesFx::compute(TFlash &flash, int frame) {
- // Particles is currently disabled in Flash...
- return;
-}
-
-//------------------------------------------------------------------
-
void ParticlesFx::compatibilityTranslatePort(int major, int minor,
std::string &portName) {
VersionNumber version(major, minor);
diff --git a/toonz/sources/stdfx/particlesfx.h b/toonz/sources/stdfx/particlesfx.h
index 3a45aabeb..fd34e0750 100644
--- a/toonz/sources/stdfx/particlesfx.h
+++ b/toonz/sources/stdfx/particlesfx.h
@@ -132,7 +132,6 @@ public:
void doDryCompute(TRectD &rect, double frame,
const TRenderSettings &info) override;
void doCompute(TTile &tile, double frame, const TRenderSettings &ri) override;
- void compute(TFlash &flash, int frame) override;
void getParamUIs(TParamUIConcept *&concepts, int &length) override;
diff --git a/toonz/sources/tcomposer/stub.cpp b/toonz/sources/tcomposer/stub.cpp
index 7552072c5..5aba9f4b6 100644
--- a/toonz/sources/tcomposer/stub.cpp
+++ b/toonz/sources/tcomposer/stub.cpp
@@ -89,10 +89,6 @@ TWriterInfo *getRasterMovieInfo(string, bool) { return 0; }
bool getFramesMovieInfo(struct TFramesMovieInfo &, bool) { return true; }
-TFlashMovieInfo *getFlashMovieInfo(bool) { return 0; }
-
-TFlashMovieInfo *getScrMovieInfo(bool) { return 0; }
-
//=========================================================
// makeScreenSaver
//---------------------------------------------------------
diff --git a/toonz/sources/tcomposer/tcomposer.cpp b/toonz/sources/tcomposer/tcomposer.cpp
index 48eba0599..fea1b5e37 100644
--- a/toonz/sources/tcomposer/tcomposer.cpp
+++ b/toonz/sources/tcomposer/tcomposer.cpp
@@ -36,7 +36,6 @@
// TnzImage includes
#include "timage_io.h"
#include "tnzimage.h"
-#include "tflash.h"
#ifdef _WIN32
#include "avicodecrestrictions.h"
diff --git a/toonz/sources/tnzcore/CMakeLists.txt b/toonz/sources/tnzcore/CMakeLists.txt
index d637cd263..02c1a0eef 100644
--- a/toonz/sources/tnzcore/CMakeLists.txt
+++ b/toonz/sources/tnzcore/CMakeLists.txt
@@ -84,7 +84,6 @@ set(HEADERS ${MOC_HEADERS}
../include/tcodec.h
../include/trasterimage.h
../include/tcolorstyles.h
- ../include/tflash.h
../include/tfont.h
../include/tinbetween.h
../include/tofflinegl.h
@@ -179,7 +178,6 @@ set(SOURCES
../common/trasterimage/trasterimage.cpp
../common/tvrender/tcolorstyles.cpp
../common/tvrender/tellipticbrush.cpp
- ../common/tvrender/tflash.cpp
../common/tvrender/qtofflinegl.cpp
../common/tvrender/tglcurves.cpp
../common/tvrender/tglregions.cpp
diff --git a/toonz/sources/toonz/CMakeLists.txt b/toonz/sources/toonz/CMakeLists.txt
index 2b8ab2e2e..0e8c82eeb 100644
--- a/toonz/sources/toonz/CMakeLists.txt
+++ b/toonz/sources/toonz/CMakeLists.txt
@@ -160,9 +160,6 @@ set(HEADERS
keyframemover.h
keyframeselection.h
kis_tablet_support_win8.h
- linetestcapturepane.h
- linetestpane.h
- linetestviewer.h
menubarcommandids.h
moviegenerator.h
scanlist.h
@@ -258,9 +255,6 @@ set(SOURCES
layerheaderpanel.cpp
levelcreatepopup.cpp
levelsettingspopup.cpp
- linetestcapturepane.cpp
- linetestpane.cpp
- linetestviewer.cpp
lipsyncpopup.cpp
magpiefileimportpopup.cpp
outputsettingspopup.cpp
diff --git a/toonz/sources/toonz/exportpanel.cpp b/toonz/sources/toonz/exportpanel.cpp
index b2872e40e..aedebeb9b 100644
--- a/toonz/sources/toonz/exportpanel.cpp
+++ b/toonz/sources/toonz/exportpanel.cpp
@@ -25,13 +25,17 @@
#include "toonz/tscenehandle.h"
#include "toonz/tcolumnhandle.h"
#include "toonz/txsheethandle.h"
+#include "toonz/txshlevelcolumn.h"
+#include "toonz/txshchildlevel.h"
#include "toonz/screensavermaker.h"
+#include "toonz/txshcell.h"
#include "toonz/toonzscene.h"
#include "toonz/tcamera.h"
#include "toonz/sceneproperties.h"
#include "toonz/onionskinmask.h"
#include "toonz/preferences.h"
#include "toutputproperties.h"
+#include "toonz/txshleveltypes.h"
// TnzBase includes
#include "trasterfx.h"
@@ -67,6 +71,45 @@
#include <QMimeData>
#include <QLabel>
+TEnv::IntVar ExportUseMarkers("ExportUseMarkers", 1);
+
+bool checkForMeshColumns(TXsheet *xsh,
+ std::vector<TXshChildLevel *> &childLevels) {
+ bool foundMesh = false;
+ int count = xsh->getColumnCount();
+ for (int c = 0; c < count; c++) {
+ int r0, r1;
+ int n = xsh->getCellRange(c, r0, r1);
+ if (n > 0) {
+ bool changed = false;
+ std::vector<TXshCell> cells(n);
+ xsh->getCells(r0, c, n, &cells[0]);
+ for (int i = 0; i < n; i++) {
+ TXshCell currCell = cells[i];
+ if (!cells[i].isEmpty() &&
+ cells[i].m_level->getType() == MESH_XSHLEVEL) {
+ return true;
+ }
+ // check the sub xsheets too
+ if (!cells[i].isEmpty() &&
+ cells[i].m_level->getType() == CHILD_XSHLEVEL) {
+ TXshChildLevel *level = cells[i].m_level->getChildLevel();
+ // make sure we haven't already checked the level
+ if (level &&
+ std::find(childLevels.begin(), childLevels.end(), level) ==
+ childLevels.end()) {
+ childLevels.push_back(level);
+ TXsheet *subXsh = level->getXsheet();
+ foundMesh = checkForMeshColumns(subXsh, childLevels);
+ }
+ }
+ }
+ }
+ }
+
+ return foundMesh;
+}
+
//=============================================================================
// RenderLocker
//-----------------------------------------------------------------------------
@@ -110,6 +153,12 @@ void RenderController::setMovieExt(string ext) { m_movieExt = ext; }
//-----------------------------------------------------------------------------
bool RenderController::addScene(MovieGenerator &g, ToonzScene *scene) {
+ bool hasMesh = false;
+ std::vector<TXshChildLevel *> childLevels;
+ hasMesh = checkForMeshColumns(scene->getXsheet(), childLevels);
+ TXsheet *xsh = scene->getXsheet();
+ if (hasMesh) return false;
+
int frameCount = scene->getFrameCount();
if (frameCount < 0) return false;
int r0 = 0, r1 = frameCount - 1, step = 0;
@@ -122,7 +171,9 @@ bool RenderController::addScene(MovieGenerator &g, ToonzScene *scene) {
}
}
if (r1 < r0) return false;
- g.setBackgroundColor(scene->getProperties()->getBgColor());
+ TPixel color = scene->getProperties()->getBgColor();
+ if (m_movieExt == "mp4" || m_movieExt == "webm") color.m = 255;
+ g.setBackgroundColor(color);
g.addScene(*scene, r0, r1);
return true;
}
@@ -178,8 +229,14 @@ void RenderController::myCancel() { m_cancelled = true; }
//-----------------------------------------------------------------------------
void RenderController::generateMovie(TFilePath outPath, bool emitSignal) {
- if (outPath == TFilePath()) return;
- if (m_clipList.empty()) return;
+ if (outPath == TFilePath()) {
+ DVGui::warning(tr("Please specify an file name."));
+ return;
+ }
+ if (m_clipList.empty()) {
+ DVGui::warning(tr("Drag a scene into the box to export a scene."));
+ return;
+ }
// verifico che il "generatore" sia libero.
if (m_rendering) return;
@@ -190,7 +247,10 @@ void RenderController::generateMovie(TFilePath outPath, bool emitSignal) {
if (outPath.getName() == "") outPath = outPath.withName("untitled");
int sceneCount = (int)m_clipList.size();
- if (sceneCount < 1) return; // non dovrebbe succedere mai
+ if (sceneCount < 1) {
+ DVGui::warning(tr("Drag a scene into the box to export a scene."));
+ return;
+ }
// Risoluzione e Settings
TDimension resolution(0, 0);
@@ -297,6 +357,14 @@ you want to do?";*/
if (sceneFrames == 0) continue;
ToonzScene scene;
scene.load(fp);
+ std::vector<TXshChildLevel *> childLevels;
+ if (checkForMeshColumns(scene.getXsheet(), childLevels)) {
+ QString text = tr("The %1 scene contains a plastic deformed level.\n"
+ "These levels can't be exported with this tool.")
+ .arg(QString::fromStdWString(fp.getLevelNameW()));
+ DVGui::warning(text);
+ continue;
+ }
addScene(movieGenerator, &scene);
}
@@ -560,6 +628,22 @@ QMenu *ClipListViewer::getContextMenu(QWidget *parent, int index) {
//-----------------------------------------------------------------------------
+void ClipListViewer::addCurrentScene() {
+ ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
+ std::vector<TXshChildLevel *> childLevels;
+ if (checkForMeshColumns(scene->getXsheet(), childLevels)) return;
+ if (!scene->isUntitled()) {
+ int j = getItemCount();
+ TFilePath fp(scene->decodeFilePath(scene->getScenePath()));
+ getController()->insertClipPath(j, fp);
+ updateContentSize();
+ getPanel()->update();
+ update();
+ }
+}
+
+//-----------------------------------------------------------------------------
+
void ClipListViewer::setDropInsertionPoint(const QPoint &pos) {
int old = m_dropInsertionPoint;
m_dropInsertionPoint = getItemCount();
@@ -745,7 +829,7 @@ ExportPanel::ExportPanel(QWidget *parent, Qt::WFlags flags)
m_saveInFileFld->setPath(QString::fromStdWString(scenePath.getWideString()));
QLabel *dirLabel = new QLabel(tr("Save in:"));
dirLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
- dirLabel->setFixedSize(55, m_saveInFileFld->height());
+ dirLabel->setFixedSize(65, m_saveInFileFld->height());
saveIn->addWidget(dirLabel);
saveIn->addWidget(m_saveInFileFld);
@@ -757,7 +841,7 @@ ExportPanel::ExportPanel(QWidget *parent, Qt::WFlags flags)
new DVGui::LineEdit(QString::fromStdWString(sceneName), settingsBox);
QLabel *nameLabel = new QLabel(tr("File Name:"));
nameLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
- nameLabel->setFixedSize(55, m_fileNameFld->height());
+ nameLabel->setFixedSize(65, m_fileNameFld->height());
fileNname->addWidget(nameLabel);
fileNname->addWidget(m_fileNameFld);
@@ -771,17 +855,18 @@ ExportPanel::ExportPanel(QWidget *parent, Qt::WFlags flags)
formats.sort();
m_fileFormat->addItems(formats);
- m_fileFormat->setMaximumHeight(DVGui::WidgetHeight);
+ m_fileFormat->setFixedHeight(DVGui::WidgetHeight + 2);
connect(m_fileFormat, SIGNAL(currentIndexChanged(const QString &)),
SLOT(onFormatChanged(const QString &)));
- m_fileFormat->setCurrentIndex(formats.indexOf("mov"));
+ // m_fileFormat->setCurrentIndex(formats.indexOf("mov"));
QPushButton *fileFormatButton = new QPushButton(QString(tr("Options")));
- fileFormatButton->setFixedSize(60, DVGui::WidgetHeight);
+ fileFormatButton->setMinimumWidth(75);
+ fileFormatButton->setFixedHeight(DVGui::WidgetHeight);
connect(fileFormatButton, SIGNAL(pressed()), this, SLOT(openSettingsPopup()));
QLabel *fileFormat = new QLabel(tr("File Format:"));
fileFormat->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
- fileFormat->setFixedSize(55, fileFormatButton->height());
+ fileFormat->setFixedSize(65, fileFormatButton->height());
fileFormatLayout->addWidget(fileFormat);
fileFormatLayout->addWidget(m_fileFormat);
@@ -790,7 +875,7 @@ ExportPanel::ExportPanel(QWidget *parent, Qt::WFlags flags)
// Use Marker checkbox
m_useMarker = new QCheckBox(tr("Use Markers"), settingsBox);
m_useMarker->setMinimumHeight(30);
- m_useMarker->setChecked(false);
+ m_useMarker->setChecked(ExportUseMarkers);
connect(m_useMarker, SIGNAL(toggled(bool)), this,
SLOT(onUseMarkerToggled(bool)));
@@ -832,6 +917,14 @@ ExportPanel::~ExportPanel() { saveExportSettings(); }
//-----------------------------------------------------------------------------
+void ExportPanel::showEvent(QShowEvent *) {
+ if (m_clipListViewer->getItemCount() == 0) {
+ m_clipListViewer->addCurrentScene();
+ }
+}
+
+//-----------------------------------------------------------------------------
+
void ExportPanel::loadExportSettings() {
TFilePath exportPath = TEnv::getConfigDir() + "exportsettings.txt";
if (!TSystem::doesExistFileOrLevel(exportPath)) return;
@@ -908,6 +1001,11 @@ void ExportPanel::generateMovie() {
void ExportPanel::onUseMarkerToggled(bool toggled) {
RenderController::instance()->setUseMarkers(toggled);
+ if (toggled) {
+ ExportUseMarkers = 1;
+ } else {
+ ExportUseMarkers = 0;
+ }
}
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonz/exportpanel.h b/toonz/sources/toonz/exportpanel.h
index 552fa99fb..5fd971f20 100644
--- a/toonz/sources/toonz/exportpanel.h
+++ b/toonz/sources/toonz/exportpanel.h
@@ -65,6 +65,7 @@ public:
void startDragDrop() override;
void draw(QPainter &) override;
+ void addCurrentScene();
protected:
void dragEnterEvent(QDragEnterEvent *event) override;
@@ -104,6 +105,9 @@ public slots:
void onSceneSwitched();
void onFormatChanged(const QString &);
void openSettingsPopup();
+
+protected:
+ void showEvent(QShowEvent *) override;
};
class RenderController final : public QObject,
diff --git a/toonz/sources/toonz/filebrowsermodel.cpp b/toonz/sources/toonz/filebrowsermodel.cpp
index 1021323c6..667fc503a 100644
--- a/toonz/sources/toonz/filebrowsermodel.cpp
+++ b/toonz/sources/toonz/filebrowsermodel.cpp
@@ -29,10 +29,6 @@
#include <Cocoa/Cocoa.h>
#endif
-#ifdef LINETEST
-#include "tnzcamera.h"
-#endif
-
namespace {
TFilePath getMyDocumentsPath() {
#ifdef _WIN32
@@ -778,11 +774,6 @@ void DvDirModelProjectNode::makeCurrent() {
TFilePath projectPath = getProjectPath();
if (!IoCmd::saveSceneIfNeeded(QObject::tr("Change project"))) return;
-#ifdef LINETEST
- TnzCamera *camera = TnzCamera::instance();
- if (camera->isCameraConnected()) camera->cameraDisconnect();
-#endif
-
pm->setCurrentProjectPath(projectPath);
IoCmd::newScene();
}
diff --git a/toonz/sources/toonz/licensecontroller.h b/toonz/sources/toonz/licensecontroller.h
deleted file mode 100644
index 2b5d70d0f..000000000
--- a/toonz/sources/toonz/licensecontroller.h
+++ /dev/null
@@ -1,145 +0,0 @@
-#pragma once
-
-#ifndef LICENSECONTROLLER_INCLUDED
-#define LICENSECONTROLLER_INCLUDED
-
-#if QT_VERSION >= 0x050000
-#include <QNetworkAccessManager>
-#else
-#include <QHttp>
-#endif
-#include <QLabel>
-#include "licensegui.h"
-#include "toonzqt/dvdialog.h"
-#include <string>
-
-//---Per il controllo della sentinella
-#include "tfilepath_io.h"
-#include "tfilepath.h"
-#include <tconvert.h>
-#include "tenv.h"
-#include "tsystem.h"
-//----
-
-// Anti-hacker
-#define decryptLicense update
-#define License VirtualEditorObject
-
-namespace License {
-
-enum ActivateStatus {
- OK, // attivazione completata con successo
- BAD_ACTIVATION_CODE, // codice di attivazione sbagliato (checksum non ok)
- CONNECTION_ERROR, // problemi di rete
- ACTIVATION_REFUSED // il server ha rifiutato l'attivazione.
-};
-
-// restituisce il primo macAddress valido
-std::string getFirstValidMacAddress();
-
-// Restituisce tutti i mac address valido delle interfacce di rete della
-// macchine corrente
-void getAllValidMacAddresses(std::vector<std::string> &addresses);
-// restituisce il machineCode della iesima interfaccia di rete della macchina
-// corrente
-// Il machine code e' costituito dagli ultimi 8 caratteri del macAdress
-std::string getCodeFromMacAddress(std::string macAddress);
-
-// restituisce la licenza corrente (installata sulla macchina)
-std::string getInstalledLicense();
-
-enum LicenseType {
- INVALID_LICENSE = 0,
- STUDENT_LICENSE = 1,
- STANDARD_LICENSE = 2,
- PRO_LICENSE = 3,
- MANGA_LICENSE = 4,
- STORYPLANNER_LICENSE = 5,
- STORYPLANNERPRO_LICENSE = 6,
- LINETEST_LICENSE = 7
-};
-
-// ritorna true sse code e' una licenza AND il mac e' giusto AND
-// (la lic e' permanente OR non e' ancorascaduta)
-// bool isValidLicense(std::string code);
-LicenseType checkLicense(std::string code = "");
-
-// ritorna il puntatore ad un intero se la licenza e' valida, altrimenti ritorna
-// 0
-// int* checkLicense();
-// ritorna true sse code e' una licenza temporanea
-bool isTemporaryLicense(std::string code);
-
-// se code e' una licenza temporanea ritorna il numero di giorni rimasti (se
-// days<=0 licenza scaduta)
-// negli altri casi ritorna 0
-int getDaysLeft(std::string code);
-
-// ritorna true sse code "sembra" un codice di attivazione (checksum ok).
-// n.b. NON controlla che il codice sia valido (cosa che richiede una
-// connessione al nostr server)
-bool isActivationCode(std::string code);
-
-// prova ad attivare la licenza con il codice di attivazione 'activationCode'.
-// se e' un buon codice di attivazione si connette al nostro server fornendogli
-// il codice di attivazione e il machine code. riceve una licenza e la installa
-// (chiamando setLicense())
-ActivateStatus activate(std::string activationCode,
- LicenseWizard *licenseWizard);
-
-// se isValidLicense(license) installa license e ritorna true
-bool setLicense(std::string license);
-// scrive su disco il macAddress della macchina corrente
-bool writeMacAddress();
-// std::string decrypt(std::string code);
-std::string decryptLicense(std::string code);
-// aggiunge i caratteri di default alla licenza necessari per il decrypt;
-// Fatto per rendere la licenza digitata dall'utente piu' corta.
-std::string addDefaultChars(std::string code);
-
-// ritorna il fullpath del file di licenza
-TFilePath getLicenseFilePath();
-// ritorna il fullpath del file del macAddress
-TFilePath getMacAddressFilePath();
-
-// Restituisce la sentinella cryptata
-std::string readSentinelDate(std::string regKey);
-// Dando in input la sentinella(criptata) ritorna true se la data di
-// prima installazione(memorizzata nella sentinella) e' minore della data
-// corrente.
-bool isValidSentinel(std::string license);
-std::string createClsid(std::string fullMacAddress, char *licenseType);
-// Controlla se la licenza e' del tipo STORYPLANNERPRO
-bool isStoryPlannerPro();
-// Ritorna l'ultimo messaggio di errore
-// se non c'è stato alcun errore ritorna "no error"
-QString getLastError();
-} // namespace License
-
-class myHttp
-#if QT_VERSION < 0x050000
- : public QHttp
-#endif
-{
- Q_OBJECT
- bool m_httpRequestAborted;
- int m_httpGetId;
- LicenseWizard *m_licenseWizard;
-
-public:
- myHttp(const QString &requestToServer, LicenseWizard *licenseWizard);
-protected slots:
- void httpRequestStarted(int requestId) {}
-#if QT_VERSION >= 0x050000
- void httpRequestFinished(QNetworkReply *);
-#else
- void httpRequestFinished(int requestId, bool error);
- void readResponseHeader(const QHttpResponseHeader &responseHeader);
- void readyReadExec(const QHttpResponseHeader &head) {}
-#endif
- void slotAuthenticationRequired(const QString &hostName, quint16,
- QAuthenticator *authenticator);
- void httpStateChanged(int state);
-};
-
-#endif
diff --git a/toonz/sources/toonz/linetestcapturepane.cpp b/toonz/sources/toonz/linetestcapturepane.cpp
deleted file mode 100644
index 376b98b07..000000000
--- a/toonz/sources/toonz/linetestcapturepane.cpp
+++ /dev/null
@@ -1,1443 +0,0 @@
-
-
-#include "linetestcapturepane.h"
-#ifdef LINETEST
-#include "tapp.h"
-#include "menubarcommandids.h"
-#include "mainwindow.h"
-#include "tsystem.h"
-#include "tenv.h"
-#include "viewerdraw.h"
-#include "trasterimage.h"
-#include "timage_io.h"
-#include "tlevel_io.h"
-#include "tgl.h"
-#include "formatsettingspopups.h"
-#include "sceneviewer.h"
-#include "toonz/tstageobjecttree.h"
-#include "toonz/tscenehandle.h"
-#include "toonz/txsheethandle.h"
-#include "toonz/tframehandle.h"
-#include "toonz/tcolumnhandle.h"
-#include "toonz/txshleveltypes.h"
-#include "toonz/namebuilder.h"
-#include "toonz/levelset.h"
-#include "toonz/tcamera.h"
-#include "toonz/txshsimplelevel.h"
-#include "toonz/captureparameters.h"
-#include "toonz/sceneproperties.h"
-#include "toonz/txshlevelhandle.h"
-#include "toonz/stage2.h"
-#include "toonzqt/gutil.h"
-#include "toonzqt/tselectionhandle.h"
-#include "toonzqt/selection.h"
-#include "toonzqt/icongenerator.h"
-#include "toonzqt/imageutils.h"
-#include "tools/toolcommandids.h"
-
-#include <QFrame>
-#include <QGridLayout>
-#include <QPushButton>
-#include <QListWidget>
-#include <QAction>
-#include <QFileDialog>
-#include <QLabel>
-#include <QGroupBox>
-#include <QCheckBox>
-#include <QComboBox>
-#include <QSound>
-#include <QSplitter>
-
-//-----------------------------------------------------------------------------
-namespace {
-
-class ViewerZoomer final : public ImageUtils::ShortcutZoomer {
-public:
- ViewerZoomer(QWidget *parent) : ShortcutZoomer(parent) {}
- void zoom(bool zoomin, bool resetZoom) {
- if (resetZoom)
- ((LineTestImageViewer *)getWidget())->resetView();
- else
- ((LineTestImageViewer *)getWidget())->zoomQt(zoomin, resetZoom);
- }
- void fit() {
- //((LineTestViewer*)getWidget())->fitToCamera();
- }
- void setActualPixelSize() {
- //((LineTestViewer*)getWidget())->setActualPixelSize();
- }
-};
-
-} // namespace
-//-----------------------------------------------------------------------------
-
-ToggleCommandHandler capturePanelFieldGuideToggle(MI_CapturePanelFieldGuide,
- false);
-
-//=============================================================================
-// CaptureCommand
-//-----------------------------------------------------------------------------
-
-class CaptureCommand final : public MenuItemHandler {
-public:
- CaptureCommand() : MenuItemHandler(MI_Capture) {}
- void execute() {}
-} CaptureCommand;
-
-//=============================================================================
-// LineTestImageViewer
-//-----------------------------------------------------------------------------
-
-LineTestImageViewer::LineTestImageViewer(QWidget *parent)
- : QWidget(parent)
- , m_pos()
- , m_mouseButton()
- , m_viewAffine()
- , m_raster()
- , m_isPainting(false)
- , m_isOnionSkinActive(false)
- , m_isViewFrameActive(false) {
- m_viewAffine = getNormalZoomScale();
- bool ret = connect(this, SIGNAL(rasterChanged()), this, SLOT(update()));
- Q_ASSERT(ret);
- setMouseTracking(true);
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestImageViewer::setImage(TRasterP ras) {
- if (m_isPainting) return;
- m_raster = TRaster32P();
- m_raster = ras;
- emit rasterChanged();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestImageViewer::resetView() {
- m_viewAffine = getNormalZoomScale();
- update();
- emit onZoomChanged();
-}
-
-//-----------------------------------------------------------------------------
-
-TRasterP LineTestImageViewer::getCurrentImage() const {
- TApp *app = TApp::instance();
- int row = app->getCurrentFrame()->getFrameIndex();
- int column = app->getCurrentColumn()->getColumnIndex();
-
- TXshCell cell = app->getCurrentXsheet()->getXsheet()->getCell(row, column);
- if (cell.isEmpty()) return TRasterP();
-
- TXshSimpleLevel *sl = cell.getSimpleLevel();
- if (!sl) return TRasterP();
-
- TRasterImageP rasImage = sl->getFrame(cell.m_frameId, false);
- if (!rasImage) return TRasterP();
-
- return rasImage->getRaster();
-}
-
-//-----------------------------------------------------------------------------
-
-TDimension LineTestImageViewer::getImageSize() const {
- ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
- CaptureParameters *p = scene->getProperties()->getCaptureParameters();
- return p->getResolution();
-}
-
-//-----------------------------------------------------------------------------
-
-TAffine LineTestImageViewer::getNormalZoomScale() {
- TApp *app = TApp::instance();
- const double inch = Stage::inch;
- TCamera *camera = app->getCurrentScene()->getScene()->getCurrentCamera();
- double size;
- int res;
- if (camera->isXPrevalence()) {
- size = camera->getSize().lx;
- res = camera->getRes().lx;
- } else {
- size = camera->getSize().ly;
- res = camera->getRes().ly;
- }
-
- TScale cameraScale(inch * size / res);
- return cameraScale.inv();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestImageViewer::mouseMoveEvent(QMouseEvent *event) {
- QPoint curPos = event->pos();
- if (m_mouseButton == Qt::MidButton || m_mouseButton == Qt::LeftButton) {
- // panning
- panQt(curPos - m_pos);
- m_pos = curPos;
- return;
- }
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestImageViewer::mousePressEvent(QMouseEvent *event) {
- m_pos = event->pos();
- m_mouseButton = event->button();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestImageViewer::mouseReleaseEvent(QMouseEvent *) {
- m_pos = QPoint(0, 0);
- m_mouseButton = Qt::NoButton;
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestImageViewer::enterEvent(QEvent *) { setFocus(); }
-
-//-----------------------------------------------------------------------------
-
-void LineTestImageViewer::keyPressEvent(QKeyEvent *event) {
- ViewerZoomer(this).exec(event);
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestImageViewer::contextMenuEvent(QContextMenuEvent *event) {
- QMenu *menu = new QMenu(this);
- QAction *act = menu->addAction("Reset View");
- act->setShortcut(
- QKeySequence(CommandManager::instance()->getKeyFromId(T_ZoomReset)));
- connect(act, SIGNAL(triggered()), this, SLOT(resetView()));
- menu->exec(event->globalPos());
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestImageViewer::wheelEvent(QWheelEvent *e) {
- if (e->orientation() == Qt::Horizontal) return;
- int delta = e->delta() > 0 ? 120 : -120;
- zoomQt(e->pos(), exp(0.001 * delta));
-
- emit onZoomChanged();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestImageViewer::panQt(const QPoint &delta) {
- if (delta == QPoint()) return;
- m_viewAffine = TTranslation(delta.x(), -delta.y()) * m_viewAffine;
- update();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestImageViewer::zoomQt(const QPoint &center, double factor) {
- if (factor == 1.0) return;
- TPointD delta(center.x() - width() * 0.5, -center.y() + height() * 0.5);
- double scale2 = fabs(m_viewAffine.det());
- if ((scale2 < 100000 || factor < 1) && (scale2 > 0.001 * 0.05 || factor > 1))
- m_viewAffine = TTranslation(delta) * TScale(factor) * TTranslation(-delta) *
- m_viewAffine;
- update();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestImageViewer::zoomQt(bool forward, bool reset) {
- int i;
- double normalZoom = sqrt(getNormalZoomScale().det());
- double scale2 = m_viewAffine.det();
- if (reset ||
- ((scale2 < 256 || !forward) && (scale2 > 0.001 * 0.05 || forward))) {
- double oldZoomScale = sqrt(scale2);
- double zoomScale = reset ? 1 : ImageUtils::getQuantizedZoomFactor(
- oldZoomScale / normalZoom, forward);
- m_viewAffine = TScale(zoomScale * normalZoom / oldZoomScale) * m_viewAffine;
- }
- update();
- emit onZoomChanged();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestImageViewer::paintEvent(QPaintEvent *e) {
- QPainter p(this);
- p.save();
- p.setRenderHint(QPainter::SmoothPixmapTransform, false);
- QRect rect = visibleRegion().boundingRect();
- p.fillRect(rect, QBrush(Qt::white));
- if (!m_raster && !m_isViewFrameActive) return;
-
- m_isPainting = true;
-
- int w = width();
- int h = height();
-
- TAffine viewAffine = TTranslation(w * 0.5, h * 0.5) * m_viewAffine;
- QMatrix matrix(viewAffine.a11, viewAffine.a21, viewAffine.a12, viewAffine.a22,
- viewAffine.a13, viewAffine.a23);
-
- QMatrix flip(1, 0, 0, -1, 0, h);
- matrix *= flip;
-
- if (!m_isViewFrameActive && m_raster) {
- m_raster->lock();
- QImage image = rasterToQImage(m_raster, true, false);
-
- QPainter::CompositionMode mode = p.compositionMode();
- if (m_isOnionSkinActive) {
- p.setMatrix(matrix, true);
- // Devo mostrare l'immagine corrente
- TRasterP currentRas = getCurrentImage();
- if (currentRas) {
- QImage currentImage = rasterToQImage(currentRas, true, false);
- p.drawImage(-currentRas->getLx() * 0.5, -currentRas->getLy() * 0.5,
- currentImage);
-
- QImage mask(1, 1, QImage::Format_ARGB32_Premultiplied);
- mask.bits()[0] = 255;
- mask.bits()[1] = 0;
- mask.bits()[2] = 0;
- mask.bits()[3] = 255;
-
- p.setCompositionMode(QPainter::CompositionMode_Plus);
- p.drawImage(
- QRect(-currentRas->getLx() * 0.5, -currentRas->getLy() * 0.5,
- currentRas->getLx(), currentRas->getLy()),
- mask);
- p.setCompositionMode(QPainter::CompositionMode_Multiply);
- }
- currentRas = TRasterP();
- }
- int lx = m_raster->getLx();
- int ly = m_raster->getLy();
-
- TDimension dim = getImageSize();
- double xScaleFactor = (double)dim.lx / (double)lx;
- double yScaleFactor = (double)dim.ly / (double)ly;
- QMatrix scaledMatrix = matrix;
- p.setMatrix(scaledMatrix.scale(xScaleFactor, yScaleFactor));
-
- if (m_isOnionSkinActive) {
- QImage mask(1, 1, QImage::Format_ARGB32_Premultiplied);
- mask.bits()[0] = 0;
- mask.bits()[1] = 0;
- mask.bits()[2] = 255;
- mask.bits()[3] = 255;
-
- QPainter q(&image);
-
- q.setCompositionMode(QPainter::CompositionMode_SourceIn);
- q.drawImage(QRect(0, 0, lx, ly), mask);
- }
-
- p.drawImage(-lx * 0.5, -ly * 0.5, image);
-
- p.setCompositionMode(mode);
-
- m_raster->unlock();
- } else {
- p.setMatrix(matrix, true);
- // Devo mostrare l'immagine corrente
- TRasterP currentRas = getCurrentImage();
- if (currentRas) {
- QImage currentImage = rasterToQImage(currentRas, true, false);
- p.drawImage(-currentRas->getLx() * 0.5, -currentRas->getLy() * 0.5,
- currentImage);
- }
- currentRas = TRasterP();
- }
- m_isPainting = false;
-
- // Draw Camera and Field Guide
- TCamera *camera =
- TApp::instance()->getCurrentScene()->getScene()->getCurrentCamera();
- TDimension res = camera->getRes();
- QRectF cameraRect(-res.lx * 0.5, -res.ly * 0.5, res.lx, res.ly);
- p.setMatrix(matrix);
-
- if (capturePanelFieldGuideToggle.getStatus()) {
- TSceneProperties *sprop =
- TApp::instance()->getCurrentScene()->getScene()->getProperties();
- double f = 1;
- int n = sprop->getFieldGuideSize();
- if (n < 4) n = 4;
- double ar = sprop->getFieldGuideAspectRatio();
- double cameraAr = camera->getAspectRatio();
- TDimensionD cameraDpi = camera->getSize();
- double ux = (double)res.lx / cameraDpi.lx * 0.5;
- double uy = ux / ar;
- p.setPen(QColor(102, 102, 102));
- int i;
- for (i = -n; i <= n; i++) {
- QLineF hLine(QPointF(i * ux, -n * uy), QPointF(i * ux, n * uy));
- p.drawLine(hLine);
- QLineF vLine(QPointF(-n * ux, i * uy), QPointF(n * ux, i * uy));
- p.drawLine(vLine);
- }
- QLineF hLine(QPointF(-n * ux, -n * uy), QPointF(n * ux, n * uy));
- p.drawLine(hLine);
- QLineF vLine(QPointF(-n * ux, n * uy), QPointF(n * ux, -n * uy));
- p.drawLine(vLine);
-
- QMatrix m = matrix;
- p.setMatrix(m.scale(1, -1));
- for (i = 1; i <= n; i++) {
- QString s = QString::number(i);
- QPointF delta = 0.03 * QPointF(ux, uy);
- QPointF point = QPointF(0, i * uy) + delta;
- p.drawText(point, s);
- point = QPointF(0, -i * uy) + delta;
- p.drawText(point, s);
- point = QPointF(-i * ux, 0) + delta;
- p.drawText(point, s);
- point = QPointF(i * ux, 0) + delta;
- p.drawText(point, s);
- }
- p.setMatrix(matrix);
- }
-
- if (!TApp::instance()->getCurrentFrame()->isEditingLevel()) {
- p.setPen(QPen(Qt::red));
- p.drawRect(cameraRect);
- }
-
- if (TnzCamera::instance()->isFreezed()) {
- QMatrix m = matrix;
- p.setMatrix(m.scale(1, -1));
- p.setPen(QPen(Qt::red));
- p.drawText(QPointF(-21, 4.5), QString("FROZEN"));
- }
- p.restore();
-}
-
-//===================================================================
-// ChooseCameraDialog
-
-ChooseCameraDialog::ChooseCameraDialog(QList<QString> cameras)
- : Dialog(TApp::instance()->getMainWindow(), true, false)
- , m_cameraIndex(-1) {
- setWindowTitle("LineTest");
- bool ret = true;
- beginVLayout();
-
- QListWidget *listView = new QListWidget(this);
- int i;
- for (i = 0; i < cameras.size(); i++) listView->addItem(cameras.at(i));
- if (cameras.size() > 0) m_cameraIndex = 0;
- ret = ret && connect(listView, SIGNAL(currentRowChanged(int)), this,
- SLOT(onCurrentRowChanged(int)));
-
- addWidget(listView);
-
- endVLayout();
-
- QPushButton *okButton = new QPushButton(tr("Ok"), this);
- ret = ret &&
- connect(okButton, SIGNAL(clicked()), this, SLOT(onOkButtonPressed()));
- QPushButton *cancelButton = new QPushButton(tr("Cancel"), this);
- ret = ret && connect(cancelButton, SIGNAL(clicked()), this,
- SLOT(onCancelButtonPressed()));
-
- addButtonBarWidget(okButton, cancelButton);
-
- Q_ASSERT(ret);
-}
-
-//-------------------------------------------------------------------
-
-void ChooseCameraDialog::onCurrentRowChanged(int currentRow) {
- m_cameraIndex = currentRow;
-}
-
-//-------------------------------------------------------------------
-
-void ChooseCameraDialog::onOkButtonPressed() { close(); }
-
-//-------------------------------------------------------------------
-
-void ChooseCameraDialog::onCancelButtonPressed() {
- m_cameraIndex = -1;
- close();
-}
-
-//===================================================================
-// CaptureSettingsPopup
-
-CaptureSettingsPopup::CaptureSettingsPopup()
- : Dialog(TApp::instance()->getMainWindow())
- , m_defineDeviceButton(0)
- , m_useWhiteImage(0)
- , m_keepWhiteImage(0)
- , m_imageWidthLineEdit(0)
- , m_imageHeightLineEdit(0)
- , m_contrastField(0)
- , m_brightnessField(0) {
- setWindowTitle("Capture Settings");
- CaptureParameters *parameters = getCaptureParameters();
- bool ret = true;
- beginVLayout();
-
- m_defineDeviceButton = new QPushButton(tr("Define Device"), this);
- m_defineDeviceButton->setFixedHeight(19);
- ret = ret && connect(m_defineDeviceButton, SIGNAL(clicked()), this,
- SLOT(defineDevice()));
- addWidget(QString(tr("")), m_defineDeviceButton);
-
- QWidget *resolutionWidget = new QWidget(this);
- resolutionWidget->setMaximumHeight(DVGui::WidgetHeight);
- QHBoxLayout *resolutionLayout = new QHBoxLayout(resolutionWidget);
- resolutionLayout->setMargin(0);
- m_imageWidthLineEdit = new DVGui::IntLineEdit(
- resolutionWidget, parameters->getResolution().lx, 0, 10000);
- m_imageWidthLineEdit->setMaximumHeight(DVGui::WidgetHeight);
- ret = ret && connect(m_imageWidthLineEdit, SIGNAL(editingFinished()), this,
- SLOT(onImageWidthEditingFinished()));
- resolutionLayout->addWidget(m_imageWidthLineEdit);
- QLabel *vResLabel = new QLabel(tr("V Resolution"), resolutionWidget);
- vResLabel->setMaximumHeight(DVGui::WidgetHeight);
- resolutionLayout->addWidget(vResLabel);
- m_imageHeightLineEdit = new DVGui::IntLineEdit(
- resolutionWidget, parameters->getResolution().ly, 0, 10000);
- m_imageHeightLineEdit->setMaximumHeight(DVGui::WidgetHeight);
- ret = ret && connect(m_imageHeightLineEdit, SIGNAL(editingFinished()), this,
- SLOT(onImageHeightEditingFinished()));
- resolutionLayout->addWidget(m_imageHeightLineEdit);
- resolutionWidget->setLayout(resolutionLayout);
- addWidget(QString(tr("H Resolution")), resolutionWidget);
-
- QWidget *whiteImageWidget = new QWidget(this);
- whiteImageWidget->setMaximumHeight(DVGui::WidgetHeight);
- QHBoxLayout *whiteImageLayout = new QHBoxLayout(whiteImageWidget);
- whiteImageLayout->setMargin(0);
- m_useWhiteImage =
- new DVGui::CheckBox(tr("White Calibration"), whiteImageWidget);
- m_useWhiteImage->setMaximumHeight(DVGui::WidgetHeight);
- m_useWhiteImage->setChecked(parameters->isUseWhiteImage());
- ret = ret && connect(m_useWhiteImage, SIGNAL(stateChanged(int)), this,
- SLOT(onUseWhiteImageStateChanged(int)));
- whiteImageLayout->addWidget(m_useWhiteImage);
- m_keepWhiteImage = new QPushButton(tr("Capture"), m_useWhiteImage);
- ret = ret && connect(m_keepWhiteImage, SIGNAL(clicked()), this,
- SLOT(onKeepWhiteImage()));
- whiteImageLayout->addWidget(m_keepWhiteImage);
- whiteImageWidget->setLayout(whiteImageLayout);
- addWidget(QString(tr("")), whiteImageWidget);
-
- m_brightnessField = new DVGui::IntField(this);
- m_brightnessField->setRange(0, 100);
- m_brightnessField->setValue(parameters->getBrightness());
- m_brightnessField->setFixedHeight(DVGui::WidgetHeight);
- ret = ret && connect(m_brightnessField, SIGNAL(valueChanged(bool)), this,
- SLOT(onBrightnessChanged(bool)));
- addWidget(QString(tr("Brightness:")), m_brightnessField);
-
- m_contrastField = new DVGui::IntField(this);
- m_contrastField->setRange(-100, 100);
- m_contrastField->setValue(parameters->getContranst());
- m_contrastField->setFixedHeight(DVGui::WidgetHeight);
- ret = ret && connect(m_contrastField, SIGNAL(valueChanged(bool)), this,
- SLOT(onContrastChanged(bool)));
- addWidget(QString(tr("Contrast:")), m_contrastField);
-
- // UsideDown Field
- m_upsideDown = new DVGui::CheckBox(tr(" Upside-down"), this);
- m_upsideDown->setMaximumSize(100, 25);
- m_upsideDown->setChecked(parameters->isUpsideDown());
- ret = ret && connect(m_upsideDown, SIGNAL(stateChanged(int)), this,
- SLOT(onUpsideDownStateChanged(int)));
- addWidget(QString(tr("")), m_upsideDown);
-
- endVLayout();
-
- Q_ASSERT(ret);
-}
-
-//-------------------------------------------------------------------
-
-void CaptureSettingsPopup::showEvent(QShowEvent *) {
- TnzCamera *camera = TnzCamera::instance();
- bool ret = true;
- ret = ret && connect(camera, SIGNAL(imageSizeUpdated()), this,
- SLOT(updateWidgets()));
-}
-
-//-------------------------------------------------------------------
-
-void CaptureSettingsPopup::hideEvent(QHideEvent *) {
- TnzCamera *camera = TnzCamera::instance();
- disconnect(camera, SIGNAL(imageSizeUpdated()), this, SLOT(updateWidgets()));
-}
-
-//-------------------------------------------------------------------
-
-void CaptureSettingsPopup::updateWidgets() {
- CaptureParameters *parameters = getCaptureParameters();
-
- m_imageWidthLineEdit->setValue(parameters->getResolution().lx);
- m_imageHeightLineEdit->setValue(parameters->getResolution().ly);
-
- m_useWhiteImage->setChecked(parameters->isUseWhiteImage());
-
- m_brightnessField->setValue(parameters->getBrightness());
- m_contrastField->setValue(parameters->getContranst());
-
- m_upsideDown->setChecked(parameters->isUpsideDown());
-}
-
-//-------------------------------------------------------------------
-
-CaptureParameters *CaptureSettingsPopup::getCaptureParameters() {
- TSceneProperties *sceneProperties =
- TApp::instance()->getCurrentScene()->getScene()->getProperties();
- Q_ASSERT(sceneProperties);
- return sceneProperties->getCaptureParameters();
-}
-
-//-------------------------------------------------------------------
-
-void CaptureSettingsPopup::defineDevice() {
- if (TnzCamera::instance()->isCameraConnected()) {
- DVGui::warning(tr("A Device is Connected."));
- return;
- }
- QList<QString> cameras;
- bool ret = TnzCamera::instance()->findConnectedCameras(cameras);
- if (!ret) {
- DVGui::warning(tr("No cameras found."));
- return;
- }
-
- ChooseCameraDialog *dialog = new ChooseCameraDialog(cameras);
- dialog->exec();
-
- int cameraIndex = dialog->getCurrentCameraIndex();
- if (cameraIndex == -1) return;
-
- CaptureParameters *parameters = getCaptureParameters();
- parameters->setDeviceName(cameras.at(cameraIndex).toStdWString());
- parameters->setResolution(TDimension(0, 0));
-
- TnzCamera::instance()->removeWhiteImage();
-
- updateWidgets();
-
- emit newDeviceDefined();
-}
-
-//-------------------------------------------------------------------
-
-void CaptureSettingsPopup::onUseWhiteImageStateChanged(int state) {
- bool value = state == 2;
- m_keepWhiteImage->setEnabled(value);
- getCaptureParameters()->useWhiteImage(value);
-}
-
-//-------------------------------------------------------------------
-
-void CaptureSettingsPopup::onKeepWhiteImage() {
- TnzCamera *camera = TnzCamera::instance();
- if (!camera->isCameraConnected()) {
- DVGui::warning(tr("Device Disconnected."));
- return;
- }
- TFilePath whiteImagePath =
- TEnv::getConfigDir() + TFilePath("whiteReferenceImage.0001.tif");
- if (TSystem::doesExistFileOrLevel(whiteImagePath)) {
- QString question;
- question = "The White Image already exists.\nDo you want to overwrite it?";
- int ret = DVGui::MsgBox(question, QObject::tr("Overwrite"),
- QObject::tr("Cancel"), 0);
- if (ret == 2 || ret == 0) return;
- }
- camera->keepWhiteImage();
-}
-
-//-------------------------------------------------------------------
-
-void CaptureSettingsPopup::onImageWidthEditingFinished() {
- CaptureParameters *parameters = getCaptureParameters();
- if (parameters->getDeviceName().empty()) {
- DVGui::warning(tr("No Device Defined."));
- m_imageWidthLineEdit->setValue(parameters->getResolution().lx);
- return;
- }
- TnzCamera *camera = TnzCamera::instance();
- TDimension deviceResolution = camera->getDeviceResolution();
- double aspectRatio =
- (double)deviceResolution.ly / (double)deviceResolution.lx;
-
- int newWidth = m_imageWidthLineEdit->getValue();
- int newHeight = tround(newWidth * aspectRatio);
- m_imageHeightLineEdit->setValue(newHeight);
-
- camera->setCurrentImageSize(newWidth, newHeight);
-}
-
-//-------------------------------------------------------------------
-
-void CaptureSettingsPopup::onImageHeightEditingFinished() {
- CaptureParameters *parameters = getCaptureParameters();
- if (parameters->getDeviceName().empty()) {
- DVGui::warning(tr("No Device Defined."));
- m_imageHeightLineEdit->setValue(parameters->getResolution().ly);
- return;
- }
- TnzCamera *camera = TnzCamera::instance();
- TDimension deviceResolution = camera->getDeviceResolution();
- double aspectRatio =
- (double)deviceResolution.lx / (double)deviceResolution.ly;
-
- int newHeight = m_imageHeightLineEdit->getValue();
- int newWidth = tround(newHeight * aspectRatio);
- m_imageWidthLineEdit->setValue(newWidth);
-
- camera->setCurrentImageSize(newWidth, newHeight);
-}
-
-//-------------------------------------------------------------------
-
-void CaptureSettingsPopup::onContrastChanged(bool) {
- getCaptureParameters()->setContranst(m_contrastField->getValue());
-}
-
-//-------------------------------------------------------------------
-
-void CaptureSettingsPopup::onBrightnessChanged(bool) {
- getCaptureParameters()->setBrightness(m_brightnessField->getValue());
-}
-
-//-------------------------------------------------------------------
-
-void CaptureSettingsPopup::onUpsideDownStateChanged(int state) {
- getCaptureParameters()->upsideDown(state != 0);
-}
-
-//===================================================================
-// FileSettingsPopup
-
-FileSettingsPopup::FileSettingsPopup()
- : Dialog(TApp::instance()->getMainWindow())
- , m_pathField(0)
- , m_fileFormat(0) {
- setWindowTitle("File Settings");
- CaptureParameters *parameters = getCaptureParameters();
- bool ret = true;
- beginVLayout();
-
- m_pathField =
- new DVGui::FileField(this, toQString(parameters->getFilePath()));
- m_pathField->setMaximumHeight(19);
- ret = ret && connect(m_pathField, SIGNAL(pathChanged()), this,
- SLOT(onPathChanged()));
- addWidget(QString(tr("Save in:")), m_pathField);
-
- QWidget *fileFormatWidget = new QWidget(this);
- fileFormatWidget->setMaximumHeight(DVGui::WidgetHeight);
- QHBoxLayout *fileFormatLayout = new QHBoxLayout(fileFormatWidget);
- fileFormatLayout->setMargin(0);
-
- m_fileFormat = new QComboBox(fileFormatWidget);
- QStringList formats;
- TImageWriter::getSupportedFormats(formats, true);
- // TLevelWriter::getSupportedFormats(formats, true);
- Tiio::Writer::getSupportedFormats(formats, true);
- formats.sort();
-
- m_fileFormat->addItems(formats);
- m_fileFormat->setMaximumHeight(WidgetHeight);
- std::string ext = parameters->getFileFormat();
- m_fileFormat->setCurrentIndex(
- m_fileFormat->findText(QString::fromStdString(ext)));
- ret =
- ret && connect(m_fileFormat, SIGNAL(currentIndexChanged(const QString &)),
- SLOT(onFormatChanged(const QString &)));
- fileFormatLayout->addWidget(m_fileFormat);
-
- QPushButton *fileFormatButton =
- new QPushButton(QString("Options"), fileFormatWidget);
- fileFormatButton->setFixedHeight(19);
- fileFormatButton->setFixedSize(60, 19);
- ret = ret && connect(fileFormatButton, SIGNAL(pressed()), this,
- SLOT(openSettingsPopup()));
- fileFormatLayout->addWidget(fileFormatButton);
-
- addWidget(QString(tr("File Format:")), fileFormatWidget);
-
- endVLayout();
- Q_ASSERT(ret);
-}
-
-//-------------------------------------------------------------------
-
-void FileSettingsPopup::updateWidgets() {
- CaptureParameters *parameters = getCaptureParameters();
-
- m_pathField->setPath(toQString(parameters->getFilePath()));
-
- std::string ext = parameters->getFileFormat();
- m_fileFormat->setCurrentIndex(
- m_fileFormat->findText(QString::fromStdString(ext)));
-}
-
-//-------------------------------------------------------------------
-
-CaptureParameters *FileSettingsPopup::getCaptureParameters() {
- TSceneProperties *sceneProperties =
- TApp::instance()->getCurrentScene()->getScene()->getProperties();
- Q_ASSERT(sceneProperties);
- return sceneProperties->getCaptureParameters();
-}
-
-//-------------------------------------------------------------------
-
-void FileSettingsPopup::onPathChanged() {
- getCaptureParameters()->setFilePath(
- TFilePath(m_pathField->getPath().toStdWString()));
-}
-
-//-------------------------------------------------------------------
-
-void FileSettingsPopup::onFormatChanged(const QString &str) {
- getCaptureParameters()->setFileFormat(str.toStdString());
-}
-
-//-----------------------------------------------------------------------------
-/*! Open a popup output format settings popup to set current output format
- settings.
-*/
-void FileSettingsPopup::openSettingsPopup() {
- CaptureParameters *parameters = getCaptureParameters();
- std::string ext = parameters->getFileFormat();
- openFormatSettingsPopup(this, ext, parameters->getFileFormatProperties(ext));
-}
-
-//=============================================================================
-// LineTestCapturePane
-
-LineTestCapturePane::LineTestCapturePane(QWidget *parent)
- : TPanel(parent)
- , m_imageView(0)
- , m_nameField(0)
- , m_frameField(0)
- , m_saveMode(0)
- , m_onionSkin(0)
- , m_incrementField(0)
- , m_stepField(0)
- , m_connectionCheckBox(0)
- , m_lineColorField(0)
- , m_captureButton(0)
- , m_captureSettingsPopup(0)
- , m_fileSettingsPopup(0)
- , m_canCapture(true)
- , m_timerId(0) {
- bool ret = true;
- CaptureParameters *parameters = getCaptureParameters();
-
- QSplitter *splitter = new QSplitter(Qt::Vertical, this);
- splitter->setObjectName("OnePixelMarginFrame");
-
- // First splitter widget top widget
- QWidget *topWidget = new QWidget(splitter);
- QVBoxLayout *topLayout = new QVBoxLayout(topWidget);
- topLayout->setMargin(0);
- topLayout->setSpacing(0);
-
- // Add to top widget image view
- m_imageView = new LineTestImageViewer(topWidget);
- topLayout->addWidget(m_imageView, 10);
- ret = ret && connect(m_imageView, SIGNAL(onZoomChanged()),
- SLOT(changeWindowTitle()));
-
- // Add to top widget separator
- DVGui::Separator *horizSeparator = new DVGui::Separator(QString(), topWidget);
- horizSeparator->setFixedHeight(1);
- topLayout->addWidget(horizSeparator);
-
- // Add to top widget capture widget
- QWidget *captureWidget = new QWidget(topWidget);
- captureWidget->setMaximumHeight(45);
- QHBoxLayout *captureLayout = new QHBoxLayout(captureWidget);
- captureLayout->setMargin(0);
- captureLayout->setSpacing(0);
-
- QWidget *optionsWidget = new QWidget(captureWidget);
- optionsWidget->setMaximumHeight(45);
- QGridLayout *optionsLayout = new QGridLayout(optionsWidget);
- optionsLayout->setMargin(0);
- optionsLayout->setSpacing(0);
- // Name field
- QLabel *nameLabel = new QLabel(tr("Name:"), optionsWidget);
- nameLabel->setMaximumHeight(19);
- optionsLayout->addWidget(nameLabel, 0, 0, 1, 1,
- Qt::AlignRight | Qt::AlignVCenter);
- m_nameField = new DVGui::LineEdit(tr(""), optionsWidget, true);
- m_nameField->setMaximumSize(110, 19);
- optionsLayout->addWidget(m_nameField, 0, 1, 1, 1,
- Qt::AlignLeft | Qt::AlignVCenter);
- // Frame Field
- QLabel *frameLabel = new QLabel(tr("Frame:"), optionsWidget);
- frameLabel->setMaximumHeight(DVGui::WidgetHeight);
- optionsLayout->addWidget(frameLabel, 0, 2, 1, 1,
- Qt::AlignRight | Qt::AlignVCenter);
- m_frameField = new DVGui::IntLineEdit(optionsWidget, 1, 1, 9999, 4);
- m_frameField->setFixedSize(35, 19);
- optionsLayout->addWidget(m_frameField, 0, 3, 1, 1,
- Qt::AlignLeft | Qt::AlignVCenter);
- // Step Field
- QLabel *incrementLabel = new QLabel(tr("Increment:"), optionsWidget);
- incrementLabel->setMaximumHeight(DVGui::WidgetHeight);
- optionsLayout->addWidget(incrementLabel, 0, 4, 1, 1,
- Qt::AlignRight | Qt::AlignVCenter);
- m_incrementField =
- new DVGui::IntLineEdit(optionsWidget, parameters->getIncrement(), 1, 100);
- m_incrementField->setFixedSize(35, 19);
- optionsLayout->addWidget(m_incrementField, 0, 5, 1, 1,
- Qt::AlignLeft | Qt::AlignVCenter);
- ret = ret && connect(m_incrementField, SIGNAL(editingFinished()),
- SLOT(onIncrementFieldEditFinished()));
- // Step Widget
- QLabel *stepLabel = new QLabel(tr("Step:"), optionsWidget);
- stepLabel->setMaximumHeight(DVGui::WidgetHeight);
- optionsLayout->addWidget(stepLabel, 0, 6, 1, 1,
- Qt::AlignRight | Qt::AlignVCenter);
- m_stepField =
- new DVGui::IntLineEdit(optionsWidget, parameters->getStep(), 1, 100);
- m_stepField->setFixedSize(35, 19);
- optionsLayout->addWidget(m_stepField, 0, 7, 1, 1,
- Qt::AlignLeft | Qt::AlignVCenter);
- ret = ret && connect(m_stepField, SIGNAL(editingFinished()),
- SLOT(onStepFieldEditFinished()));
- // Mode Field
- QLabel *modeLabel = new QLabel(tr("Mode:"), optionsWidget);
- modeLabel->setMaximumHeight(DVGui::WidgetHeight);
- optionsLayout->addWidget(modeLabel, 1, 0, 1, 1,
- Qt::AlignRight | Qt::AlignVCenter);
- m_saveMode = new QComboBox(optionsWidget);
- m_saveMode->setMaximumSize(110, DVGui::WidgetHeight);
- QStringList saveMode;
- saveMode << tr("New ") << tr("Overwite ") << tr("Insert");
- m_saveMode->addItems(saveMode);
- ret = ret && connect(m_saveMode, SIGNAL(currentIndexChanged(int)),
- SLOT(onSaveModeChanged(int)));
- optionsLayout->addWidget(m_saveMode, 1, 1, 1, 1,
- Qt::AlignLeft | Qt::AlignVCenter);
- // Onion Skin Field
- m_onionSkin = new DVGui::CheckBox(tr(" Onion Skin "), optionsWidget);
- m_onionSkin->setMaximumSize(100, 25);
- ret = ret && connect(m_onionSkin, SIGNAL(stateChanged(int)), this,
- SLOT(onOnionSkinStateChanged(int)));
- optionsLayout->addWidget(m_onionSkin, 1, 3, 1, 1,
- Qt::AlignLeft | Qt::AlignVCenter);
- // Onion View Frame
- m_viewFrame = new DVGui::CheckBox(tr(" View Frame"), optionsWidget);
- m_viewFrame->setMaximumSize(100, 25);
- ret = ret && connect(m_viewFrame, SIGNAL(stateChanged(int)), this,
- SLOT(onViewFrameStateChanged(int)));
- optionsLayout->addWidget(m_viewFrame, 1, 4, 1, 1,
- Qt::AlignLeft | Qt::AlignVCenter);
- // Line Colo Field
- QLabel *fadeLabel = new QLabel(tr("Fade:"), optionsWidget);
- fadeLabel->setMaximumHeight(DVGui::WidgetHeight);
- optionsLayout->addWidget(fadeLabel, 1, 5, 1, 1,
- Qt::AlignRight | Qt::AlignVCenter);
- m_lineColorField =
- new DVGui::ColorField(optionsWidget, false, TPixel32(), 18);
- m_lineColorField->setFixedHeight(18);
- m_lineColorField->hideChannelsFields(true);
- ret = ret &&
- connect(m_lineColorField, SIGNAL(colorChanged(const TPixel32 &, bool)),
- this, SLOT(onLinesColorChanged(const TPixel32 &, bool)));
- optionsLayout->addWidget(m_lineColorField, 1, 6, 1, 1,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- optionsWidget->setLayout(optionsLayout);
- captureLayout->addWidget(optionsWidget, Qt::AlignCenter);
- captureLayout->setStretchFactor(optionsWidget, 20);
-
- DVGui::Separator *separator = new DVGui::Separator(QString(), captureWidget);
- separator->setFixedSize(1, 80);
- separator->setOrientation(false);
- captureLayout->addWidget(separator);
-
- QWidget *captureButtonsWidget = new QWidget(captureWidget);
- QVBoxLayout *captureButtonsLayout = new QVBoxLayout(captureButtonsWidget);
- captureButtonsLayout->setMargin(2);
- captureButtonsLayout->setSpacing(0);
- // Connection Button
- m_connectionCheckBox =
- new DVGui::CheckBox(tr(" Connection"), captureButtonsWidget);
- m_connectionCheckBox->setMaximumSize(100, 19);
- ret = ret && connect(m_connectionCheckBox, SIGNAL(stateChanged(int)), this,
- SLOT(onConnectCheckboxStateChanged(int)));
- captureButtonsLayout->addWidget(m_connectionCheckBox, Qt::AlignCenter);
- // Capture Button
- m_captureButton =
- new QPushButton(tr(" Capture "), captureButtonsWidget);
- m_captureButton->setMaximumSize(100, 19);
- ret = ret && connect(m_captureButton, SIGNAL(clicked()), this,
- SLOT(captureButton()));
- captureButtonsLayout->addWidget(m_captureButton, Qt::AlignCenter);
-
- captureButtonsWidget->setLayout(captureButtonsLayout);
- captureLayout->addWidget(captureButtonsWidget, Qt::AlignCenter);
- captureLayout->setStretchFactor(captureButtonsWidget, 1);
-
- captureWidget->setLayout(captureLayout);
- topLayout->addWidget(captureWidget);
-
- topWidget->setLayout(topLayout);
-
- splitter->addWidget(topWidget);
-
- // Second splitter widget
- QWidget *bottomWidget = new QWidget(splitter);
- bottomWidget->setFixedHeight(23);
- QHBoxLayout *bottomLayout = new QHBoxLayout(bottomWidget);
- bottomLayout->setMargin(0);
- bottomLayout->setSpacing(0);
- // Capture Settings Button
- QPushButton *captureSettingsButton =
- new QPushButton(tr("Capture Settings"), bottomWidget);
- captureSettingsButton->setMaximumSize(100, 19);
- ret = ret && connect(captureSettingsButton, SIGNAL(clicked()), this,
- SLOT(showCaptureSettings()));
- bottomLayout->addWidget(captureSettingsButton, Qt::AlignHCenter);
- // File Settings Button
- QPushButton *fileSettingsButton =
- new QPushButton(tr(" File Settings "), bottomWidget);
- fileSettingsButton->setMaximumSize(100, 19);
- ret = ret && connect(fileSettingsButton, SIGNAL(clicked()), this,
- SLOT(showFileSettings()));
- bottomLayout->addWidget(fileSettingsButton, Qt::AlignHCenter);
-
- bottomWidget->setLayout(bottomLayout);
- splitter->addWidget(bottomWidget);
-
- setWidget(splitter);
-
- initializeTitleBar(getTitleBar());
-
- // Lo sceneSwitched() va aggiornato anche quando il popup non e' visibile
- // altrimenti ci si trova in una situazione inconsistente
- ret = ret && connect(TApp::instance()->getCurrentScene(),
- SIGNAL(sceneSwitched()), this, SLOT(onSceneSwitched()));
-
- changeWindowTitle();
-
- Q_ASSERT(ret);
-}
-
-//-------------------------------------------------------------------
-
-CaptureParameters *LineTestCapturePane::getCaptureParameters() {
- TSceneProperties *sceneProperties =
- TApp::instance()->getCurrentScene()->getScene()->getProperties();
- Q_ASSERT(sceneProperties);
- return sceneProperties->getCaptureParameters();
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::closeEvent(QCloseEvent *) {
- TnzCamera::instance()->cameraDisconnect();
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::showEvent(QShowEvent *) {
- updateFileField();
- TApp *app = TApp::instance();
-
- TXsheetHandle *xshHandle = app->getCurrentXsheet();
- bool ret = connect(app->getCurrentColumn(), SIGNAL(columnIndexSwitched()),
- this, SLOT(updateFileField()));
- ret = ret && connect(app->getCurrentFrame(), SIGNAL(frameSwitched()), this,
- SLOT(updateFileField()));
- ret = ret && connect(app->getCurrentXsheet(), SIGNAL(xsheetChanged()), this,
- SLOT(updateFileField()));
- ret = ret && connect(TnzCamera::instance(), SIGNAL(captureFinished()), this,
- SLOT(onCaptureFinished()));
-
- QAction *act = CommandManager::instance()->getAction(MI_Capture);
- ret = ret &&
- connect(act, SIGNAL(triggered()), m_captureButton, SIGNAL(clicked()));
-
- TnzCamera *camera = TnzCamera::instance();
- camera->setScene(app->getCurrentScene()->getScene());
-
- assert(ret);
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::hideEvent(QHideEvent *) {
- TApp *app = TApp::instance();
- TXsheetHandle *xshHandle = app->getCurrentXsheet();
- disconnect(app->getCurrentColumn(), SIGNAL(columnIndexSwitched()), this,
- SLOT(updateFileField()));
- disconnect(app->getCurrentXsheet(), SIGNAL(xsheetChanged()), this,
- SLOT(updateFileField()));
- disconnect(app->getCurrentFrame(), SIGNAL(frameSwitched()), this,
- SLOT(updateFileField()));
- disconnect(TnzCamera::instance(), SIGNAL(captureFinished()), this,
- SLOT(onCaptureFinished()));
-
- QAction *act = CommandManager::instance()->getAction(MI_Capture);
- disconnect(act, SIGNAL(triggered()), m_captureButton, SIGNAL(clicked()));
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::timerEvent(QTimerEvent *e) {
- if (m_timerId <= 0) return;
- killTimer(m_timerId);
- m_timerId = 0;
- m_canCapture = true;
-}
-
-//-------------------------------------------------------------------
-
-bool LineTestCapturePane::capture() {
- TApp *app = TApp::instance();
- int row = app->getCurrentFrame()->getFrameIndex();
- int col = app->getCurrentColumn()->getColumnIndex();
- TXsheet *xsheet = app->getCurrentXsheet()->getXsheet();
- TXshColumn *column = xsheet->getColumn(col);
- TXshCell cell = xsheet->getCell(row, col);
- if ((column && !column->getLevelColumn()) ||
- (!cell.isEmpty() && cell.getChildLevel() != 0)) {
- DVGui::error(tr("Bad Selection."));
- return false;
- }
- QApplication::setOverrideCursor(Qt::WaitCursor);
- bool ret = TnzCamera::instance()->onRelease(
- TFrameId(m_frameField->text().toInt()),
- m_nameField->text().toStdWString(), row, col);
- QApplication::restoreOverrideCursor();
- return ret;
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::setFrameField(TFrameId fid) {
- int number = fid.getNumber();
- QString newStr;
- if (number < 10)
- newStr = QString("000");
- else if (number < 100)
- newStr = QString("00");
- else if (number < 1000)
- newStr = QString("0");
- m_frameField->setText(newStr + QString::number(number));
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::initializeTitleBar(TPanelTitleBar *titleBar) {
- bool ret = true;
-
- int x = -50;
- int iconWidth = 20;
- TPanelTitleBarButton *button;
- button = new TPanelTitleBarButton(titleBar, ":Resources/pane_freeze_off.svg",
- ":Resources/pane_freeze_over.svg",
- ":Resources/pane_freeze_on.svg");
- button->setToolTip("Freeze");
- titleBar->add(QPoint(x, 0), button);
- ret = ret && connect(button, SIGNAL(toggled(bool)), this, SLOT(freeze(bool)));
-
- assert(ret);
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::showCaptureSettings() {
- if (!m_captureSettingsPopup) {
- m_captureSettingsPopup = new CaptureSettingsPopup();
- bool ret = connect(m_captureSettingsPopup, SIGNAL(newDeviceDefined()),
- m_connectionCheckBox, SLOT(toggle()));
- assert(ret);
- }
- m_captureSettingsPopup->show();
- m_captureSettingsPopup->raise();
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::showFileSettings() {
- if (!m_fileSettingsPopup) m_fileSettingsPopup = new FileSettingsPopup();
- m_fileSettingsPopup->show();
- m_fileSettingsPopup->raise();
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::onSaveModeChanged(int value) {
- TnzCamera::instance()->setSaveType(value);
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::onIncrementFieldEditFinished() {
- getCaptureParameters()->setIncrement(m_incrementField->getValue());
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::onStepFieldEditFinished() {
- getCaptureParameters()->setStep(m_stepField->getValue());
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::onOnionSkinStateChanged(int state) {
- bool checked = state != Qt::Unchecked;
- if (checked) m_viewFrame->setCheckState(Qt::Unchecked);
- m_imageView->setOnionSkinActive(checked);
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::onViewFrameStateChanged(int state) {
- bool checked = state != Qt::Unchecked;
- if (checked) m_onionSkin->setCheckState(Qt::Unchecked);
- m_imageView->setViewFrameActive(checked);
- if (!m_connectionCheckBox->isChecked()) m_imageView->repaint();
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::onLinesColorChanged(const TPixel32 &color, bool) {
- TnzCamera::instance()->setLinesColor(color);
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::onConnectCheckboxStateChanged(int state) {
- if (state) {
- TSceneProperties *sceneProperties =
- TApp::instance()->getCurrentScene()->getScene()->getProperties();
- Q_ASSERT(sceneProperties);
- std::wstring deviceName =
- sceneProperties->getCaptureParameters()->getDeviceName();
-
- if (deviceName.empty()) {
- DVGui::warning(tr("No Device Defined."));
- m_connectionCheckBox->setChecked(false);
- return;
- }
- bool ret = TnzCamera::instance()->cameraConnect(deviceName);
- if (!ret) {
- DVGui::warning(tr("Cannot connect Camera"));
- m_connectionCheckBox->setChecked(false);
- } else
- TnzCamera::instance()->onViewfinder(m_imageView);
- } else {
- TnzCamera::instance()->cameraDisconnect();
- }
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::captureButton() {
- // Se il bottone di capture e' stato cliccato da meno di 500 ms non consento
- // una nuova acquisizione.
- if (!m_canCapture) return;
-
- if (!TnzCamera::instance()->isCameraConnected()) {
- DVGui::warning(tr("Device Disconnected."));
- return;
- }
- QString clickPath =
- QString::fromStdString(TEnv::getApplicationName()) + QString(" ") +
- QString::fromStdString(TEnv::getApplicationVersion()) + QString(".app") +
- QString("/Contents/Resources/click.wav");
- QSound::play(clickPath);
-
- bool isDummyLevel = false;
- TApp *app = TApp::instance();
- int row = app->getCurrentFrame()->getFrameIndex();
- int col = app->getCurrentColumn()->getColumnIndex();
- TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
- TXshCell cell = xsh->getCell(row, col);
- if (!cell.isEmpty()) {
- TXshSimpleLevel *sl = cell.getSimpleLevel();
- if (sl && !sl->isFid(cell.m_frameId)) isDummyLevel = true;
- }
- bool ret = capture();
- if (!ret) return;
-
- app->getCurrentSelection()->setSelection(0);
- disconnect(app->getCurrentFrame(), SIGNAL(frameSwitched()), this,
- SLOT(updateFileField()));
- disconnect(app->getCurrentXsheet(), SIGNAL(xsheetChanged()), this,
- SLOT(updateFileField()));
-
- int step = getCaptureParameters()->getStep();
- if (isDummyLevel) {
- step = 0;
- int frameIdNumber = cell.m_frameId.getNumber();
- while (frameIdNumber == cell.m_frameId.getNumber()) {
- ++step;
- cell = xsh->getCell(row + step, col);
- }
- }
- TApp::instance()->getCurrentFrame()->setFrameIndex(row + step);
-
- QString str = m_frameField->text();
- int number = str.toInt();
- number += getCaptureParameters()->getIncrement();
- TFrameId fid(number);
-
- // controllo se esiste gia' un livello con frame number diversi.
- // Nel qual ccaso devo utilizzare il FrameId presente nella cella.
- row = TApp::instance()->getCurrentFrame()->getFrameIndex();
- TXshColumn *column = xsh->getColumn(col);
- if (column) {
- TXshCell cell = column->getCellColumn()->getCell(row);
- if (!cell.isEmpty()) fid = cell.getFrameId();
- }
-
- setFrameField(fid);
-
- bool connectionRet = connect(app->getCurrentFrame(), SIGNAL(frameSwitched()),
- this, SLOT(updateFileField()));
- connectionRet =
- connectionRet && connect(app->getCurrentXsheet(), SIGNAL(xsheetChanged()),
- this, SLOT(updateFileField()));
- assert(connectionRet);
-
- m_canCapture = false;
- m_timerId = startTimer(500);
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::updateFileField() {
- QString parentDir;
- QString fileName;
- TFrameId fid;
- TApp *app = TApp::instance();
- TXsheet *xsheet = app->getCurrentXsheet()->getXsheet();
- int col = app->getCurrentColumn()->getColumnIndex();
- TXshColumn *column = xsheet->getColumn(col);
- if (!column || column->getLevelColumn()) {
- int row = app->getCurrentFrame()->getFrameIndex();
- TXshCell cell = xsheet->getCell(row, col);
- TXshCell precCell = row > 0 ? xsheet->getCell(row - 1, col) : TXshCell();
- if (!cell.isEmpty()) {
- TXshSimpleLevel *sl = cell.getSimpleLevel();
- if (sl) {
- parentDir = toQString(sl->getPath().getParentDir());
- fileName = QString::fromStdWString(sl->getName());
- fid = cell.getFrameId();
- }
- } else if (!precCell.isEmpty() && precCell.getSimpleLevel()) {
- TXshSimpleLevel *sl = precCell.getSimpleLevel();
- parentDir = toQString(sl->getPath().getParentDir());
- fileName = QString::fromStdWString(sl->getName());
- fid = TFrameId(precCell.getFrameId().getNumber() + 1);
- } else {
- ToonzScene *scene = xsheet->getScene();
- TLevelSet *levelSet = scene->getLevelSet();
- std::wstring levelName;
- NameBuilder *nameBuilder = NameBuilder::getBuilder(levelName);
- TFilePath fp;
- for (;;) {
- levelName = nameBuilder->getNext();
- if (levelSet->getLevel(levelName) != 0) continue;
- fp = scene->getDefaultLevelPath(OVL_XSHLEVEL, levelName);
- TFilePath actualFp = scene->decodeFilePath(fp);
- break;
- }
-
- delete nameBuilder;
- nameBuilder = 0;
-
- fileName = QString::fromStdWString(levelName);
- TFilePath defaultPath =
- scene->getDefaultLevelPath(OVL_XSHLEVEL).getParentDir();
- parentDir = toQString(defaultPath);
- fid = TFrameId(1);
- }
- }
-
- m_nameField->setText(fileName);
- setFrameField(fid);
- if (!m_connectionCheckBox->isChecked()) m_imageView->repaint();
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::onCaptureFinished() {
- TApp *app = TApp::instance();
- disconnect(app->getCurrentXsheet(), SIGNAL(xsheetChanged()), this,
- SLOT(updateFileField()));
-
- app->getCurrentScene()->notifySceneChanged();
- app->getCurrentXsheet()->notifyXsheetChanged();
- app->getCurrentLevel()->notifyLevelChange();
-
- bool ret = connect(app->getCurrentXsheet(), SIGNAL(xsheetChanged()), this,
- SLOT(updateFileField()));
- assert(ret);
-
- TnzCamera *camera = TnzCamera::instance();
- IconGenerator::instance()->invalidate(camera->getCurrentLevel(),
- camera->getCurrentFid());
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::onSceneSwitched() {
- if (m_captureSettingsPopup) m_captureSettingsPopup->updateWidgets();
- if (m_fileSettingsPopup) m_fileSettingsPopup->updateWidgets();
-
- TnzCamera *camera = TnzCamera::instance();
- if (camera->isCameraConnected()) camera->cameraDisconnect();
-
- updateFileField();
-
- m_saveMode->setCurrentIndex(0);
- camera->setSaveType(0);
-
- m_incrementField->setValue(getCaptureParameters()->getIncrement());
- m_stepField->setValue(getCaptureParameters()->getStep());
-
- m_lineColorField->setColor(TPixel32());
- camera->setLinesColor(TPixel32());
-
- m_connectionCheckBox->setChecked(false);
-
- m_onionSkin->setChecked(false);
- m_imageView->setOnionSkinActive(false);
-
- m_imageView->resetView();
-
- camera->setScene(TApp::instance()->getCurrentScene()->getScene());
- changeWindowTitle();
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::changeWindowTitle() {
- QString name = tr("LineTest Capture");
- TAffine aff =
- m_imageView->getViewMatrix() * m_imageView->getNormalZoomScale().inv();
- name = name + " Zoom : " + QString::number(tround(100.0 * sqrt(aff.det()))) +
- "%";
- setWindowTitle(name);
-}
-
-//-------------------------------------------------------------------
-
-void LineTestCapturePane::freeze(bool value) {
- TnzCamera::instance()->freeze(value);
- m_imageView->update();
-}
-
-#endif
diff --git a/toonz/sources/toonz/linetestcapturepane.h b/toonz/sources/toonz/linetestcapturepane.h
deleted file mode 100644
index b680f3445..000000000
--- a/toonz/sources/toonz/linetestcapturepane.h
+++ /dev/null
@@ -1,234 +0,0 @@
-#pragma once
-
-#ifndef LINETESTCAPTUREPANE_H
-#define LINETESTCAPTUREPANE_H
-#ifdef LINETEST
-#include "tnzcamera.h"
-#include "trasterimage.h"
-#include "pane.h"
-
-#include "toonz/toonzscene.h"
-
-#include "toonzqt/dvdialog.h"
-#include "toonzqt/filefield.h"
-#include "toonzqt/intfield.h"
-#include "toonzqt/checkbox.h"
-#include "toonzqt/colorfield.h"
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QDialog>
-#include <QPainter>
-#include <QLineEdit>
-#include <QMouseEvent>
-
-//-----------------------------------------------------------------------------
-// forward declaration
-class QSlider;
-class QLabel;
-class QComboBox;
-class CaptureParameters;
-
-//=============================================================================
-// LineTestImageViewer
-
-class LineTestImageViewer final : public QWidget, public CameraImageViewer {
- Q_OBJECT
-
- QPoint m_pos;
- Qt::MouseButton m_mouseButton;
- //! Used to zoom and pan
- TAffine m_viewAffine;
-
- TRasterP m_raster;
-
- bool m_isPainting;
-
- bool m_isOnionSkinActive;
- bool m_isViewFrameActive;
-
-public:
- LineTestImageViewer(QWidget *parent);
-
- void setImage(TRasterP ras);
-
- void setOnionSkinActive(bool value) { m_isOnionSkinActive = value; }
- void setViewFrameActive(bool value) { m_isViewFrameActive = value; }
-
- TAffine getNormalZoomScale();
- TAffine getViewMatrix() const { return m_viewAffine; }
-
- void zoomQt(bool forward, bool reset);
-
-public slots:
- void resetView();
-
-signals:
- void rasterChanged();
- void onZoomChanged();
-
-protected:
- TRasterP getCurrentImage() const;
- TDimension getImageSize() const;
-
- void mouseMoveEvent(QMouseEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void enterEvent(QEvent *);
- void keyPressEvent(QKeyEvent *event);
- void contextMenuEvent(QContextMenuEvent *event);
-
- void wheelEvent(QWheelEvent *e);
- void panQt(const QPoint &delta);
- void zoomQt(const QPoint &center, double factor);
-
- void paintEvent(QPaintEvent *e);
-};
-
-//===================================================================
-// ChooseCameraDialog
-
-class ChooseCameraDialog final : public DVGui::Dialog {
- Q_OBJECT
-
- int m_cameraIndex;
-
-public:
- ChooseCameraDialog(QList<QString> cameras);
-
- int getCurrentCameraIndex() const { return m_cameraIndex; }
-
-protected slots:
- void onCurrentRowChanged(int currentRow);
- void onOkButtonPressed();
- void onCancelButtonPressed();
-};
-
-//===================================================================
-// CaptureSettingsPopup
-
-class CaptureSettingsPopup final : public DVGui::Dialog {
- Q_OBJECT
-
- QPushButton *m_defineDeviceButton;
- DVGui::CheckBox *m_useWhiteImage;
- QPushButton *m_keepWhiteImage;
- DVGui::IntLineEdit *m_imageWidthLineEdit;
- DVGui::IntLineEdit *m_imageHeightLineEdit;
- DVGui::IntField *m_brightnessField;
- DVGui::IntField *m_contrastField;
- DVGui::CheckBox *m_upsideDown;
-
-public:
- CaptureSettingsPopup();
-
-public slots:
- void updateWidgets();
-
-protected:
- CaptureParameters *getCaptureParameters();
-
-protected:
- void showEvent(QShowEvent *e);
- void hideEvent(QHideEvent *e);
-
-protected slots:
- void defineDevice();
- void onUseWhiteImageStateChanged(int state);
- void onKeepWhiteImage();
- void onImageWidthEditingFinished();
- void onImageHeightEditingFinished();
- void onContrastChanged(bool);
- void onBrightnessChanged(bool);
- void onUpsideDownStateChanged(int);
-
-signals:
- void newDeviceDefined();
-};
-
-//===================================================================
-// FileSettingsPopup
-
-class FileSettingsPopup final : public DVGui::Dialog {
- Q_OBJECT
-
- DVGui::FileField *m_pathField;
- QComboBox *m_fileFormat;
-
-public:
- FileSettingsPopup();
-
-public slots:
- void updateWidgets();
-
-protected:
- CaptureParameters *getCaptureParameters();
-
-protected slots:
- void onPathChanged();
- void onFormatChanged(const QString &);
- void openSettingsPopup();
-};
-
-//=============================================================================
-// LineTestCapturePane
-
-class LineTestCapturePane final : public TPanel {
- Q_OBJECT
-
- LineTestImageViewer *m_imageView;
-
- DVGui::LineEdit *m_nameField;
- DVGui::LineEdit *m_frameField;
- QComboBox *m_saveMode;
- DVGui::CheckBox *m_onionSkin;
- DVGui::CheckBox *m_viewFrame;
- DVGui::IntLineEdit *m_incrementField;
- DVGui::IntLineEdit *m_stepField;
- DVGui::CheckBox *m_connectionCheckBox;
- DVGui::ColorField *m_lineColorField;
- QPushButton *m_captureButton;
-
- CaptureSettingsPopup *m_captureSettingsPopup;
- FileSettingsPopup *m_fileSettingsPopup;
-
- int m_timerId;
- bool m_canCapture;
-
-public:
- LineTestCapturePane(QWidget *parent = 0);
- ~LineTestCapturePane() {}
-
-protected:
- CaptureParameters *getCaptureParameters();
-
- void closeEvent(QCloseEvent *e);
- void showEvent(QShowEvent *e);
- void hideEvent(QHideEvent *e);
- void timerEvent(QTimerEvent *e);
-
- bool capture();
- void setFrameField(TFrameId fid);
-
- void initializeTitleBar(TPanelTitleBar *titleBar);
-
-protected slots:
- void showCaptureSettings();
- void showFileSettings();
- void onSaveModeChanged(int);
- void onIncrementFieldEditFinished();
- void onStepFieldEditFinished();
- void onConnectCheckboxStateChanged(int state);
- void onOnionSkinStateChanged(int state);
- void onViewFrameStateChanged(int);
- void onLinesColorChanged(const TPixel32 &, bool);
- void captureButton();
- void updateFileField();
- void onCaptureFinished();
- void onSceneSwitched();
- void changeWindowTitle();
- void freeze(bool);
-};
-#endif
-
-#endif // LINETESTCAPTUREPANE
diff --git a/toonz/sources/toonz/linetestpane.cpp b/toonz/sources/toonz/linetestpane.cpp
deleted file mode 100644
index 5d53a8863..000000000
--- a/toonz/sources/toonz/linetestpane.cpp
+++ /dev/null
@@ -1,665 +0,0 @@
-
-
-#include "linetestpane.h"
-#ifdef LINETEST
-#include "xsheetdragtool.h"
-#include "toutputproperties.h"
-#include "tapp.h"
-#include "toonz/tcolumnhandle.h"
-#include "toonz/txshlevelhandle.h"
-#include "toonz/toonzscene.h"
-#include "toonz/sceneproperties.h"
-
-#include <QThread>
-#include <QStackedWidget>
-
-using namespace DVGui;
-
-//=============================================================================
-// MixAudioThread
-//-----------------------------------------------------------------------------
-
-MixAudioThread::MixAudioThread(QObject *parent)
- : QThread(parent), m_abort(false), m_restart(false) {}
-
-//-----------------------------------------------------------------------------
-
-MixAudioThread::~MixAudioThread() {
- m_mutex.lock();
- m_abort = true;
- m_condition.wakeOne();
- m_mutex.unlock();
- wait();
-}
-
-//-----------------------------------------------------------------------------
-
-void MixAudioThread::run() {
- forever {
- m_mutex.lock();
- int from = this->m_from;
- int to = this->m_to;
- m_mutex.unlock();
-
- if (m_abort) return;
-
- TXsheet::SoundProperties *prop = new TXsheet::SoundProperties();
- prop->m_fromFrame = from;
- prop->m_toFrame = to;
- m_computedBuffer =
- TApp::instance()->getCurrentXsheet()->getXsheet()->makeSound(prop);
- m_buffer = TSoundTrackP();
- if (m_computedBuffer) m_buffer = m_computedBuffer->clone();
-
- if (!m_restart && m_buffer) emit computedBuffer();
-
- m_mutex.lock();
- if (!m_restart) m_condition.wait(&m_mutex);
- m_restart = false;
- m_mutex.unlock();
- }
-}
-
-//-----------------------------------------------------------------------------
-
-void MixAudioThread::computeBuffer(int fromFrame, int toFrame) {
- QMutexLocker locker(&m_mutex);
-
- this->m_from = fromFrame;
- this->m_to = toFrame;
-
- if (!isRunning()) {
- start(QThread::NormalPriority);
- } else {
- m_restart = true;
- m_condition.wakeOne();
- }
-}
-
-//=============================================================================
-// LineTestPane
-//-----------------------------------------------------------------------------
-
-LineTestPane::LineTestPane(QWidget *parent, Qt::WFlags flags)
- : TPanel(parent)
- , m_flipConsole(0)
- , m_keyFrameButton(0)
- , m_mainTrack(0)
- , m_startTrack(0)
- , m_player(0)
- , m_trackStartFrame(0)
- , m_startPlayRange(-1)
- , m_endPlayRange(0)
- , m_bufferSize(0)
- , m_nextBufferSize(0) {
- bool ret = true;
- QFrame *hbox = new QFrame(this);
- hbox->setFrameStyle(QFrame::StyledPanel);
- hbox->setObjectName("OnePixelMarginFrame");
-
- QVBoxLayout *mainLayout = new QVBoxLayout(hbox);
- mainLayout->setMargin(0);
- mainLayout->setSpacing(0);
-
- // Viewer
- m_stackedWidget = new QStackedWidget(this);
- m_sceneViewer = new SceneViewer(this);
- m_stackedWidget->addWidget(m_sceneViewer);
- m_lineTestViewer = new LineTestViewer(this);
- m_stackedWidget->addWidget(m_lineTestViewer);
-
- mainLayout->addWidget(m_stackedWidget, Qt::AlignCenter);
-
- TApp *app = TApp::instance();
- m_keyFrameButton = new ViewerKeyframeNavigator(0, app->getCurrentFrame());
- m_keyFrameButton->setObjectHandle(app->getCurrentObject());
- m_keyFrameButton->setXsheetHandle(app->getCurrentXsheet());
-
- int buttons = FlipConsole::cFullConsole;
-
- buttons &= (~FlipConsole::eSound);
- buttons &= (~FlipConsole::eCheckBg);
- buttons &= (~FlipConsole::eWhiteBg);
- buttons &= (~FlipConsole::eBlackBg);
- buttons &= (~FlipConsole::eSave);
- buttons &= (~FlipConsole::eCompare);
- buttons &= (~FlipConsole::eSaveImg);
- buttons &= (~FlipConsole::eHisto);
- buttons &= (~FlipConsole::eCustomize);
- buttons &= (~FlipConsole::eMatte);
- buttons &= (~FlipConsole::eGRed);
- buttons &= (~FlipConsole::eGGreen);
- buttons &= (~FlipConsole::eGBlue);
- buttons &= (~FlipConsole::eRed);
- buttons &= (~FlipConsole::eGreen);
- buttons &= (~FlipConsole::eBlue);
- buttons &= (~FlipConsole::eDefineSubCamera);
- buttons &= (~FlipConsole::eDefineLoadBox);
- buttons &= (~FlipConsole::eUseLoadBox);
-
- m_flipConsole = new FlipConsole(mainLayout, buttons, false, m_keyFrameButton,
- "SceneViewerConsole");
-
- ret = ret && connect(m_sceneViewer, SIGNAL(onZoomChanged()),
- SLOT(changeWindowTitle()));
- ret = ret && connect(m_lineTestViewer, SIGNAL(onZoomChanged()),
- SLOT(changeWindowTitle()));
-
- ret = connect(m_flipConsole,
- SIGNAL(drawFrame(int, const ImagePainter::VisualSettings &)),
- this,
- SLOT(onDrawFrame(int, const ImagePainter::VisualSettings &)));
- ret = ret && connect(m_flipConsole, SIGNAL(playStateChanged(bool)), this,
- SLOT(onPlayStateChanged(bool)));
- ret = ret &&
- connect(m_flipConsole, SIGNAL(buttonPressed(FlipConsole::EGadget)),
- m_lineTestViewer, SLOT(onButtonPressed(FlipConsole::EGadget)));
- ret = ret &&
- connect(m_flipConsole, SIGNAL(buttonPressed(FlipConsole::EGadget)),
- m_sceneViewer, SLOT(onButtonPressed(FlipConsole::EGadget)));
- ret = ret && connect(m_flipConsole, SIGNAL(sliderReleased()), this,
- SLOT(onFlipSliderReleased()));
-
- m_flipConsole->setFrameRate(app->getCurrentScene()
- ->getScene()
- ->getProperties()
- ->getOutputProperties()
- ->getFrameRate());
-
- hbox->setLayout(mainLayout);
-
- setWidget(hbox);
-
- initializeTitleBar(getTitleBar());
-
- ret = ret && connect(&m_mixAudioThread, SIGNAL(computedBuffer()), this,
- SLOT(onComputedBuffer()), Qt::DirectConnection);
-
- ret = ret && connect(app->getCurrentScene(), SIGNAL(sceneSwitched()), this,
- SLOT(onSceneSwitched()));
-
- assert(ret);
- setCurrentViewType(0);
-}
-
-//-----------------------------------------------------------------------------
-
-LineTestPane::~LineTestPane() {}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::showEvent(QShowEvent *) {
- TApp *app = TApp::instance();
- TFrameHandle *frameHandle = app->getCurrentFrame();
- TSceneHandle *sceneHandle = app->getCurrentScene();
- TXshLevelHandle *levelHandle = app->getCurrentLevel();
- TObjectHandle *objectHandle = app->getCurrentObject();
- TXsheetHandle *xshHandle = app->getCurrentXsheet();
-
- updateFrameRange();
-
- bool ret = true;
-
- ret = ret && connect(xshHandle, SIGNAL(xsheetChanged()), this,
- SLOT(onSceneChanged()));
-
- ret = ret && connect(sceneHandle, SIGNAL(sceneChanged()), this,
- SLOT(onSceneChanged()));
- ret = ret && connect(sceneHandle, SIGNAL(nameSceneChanged()), this,
- SLOT(changeWindowTitle()));
-
- ret = ret && connect(levelHandle, SIGNAL(xshLevelSwitched(TXshLevel *)), this,
- SLOT(onXshLevelSwitched(TXshLevel *)));
- ret = ret && connect(levelHandle, SIGNAL(xshLevelChanged()), this,
- SLOT(changeWindowTitle()));
- ret = ret && connect(levelHandle, SIGNAL(xshLevelTitleChanged()), this,
- SLOT(changeWindowTitle()));
- ret = ret && connect(levelHandle, SIGNAL(xshLevelChanged()), this,
- SLOT(updateFrameRange()));
-
- ret = ret && connect(frameHandle, SIGNAL(frameSwitched()), this,
- SLOT(changeWindowTitle()));
- ret = ret && connect(frameHandle, SIGNAL(frameSwitched()), this,
- SLOT(onFrameSwitched()));
- ret = ret && connect(frameHandle, SIGNAL(frameTypeChanged()), this,
- SLOT(onFrameTypeChanged()));
-
- assert(ret);
-
- // Aggiorno FPS al valore definito nel viewer corrente.
- m_flipConsole->setActive(true);
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::hideEvent(QHideEvent *) {
- TApp *app = TApp::instance();
- TFrameHandle *frameHandle = app->getCurrentFrame();
- TSceneHandle *sceneHandle = app->getCurrentScene();
- TXshLevelHandle *levelHandle = app->getCurrentLevel();
- TObjectHandle *objectHandle = app->getCurrentObject();
- TXsheetHandle *xshHandle = app->getCurrentXsheet();
-
- disconnect(xshHandle, SIGNAL(xsheetChanged()), this, SLOT(onSceneChanged()));
-
- disconnect(sceneHandle, SIGNAL(sceneChanged()), this, SLOT(onSceneChanged()));
- disconnect(sceneHandle, SIGNAL(nameSceneChanged()), this,
- SLOT(changeWindowTitle()));
-
- disconnect(levelHandle, SIGNAL(xshLevelSwitched(TXshLevel *)), this,
- SLOT(onXshLevelSwitched(TXshLevel *)));
- disconnect(levelHandle, SIGNAL(xshLevelChanged()), this,
- SLOT(changeWindowTitle()));
- disconnect(levelHandle, SIGNAL(xshLevelTitleChanged()), this,
- SLOT(changeWindowTitle()));
- disconnect(levelHandle, SIGNAL(xshLevelChanged()), this,
- SLOT(updateFrameRange()));
-
- disconnect(frameHandle, SIGNAL(frameSwitched()), this,
- SLOT(changeWindowTitle()));
- disconnect(frameHandle, SIGNAL(frameSwitched()), this,
- SLOT(onFrameSwitched()));
- disconnect(frameHandle, SIGNAL(frameTypeChanged()), this,
- SLOT(onFrameTypeChanged()));
-
- m_flipConsole->setActive(false);
-}
-
-//-----------------------------------------------------------------------------
-
-int LineTestPane::computeBufferSize(int frame) {
- int bufferSize = 0;
- double time = 2.0;
- ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
- TOutputProperties *outputSettings =
- scene->getProperties()->getOutputProperties();
- int frameRate = outputSettings->getFrameRate();
- if (m_endPlayRange > m_startPlayRange) {
- int range = m_endPlayRange - m_startPlayRange;
- time = double(range) / double(frameRate);
- int minuts = tround(time / 60.0);
- if (minuts == 0) minuts = 1;
- while (time > 2.0 * minuts) time = time * 0.5;
- }
- bufferSize = tfloor(frameRate * time) + 1;
- // qDebug("BUFFER SIZE: %d", bufferSize);
-
- if (frame + bufferSize > m_endPlayRange) {
- bufferSize = m_endPlayRange - frame + 1;
- // qDebug("\n BUFFER SIZE: %d \n", bufferSize);
- }
-
- return bufferSize;
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::computeBuffer(int frame) {
- int startFrame = m_trackStartFrame + m_bufferSize;
- if (startFrame >= m_endPlayRange) {
- // qDebug("\n OPS \n");
- return;
- }
- // qDebug("COMPUTE BUFFER SIZE AT FRAME: %d", startFrame);
- m_nextBufferSize = computeBufferSize(startFrame);
- // qDebug("start frame: %d, start next buffer size: %d", startFrame,
- // m_nextBufferSize);
- m_mixAudioThread.computeBuffer(startFrame, startFrame + m_nextBufferSize);
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::initSound() {
- m_mainTrack = 0;
- m_startTrack = 0;
- TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
- TFrameHandle *frameHandle = TApp::instance()->getCurrentFrame();
- m_trackStartFrame = frameHandle->getFrame();
-
- m_startPlayRange = 0;
- m_endPlayRange = frameHandle->getMaxFrameIndex();
- int fromMarker, toMarker, step;
- if (XsheetGUI::getPlayRange(fromMarker, toMarker, step)) {
- m_startPlayRange = fromMarker;
- m_endPlayRange = toMarker;
- }
-
- m_bufferSize = computeBufferSize(m_trackStartFrame);
- // qDebug("initSound()");
- // qDebug("m_startPlayRange: %d", m_startPlayRange);
- // qDebug("m_endPlayRange: %d", m_endPlayRange);
- // qDebug("start frame: %d, start bufferSize: %d", m_trackStartFrame,
- // m_bufferSize);
-
- if (xsh) {
- if (!m_player) m_player = new TSoundOutputDevice();
- // Compute the first seconds and then launch the thread to compute the next
- // buffer
- TXsheet::SoundProperties *prop = new TXsheet::SoundProperties();
- prop->m_fromFrame = m_trackStartFrame;
- prop->m_toFrame = m_trackStartFrame + m_bufferSize;
- m_mainTrack = xsh->makeSound(prop);
- if (m_trackStartFrame == m_startPlayRange) {
- // qDebug("set start track");
- m_startTrack = m_mainTrack;
- m_startBufferSize = m_bufferSize;
- } else // compute start track (it's necessary to avoid async in loop)
- {
- m_startBufferSize = computeBufferSize(m_startPlayRange);
- TXsheet::SoundProperties *prop = new TXsheet::SoundProperties();
- prop->m_fromFrame = m_startPlayRange;
- prop->m_toFrame = m_startPlayRange + m_startBufferSize;
- m_startTrack = xsh->makeSound(prop);
- }
- computeBuffer(m_trackStartFrame);
- } else {
- m_mainTrack = 0;
- m_startTrack = 0;
- }
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::playSound() {
- if (m_player && m_mainTrack) {
- try {
- int currentFrame = TApp::instance()->getCurrentFrame()->getFrame();
- double t0 = (double)(currentFrame - m_trackStartFrame) /
- (double)(m_mainTrack->getSampleRate());
- // Pay attention at don't call play everytime (there is a big leak
- // otherwise !)
- double trackDuration = m_mainTrack->getDuration();
- // qDebug("trackDuration: %f", trackDuration);
- if (m_mainTrack && trackDuration != 0)
- if (trackDuration > t0) m_player->play(m_mainTrack, t0, trackDuration);
- } catch (TSoundDeviceException &e) {
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::initializeTitleBar(TPanelTitleBar *titleBar) {
- bool ret = true;
-
- TPanelTitleBarButtonSet *viewModeButtonSet;
- viewModeButtonSet = new TPanelTitleBarButtonSet();
- int x = -100;
- int iconWidth = 17;
- TPanelTitleBarButton *button;
-
- m_cameraStandButton = new TPanelTitleBarButton(
- titleBar, ":Resources/pane_table_off.svg", ":Resources/pane_table_over.svg",
- ":Resources/pane_table_on.svg");
- m_cameraStandButton->setToolTip("Camera Stand View");
- x += 18 + iconWidth;
- titleBar->add(QPoint(x, 2), m_cameraStandButton);
- m_cameraStandButton->setButtonSet(viewModeButtonSet, 0);
- m_cameraStandButton->setPressed(true);
-
- m_previewButton = new TPanelTitleBarButton(
- titleBar, ":Resources/pane_preview_off.svg", ":Resources/pane_preview_over.svg",
- ":Resources/pane_preview_on.svg");
- m_previewButton->setToolTip(tr("Preview"));
- x += 5 + iconWidth;
- titleBar->add(QPoint(x, 2), m_previewButton);
- m_previewButton->setButtonSet(viewModeButtonSet, 1);
-
- ret = ret && connect(viewModeButtonSet, SIGNAL(selected(int)), this,
- SLOT(setCurrentViewType(int)));
- assert(ret);
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::onXshLevelSwitched(TXshLevel *) { changeWindowTitle(); }
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::changeWindowTitle() {
- TApp *app = TApp::instance();
- ToonzScene *scene = app->getCurrentScene()->getScene();
- if (!scene) return;
- int frame = app->getCurrentFrame()->getFrame();
- QString name;
- if (app->getCurrentFrame()->isEditingScene()) {
- QString sceneName = QString::fromStdWString(scene->getSceneName());
- if (sceneName.isEmpty()) sceneName = tr("Untitled");
- if (app->getCurrentScene()->getDirtyFlag()) sceneName += QString("*");
- name = tr("Scene: ") + sceneName;
- if (frame >= 0)
- name = name + tr(" :: Frame: ") + tr(toString(frame + 1).c_str());
- int col = app->getCurrentColumn()->getColumnIndex();
- if (col < 0) {
- setWindowTitle(name);
- return;
- }
- TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
- TXshCell cell = xsh->getCell(frame, col);
- if (cell.isEmpty()) {
- setWindowTitle(name);
- return;
- }
- assert(cell.m_level.getPointer());
- TFilePath fp(cell.m_level->getName());
- QString imageName =
- QString::fromStdWString(fp.withFrame(cell.m_frameId).getWideString());
- name = name + tr(" :: Level: ") + imageName;
- } else {
- TXshLevel *level = app->getCurrentLevel()->getLevel();
- if (level) {
- TFilePath fp(level->getName());
- QString imageName = QString::fromStdWString(
- fp.withFrame(app->getCurrentFrame()->getFid()).getWideString());
- name = name + tr("Level: ") + imageName;
- }
- }
- if (m_stackedWidget->currentIndex() == 0) {
- TAffine aff = m_sceneViewer->getViewMatrix() *
- m_sceneViewer->getNormalZoomScale().inv();
- name = name + " :: Zoom : " +
- QString::number(tround(100.0 * sqrt(aff.det()))) + "%";
- } else {
- TAffine aff = m_lineTestViewer->getViewMatrix() *
- m_lineTestViewer->getNormalZoomScale().inv();
- name = name + " :: Zoom : " +
- QString::number(tround(100.0 * sqrt(aff.det()))) + "%";
- }
-
- setWindowTitle(name);
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::updateFrameRange() {
- TApp *app = TApp::instance();
- TFrameHandle *fh = app->getCurrentFrame();
- int frameIndex = fh->getFrameIndex();
- int maxFrameIndex = fh->getMaxFrameIndex();
- m_flipConsole->setFrameRange(1, maxFrameIndex + 1, 1, frameIndex + 1);
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::updateFrameMarkers() {
- int fromIndex, toIndex, dummy;
- XsheetGUI::getPlayRange(fromIndex, toIndex, dummy);
- TFrameHandle *fh = TApp::instance()->getCurrentFrame();
- if (fh->isEditingLevel()) {
- fromIndex = 0;
- toIndex = -1;
- }
- m_flipConsole->setMarkers(fromIndex, toIndex);
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::setCurrentViewType(int index) {
- TFrameHandle *frameHandle = TApp::instance()->getCurrentFrame();
- if (index == 1 && frameHandle->getFrameType() == TFrameHandle::LevelFrame)
- frameHandle->setFrame(frameHandle->getFrameIndex());
- m_stackedWidget->setCurrentIndex(index);
- if (index == 0) {
- CommandManager::instance()->enable("MI_ViewTable", true);
- CommandManager::instance()->enable("MI_FieldGuide", true);
- CommandManager::instance()->enable("MI_SafeArea", true);
- CommandManager::instance()->enable("MI_RasterizePli", true);
- CommandManager::instance()->enable("MI_ViewColorcard", true);
- CommandManager::instance()->enable("MI_ViewCamera", true);
- m_flipConsole->enableButton(FlipConsole::eFilledRaster, false, false);
- } else {
- CommandManager::instance()->enable("MI_ViewTable", false);
- CommandManager::instance()->enable("MI_FieldGuide", false);
- CommandManager::instance()->enable("MI_SafeArea", false);
- CommandManager::instance()->enable("MI_RasterizePli", false);
- CommandManager::instance()->enable("MI_ViewColorcard", false);
- CommandManager::instance()->enable("MI_ViewCamera", false);
- if (m_flipConsole)
- m_flipConsole->enableButton(FlipConsole::eFilledRaster, true, false);
- }
- changeWindowTitle();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::onDrawFrame(int frame,
- const ImagePainter::VisualSettings &settings) {
- TApp *app = TApp::instance();
- TFrameHandle *frameHandle = app->getCurrentFrame();
-
- assert(frame >= 0);
- if (frame != frameHandle->getFrameIndex() + 1) {
- int oldFrame = frameHandle->getFrame();
- frameHandle->setCurrentFrame(frame);
- if (!m_mainTrack && !frameHandle->isPlaying() &&
- !frameHandle->isEditingLevel() && oldFrame != frameHandle->getFrame())
- frameHandle->scrubXsheet(
- frame - 1, frame - 1,
- TApp::instance()->getCurrentXsheet()->getXsheet());
-
- // qDebug("frame: %d",frame);
- if (m_mainTrack && frameHandle->isPlaying() &&
- !frameHandle->isEditingLevel()) {
- if (frame == m_startPlayRange + 1) {
- if (m_startTrack) {
- m_mainTrack = m_startTrack;
- m_trackStartFrame = frame;
- // qDebug("1. play at m_trackStartFrame: %d", m_trackStartFrame);
- playSound();
-
- m_bufferSize = m_startBufferSize;
- computeBuffer(frame);
- } else {
- // qDebug("2. play at m_trackStartFrame: %d", m_trackStartFrame);
- assert(0);
- initSound();
- }
- }
- int frameElapsed = frame - m_trackStartFrame - 1;
- if (frameElapsed >= (m_bufferSize)) {
- if (m_buffer) m_mainTrack = m_buffer->clone();
-
- m_trackStartFrame = frame;
- // qDebug("PLAY SOUND AT FRAME: %d", frame);
- playSound();
-
- // qDebug("3. play at m_trackStartFrame: %d", m_trackStartFrame);
- m_bufferSize = m_nextBufferSize;
- computeBuffer(frame);
- }
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::onComputedBuffer() {
- m_buffer = TSoundTrackP();
- m_buffer = m_mixAudioThread.getBuffer();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::onPlayStateChanged(bool value) {
- TFrameHandle *frameHandle = TApp::instance()->getCurrentFrame();
- bool wasPlaying = frameHandle->isPlaying();
- frameHandle->setPlaying(value);
- if (value && !frameHandle->isEditingLevel()) {
- if (m_player && wasPlaying) {
- m_player->close();
- if (m_mainTrack) m_mainTrack = TSoundTrackP();
- if (m_startTrack) m_startTrack = TSoundTrackP();
- if (m_buffer) m_buffer = TSoundTrackP();
- }
- initSound();
- playSound();
- } else if (m_player) {
- m_player->close();
- if (m_mainTrack) m_mainTrack = TSoundTrackP();
- if (m_startTrack) m_startTrack = TSoundTrackP();
- if (m_buffer) m_buffer = TSoundTrackP();
- }
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::onSceneChanged() {
- TApp *app = TApp::instance();
- ToonzScene *scene = app->getCurrentScene()->getScene();
- assert(scene);
- m_flipConsole->updateCurrentFPS(
- scene->getProperties()->getOutputProperties()->getFrameRate());
-
- updateFrameRange();
- updateFrameMarkers();
- changeWindowTitle();
-
- int frameIndex = app->getCurrentFrame()->getFrameIndex();
- if (m_keyFrameButton->getCurrentFrame() != frameIndex)
- m_keyFrameButton->setCurrentFrame(frameIndex);
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::onSceneSwitched() {
- if (!isHidden()) onSceneChanged();
- m_flipConsole->setFrameRate(TApp::instance()
- ->getCurrentScene()
- ->getScene()
- ->getProperties()
- ->getOutputProperties()
- ->getFrameRate());
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::onFrameSwitched() {
- int frameIndex = TApp::instance()->getCurrentFrame()->getFrameIndex();
- m_flipConsole->setCurrentFrame(frameIndex + 1);
- if (m_keyFrameButton->getCurrentFrame() != frameIndex)
- m_keyFrameButton->setCurrentFrame(frameIndex);
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::onFrameTypeChanged() {
- if (TApp::instance()->getCurrentFrame()->getFrameType() ==
- TFrameHandle::LevelFrame) {
- if (m_stackedWidget->currentIndex() != 0) {
- m_cameraStandButton->setPressed(true);
- m_previewButton->setPressed(false);
- setCurrentViewType(0);
- }
- }
-
- updateFrameRange();
- updateFrameMarkers();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestPane::onFlipSliderReleased() {
- TApp::instance()->getCurrentXsheet()->getXsheet()->stopScrub();
-}
-
-#endif
diff --git a/toonz/sources/toonz/linetestpane.h b/toonz/sources/toonz/linetestpane.h
deleted file mode 100644
index 339f3a267..000000000
--- a/toonz/sources/toonz/linetestpane.h
+++ /dev/null
@@ -1,118 +0,0 @@
-#pragma once
-
-#ifndef LINETEST_PANE_INCLUDED
-#define LINETEST_PANE_INCLUDED
-
-#ifdef LINETEST
-
-#include "pane.h"
-#include "linetestviewer.h"
-#include "sceneviewer.h"
-#include "toonz/imagepainter.h"
-#include "toonzqt/intfield.h"
-#include "toonzqt/keyframenavigator.h"
-#include "toonzqt/flipconsole.h"
-
-#include <QThread>
-#include <QWaitCondition>
-
-class QStackedWidget;
-
-//=============================================================================
-// MixAudioThread
-//-----------------------------------------------------------------------------
-
-class MixAudioThread final : public QThread {
- Q_OBJECT
-
- bool m_abort;
- bool m_restart;
-
- int m_from;
- int m_to;
-
- QWaitCondition m_condition;
-
- TSoundTrackP m_computedBuffer;
- TSoundTrackP m_buffer;
-
-public:
- QMutex m_mutex;
-
- MixAudioThread(QObject *parent = 0);
- ~MixAudioThread();
-
- void computeBuffer(int fromFrame, int toFrame);
-
- TSoundTrackP getBuffer() { return m_buffer; }
-
-protected:
- void run();
-
-signals:
- void computedBuffer();
-};
-
-//=============================================================================
-// LineTestPanel
-//-----------------------------------------------------------------------------
-// Andrebbe messo a fattor comune del codice con ViewerPane
-class LineTestPane final : public TPanel {
- Q_OBJECT
-
- QStackedWidget *m_stackedWidget;
- SceneViewer *m_sceneViewer;
- LineTestViewer *m_lineTestViewer;
- FlipConsole *m_flipConsole;
- ViewerKeyframeNavigator *m_keyFrameButton;
-
- TSoundTrackP m_mainTrack, m_startTrack; // used in loop
- TSoundTrackP m_buffer;
- int m_bufferSize; // in Frames
- int m_nextBufferSize; // in Frames
- int m_startBufferSize; // in Frames
- MixAudioThread m_mixAudioThread;
- TSoundOutputDevice *m_player;
-
- TPanelTitleBarButton *m_previewButton;
- TPanelTitleBarButton *m_cameraStandButton;
-
- // For audio playback
- int m_trackStartFrame;
- int m_startPlayRange, m_endPlayRange;
-
-public:
- LineTestPane(QWidget *parent = 0, Qt::WFlags flags = 0);
- ~LineTestPane();
-
-protected:
- void showEvent(QShowEvent *);
- void hideEvent(QHideEvent *);
-
- int computeBufferSize(int frame);
- void computeBuffer(int frame);
- void initSound();
- void playSound();
- void initializeTitleBar(TPanelTitleBar *titleBar);
-
-public slots:
- void changeWindowTitle();
- void onSceneChanged();
- void onXshLevelSwitched(TXshLevel *);
- void updateFrameRange();
- void updateFrameMarkers();
-
-protected slots:
- void setCurrentViewType(int index);
- void onDrawFrame(int frame, const ImagePainter::VisualSettings &settings);
- void onComputedBuffer();
- void onPlayStateChanged(bool);
- void onFrameSwitched();
- void onSceneSwitched();
- void onFrameTypeChanged();
- void onFlipSliderReleased();
-};
-
-#endif // LINETEST
-
-#endif
diff --git a/toonz/sources/toonz/linetestviewer.cpp b/toonz/sources/toonz/linetestviewer.cpp
deleted file mode 100644
index f40aed0a1..000000000
--- a/toonz/sources/toonz/linetestviewer.cpp
+++ /dev/null
@@ -1,846 +0,0 @@
-
-
-#include "linetestviewer.h"
-#ifdef LINETEST
-#include "tapp.h"
-#include "viewerdraw.h"
-#include "timagecache.h"
-#include "tgl.h"
-#include "trop.h"
-#include "toonz/txsheethandle.h"
-#include "toonz/tframehandle.h"
-#include "toonz/tcolumnhandle.h"
-#include "toonz/txshlevelhandle.h"
-#include "toonz/tobjecthandle.h"
-#include "toonz/txshsimplelevel.h"
-#include "toonz/stage2.h"
-#include "toonz/stagevisitor.h"
-#include "toonz/tonionskinmaskhandle.h"
-#include "toonz/imagemanager.h"
-#include "toonz/tstageobjecttree.h"
-#include "toonz/childstack.h"
-#include "toonz/dpiscale.h"
-#include "toonz/toonzscene.h"
-#include "toonz/sceneproperties.h"
-#include "toonz/tcamera.h"
-#include "tools/toolhandle.h"
-#include "tools/cursormanager.h"
-#include "tools/toolcommandids.h"
-#include "toonzqt/menubarcommand.h"
-#include "toonzqt/imageutils.h"
-
-#include <QPainter>
-#include <QPaintEvent>
-#include <QApplication>
-#include <QInputContext>
-#include <QMenu>
-
-#ifndef USE_QPAINTER
-GLshort vertices[] = {0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0};
-
-GLshort coords[] = {0, 1, 0, 0, 1, 0, 1, 1};
-
-// function pointers for PBO Extension
-// Windows needs to get function pointers from ICD OpenGL drivers,
-// because opengl32.dll does not support extensions higher than v1.1.
-#ifdef _WIN32
-PFNGLGENBUFFERSARBPROC pglGenBuffersARB = 0; // VBO Name Generation Procedure
-PFNGLBINDBUFFERARBPROC pglBindBufferARB = 0; // VBO Bind Procedure
-PFNGLBUFFERDATAARBPROC pglBufferDataARB = 0; // VBO Data Loading Procedure
-PFNGLBUFFERSUBDATAARBPROC pglBufferSubDataARB =
- 0; // VBO Sub Data Loading Procedure
-PFNGLDELETEBUFFERSARBPROC pglDeleteBuffersARB = 0; // VBO Deletion Procedure
-PFNGLGETBUFFERPARAMETERIVARBPROC pglGetBufferParameterivARB =
- 0; // return various parameters of VBO
-PFNGLMAPBUFFERARBPROC pglMapBufferARB = 0; // map VBO procedure
-PFNGLUNMAPBUFFERARBPROC pglUnmapBufferARB = 0; // unmap VBO procedure
-#define glGenBuffersARB pglGenBuffersARB
-#define glBindBufferARB pglBindBufferARB
-#define glBufferDataARB pglBufferDataARB
-#define glBufferSubDataARB pglBufferSubDataARB
-#define glDeleteBuffersARB pglDeleteBuffersARB
-#define glGetBufferParameterivARB pglGetBufferParameterivARB
-#define glMapBufferARB pglMapBufferARB
-#define glUnmapBufferARB pglUnmapBufferARB
-#endif
-
-#endif // USE_QPAINTER
-
-//-----------------------------------------------------------------------------
-namespace {
-//-----------------------------------------------------------------------------
-
-void initToonzEvent(TMouseEvent &toonzEvent, QMouseEvent *event,
- int widgetHeight, double pressure, bool isTablet) {
- toonzEvent.m_pos =
- TPoint(event->pos().x(), widgetHeight - 1 - event->pos().y());
- toonzEvent.setModifiers(event->modifiers() & Qt::ShiftModifier,
- event->modifiers() & Qt::AltModifier,
- event->modifiers() & Qt::CtrlModifier);
-
- if (isTablet)
- toonzEvent.m_pressure = (int)(255 * pressure);
- else
- toonzEvent.m_pressure = 255;
-}
-
-//-----------------------------------------------------------------------------
-
-class ViewerZoomer final : public ImageUtils::ShortcutZoomer {
-public:
- ViewerZoomer(QWidget *parent) : ShortcutZoomer(parent) {}
- void zoom(bool zoomin, bool resetZoom) {
- if (resetZoom)
- ((LineTestViewer *)getWidget())->resetView();
- else
- ((LineTestViewer *)getWidget())->zoomQt(zoomin, resetZoom);
- }
- void fit() {
- //((LineTestViewer*)getWidget())->fitToCamera();
- }
- void setActualPixelSize() {
- //((LineTestViewer*)getWidget())->setActualPixelSize();
- }
-};
-
-//-----------------------------------------------------------------------------
-} // namespace
-//-----------------------------------------------------------------------------
-
-// definito - per ora - in tapp.cpp
-extern string updateToolEnableStatus(TTool *tool);
-
-//=============================================================================
-// LineTestViewer
-//-----------------------------------------------------------------------------
-
-LineTestViewer::LineTestViewer(QWidget *parent)
-#ifdef USE_QPAINTER
- : QWidget(parent)
-#else
- : QOpenGLWidget(parent)
-//, m_pboSupported(false)
-#endif // USE_QPAINTER
- , m_pos()
- , m_mouseButton(Qt::NoButton)
- , m_viewAffine() {
- m_viewAffine = getNormalZoomScale();
- setMouseTracking(true);
-}
-
-//-----------------------------------------------------------------------------
-
-LineTestViewer::~LineTestViewer() {
- //#ifndef USE_QPAINTER
- // clean up PBO
- // if(m_pboSupported)
- // glDeleteBuffersARB(1, &m_pboId);
- //#endif //USE_QPAINTER
-}
-
-//-----------------------------------------------------------------------------
-
-TPointD LineTestViewer::winToWorld(const QPoint &pos) const {
- // coordinate window (origine in alto a sinistra) -> coordinate colonna
- // (origine al centro dell'immagine)
- TPointD pp(pos.x() - width() * 0.5, -pos.y() + height() * 0.5);
- return getViewMatrix().inv() * pp;
-}
-
-//-----------------------------------------------------------------------------
-
-TPointD LineTestViewer::winToWorld(const TPoint &winPos) const {
- return winToWorld(QPoint(winPos.x, height() - winPos.y));
-}
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::resetInputMethod() { qApp->inputContext()->reset(); }
-
-//-----------------------------------------------------------------------------
-
-TAffine LineTestViewer::getViewMatrix() const {
- int frame = TApp::instance()->getCurrentFrame()->getFrame();
- TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
- TAffine aff = xsh->getCameraAff(frame);
- return m_viewAffine * aff.inv();
-}
-
-//-----------------------------------------------------------------------------
-
-#ifdef USE_QPAINTER
-
-void LineTestViewer::paintEvent(QPaintEvent *) {
- QPainter p(this);
- p.begin(this);
- p.resetMatrix();
-
- TApp *app = TApp::instance();
- ToonzScene *scene = app->getCurrentScene()->getScene();
-
- p.fillRect(visibleRegion().boundingRect(), QBrush(QColor(Qt::white)));
- TPixel32 cameraBgColor = scene->getProperties()->getBgColor();
- TPixel32 viewerBgColor = scene->getProperties()->getViewerBgColor();
- p.fillRect(visibleRegion().boundingRect(),
- QBrush(QColor(viewerBgColor.r, viewerBgColor.g, viewerBgColor.b,
- viewerBgColor.m)));
-
- int h = height();
- int w = width();
- TDimension viewerSize(w, h);
- TRect clipRect(viewerSize);
- clipRect -= TPoint(viewerSize.lx * 0.5, viewerSize.ly * 0.5);
-
- TAffine viewAff = getViewMatrix();
-
- Stage::RasterPainter stagePainter(viewerSize, viewAff, clipRect, 0, true);
-
- TFrameHandle *frameHandle = app->getCurrentFrame();
- if (app->getCurrentFrame()->isEditingLevel()) {
- Stage::visit(stagePainter, app->getCurrentLevel()->getLevel(),
- app->getCurrentFrame()->getFid(), OnionSkinMask(),
- frameHandle->isPlaying());
- } else {
- int xsheetLevel = 0;
- TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
- int frame = app->getCurrentFrame()->getFrame();
-
- Stage::VisitArgs args;
- args.scene = scene;
- args.xsh = xsh;
- args.row = frame;
- args.currentColumnIndex = app->getCurrentColumn()->getColumnIndex();
- OnionSkinMask osm = app->getCurrentOnionSkin()->getOnionSkinMask();
- args.osm = &osm;
- args.xsheetLevel = xsheetLevel;
- args.isPlaying = frameHandle->isPlaying();
- args.onlyVisible = true;
- args.checkPreviewVisibility = true;
- Stage::visit(stagePainter, args);
- }
-
- // Draw camera rect and mask
- TRectD rect = ViewerDraw::getCameraRect();
- TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
- TStageObjectId cameraId = xsh->getStageObjectTree()->getCurrentCameraId();
- int row = app->getCurrentFrame()->getFrameIndex();
- double cameraZ = xsh->getZ(cameraId, row);
- TAffine aff =
- xsh->getPlacement(cameraId, row) * TScale((1000 + cameraZ) / 1000);
- aff = TAffine(1, 0, 0, 0, -1, viewerSize.ly) *
- TTranslation(viewerSize.lx * 0.5, viewerSize.ly * 0.5) * viewAff * aff;
- QMatrix matrix(aff.a11, aff.a21, aff.a12, aff.a22, aff.a13, aff.a23);
- QPolygon cameraPolygon(
- QRect(rect.getP00().x, rect.getP00().y, rect.getLx(), rect.getLy()));
- cameraPolygon = cameraPolygon * matrix;
-
- p.fillRect(cameraPolygon.boundingRect(),
- QBrush(QColor(cameraBgColor.r, cameraBgColor.g, cameraBgColor.b,
- cameraBgColor.m)));
- stagePainter.drawRasterImages(p, cameraPolygon);
-
- p.end();
-}
-
-#else
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::initializeGL() {
- glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 4); // 4-byte pixel alignment
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_TEXTURE_2D);
- // checkPBOSupport();
-
- // Generater pbuffer
- // if(m_pboSupported)
- // glGenBuffersARB(1, &m_pboId);
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::resizeGL(int width, int height) {
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0, width, 0, height, -1, 1);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- // To maintain pixel accuracy
- glTranslated(0.375, 0.375, 0.0);
-}
-
-//-----------------------------------------------------------------------------
-
-//#include "tstopwatch.h"
-
-void LineTestViewer::paintRaster(TRasterP ras) {
- // TStopWatch timer;
- // TStopWatch timer2;
- // timer.start();
- // timer2.start();
-
- int w = ras->getLx();
- int h = ras->getLy();
-
- vertices[1] = h;
- vertices[6] = w;
- vertices[9] = w;
- vertices[10] = h;
-
- int dataSize = w * h * 4;
-
- // timer.stop();
- // timer2.stop();
- // qDebug("time 1: %d",timer.getTotalTime());
- // timer.start(true);
- // timer2.start();
-
- /****************************************************************************************
-ATTENZIONE!!! Qeesto codice potrebbe dare problemi!!!!!
-quando si utilizzano le texture le loro dimensioni dovrebbero essere potenze di
-dur...
-le nuove schede grafiche sembrerebbero funzionare lo stesso ma le vecchie a
-volte danno problemi!!!
-Inoltre non viene fatto il controllo se le dimenzioni dei raster da disegnare
-superano le dimenzioni
-supportate dalla scheda grafica... se cio' accade bisognerebbe spezzare il
-raster in due...
-Questo codice sembra essere meolto veloce (cosa di cui abbiamo bisogno) ma puo'
-dare seri problemi!!!!
-*****************************************************************************************/
-
- ras->lock();
- int pixelSize = ras->getPixelSize();
- glGenTextures(1, &m_textureId);
- glBindTexture(GL_TEXTURE_2D, m_textureId);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
- if (pixelSize == 4)
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE,
- (GLvoid *)0);
- else if (pixelSize == 1) {
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE8, w, h, 0, GL_LUMINANCE,
- GL_UNSIGNED_BYTE, (GLvoid *)0);
- } else
- return;
-
- // if(m_pboSupported)
- // {
- // // bind PBO to update pixel values
- // glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, m_pboId);
-
- // // map the buffer object into client's memory
- // // Note that glMapBufferARB() causes sync issue.
- // // If GPU is working with this buffer, glMapBufferARB() will wait(stall)
- // // for GPU to finish its job. To avoid waiting (stall), you can call
- // // first glBufferDataARB() with NULL pointer before glMapBufferARB().
- // // If you do that, the previous data in PBO will be discarded and
- // // glMapBufferARB() returns a new allocated pointer immediately
- // // even if GPU is still working with the previous data.
-
- // glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, dataSize, 0,
- // GL_STREAM_DRAW_ARB);
- // GLubyte* ptr = (GLubyte*)glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB,
- // GL_WRITE_ONLY_ARB);
- // if(ptr)
- // {
- // ras->lock();
- // memcpy( ptr, ras->getRawData(), dataSize);
- // glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB); // release pointer
- // to
- // mapping buffer
- // ras->unlock();
- // }
-
- // // it is good idea to release PBOs with ID 0 after use.
- // // Once bound with 0, all pixel operations behave normal ways.
- // //glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
- //
- // // bind the texture and PBO
- // glBindTexture(GL_TEXTURE_2D, m_textureId);
- // glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, m_pboId);
- // // copy pixels from PBO to texture object
- // // Use offset instead of ponter.
- // glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE,
- // 0);
- // }
- // else
- // {
- // start to copy pixels from system memory to textrure object
- glBindTexture(GL_TEXTURE_2D, m_textureId);
- if (pixelSize == 4)
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE,
- (GLvoid *)ras->getRawData());
- else if (pixelSize == 1)
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_LUMINANCE,
- GL_UNSIGNED_BYTE, (GLvoid *)ras->getRawData());
- else
- return;
- ras->unlock();
- // }
-
- glEnable(GL_BLEND);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glVertexPointer(3, GL_SHORT, 0, vertices);
- glTexCoordPointer(2, GL_SHORT, 0, &coords);
- glDrawArrays(GL_QUADS, 0, 4);
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisable(GL_BLEND);
-
- // clean up texture
- glDeleteTextures(1, &m_textureId);
-
- // timer.stop();
- // timer2.stop();
- // qDebug("time 2: %d",timer.getTotalTime());
- // qDebug("total time: %d",timer2.getTotalTime());
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::paintGL() {
- TApp *app = TApp::instance();
- ToonzScene *scene = app->getCurrentScene()->getScene();
-
- TPixel32 cameraBgColor = scene->getProperties()->getBgColor();
- TPixel32 viewerBgColor = scene->getProperties()->getViewerBgColor();
- glClearColor(viewerBgColor.r / 255.0, viewerBgColor.g / 255.0,
- viewerBgColor.b / 255.0, viewerBgColor.m / 255.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- int h = height();
- int w = width();
- TDimension viewerSize(w, h);
- TRect clipRect(viewerSize);
- // clipRect -= TPoint(viewerSize.lx*0.5,viewerSize.ly*0.5);
-
- TAffine viewAff = getViewMatrix();
-
- Stage::RasterPainter stagePainter(viewerSize, viewAff, clipRect, 0, true);
-
- TFrameHandle *frameHandle = app->getCurrentFrame();
- int frame = frameHandle->getFrame();
- if (app->getCurrentFrame()->isEditingLevel()) {
- Stage::visit(stagePainter, app->getCurrentLevel()->getLevel(),
- frameHandle->getFid(), OnionSkinMask(),
- frameHandle->isPlaying());
- } else {
- int xsheetLevel = 0;
- TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
-
- Stage::VisitArgs args;
- args.scene = scene;
- args.xsh = xsh;
- args.row = frame;
- args.currentColumnIndex = app->getCurrentColumn()->getColumnIndex();
- OnionSkinMask osm = app->getCurrentOnionSkin()->getOnionSkinMask();
- args.osm = &osm;
- args.xsheetLevel = xsheetLevel;
- args.isPlaying = frameHandle->isPlaying();
- args.onlyVisible = true;
- args.checkPreviewVisibility = true;
- Stage::visit(stagePainter, args);
- }
-
- // Draw camera rect and mask
- TRectD cameraRect = ViewerDraw::getCameraRect();
- TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
- TStageObjectId cameraId = xsh->getStageObjectTree()->getCurrentCameraId();
- int row = frameHandle->getFrameIndex();
- double cameraZ = xsh->getZ(cameraId, row);
- TAffine aff =
- xsh->getPlacement(cameraId, row) * TScale((1000 + cameraZ) / 1000);
- aff = TTranslation(viewerSize.lx * 0.5, viewerSize.ly * 0.5) * viewAff * aff;
- QMatrix matrix(aff.a11, aff.a21, aff.a12, aff.a22, aff.a13, aff.a23);
- QPolygon cameraPolygon(QRect(cameraRect.getP00().x, cameraRect.getP00().y,
- cameraRect.getLx(), cameraRect.getLy()));
- cameraPolygon = cameraPolygon * matrix;
-
- tglColor(cameraBgColor);
-
- glBegin(GL_POLYGON);
- glVertex2d(cameraPolygon.at(0).x(), cameraPolygon.at(0).y());
- glVertex2d(cameraPolygon.at(1).x(), cameraPolygon.at(1).y());
- glVertex2d(cameraPolygon.at(2).x(), cameraPolygon.at(2).y());
- glVertex2d(cameraPolygon.at(3).x(), cameraPolygon.at(3).y());
- glEnd();
-
- tglColor(TPixel::White);
-
- int nodesSize = stagePainter.getNodesCount();
- if (nodesSize == 0) return;
-
- int cameraWidth = cameraPolygon.at(2).x() - cameraPolygon.at(0).x();
- int cameraHeight = cameraPolygon.at(2).y() - cameraPolygon.at(0).y();
-
- int i;
- GLfloat mat[4][4];
- QMatrix mtx;
- // GLubyte *pbo;
- // TRaster32P pboRaster;
- // if(m_pboSupported)
- //{
- // glGenTextures(1, &m_textureId);
- // glBindTexture(GL_TEXTURE_2D, m_textureId);
- // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
- // glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, cameraWidth, cameraHeight, 0,
- // GL_BGRA, GL_UNSIGNED_BYTE, (GLvoid*)0);
-
- // glBindTexture(GL_TEXTURE_2D, m_textureId);
- // glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, m_pboId);
- // // copy pixels from PBO to texture object
- // // Use offset instead of ponter.
- // glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, cameraWidth, cameraHeight,
- // GL_BGRA, GL_UNSIGNED_BYTE, 0);
-
- // // bind PBO to update pixel values
- // glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, m_pboId);
-
- // // map the buffer object into client's memory
- // // Note that glMapBufferARB() causes sync issue.
- // // If GPU is working with this buffer, glMapBufferARB() will wait(stall)
- // // for GPU to finish its job. To avoid waiting (stall), you can call
- // // first glBufferDataARB() with NULL pointer before glMapBufferARB().
- // // If you do that, the previous data in PBO will be discarded and
- // // glMapBufferARB() returns a new allocated pointer immediately
- // // even if GPU is still working with the previous data.
- // glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, cameraWidth * cameraHeight *
- // 4, 0, GL_STREAM_DRAW_ARB);
- // pbo = (GLubyte*)glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB,
- // GL_WRITE_ONLY_ARB);
-
- // pboRaster = TRaster32P(cameraWidth, cameraHeight,cameraWidth,
- //(TPixelRGBM32*) pbo, false);
- // pboRaster->fill(TPixel32::Green);
- //}
-
- glScissor(cameraPolygon.at(0).x(), cameraPolygon.at(0).y(), cameraWidth,
- cameraHeight);
- glEnable(GL_SCISSOR_TEST);
-
- // if(!m_pboSupported)
- glPushMatrix();
- for (i = 0; i < nodesSize; i++) {
- TRasterP ras = stagePainter.getRaster(i, mtx);
- if (!ras.getPointer()) continue;
-
- // if(!m_pboSupported)
- //{
- // Matrix tranformation
- mat[0][0] = mtx.m11();
- mat[0][1] = mtx.m12();
- mat[0][2] = 0;
- mat[0][3] = 0;
-
- mat[1][0] = mtx.m21();
- mat[1][1] = mtx.m22();
- mat[1][2] = 0;
- mat[1][3] = 0;
-
- mat[2][0] = 0;
- mat[2][1] = 0;
- mat[2][2] = 1;
- mat[2][3] = 0;
-
- mat[3][0] = mtx.dx();
- mat[3][1] = mtx.dy();
- mat[3][2] = 0;
- mat[3][3] = 1;
-
- // Draw Raster
- // CASO NON PBO
- glLoadMatrixf(&mat[0][0]);
- paintRaster(ras);
- //}
- // else
- //{
- // TAffine aff;//
- //(mtx.m11(),mtx.m12(),mtx.dx(),mtx.m21(),mtx.m22(),mtx.dy());
- // //TRop::quickPut(pboRaster, ras, aff);
- //}
- }
- // if(!m_pboSupported)
- glPopMatrix();
-
- // Convert PBO to texture and draw it
- // if(m_pboSupported)
- //{
- // glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
-
- // vertices[0] = cameraPolygon.at(0).x();
- // vertices[1] = cameraPolygon.at(0).y() + cameraHeight;
-
- // vertices[3] = cameraPolygon.at(0).x();
- // vertices[4] = cameraPolygon.at(0).y();
-
- // vertices[6] = cameraPolygon.at(0).x() + cameraWidth;
- // vertices[7] = cameraPolygon.at(0).y();
-
- // vertices[9] = cameraPolygon.at(0).x() + cameraWidth;
- // vertices[10] = cameraPolygon.at(0).y() + cameraHeight;
-
- // glBindTexture(GL_TEXTURE_2D, m_textureId);
-
- // glEnable(GL_BLEND);
- // glEnableClientState(GL_VERTEX_ARRAY);
- // glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- // glVertexPointer(3, GL_SHORT, 0, vertices);
- // glTexCoordPointer(2,GL_SHORT,0,&coords);
- // glDrawArrays(GL_QUADS, 0, 4);
- // glDisableClientState(GL_VERTEX_ARRAY);
- // glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- // glDisable(GL_BLEND);
-
- // // clean up texture
- // glDeleteTextures(1, &m_textureId);
- //}
-
- glDisable(GL_SCISSOR_TEST);
-
- stagePainter.clearNodes();
-}
-
-#endif // USE_QPAINTER
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::showEvent(QShowEvent *) {
- TApp *app = TApp::instance();
-
- bool ret = true;
-
- ret = ret && connect(TApp::instance()->getCurrentObject(),
- SIGNAL(objectSwitched()), this, SLOT(update()));
- ret = ret && connect(TApp::instance()->getCurrentObject(),
- SIGNAL(objectChanged(bool)), this, SLOT(update()));
-
- ret = ret && connect(TApp::instance()->getCurrentOnionSkin(),
- SIGNAL(onionSkinMaskChanged()), this, SLOT(update()));
-
- ret = ret && connect(TApp::instance()->getCurrentLevel(),
- SIGNAL(xshLevelChanged()), this, SLOT(update()));
-
- TFrameHandle *frameHandle = app->getCurrentFrame();
- ret = ret &&
- connect(frameHandle, SIGNAL(frameSwitched()), this, SLOT(update()));
-
- TXsheetHandle *xsheetHandle = app->getCurrentXsheet();
- ret = ret &&
- connect(xsheetHandle, SIGNAL(xsheetChanged()), this, SLOT(update()));
- ret = ret &&
- connect(xsheetHandle, SIGNAL(xsheetSwitched()), this, SLOT(update()));
-
- TSceneHandle *sceneHandle = app->getCurrentScene();
- ret = ret && connect(sceneHandle, SIGNAL(sceneSwitched()), this,
- SLOT(onSceneSwitched()));
- ret =
- ret && connect(sceneHandle, SIGNAL(sceneChanged()), this, SLOT(update()));
-
- ret = ret && connect(TApp::instance()->getCurrentOnionSkin(),
- SIGNAL(onionSkinMaskChanged()), this, SLOT(update()));
-
- assert(ret);
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::hideEvent(QHideEvent *e) {
- TApp *app = TApp::instance();
-
- disconnect(TApp::instance()->getCurrentObject(), SIGNAL(objectSwitched()),
- this, SLOT(update()));
- disconnect(TApp::instance()->getCurrentObject(), SIGNAL(objectChanged(bool)),
- this, SLOT(update()));
-
- disconnect(TApp::instance()->getCurrentOnionSkin(),
- SIGNAL(onionSkinMaskChanged()), this, SLOT(update()));
-
- disconnect(TApp::instance()->getCurrentLevel(), SIGNAL(xshLevelChanged()),
- this, SLOT(update()));
-
- TFrameHandle *frameHandle = app->getCurrentFrame();
- disconnect(frameHandle, SIGNAL(frameSwitched()), this, SLOT(update()));
-
- TXsheetHandle *xsheetHandle = app->getCurrentXsheet();
- disconnect(xsheetHandle, SIGNAL(xsheetChanged()), this, SLOT(update()));
- disconnect(xsheetHandle, SIGNAL(xsheetSwitched()), this, SLOT(update()));
-
- TSceneHandle *sceneHandle = app->getCurrentScene();
- disconnect(sceneHandle, SIGNAL(sceneSwitched()), this,
- SLOT(onSceneSwitched()));
- disconnect(sceneHandle, SIGNAL(sceneChanged()), this, SLOT(update()));
-
- disconnect(TApp::instance()->getCurrentOnionSkin(),
- SIGNAL(onionSkinMaskChanged()), this, SLOT(update()));
-
- QWidget::hideEvent(e);
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::leaveEvent(QEvent *) {
- // update();
- QApplication::restoreOverrideCursor();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::enterEvent(QEvent *) {
- QApplication::setOverrideCursor(Qt::ForbiddenCursor);
- // update();
- setFocus();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::mouseMoveEvent(QMouseEvent *event) {
- if (m_mouseButton == Qt::MidButton) {
- // panning
- QPoint curPos = event->pos();
- panQt(curPos - m_pos);
- m_pos = curPos;
- return;
- }
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::mousePressEvent(QMouseEvent *event) {
- m_pos = event->pos();
- m_mouseButton = event->button();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::mouseReleaseEvent(QMouseEvent *event) {
- m_pos = QPoint(0, 0);
- m_mouseButton = Qt::NoButton;
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::wheelEvent(QWheelEvent *e) {
- if (e->orientation() == Qt::Horizontal) return;
- int delta = e->delta() > 0 ? 120 : -120;
- zoomQt(e->pos(), exp(0.001 * delta));
-}
-
-//-----------------------------------------------------------------------------
-
-// delta.x: right panning, pixel; delta.y: down panning, pixel
-void LineTestViewer::panQt(const QPoint &delta) {
- if (delta == QPoint()) return;
- m_viewAffine = TTranslation(delta.x(), -delta.y()) * m_viewAffine;
- update();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::contextMenuEvent(QContextMenuEvent *event) {
- QMenu *menu = new QMenu(this);
- QAction *act = menu->addAction("Reset View");
- act->setShortcut(
- QKeySequence(CommandManager::instance()->getKeyFromId(T_ZoomReset)));
- connect(act, SIGNAL(triggered()), this, SLOT(resetView()));
- menu->exec(event->globalPos());
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::keyPressEvent(QKeyEvent *event) {
- ViewerZoomer(this).exec(event);
-}
-
-//-----------------------------------------------------------------------------
-
-// center: window coordinate, pixels, topleft origin
-void LineTestViewer::zoomQt(const QPoint &center, double factor) {
- if (factor == 1.0) return;
- TPointD delta(center.x() - width() * 0.5, -center.y() + height() * 0.5);
- double scale2 = fabs(m_viewAffine.det());
- if ((scale2 < 100000 || factor < 1) && (scale2 > 0.001 * 0.05 || factor > 1))
- m_viewAffine = TTranslation(delta) * TScale(factor) * TTranslation(-delta) *
- m_viewAffine;
- update();
- emit onZoomChanged();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::zoomQt(bool forward, bool reset) {
- int i;
- double normalZoom = sqrt(getNormalZoomScale().det());
- double scale2 = m_viewAffine.det();
- if (reset ||
- ((scale2 < 256 || !forward) && (scale2 > 0.001 * 0.05 || forward))) {
- double oldZoomScale = sqrt(scale2);
- double zoomScale = reset ? 1 : ImageUtils::getQuantizedZoomFactor(
- oldZoomScale / normalZoom, forward);
- m_viewAffine = TScale(zoomScale * normalZoom / oldZoomScale) * m_viewAffine;
- }
- update();
- emit onZoomChanged();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::onFrameSwitched() { update(); }
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::onXsheetChanged() { update(); }
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::onSceneSwitched() { resetView(); }
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::resetView() {
- m_viewAffine = getNormalZoomScale();
- update();
- emit onZoomChanged();
-}
-
-//-----------------------------------------------------------------------------
-
-void LineTestViewer::onButtonPressed(FlipConsole::EGadget button) {
- switch (button) {
- case FlipConsole::eFilledRaster:
- TXshSimpleLevel::m_fillFullColorRaster =
- !TXshSimpleLevel::m_fillFullColorRaster;
- update();
- break;
- }
-}
-
-//-----------------------------------------------------------------------------
-
-TAffine LineTestViewer::getNormalZoomScale() {
- TApp *app = TApp::instance();
- const double inch = Stage::inch;
- TCamera *camera = app->getCurrentScene()->getScene()->getCurrentCamera();
- double size;
- int res;
- if (camera->isXPrevalence()) {
- size = camera->getSize().lx;
- res = camera->getRes().lx;
- } else {
- size = camera->getSize().ly;
- res = camera->getRes().ly;
- }
-
- TScale cameraScale(inch * size / res);
- return cameraScale.inv();
-}
-
-#endif
diff --git a/toonz/sources/toonz/linetestviewer.h b/toonz/sources/toonz/linetestviewer.h
deleted file mode 100644
index b9f408128..000000000
--- a/toonz/sources/toonz/linetestviewer.h
+++ /dev/null
@@ -1,113 +0,0 @@
-#pragma once
-
-#ifndef LINETESTVIEWER_H
-#define LINETESTVIEWER_H
-
-#ifdef LINETEST
-
-//#define USE_QPAINTER
-
-#include "toonz/txsheet.h"
-#include "toonz/tscenehandle.h"
-
-#include "toonzqt/flipconsole.h"
-
-#ifdef USE_QPAINTER
-#include <QWidget>
-#else
-#include <QOpenGLWidget>
-#endif
-
-//-----------------------------------------------------------------------------
-// LineTestViewer
-// Andrebbe messo a fattor comune del codice con SceneViewer
-
-#ifdef USE_QPAINTER
-class LineTestViewer final : public QWidget
-#else
-class LineTestViewer final : public QOpenGLWidget
-#endif
-{
- Q_OBJECT
-
- QPoint m_pos;
- Qt::MouseButton m_mouseButton;
-
-#ifndef USE_QPAINTER
- // bool m_pboSupported;
- GLuint m_textureId;
- GLuint m_pboId;
-#endif
-
- //! Used to zoom and pan
- TAffine m_viewAffine;
-
-public:
- LineTestViewer(QWidget *parent = 0);
- ~LineTestViewer();
-
- TPointD LineTestViewer::winToWorld(const QPoint &pos) const;
- // note: winPos in pixel, top-left origin;
- // when no camera movements have been defined then worldPos = 0 at camera
- // center
- TPointD winToWorld(const TPoint &winPos) const;
-
- // overriden from TTool::Viewer
- void pan(const TPoint &delta) { panQt(QPoint(delta.x, delta.y)); }
- // overriden from TTool::Viewer
- void zoom(const TPointD &center, double factor) {
- zoomQt(QPoint(center.x, height() - center.y), factor);
- }
-
- void resetInputMethod();
-
- void setFocus() { QWidget::setFocus(); };
-
- TAffine getViewMatrix() const;
-
- TAffine getNormalZoomScale();
-
- void zoomQt(bool forward, bool reset);
-
-protected:
-#ifdef USE_QPAINTER
- void paintEvent(QPaintEvent *);
-#else
- void paintGL();
- void initializeGL();
- void resizeGL(int width, int height);
- // void checkPBOSupport();
- void paintRaster(TRasterP ras);
-#endif
-
- void showEvent(QShowEvent *);
- void hideEvent(QHideEvent *);
-
- void leaveEvent(QEvent *);
- void enterEvent(QEvent *);
- void mouseMoveEvent(QMouseEvent *event);
-
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void wheelEvent(QWheelEvent *e);
- void contextMenuEvent(QContextMenuEvent *event);
- void keyPressEvent(QKeyEvent *event);
-
- void panQt(const QPoint &delta);
- void zoomQt(const QPoint &center, double factor);
-
-public slots:
- void onButtonPressed(FlipConsole::EGadget button);
- void resetView();
-
-protected slots:
- void onFrameSwitched();
- void onXsheetChanged();
- void onSceneSwitched();
-signals:
- void onZoomChanged();
-};
-
-#endif // LINETEST
-
-#endif // LINETESTVIEWER_H
diff --git a/toonz/sources/toonz/main.cpp b/toonz/sources/toonz/main.cpp
index 27b10880c..d12ef9ad6 100644
--- a/toonz/sources/toonz/main.cpp
+++ b/toonz/sources/toonz/main.cpp
@@ -9,11 +9,6 @@
#include "cleanupsettingspopup.h"
#include "filebrowsermodel.h"
-#ifdef LINETEST
-#include "licensegui.h"
-#include "licensecontroller.h"
-#endif
-
// TnzTools includes
#include "tools/tool.h"
#include "tools/toolcommandids.h"
@@ -92,16 +87,6 @@
#endif
using namespace DVGui;
-#if defined LINETEST
-const char *applicationName = "Toonz LineTest";
-const char *applicationVersion = "6.4";
-const char *dllRelativePath = "./linetest.app/Contents/Frameworks";
-TEnv::StringVar EnvSoftwareCurrentFont("SoftwareCurrentFont", "MS Sans Serif");
-TEnv::IntVar EnvSoftwareCurrentFontSize("SoftwareCurrentFontSize", 12);
-const char *applicationFullName = "LineTest 6.4 Beta";
-const char *rootVarName = "LINETESTROOT";
-const char *systemVarPrefix = "LINETEST";
-#endif
TEnv::IntVar EnvSoftwareCurrentFontSize("SoftwareCurrentFontSize", 12);
@@ -238,7 +223,7 @@ project->setUseScenePath(TProject::Extras, false);
// Imposto la rootDir per ImageCache
/*-- TOONZCACHEROOTの設定 --*/
- TFilePath cacheDir = ToonzFolder::getCacheRootFolder();
+ TFilePath cacheDir = ToonzFolder::getCacheRootFolder();
if (cacheDir.isEmpty()) cacheDir = TEnv::getStuffDir() + "cache";
TImageCache::instance()->setRootDir(cacheDir);
}
@@ -337,10 +322,10 @@ int main(int argc, char *argv[]) {
QApplication a(argc, argv);
#ifdef MACOSX
- // This workaround is to avoid missing left button problem on Qt5.6.0.
- // To invalidate m_rightButtonClicked in Qt/qnsview.mm, sending
- // NSLeftButtonDown event before NSLeftMouseDragged event propagated to
- // QApplication. See more details in ../mousedragfilter/mousedragfilter.mm.
+// This workaround is to avoid missing left button problem on Qt5.6.0.
+// To invalidate m_rightButtonClicked in Qt/qnsview.mm, sending
+// NSLeftButtonDown event before NSLeftMouseDragged event propagated to
+// QApplication. See more details in ../mousedragfilter/mousedragfilter.mm.
#include "mousedragfilter.h"
@@ -545,11 +530,7 @@ int main(int argc, char *argv[]) {
languagePathString += "\\" + Preferences::instance()->getCurrentLanguage();
#endif
QTranslator translator;
-#ifdef LINETEST
- translator.load("linetest", languagePathString);
-#else
translator.load("toonz", languagePathString);
-#endif
// La installo
a.installTranslator(&translator);
diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp
index 7e5f795dd..a36b785fc 100644
--- a/toonz/sources/toonz/mainwindow.cpp
+++ b/toonz/sources/toonz/mainwindow.cpp
@@ -42,11 +42,6 @@
#include "timagecache.h"
#include "tthread.h"
-// Couldn't place it...
-#ifdef LINETEST
-#include "tnzcamera.h"
-#endif
-
// Qt includes
#include <QStackedWidget>
#include <QSettings>
@@ -64,10 +59,6 @@ TEnv::IntVar ViewTableToggleAction("ViewTableToggleAction", 1);
TEnv::IntVar FieldGuideToggleAction("FieldGuideToggleAction", 0);
TEnv::IntVar ViewBBoxToggleAction("ViewBBoxToggleAction1", 1);
TEnv::IntVar EditInPlaceToggleAction("EditInPlaceToggleAction", 0);
-#ifdef LINETEST
-TEnv::IntVar CapturePanelFieldGuideToggleAction(
- "CapturePanelFieldGuideToggleAction", 0);
-#endif
TEnv::IntVar RasterizePliToggleAction("RasterizePliToggleAction", 0);
TEnv::IntVar SafeAreaToggleAction("SafeAreaToggleAction", 0);
TEnv::IntVar ViewColorcardToggleAction("ViewColorcardToggleAction", 1);
@@ -1302,13 +1293,9 @@ void MainWindow::onMenuCheckboxChanged() {
ViewBBoxToggleAction = isChecked;
else if (cm->getAction(MI_FieldGuide) == action)
FieldGuideToggleAction = isChecked;
-#ifdef LINETEST
- else if (cm->getAction(MI_CapturePanelFieldGuide) == action)
- CapturePanelFieldGuideToggleAction = isChecked;
-#endif
else if (cm->getAction(MI_RasterizePli) == action) {
if (!QGLPixelBuffer::hasOpenGLPbuffers()) isChecked = 0;
- RasterizePliToggleAction = isChecked;
+ RasterizePliToggleAction = isChecked;
} else if (cm->getAction(MI_SafeArea) == action)
SafeAreaToggleAction = isChecked;
else if (cm->getAction(MI_ViewColorcard) == action)
@@ -1448,10 +1435,6 @@ void MainWindow::closeEvent(QCloseEvent *event) {
}
TImageCache::instance()->clear(true);
-#ifdef LINETEST
- if (TnzCamera::instance()->isCameraConnected())
- TnzCamera::instance()->cameraDisconnect();
-#endif
event->accept();
TThread::shutdown();
@@ -1855,9 +1838,6 @@ void MainWindow::defineActions() {
createMenuLevelAction(MI_BrightnessAndContrast,
tr("&Brightness and Contrast..."), "");
createMenuLevelAction(MI_LinesFade, tr("&Color Fade..."), "");
-#ifdef LINETEST
- createMenuLevelAction(MI_Capture, tr("&Capture"), "");
-#endif
QAction *action =
createMenuLevelAction(MI_CanvasSize, tr("&Canvas Size..."), "");
if (action) action->setDisabled(true);
@@ -1995,11 +1975,6 @@ void MainWindow::defineActions() {
FieldGuideToggleAction ? 1 : 0, MenuViewCommandType);
createToggle(MI_ViewBBox, tr("&Raster Bounding Box"), "",
ViewBBoxToggleAction ? 1 : 0, MenuViewCommandType);
-#ifdef LINETEST
- createToggle(MI_CapturePanelFieldGuide, tr("&Field Guide in Capture Window"),
- "", CapturePanelFieldGuideToggleAction ? 1 : 0,
- MenuViewCommandType);
-#endif
createToggle(MI_SafeArea, tr("&Safe Area"), "", SafeAreaToggleAction ? 1 : 0,
MenuViewCommandType);
createToggle(MI_ViewColorcard, tr("&Camera BG Color"), "",
@@ -2096,8 +2071,8 @@ void MainWindow::defineActions() {
DockingCheckToggleAction ? 1 : 0, MenuWindowsCommandType);
DockingCheck::instance()->setToggle(toggle);
-// createRightClickMenuAction(MI_OpenCurrentScene, tr("&Current Scene"),
-// "");
+ // createRightClickMenuAction(MI_OpenCurrentScene, tr("&Current Scene"),
+ // "");
createMenuWindowsAction(MI_OpenExport, tr("&Export"), "");
@@ -2131,10 +2106,6 @@ void MainWindow::defineActions() {
#endif
createMenuWindowsAction(MI_OpenLevelView, tr("&Viewer"), "");
-#ifdef LINETEST
- createMenuWindowsAction(MI_OpenLineTestCapture, tr("&LineTest Capture"), "");
- createMenuWindowsAction(MI_OpenLineTestView, tr("&LineTest Viewer"), "");
-#endif
createMenuWindowsAction(MI_OpenXshView, tr("&Xsheet"), "");
createMenuWindowsAction(MI_OpenTimelineView, tr("&Timeline"), "");
// createAction(MI_TestAnimation, "Test Animation", "Ctrl+Return");
@@ -2373,8 +2344,8 @@ void MainWindow::defineActions() {
tr("Brush hardness - Increase"), "");
createToolOptionsAction("A_DecreaseBrushHardness",
tr("Brush hardness - Decrease"), "");
- createToolOptionsAction("A_ToolOption_SnapSensitivity", tr("Snap Sensitivity"),
- "");
+ createToolOptionsAction("A_ToolOption_SnapSensitivity",
+ tr("Snap Sensitivity"), "");
createToolOptionsAction("A_ToolOption_AutoGroup", tr("Auto Group"), "");
createToolOptionsAction("A_ToolOption_BreakSharpAngles",
tr("Break sharp angles"), "");
@@ -2585,8 +2556,8 @@ void MainWindow::defineActions() {
ToolCommandType);
createAction(MI_TapeNextMode, tr("Tape Tool - Next Mode"), "",
ToolCommandType);
- createAction(MI_TapeEndpointToEndpoint, tr("Tape Tool - Endpoint to Endpoint"),
- "", ToolCommandType);
+ createAction(MI_TapeEndpointToEndpoint,
+ tr("Tape Tool - Endpoint to Endpoint"), "", ToolCommandType);
createAction(MI_TapeEndpointToLine, tr("Tape Tool - Endpoint to Line"), "",
ToolCommandType);
createAction(MI_TapeLineToLine, tr("Tape Tool - Line to Line"), "",
@@ -3180,7 +3151,7 @@ void MainWindow::clearCacheFolder() {
// 1. $CACHE/[Current ProcessID]
// 2. $CACHE/temp/[Current scene folder] if the current scene is untitled
- TFilePath cacheRoot = ToonzFolder::getCacheRootFolder();
+ TFilePath cacheRoot = ToonzFolder::getCacheRootFolder();
if (cacheRoot.isEmpty()) cacheRoot = TEnv::getStuffDir() + "cache";
TFilePathSet filesToBeRemoved;
@@ -3294,9 +3265,9 @@ RecentFiles::~RecentFiles() {}
void RecentFiles::addFilePath(QString path, FileType fileType,
QString projectName) {
QList<QString> files =
- (fileType == Scene)
- ? m_recentScenes
- : (fileType == Level) ? m_recentLevels : m_recentFlipbookImages;
+ (fileType == Scene) ? m_recentScenes : (fileType == Level)
+ ? m_recentLevels
+ : m_recentFlipbookImages;
int i;
for (i = 0; i < files.size(); i++)
if (files.at(i) == path) {
@@ -3463,9 +3434,9 @@ void RecentFiles::saveRecentFiles() {
QList<QString> RecentFiles::getFilesNameList(FileType fileType) {
QList<QString> files =
- (fileType == Scene)
- ? m_recentScenes
- : (fileType == Level) ? m_recentLevels : m_recentFlipbookImages;
+ (fileType == Scene) ? m_recentScenes : (fileType == Level)
+ ? m_recentLevels
+ : m_recentFlipbookImages;
QList<QString> names;
int i;
for (i = 0; i < files.size(); i++) {
@@ -3492,9 +3463,9 @@ void RecentFiles::refreshRecentFilesMenu(FileType fileType) {
menu->setEnabled(false);
else {
CommandId clearActionId =
- (fileType == Scene)
- ? MI_ClearRecentScene
- : (fileType == Level) ? MI_ClearRecentLevel : MI_ClearRecentImage;
+ (fileType == Scene) ? MI_ClearRecentScene : (fileType == Level)
+ ? MI_ClearRecentLevel
+ : MI_ClearRecentImage;
menu->setActions(names);
menu->addSeparator();
QAction *clearAction = CommandManager::instance()->getAction(clearActionId);
diff --git a/toonz/sources/toonz/menubar.cpp b/toonz/sources/toonz/menubar.cpp
index 1e30f03c1..6f615726c 100644
--- a/toonz/sources/toonz/menubar.cpp
+++ b/toonz/sources/toonz/menubar.cpp
@@ -1158,12 +1158,8 @@ QMenuBar *StackedMenuBar::createFullMenuBar() {
addMenuItem(arrangeMenu, MI_SendBackward);
}
-// Menu' SCAN CLEANUP
-#ifdef LINETEST
- QMenu *scanCleanupMenu = addMenu(tr("Scan"));
-#else
+ // Menu' SCAN CLEANUP
QMenu *scanCleanupMenu = addMenu(tr("Scan && Cleanup"), fullMenuBar);
-#endif
addMenuItem(scanCleanupMenu, MI_DefineScanner);
addMenuItem(scanCleanupMenu, MI_ScanSettings);
addMenuItem(scanCleanupMenu, MI_Scan);
@@ -1235,10 +1231,6 @@ QMenuBar *StackedMenuBar::createFullMenuBar() {
addMenuItem(levelMenu, MI_ReplaceParentDirectory);
levelMenu->addSeparator();
addMenuItem(levelMenu, MI_RemoveUnused);
-#ifdef LINETEST
- levelMenu->addSeparator();
- addMenuItem(levelMenu, MI_Capture);
-#endif
// Menu' XSHEET
QMenu *xsheetMenu = addMenu(tr("Xsheet"), fullMenuBar);
@@ -1386,10 +1378,6 @@ QMenuBar *StackedMenuBar::createFullMenuBar() {
addMenuItem(viewMenu, MI_VectorGuidedDrawing);
viewMenu->addSeparator();
addMenuItem(viewMenu, MI_RasterizePli);
-#ifdef LINETEST
- viewMenu->addSeparator();
- addMenuItem(viewMenu, MI_CapturePanelFieldGuide);
-#endif
// Menu' WINDOWS
QMenu *windowsMenu = addMenu(tr("Windows"), fullMenuBar);
@@ -1433,12 +1421,8 @@ QMenuBar *StackedMenuBar::createFullMenuBar() {
#endif
addMenuItem(windowsMenu, MI_StartupPopup);
addMenuItem(windowsMenu, MI_OpenGuidedDrawingControls);
-#ifdef LINETEST
windowsMenu->addSeparator();
addMenuItem(windowsMenu, MI_OpenExport);
- addMenuItem(windowsMenu, MI_OpenLineTestCapture);
- addMenuItem(windowsMenu, MI_OpenLineTestView);
-#endif
windowsMenu->addSeparator();
addMenuItem(windowsMenu, MI_MaximizePanel);
addMenuItem(windowsMenu, MI_FullScreenWindow);
diff --git a/toonz/sources/toonz/menubarcommandids.h b/toonz/sources/toonz/menubarcommandids.h
index 1e7269bc1..44c38638e 100644
--- a/toonz/sources/toonz/menubarcommandids.h
+++ b/toonz/sources/toonz/menubarcommandids.h
@@ -97,11 +97,6 @@
#define MI_OpenLevelView "MI_OpenLevelView"
#define MI_OpenStopMotionPanel "MI_OpenStopMotionPanel"
#define MI_OpenExport "MI_OpenExport"
-#ifdef LINETEST
-#define MI_OpenLineTestView "MI_OpenLineTestView"
-#define MI_OpenLineTestCapture "MI_OpenLineTestCapture"
-#define MI_Capture "MI_Capture"
-#endif
#define MI_BrightnessAndContrast "MI_BrightnessAndContrast"
#define MI_Antialias "MI_Antialias"
#define MI_AdjustLevels "MI_AdjustLevels"
@@ -177,9 +172,6 @@
#define MI_ViewBBox "MI_ViewBBox"
#define MI_ViewTable "MI_ViewTable"
#define MI_FieldGuide "MI_FieldGuide"
-#ifdef LINETEST
-#define MI_CapturePanelFieldGuide "MI_CapturePanelFieldGuide"
-#endif
#define MI_RasterizePli "MI_RasterizePli"
#define MI_SafeArea "MI_SafeArea"
#define MI_ViewColorcard "MI_ViewColorcard"
diff --git a/toonz/sources/toonz/moviegenerator.cpp b/toonz/sources/toonz/moviegenerator.cpp
index 98978293e..e21c31546 100644
--- a/toonz/sources/toonz/moviegenerator.cpp
+++ b/toonz/sources/toonz/moviegenerator.cpp
@@ -3,7 +3,6 @@
#include "moviegenerator.h"
#include "timage.h"
-#include "tflash.h"
#include "tpalette.h"
#include "tvectorimage.h"
#include "trasterimage.h"
@@ -300,154 +299,6 @@ false,0);
}
};
-//=============================================================================
-// FlashStagePainter
-//-----------------------------------------------------------------------------
-
-class FlashStagePainter final : public Stage::Visitor {
- TFlash &m_flash;
- TAffine m_cameraAff;
- TPixel32 m_bgColor;
-
-public:
- FlashStagePainter(TFlash &flash, TAffine &cameraAff,
- const ImagePainter::VisualSettings &vs,
- const TPixel32 &bgColor)
- : Visitor(vs)
- , m_flash(flash)
- , m_cameraAff(cameraAff)
- , m_bgColor(bgColor) {}
-
- void onImage(const Stage::Player &player) override {
- const TImageP &img = player.image();
- m_flash.pushMatrix();
- m_flash.multMatrix(m_cameraAff * player.m_placement * player.m_dpiAff);
-
- TColorFunction *cf = 0;
- TColorFader fader;
- if (player.m_onionSkinDistance != c_noOnionSkin) {
- fader = TColorFader(m_bgColor, OnionSkinMask::getOnionSkinFade(
- player.m_onionSkinDistance));
- cf = &fader;
- }
-
- if (img->getPalette()) img->getPalette()->setFrame(player.m_frame);
- m_flash.draw(img, cf);
-
- m_flash.popMatrix();
- }
- void beginMask() override { m_flash.beginMask(); }
- void endMask() override { m_flash.endMask(); }
- void enableMask() override { m_flash.enableMask(); }
- void disableMask() override { m_flash.disableMask(); }
-};
-
-//=============================================================================
-// FlashMovieGenerator
-//-----------------------------------------------------------------------------
-
-class FlashMovieGenerator final : public MovieGenerator::Imp {
-public:
- TFlash m_flash;
- TAffine m_viewAff;
- int m_frameIndex;
- int m_sceneIndex;
- int m_frameCountLoader;
- bool m_screenSaverMode;
-
- FlashMovieGenerator(const TFilePath &fp, const TDimension cameraSize,
- TOutputProperties &properties)
- : Imp(fp, cameraSize, properties.getFrameRate())
- , m_flash(cameraSize.lx, cameraSize.ly, 0, properties.getFrameRate(),
- properties.getFileFormatProperties("swf"))
- , m_frameIndex(0)
- , m_sceneIndex(0)
- , m_frameCountLoader(0)
- , m_screenSaverMode(false) {
- TPointD center(0.5 * cameraSize.lx, 0.5 * cameraSize.ly);
- m_viewAff = TAffine();
- m_screenSaverMode = fp.getType() == "scr";
- }
-
- void addSoundtrack(const ToonzScene &scene, int frameOffset,
- int sceneFrameCount) override {}
-
- void startScene(const ToonzScene &scene, int r) override {
- m_flash.cleanCachedImages();
- m_flash.setBackgroundColor(m_bgColor);
- TXsheet::SoundProperties *prop = new TXsheet::SoundProperties();
- prop->m_frameRate = m_fps;
- TSoundTrackP snd = scene.getXsheet()->makeSound(prop);
- if (snd) {
- if (m_useMarkers) {
- long samplePerFrame = snd->getSampleRate() / m_fps;
- snd = snd->extract((TINT32)(m_renderRange.first * samplePerFrame),
- (TINT32)(m_renderRange.second * samplePerFrame));
- }
- m_flash.putSound(snd, 0);
- }
- if (m_sceneIndex == 0 && m_sceneCount == 1) {
- if (m_renderRange.first == m_renderRange.second)
- m_frameCountLoader = 0;
- else
- m_frameCountLoader = 1;
- } else if (m_sceneIndex == 0)
- m_frameCountLoader = m_renderRange.second - m_renderRange.first + 1;
- m_sceneIndex++;
- }
-
- bool addFrame(ToonzScene &scene, int row, bool isLast) override {
- TAffine cameraView =
- scene.getXsheet()->getPlacement(TStageObjectId::CameraId(0), row).inv();
- TPixel32 bgColor = scene.getProperties()->getBgColor();
-
- TStageObject *cameraPegbar =
- scene.getXsheet()->getStageObject(TStageObjectId::CameraId(0));
- assert(cameraPegbar);
- TCamera *camera = cameraPegbar->getCamera();
- assert(camera);
- TAffine dpiAff = getDpiAffine(camera).inv();
-
- TAffine aff = cameraView * dpiAff;
-
- Stage::VisitArgs args;
- args.m_scene = &scene;
- args.m_xsh = scene.getXsheet();
- args.m_row = row;
- args.m_col = m_columnIndex;
- args.m_osm = &m_osMask;
-
- ImagePainter::VisualSettings vs;
- FlashStagePainter painter(m_flash, aff, vs, bgColor);
- m_flash.beginFrame(++m_frameIndex);
-
- Stage::visit(painter, args);
- /*
- &scene,
- scene.getXsheet(),
- row,
- m_columnIndex,
- m_osMask,
- false, 0);
- */
-
- m_frameIndex = m_flash.endFrame(isLast, m_frameCountLoader,
- (m_sceneCount == m_sceneIndex));
- return true;
- }
-
- void close() override {
- TFilePath flashFn = m_filepath.withType("swf");
- FILE *fp = fopen(flashFn, "wb");
- if (!fp) throw TException("Can't open file");
- m_flash.writeMovie(fp);
- fclose(fp);
- if (m_screenSaverMode) {
- makeScreenSaver(m_filepath, flashFn, "prova");
- }
- }
-};
-
//=============================================================================
// MovieGenerator
//-----------------------------------------------------------------------------
@@ -456,10 +307,7 @@ MovieGenerator::MovieGenerator(const TFilePath &path,
const TDimension &resolution,
TOutputProperties &outputProperties,
bool useMarkers) {
- if (path.getType() == "swf" || path.getType() == "scr")
- m_imp.reset(new FlashMovieGenerator(path, resolution, outputProperties));
- else
- m_imp.reset(new RasterMovieGenerator(path, resolution, outputProperties));
+ m_imp.reset(new RasterMovieGenerator(path, resolution, outputProperties));
m_imp->m_useMarkers = useMarkers;
}
diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp
index 12914d819..8e9d34803 100644
--- a/toonz/sources/toonz/preferencespopup.cpp
+++ b/toonz/sources/toonz/preferencespopup.cpp
@@ -102,7 +102,7 @@ SizeField::SizeField(QSize min, QSize max, QSize value, QWidget* parent)
bool ret = true;
ret = ret && connect(m_fieldX, SIGNAL(editingFinished()), this,
SIGNAL(editingFinished()));
- ret = ret && connect(m_fieldY, SIGNAL(editingFinished()), this,
+ ret = ret && connect(m_fieldY, SIGNAL(editingFinished()), this,
SIGNAL(editingFinished()));
assert(ret);
}
@@ -612,7 +612,7 @@ void PreferencesPopup::onInterfaceFontChanged(const QString& text) {
for (ComboBoxItem& item : newStyleItems)
fontStyleCombo->addItem(item.first, item.second);
if (!oldTypeface.isEmpty()) {
- int newIndex = fontStyleCombo->findText(oldTypeface);
+ int newIndex = fontStyleCombo->findText(oldTypeface);
if (newIndex < 0) newIndex = 0;
fontStyleCombo->setCurrentIndex(newIndex);
}
@@ -696,17 +696,6 @@ void PreferencesPopup::onImportPolicyExternallyChanged(int policy) {
// update preferences data accordingly
importPolicyCombo->setCurrentIndex(policy);
}
-//-----------------------------------------------------------------------------
-
-#ifdef LINETEST
-void PreferencesPopup::onLineTestFpsCapture(int index) {
- if (index == 0) m_pref->setLineTestFpsCapture(0);
- if (index == 1)
- m_pref->setLineTestFpsCapture(25);
- else if (index == 2)
- m_pref->setLineTestFpsCapture(30);
-}
-#endif
//-----------------------------------------------------------------------------
@@ -731,7 +720,7 @@ QWidget* PreferencesPopup::createUI(PreferencesItemId id,
for (const ComboBoxItem& item : comboItems)
combo->addItem(item.first, item.second);
combo->setCurrentIndex(combo->findData(item.value));
- ret = connect(combo, SIGNAL(currentIndexChanged(int)), this,
+ ret = connect(combo, SIGNAL(currentIndexChanged(int)), this,
SLOT(onChange()));
widget = combo;
} else { // create IntLineEdit
@@ -768,7 +757,7 @@ QWidget* PreferencesPopup::createUI(PreferencesItemId id,
if (id == interfaceFont) { // create QFontComboBox
QFontComboBox* combo = new QFontComboBox(this);
combo->setCurrentText(item.value.toString());
- ret = connect(combo, SIGNAL(currentIndexChanged(const QString&)), this,
+ ret = connect(combo, SIGNAL(currentIndexChanged(const QString&)), this,
SLOT(onInterfaceFontChanged(const QString&)));
widget = combo;
} else if (!comboItems.isEmpty()) { // create QComboBox
@@ -776,7 +765,7 @@ QWidget* PreferencesPopup::createUI(PreferencesItemId id,
for (const ComboBoxItem& item : comboItems)
combo->addItem(item.first, item.second);
combo->setCurrentIndex(combo->findData(item.value));
- ret = connect(combo, SIGNAL(currentIndexChanged(int)), this,
+ ret = connect(combo, SIGNAL(currentIndexChanged(int)), this,
SLOT(onChange()));
widget = combo;
} else { // create FileField
@@ -799,7 +788,7 @@ QWidget* PreferencesPopup::createUI(PreferencesItemId id,
{
ColorField* field =
new ColorField(this, false, colorToTPixel(item.value.value<QColor>()));
- ret = connect(field, SIGNAL(colorChanged(const TPixel32&, bool)), this,
+ ret = connect(field, SIGNAL(colorChanged(const TPixel32&, bool)), this,
SLOT(onColorFieldChanged(const TPixel32&, bool)));
widget = field;
} break;
@@ -908,8 +897,8 @@ void PreferencesPopup::insertDualUIs(
//-----------------------------------------------------------------------------
void PreferencesPopup::insertFootNote(QGridLayout* layout) {
- QLabel* note =
- new QLabel(tr("* Changes will take effect the next time you run OpenToonz"));
+ QLabel* note = new QLabel(
+ tr("* Changes will take effect the next time you run OpenToonz"));
note->setStyleSheet("font-size: 10px; font: italic;");
layout->addWidget(note, layout->rowCount(), 0, 1, 2,
Qt::AlignLeft | Qt::AlignVCenter);
@@ -1352,9 +1341,9 @@ QWidget* PreferencesPopup::createGeneralPage() {
bool ret = true;
ret = ret && connect(m_pref, SIGNAL(stopAutoSave()), this,
SLOT(onAutoSaveExternallyChanged()));
- ret = ret && connect(m_pref, SIGNAL(startAutoSave()), this,
+ ret = ret && connect(m_pref, SIGNAL(startAutoSave()), this,
SLOT(onAutoSaveExternallyChanged()));
- ret = ret && connect(m_pref, SIGNAL(autoSavePeriodChanged()), this,
+ ret = ret && connect(m_pref, SIGNAL(autoSavePeriodChanged()), this,
SLOT(onAutoSavePeriodExternallyChanged()));
ret = ret && connect(m_projectRootDocuments, SIGNAL(stateChanged(int)),
diff --git a/toonz/sources/toonz/preferencespopup.h b/toonz/sources/toonz/preferencespopup.h
index 08f10bb67..4a71f09bf 100644
--- a/toonz/sources/toonz/preferencespopup.h
+++ b/toonz/sources/toonz/preferencespopup.h
@@ -157,10 +157,6 @@ private slots:
void onEditLevelFormat();
void onLevelFormatEdited();
void onImportPolicyExternallyChanged(int policy);
-
-#ifdef LINETEST
- void onLineTestFpsCapture(int);
-#endif
};
//**********************************************************************************
diff --git a/toonz/sources/toonz/projectpopup.cpp b/toonz/sources/toonz/projectpopup.cpp
index e2278eeac..39e3e03b8 100644
--- a/toonz/sources/toonz/projectpopup.cpp
+++ b/toonz/sources/toonz/projectpopup.cpp
@@ -17,11 +17,6 @@
#include "toonzqt/checkbox.h"
#include "toonzqt/gutil.h"
-// TnzLic includes
-#ifdef LINETEST
-#include "tnzcamera.h"
-#endif
-
// TnzCore includes
#include "tsystem.h"
#include "tenv.h"
@@ -145,7 +140,7 @@ DvDirModelNode *ProjectDirModel::getNode(const QModelIndex &index) const {
QModelIndex ProjectDirModel::index(int row, int column,
const QModelIndex &parent) const {
if (column != 0) return QModelIndex();
- DvDirModelNode *parentNode = m_root;
+ DvDirModelNode *parentNode = m_root;
if (parent.isValid()) parentNode = getNode(parent);
if (row < 0 || row >= parentNode->getChildCount()) return QModelIndex();
DvDirModelNode *node = parentNode->getChild(row);
@@ -570,11 +565,6 @@ ProjectCreatePopup::ProjectCreatePopup() : ProjectPopup(true) {
void ProjectCreatePopup::createProject() {
if (!IoCmd::saveSceneIfNeeded(QObject::tr("Create project"))) return;
-#ifdef LINETEST
- TnzCamera *camera = TnzCamera::instance();
- if (camera->isCameraConnected()) camera->cameraDisconnect();
-#endif
-
QFileInfo fi(m_nameFld->text());
if (!isValidFileName(fi.baseName())) {
diff --git a/toonz/sources/toonz/rendercommand.cpp b/toonz/sources/toonz/rendercommand.cpp
index c7e615b8a..87f5d614c 100644
--- a/toonz/sources/toonz/rendercommand.cpp
+++ b/toonz/sources/toonz/rendercommand.cpp
@@ -46,7 +46,6 @@
#include "trop.h"
#include "tconvert.h"
#include "tfiletype.h"
-#include "tflash.h"
#include "timagecache.h"
#include "tthreadmessage.h"
@@ -219,7 +218,6 @@ public:
}
bool init(bool isPreview); // true if r0<=r1
- void flashRender();
void rasterRender(bool isPreview);
void multimediaRender();
void onRender();
@@ -346,54 +344,6 @@ sprop->getOutputProperties()->setRenderSettings(rso);*/
//===================================================================
-void RenderCommand::flashRender() {
- ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
- TSceneProperties *sprop = scene->getProperties();
- FILE *fileP = fopen(m_fp, "wb");
- if (!fileP) return;
- DVGui::ProgressDialog pb("rendering " + toQString(m_fp), "Cancel", 0,
- m_numFrames);
- pb.show();
-
- TDimension cameraSize = scene->getCurrentCamera()->getRes();
- double frameRate = sprop->getOutputProperties()->getFrameRate();
- TFlash flash(cameraSize.lx, cameraSize.ly, m_numFrames, frameRate,
- sprop->getOutputProperties()->getFileFormatProperties("swf"));
- flash.setBackgroundColor(sprop->getBgColor());
-
- std::vector<TXshSoundColumn *> columns;
- scene->getSoundColumns(columns);
- if (!columns.empty()) {
- TXsheet::SoundProperties *prop = new TXsheet::SoundProperties();
- prop->m_frameRate = frameRate;
- TSoundTrack *st = scene->getXsheet()->makeSound(prop);
- if (st) flash.putSound(st, 0);
- }
-
- int i = 0;
- for (i = 0; i < m_numFrames; ++i, m_r += m_stepd) {
- flash.beginFrame(m_step * i + 1);
- TRasterFxP rfx = buildSceneFx(scene, m_r, 0, false);
- assert(rfx);
- rfx->compute(flash,
- tround(m_r)); // WARNING: This should accept a DOUBLE...
- flash.endFrame(i == m_numFrames - 1, 0, true);
- if (pb.wasCanceled()) break;
- pb.setValue(i + 1);
- }
-
- flash.writeMovie(fileP);
- fclose(fileP);
-
- TSystem::showDocument(m_fp);
- // QDesktopServices::openUrl(QUrl(toQString(m_fp)));
-
- TImageCache::instance()->remove(::to_string(m_fp.getWideString() + L".0"));
- TNotifier::instance()->notify(TSceneNameChange());
-}
-
-//===================================================================
-
class RenderListener final : public DVGui::ProgressDialog,
public MovieRenderer::Listener {
QString m_progressBarString;
@@ -762,8 +712,7 @@ public:
//---------------------------------------------------------
-//! Specialized render invocation for multimedia rendering. Flash rendering
-//! is currently not supported in this mode.
+//! Specialized render invocation for multimedia rendering.
void RenderCommand::multimediaRender() {
ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
std::string ext = m_fp.getType();
@@ -913,12 +862,9 @@ void RenderCommand::doRender(bool isPreview) {
MultipleRender で Schematic Flows または Fx Schematic Terminal Nodes
が選択されている場合
--*/
- if (m_multimediaRender &&
- m_fp.getType() !=
- "swf") // swf is not currently supported on multimedia...
+ if (m_multimediaRender)
multimediaRender();
- else if (!isPreview && m_fp.getType() == "swf")
- flashRender();
+
else
/*-- 通常のRendering --*/
rasterRender(isPreview);
diff --git a/toonz/sources/toonz/subscenecommand.cpp b/toonz/sources/toonz/subscenecommand.cpp
index 938cd64d8..e756a5961 100644
--- a/toonz/sources/toonz/subscenecommand.cpp
+++ b/toonz/sources/toonz/subscenecommand.cpp
@@ -2130,8 +2130,6 @@ public:
void SubsceneCmd::collapse(std::set<int> &indices) {
if (indices.empty()) return;
-#ifndef LINETEST
-
// User must decide if pegbars must be collapsed too
QString question(QObject::tr("Collapsing columns: what you want to do?"));
@@ -2143,10 +2141,6 @@ void SubsceneCmd::collapse(std::set<int> &indices) {
int ret = DVGui::RadioButtonMsgBox(DVGui::WARNING, question, list);
if (ret == 0) return;
-#else
- int ret = 1;
-#endif
-
std::set<int> oldIndices = indices;
int index = *indices.begin();
@@ -2236,8 +2230,6 @@ void SubsceneCmd::collapse(const QList<TStageObjectId> &objects) {
void SubsceneCmd::collapse(const QList<TFxP> &fxs) {
if (fxs.isEmpty()) return;
-#ifndef LINETEST
-
QString question(QObject::tr("Collapsing columns: what you want to do?"));
QList<QString> list;
list.append(
@@ -2246,10 +2238,6 @@ void SubsceneCmd::collapse(const QList<TFxP> &fxs) {
int ret = DVGui::RadioButtonMsgBox(DVGui::WARNING, question, list);
if (ret == 0) return;
-#else
- int ret = 1;
-#endif
-
std::set<int> indices;
std::set<TFx *> internalFx;
getColumnIndexesAndInternalFxs(fxs, indices, internalFx);
@@ -2308,8 +2296,6 @@ void SubsceneCmd::explode(int index) {
TXshChildLevel *childLevel = cell.getChildLevel();
if (!childLevel) return;
-#ifndef LINETEST
-
/*- Pegbarを親Sheetに持って出るか?の質問ダイアログ -*/
QString question(QObject::tr("Exploding Sub-xsheet: what you want to do?"));
QList<QString> list;
@@ -2318,10 +2304,6 @@ void SubsceneCmd::explode(int index) {
int ret = DVGui::RadioButtonMsgBox(DVGui::WARNING, question, list);
if (ret == 0) return;
-#else
- int ret = 2;
-#endif
-
// Collect column stage object informations
TStageObjectId colId = TStageObjectId::ColumnId(index);
TStageObjectId parentId = xsh->getStageObjectParent(colId);
diff --git a/toonz/sources/toonz/tapp.cpp b/toonz/sources/toonz/tapp.cpp
index 19386d6f5..d03b86101 100644
--- a/toonz/sources/toonz/tapp.cpp
+++ b/toonz/sources/toonz/tapp.cpp
@@ -284,11 +284,7 @@ int TApp::getCurrentImageType() {
if (getCurrentFrame()->isEditingScene()) {
int row = getCurrentFrame()->getFrame();
int col = getCurrentColumn()->getColumnIndex();
- if (col < 0)
-#ifdef LINETEST
- return TImage::RASTER;
-#else
- {
+ if (col < 0) {
int levelType = Preferences::instance()->getDefLevelType();
return (levelType == PLI_XSHLEVEL)
? TImage::VECTOR
@@ -297,7 +293,6 @@ int TApp::getCurrentImageType() {
? TImage::TOONZ_RASTER
: TImage::RASTER; // and OVL_XSHLEVEL level types
}
-#endif
TXsheet *xsh = getCurrentXsheet()->getXsheet();
TXshCell cell = xsh->getCell(row, col);
@@ -309,15 +304,11 @@ int TApp::getCurrentImageType() {
cell = xsh->getCell(r0, col);
} else /*-- Columnが空の場合 --*/
{
-#ifdef LINETEST
- return TImage::RASTER;
-#else
int levelType = Preferences::instance()->getDefLevelType();
return (levelType == PLI_XSHLEVEL)
? TImage::VECTOR
: (levelType == TZP_XSHLEVEL) ? TImage::TOONZ_RASTER
: TImage::RASTER;
-#endif
}
}
diff --git a/toonz/sources/toonz/tpanels.cpp b/toonz/sources/toonz/tpanels.cpp
index 019498803..403c5ce3d 100644
--- a/toonz/sources/toonz/tpanels.cpp
+++ b/toonz/sources/toonz/tpanels.cpp
@@ -30,14 +30,9 @@
#include "stopmotioncontroller.h"
#endif
-#ifdef LINETEST
-#include "linetestpane.h"
-#include "linetestcapturepane.h"
-#else
#include "tasksviewer.h"
#include "batchserversviewer.h"
#include "colormodelviewer.h"
-#endif
#include "curveio.h"
#include "menubarcommandids.h"
@@ -1035,7 +1030,6 @@ public:
void initialize(TPanel *panel) override { assert(0); }
} flipbookFactory;
-#ifndef LINETEST
//=============================================================================
// TasksViewerFactory
//-----------------------------------------------------------------------------
@@ -1057,7 +1051,6 @@ public:
panel->setWidget(new BatchServersViewer(panel));
}
} batchServersViewerFactory;
-#endif
class BrowserFactory final : public TPanelFactory {
public:
@@ -1124,8 +1117,6 @@ OpenFloatingPanel openExportPanelCommand(MI_OpenExport, "Export",
// ColorModelViewerFactory
//-----------------------------------------------------------------------------
-
-#ifndef LINETEST
class ColorModelViewerFactory final : public TPanelFactory {
public:
ColorModelViewerFactory() : TPanelFactory("ColorModel") {}
@@ -1135,8 +1126,6 @@ public:
}
} colorModelViewerFactory;
-#endif
-
//=============================================================================
// FunctionViewerFactory
//-----------------------------------------------------------------------------
@@ -1200,61 +1189,6 @@ public:
OpenFloatingPanel openTScriptConsoleCommand("MI_OpenScriptConsole",
"ScriptConsole",
QObject::tr("Script Console"));
-//------------------------------------------------------------------------------
-
-#ifdef LINETEST
-
-//=============================================================================
-// LineTestViewer
-//-----------------------------------------------------------------------------
-
-class LineTestFactory final : public TPanelFactory {
-public:
- LineTestFactory() : TPanelFactory("LineTestViewer") {}
-
- TPanel *createPanel(QWidget *parent) {
- LineTestPane *panel = new LineTestPane(parent);
- panel->setObjectName(getPanelType());
- panel->setMinimumSize(220, 280);
- return panel;
- }
-
- void initialize(TPanel *panel) { assert(0); }
-
-} lineTestFactory;
-
-//=============================================================================
-OpenFloatingPanel openLineTestViewerCommand(MI_OpenLineTestView,
- "LineTestViewer",
- QObject::tr("LineTest Viewer"));
-//-----------------------------------------------------------------------------
-
-//=============================================================================
-// LineTestCapturePane
-//-----------------------------------------------------------------------------
-
-class LineTestCaptureFactory final : public TPanelFactory {
-public:
- LineTestCaptureFactory() : TPanelFactory("LineTestCapture") {}
-
- TPanel *createPanel(QWidget *parent) {
- LineTestCapturePane *panel = new LineTestCapturePane(parent);
- panel->setObjectName(getPanelType());
- // panel->setMinimumSize(220, 280);
- return panel;
- }
-
- void initialize(TPanel *panel) { assert(0); }
-
-} LineTestCaptureFactory;
-
-//=============================================================================
-OpenFloatingPanel openLineTestCaptureCommand(MI_OpenLineTestCapture,
- "LineTestCapture",
- QObject::tr("LineTest Capture"));
-//-----------------------------------------------------------------------------
-
-#endif // LINETEST
//=============================================================================
// ComboViewer : Viewer + Toolbar + Tool Options
@@ -1307,47 +1241,46 @@ OpenFloatingPanel openComboViewerCommand(MI_OpenComboViewer, "ComboViewer",
// SceneViewer
//-----------------------------------------------------------------------------
-SceneViewerPanelContainer::SceneViewerPanelContainer(QWidget* parent)
+SceneViewerPanelContainer::SceneViewerPanelContainer(QWidget *parent)
: StyleShortcutSwitchablePanel(parent) {
- m_sceneViewer = new SceneViewerPanel(parent);
- setFocusProxy(m_sceneViewer);
- setWidget(m_sceneViewer);
+ m_sceneViewer = new SceneViewerPanel(parent);
+ setFocusProxy(m_sceneViewer);
+ setWidget(m_sceneViewer);
- m_sceneViewer->initializeTitleBar(getTitleBar());
+ m_sceneViewer->initializeTitleBar(getTitleBar());
}
// reimplementation of TPanel::widgetInThisPanelIsFocused
bool SceneViewerPanelContainer::widgetInThisPanelIsFocused() {
- return m_sceneViewer->hasFocus();
+ return m_sceneViewer->hasFocus();
}
// reimplementation of TPanel::widgetFocusOnEnter
void SceneViewerPanelContainer::widgetFocusOnEnter() {
- m_sceneViewer->onEnterPanel();
+ m_sceneViewer->onEnterPanel();
}
void SceneViewerPanelContainer::widgetClearFocusOnLeave() {
- m_sceneViewer->onLeavePanel();
+ m_sceneViewer->onLeavePanel();
}
-
//-----------------------------------------------------------------------------
class SceneViewerFactory final : public TPanelFactory {
public:
- SceneViewerFactory() : TPanelFactory("SceneViewer") {}
-
- TPanel* createPanel(QWidget* parent) override {
- SceneViewerPanelContainer* panel = new SceneViewerPanelContainer(parent);
- panel->setObjectName(getPanelType());
- panel->setWindowTitle(QObject::tr("Viewer"));
- panel->setMinimumSize(220, 280);
- //panel->resize(700, 600);
- return panel;
- }
- void initialize(TPanel* panel) override { assert(0); }
+ SceneViewerFactory() : TPanelFactory("SceneViewer") {}
+
+ TPanel *createPanel(QWidget *parent) override {
+ SceneViewerPanelContainer *panel = new SceneViewerPanelContainer(parent);
+ panel->setObjectName(getPanelType());
+ panel->setWindowTitle(QObject::tr("Viewer"));
+ panel->setMinimumSize(220, 280);
+ // panel->resize(700, 600);
+ return panel;
+ }
+ void initialize(TPanel *panel) override { assert(0); }
} sceneViewerFactory;
//=============================================================================
OpenFloatingPanel openSceneViewerCommand(MI_OpenLevelView, "SceneViewer",
- QObject::tr("Viewer"));
+ QObject::tr("Viewer"));
//-----------------------------------------------------------------------------
//=============================================================================
diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cpp
index d55cbe46a..abf2595b0 100644
--- a/toonz/sources/toonz/xshcellviewer.cpp
+++ b/toonz/sources/toonz/xshcellviewer.cpp
@@ -330,36 +330,46 @@ bool isGlobalKeyFrameWithSameTypeDiffFromLinear(TStageObject *stageObject,
TDoubleKeyframe::Type type =
stageObject->getParam(TStageObject::T_Angle)->getKeyframeAt(frame).m_type;
if (type == TDoubleKeyframe::Linear) return false;
- if (type != stageObject->getParam(TStageObject::T_X)
- ->getKeyframeAt(frame)
- .m_type ||
- type != stageObject->getParam(TStageObject::T_Y)
- ->getKeyframeAt(frame)
- .m_type ||
- type != stageObject->getParam(TStageObject::T_Z)
- ->getKeyframeAt(frame)
- .m_type ||
- type != stageObject->getParam(TStageObject::T_SO)
- ->getKeyframeAt(frame)
- .m_type ||
- type != stageObject->getParam(TStageObject::T_ScaleX)
- ->getKeyframeAt(frame)
- .m_type ||
- type != stageObject->getParam(TStageObject::T_ScaleY)
- ->getKeyframeAt(frame)
- .m_type ||
- type != stageObject->getParam(TStageObject::T_Scale)
- ->getKeyframeAt(frame)
- .m_type ||
- type != stageObject->getParam(TStageObject::T_Path)
- ->getKeyframeAt(frame)
- .m_type ||
- type != stageObject->getParam(TStageObject::T_ShearX)
- ->getKeyframeAt(frame)
- .m_type ||
- type != stageObject->getParam(TStageObject::T_ShearY)
- ->getKeyframeAt(frame)
- .m_type)
+ if (type !=
+ stageObject->getParam(TStageObject::T_X)
+ ->getKeyframeAt(frame)
+ .m_type ||
+ type !=
+ stageObject->getParam(TStageObject::T_Y)
+ ->getKeyframeAt(frame)
+ .m_type ||
+ type !=
+ stageObject->getParam(TStageObject::T_Z)
+ ->getKeyframeAt(frame)
+ .m_type ||
+ type !=
+ stageObject->getParam(TStageObject::T_SO)
+ ->getKeyframeAt(frame)
+ .m_type ||
+ type !=
+ stageObject->getParam(TStageObject::T_ScaleX)
+ ->getKeyframeAt(frame)
+ .m_type ||
+ type !=
+ stageObject->getParam(TStageObject::T_ScaleY)
+ ->getKeyframeAt(frame)
+ .m_type ||
+ type !=
+ stageObject->getParam(TStageObject::T_Scale)
+ ->getKeyframeAt(frame)
+ .m_type ||
+ type !=
+ stageObject->getParam(TStageObject::T_Path)
+ ->getKeyframeAt(frame)
+ .m_type ||
+ type !=
+ stageObject->getParam(TStageObject::T_ShearX)
+ ->getKeyframeAt(frame)
+ .m_type ||
+ type !=
+ stageObject->getParam(TStageObject::T_ShearY)
+ ->getKeyframeAt(frame)
+ .m_type)
return false;
return true;
}
@@ -382,45 +392,54 @@ bool isGlobalKeyFrameWithSamePrevTypeDiffFromLinear(TStageObject *stageObject,
->getKeyframeAt(frame)
.m_prevType;
if (type == TDoubleKeyframe::Linear) return false;
- if (type != stageObject->getParam(TStageObject::T_X)
- ->getKeyframeAt(frame)
- .m_prevType ||
- type != stageObject->getParam(TStageObject::T_Y)
- ->getKeyframeAt(frame)
- .m_prevType ||
- type != stageObject->getParam(TStageObject::T_Z)
- ->getKeyframeAt(frame)
- .m_prevType ||
- type != stageObject->getParam(TStageObject::T_SO)
- ->getKeyframeAt(frame)
- .m_prevType ||
- type != stageObject->getParam(TStageObject::T_ScaleX)
- ->getKeyframeAt(frame)
- .m_prevType ||
- type != stageObject->getParam(TStageObject::T_ScaleY)
- ->getKeyframeAt(frame)
- .m_prevType ||
- type != stageObject->getParam(TStageObject::T_Scale)
- ->getKeyframeAt(frame)
- .m_prevType ||
- type != stageObject->getParam(TStageObject::T_Path)
- ->getKeyframeAt(frame)
- .m_prevType ||
- type != stageObject->getParam(TStageObject::T_ShearX)
- ->getKeyframeAt(frame)
- .m_prevType ||
- type != stageObject->getParam(TStageObject::T_ShearY)
- ->getKeyframeAt(frame)
- .m_prevType)
+ if (type !=
+ stageObject->getParam(TStageObject::T_X)
+ ->getKeyframeAt(frame)
+ .m_prevType ||
+ type !=
+ stageObject->getParam(TStageObject::T_Y)
+ ->getKeyframeAt(frame)
+ .m_prevType ||
+ type !=
+ stageObject->getParam(TStageObject::T_Z)
+ ->getKeyframeAt(frame)
+ .m_prevType ||
+ type !=
+ stageObject->getParam(TStageObject::T_SO)
+ ->getKeyframeAt(frame)
+ .m_prevType ||
+ type !=
+ stageObject->getParam(TStageObject::T_ScaleX)
+ ->getKeyframeAt(frame)
+ .m_prevType ||
+ type !=
+ stageObject->getParam(TStageObject::T_ScaleY)
+ ->getKeyframeAt(frame)
+ .m_prevType ||
+ type !=
+ stageObject->getParam(TStageObject::T_Scale)
+ ->getKeyframeAt(frame)
+ .m_prevType ||
+ type !=
+ stageObject->getParam(TStageObject::T_Path)
+ ->getKeyframeAt(frame)
+ .m_prevType ||
+ type !=
+ stageObject->getParam(TStageObject::T_ShearX)
+ ->getKeyframeAt(frame)
+ .m_prevType ||
+ type !=
+ stageObject->getParam(TStageObject::T_ShearY)
+ ->getKeyframeAt(frame)
+ .m_prevType)
return false;
return true;
}
//-----------------------------------------------------------------------------
-#ifdef LINETEST
-
int getParamStep(TStageObject *stageObject, int frame) {
+ // this is a pretty useless function outside of global keyframes.
TDoubleKeyframe keyFrame =
stageObject->getParam(TStageObject::T_Angle)->getKeyframeAt(frame);
return keyFrame.m_step;
@@ -433,7 +452,6 @@ void setParamStep(int indexKeyframe, int step, TDoubleParam *param) {
setter.setStep(step);
}
-#endif
//=============================================================================
// RenameCellUndo
//-----------------------------------------------------------------------------
@@ -1817,10 +1835,10 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {
nameRect.adjust(0, 0, -frameAdj, 0);
// draw text in red if the file does not exist
- bool isRed = false;
- TXshSimpleLevel *sl = cell.getSimpleLevel();
+ bool isRed = false;
+ TXshSimpleLevel *sl = cell.getSimpleLevel();
if (sl && !sl->isFid(cell.m_frameId)) isRed = true;
- TXshChildLevel *cl = cell.getChildLevel();
+ TXshChildLevel *cl = cell.getChildLevel();
if (cl && cell.getFrameId().getNumber() - 1 >= cl->getFrameCount())
isRed = true;
QColor penColor =
@@ -1920,9 +1938,8 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {
bool isSelected = cellSelection->isCellSelected(row, col) ||
columnSelection->isColumnSelected(col);
- if (row > 0)
- prevCell = xsh->getCell(row - 1, col); // cell in previous frame
- // nothing to draw
+ if (row > 0) prevCell = xsh->getCell(row - 1, col); // cell in previous frame
+ // nothing to draw
bool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer();
@@ -2028,7 +2045,7 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {
#ifdef _WIN32
fontName = "Arial";
#else
- fontName = "Helvetica";
+ fontName = "Helvetica";
#endif
}
static QFont font(fontName, -1, QFont::Normal);
@@ -2060,7 +2077,7 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {
#if QT_VERSION >= 0x050500
QString elidaName = elideText(text, metric, nameRect.width(), "~");
#else
- QString elidaName = elideText(text, font, nameRect.width(), "~");
+ QString elidaName = elideText(text, font, nameRect.width(), "~");
#endif
if (!sameLevel || prevCell.m_frameId != cell.m_frameId)
@@ -2081,7 +2098,7 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,
bool isSelected = cellSelection->isCellSelected(row, col);
if (row > 0) prevCell = xsh->getCell(row - 1, col);
- TXshCell nextCell = xsh->getCell(row + 1, col);
+ TXshCell nextCell = xsh->getCell(row + 1, col);
bool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer();
@@ -2092,8 +2109,8 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,
bool isAfterMarkers =
distance > 0 && ((row - offset) % distance) == 0 && row != 0;
- bool isRed = false;
- TXshPaletteLevel *pl = cell.getPaletteLevel();
+ bool isRed = false;
+ TXshPaletteLevel *pl = cell.getPaletteLevel();
if (pl && !pl->getPalette()) isRed = true;
QPoint xy = m_viewer->positionToXY(CellPosition(row, col));
@@ -2225,7 +2242,7 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,
#ifdef _WIN32
fontName = "Arial";
#else
- fontName = "Helvetica";
+ fontName = "Helvetica";
#endif
}
static QFont font(fontName, -1, QFont::Normal);
@@ -2784,9 +2801,10 @@ void CellArea::mousePressEvent(QMouseEvent *event) {
setDragTool(XsheetGUI::DragTool::makeLevelMoverTool(m_viewer));
} else {
m_viewer->getKeyframeSelection()->selectNone();
- if (isSoundColumn && o->rect(PredefinedRect::PREVIEW_TRACK)
- .adjusted(0, 0, -frameAdj, 0)
- .contains(mouseInCell))
+ if (isSoundColumn &&
+ o->rect(PredefinedRect::PREVIEW_TRACK)
+ .adjusted(0, 0, -frameAdj, 0)
+ .contains(mouseInCell))
setDragTool(XsheetGUI::DragTool::makeSoundScrubTool(
m_viewer, column->getSoundColumn()));
else if (isSoundColumn &&
@@ -2921,9 +2939,10 @@ void CellArea::mouseMoveEvent(QMouseEvent *event) {
: QString::fromStdWString(levelName) + QString(" ") +
QString::fromStdString(frameNumber));
}
- } else if (isSoundColumn && o->rect(PredefinedRect::PREVIEW_TRACK)
- .adjusted(0, 0, -frameAdj, 0)
- .contains(mouseInCell))
+ } else if (isSoundColumn &&
+ o->rect(PredefinedRect::PREVIEW_TRACK)
+ .adjusted(0, 0, -frameAdj, 0)
+ .contains(mouseInCell))
m_tooltip = tr("Click and drag to play");
else if (m_levelExtenderRect.contains(pos))
m_tooltip = tr("Click and drag to repeat selected cells");
@@ -3513,14 +3532,14 @@ void CellArea::createKeyLineMenu(QMenu &menu, int row, int col) {
menu.addAction(cmdManager->getAction(MI_ShiftKeyframesUp));
}
-#ifdef LINETEST
menu.addSeparator();
- int paramStep = getParamStep(pegbar, r0);
+ // int paramStep = getParamStep(pegbar, r0);
QActionGroup *actionGroup = new QActionGroup(this);
int i;
- for (i = 1; i < 4; i++) {
- QAction *act = new QAction(QString("Step ") + QString::number(i), this);
- if (paramStep == i) act->setEnabled(false);
+ for (i = 1; i <= 4; i++) {
+ QAction *act = new QAction(
+ QString("Interpolation on ") + QString::number(i) + "'s", this);
+ // if (paramStep == i) act->setEnabled(false);
QList<QVariant> list;
list.append(QVariant(i));
list.append(QVariant(r0));
@@ -3531,7 +3550,6 @@ void CellArea::createKeyLineMenu(QMenu &menu, int row, int col) {
}
connect(actionGroup, SIGNAL(triggered(QAction *)), this,
SLOT(onStepChanged(QAction *)));
-#endif
}
//-----------------------------------------------------------------------------
@@ -3564,39 +3582,80 @@ void CellArea::deleteNote() {
//-----------------------------------------------------------------------------
void CellArea::onStepChanged(QAction *act) {
-#ifdef LINETEST
QList<QVariant> list = act->data().toList();
int step = list.at(0).toInt();
int frame = list.at(1).toInt();
int col = list.at(2).toInt();
- // Siamo in LineTest il keyframe è globale quindi basta calcolare l'indice
- // del primo parametro!!!!
TUndoManager::manager()->beginBlock();
TStageObject *stageObject =
m_viewer->getXsheet()->getStageObject(m_viewer->getObjectId(col));
TDoubleParam *param = stageObject->getParam(TStageObject::T_Angle);
int keyFrameIndex = param->getClosestKeyframe(frame);
- setParamStep(keyFrameIndex, step,
- stageObject->getParam(TStageObject::T_Angle));
- setParamStep(keyFrameIndex, step, stageObject->getParam(TStageObject::T_X));
- setParamStep(keyFrameIndex, step, stageObject->getParam(TStageObject::T_Y));
- setParamStep(keyFrameIndex, step, stageObject->getParam(TStageObject::T_Z));
- setParamStep(keyFrameIndex, step, stageObject->getParam(TStageObject::T_SO));
- setParamStep(keyFrameIndex, step,
- stageObject->getParam(TStageObject::T_ScaleX));
- setParamStep(keyFrameIndex, step,
- stageObject->getParam(TStageObject::T_ScaleY));
- setParamStep(keyFrameIndex, step,
- stageObject->getParam(TStageObject::T_Scale));
- setParamStep(keyFrameIndex, step,
- stageObject->getParam(TStageObject::T_Path));
- setParamStep(keyFrameIndex, step,
- stageObject->getParam(TStageObject::T_ShearX));
- setParamStep(keyFrameIndex, step,
- stageObject->getParam(TStageObject::T_ShearY));
+ if (keyFrameIndex >= 0) {
+ setParamStep(keyFrameIndex, step,
+ stageObject->getParam(TStageObject::T_Angle));
+ }
+
+ param = stageObject->getParam(TStageObject::T_X);
+ keyFrameIndex = param->getClosestKeyframe(frame);
+ if (keyFrameIndex >= 0) {
+ setParamStep(keyFrameIndex, step, stageObject->getParam(TStageObject::T_X));
+ }
+ param = stageObject->getParam(TStageObject::T_Y);
+ keyFrameIndex = param->getClosestKeyframe(frame);
+ if (keyFrameIndex >= 0) {
+ setParamStep(keyFrameIndex, step, stageObject->getParam(TStageObject::T_Y));
+ }
+ param = stageObject->getParam(TStageObject::T_Z);
+ keyFrameIndex = param->getClosestKeyframe(frame);
+ if (keyFrameIndex >= 0) {
+ setParamStep(keyFrameIndex, step, stageObject->getParam(TStageObject::T_Z));
+ }
+ param = stageObject->getParam(TStageObject::T_SO);
+ keyFrameIndex = param->getClosestKeyframe(frame);
+ if (keyFrameIndex >= 0) {
+ setParamStep(keyFrameIndex, step,
+ stageObject->getParam(TStageObject::T_SO));
+ }
+ param = stageObject->getParam(TStageObject::T_ScaleX);
+ keyFrameIndex = param->getClosestKeyframe(frame);
+ if (keyFrameIndex >= 0) {
+ setParamStep(keyFrameIndex, step,
+ stageObject->getParam(TStageObject::T_ScaleX));
+ }
+ param = stageObject->getParam(TStageObject::T_ScaleY);
+ keyFrameIndex = param->getClosestKeyframe(frame);
+ if (keyFrameIndex >= 0) {
+ setParamStep(keyFrameIndex, step,
+ stageObject->getParam(TStageObject::T_ScaleY));
+ }
+ param = stageObject->getParam(TStageObject::T_Scale);
+ keyFrameIndex = param->getClosestKeyframe(frame);
+ if (keyFrameIndex >= 0) {
+ setParamStep(keyFrameIndex, step,
+ stageObject->getParam(TStageObject::T_Scale));
+ }
+ param = stageObject->getParam(TStageObject::T_Path);
+ keyFrameIndex = param->getClosestKeyframe(frame);
+ if (keyFrameIndex >= 0) {
+ setParamStep(keyFrameIndex, step,
+ stageObject->getParam(TStageObject::T_Path));
+ }
+ param = stageObject->getParam(TStageObject::T_ShearX);
+ keyFrameIndex = param->getClosestKeyframe(frame);
+ if (keyFrameIndex >= 0) {
+ setParamStep(keyFrameIndex, step,
+ stageObject->getParam(TStageObject::T_ShearX));
+ }
+ param = stageObject->getParam(TStageObject::T_ShearY);
+ keyFrameIndex = param->getClosestKeyframe(frame);
+ if (keyFrameIndex >= 0) {
+ setParamStep(keyFrameIndex, step,
+ stageObject->getParam(TStageObject::T_ShearY));
+ }
+
TUndoManager::manager()->endBlock();
-#endif
}
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonz/xshcolumnviewer.cpp b/toonz/sources/toonz/xshcolumnviewer.cpp
index ec038a40e..53455a2b9 100644
--- a/toonz/sources/toonz/xshcolumnviewer.cpp
+++ b/toonz/sources/toonz/xshcolumnviewer.cpp
@@ -117,9 +117,79 @@ const QIcon getColorChipIcon(TPixel32 color) {
return QIcon(pixmap);
}
+bool containsVectorLevel(int col) {
+ TXshColumn *column =
+ TApp::instance()->getCurrentXsheet()->getXsheet()->getColumn(col);
+ TXshColumn::ColumnType type = column->getColumnType();
+ if (type != TXshColumn::eLevelType) return false;
+
+ const QSet<TXshSimpleLevel *> levels = getLevels(column);
+ QSet<TXshSimpleLevel *>::const_iterator it2;
+ bool isVector = false;
+ for (it2 = levels.begin(); it2 != levels.end(); it2++) {
+ TXshSimpleLevel *sl = *it2;
+ int type = sl->getType();
+ if (type == PLI_XSHLEVEL) {
+ isVector = true;
+ return true;
+ }
+ }
+ return false;
+}
+
bool isCtrlPressed = false;
} // namespace
+//=============================================================================
+// ColumnMaskUndo
+//-----------------------------------------------------------------------------
+class ColumnMaskUndo final : public TUndo {
+ int m_col;
+ bool m_isMask;
+ std::string m_name;
+
+public:
+ ColumnMaskUndo(int column, bool isMask, std::string name)
+ : m_col(column), m_isMask(isMask), m_name(name) {}
+ ~ColumnMaskUndo() {}
+
+ void undo() const override {
+ TXshColumn *column =
+ TApp::instance()->getCurrentXsheet()->getXsheet()->getColumn(m_col);
+ TXshColumn::ColumnType type = column->getColumnType();
+ if (type != TXshColumn::eLevelType) return;
+
+ if (containsVectorLevel(m_col)) {
+ column->setIsMask(m_isMask);
+ TApp::instance()->getCurrentScene()->notifySceneChanged();
+ TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
+ TApp::instance()->getCurrentScene()->setDirtyFlag(true);
+ }
+ }
+
+ void redo() const override {
+ TXshColumn *column =
+ TApp::instance()->getCurrentXsheet()->getXsheet()->getColumn(m_col);
+ TXshColumn::ColumnType type = column->getColumnType();
+ if (type != TXshColumn::eLevelType) return;
+
+ if (containsVectorLevel(m_col)) {
+ column->setIsMask(!m_isMask);
+ TApp::instance()->getCurrentScene()->notifySceneChanged();
+ TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
+ TApp::instance()->getCurrentScene()->setDirtyFlag(true);
+ }
+ }
+
+ int getSize() const override { return sizeof(*this); }
+
+ QString getHistoryString() override {
+ QString str = QObject::tr("Toggle vector column as mask. ");
+ return str;
+ }
+ int getHistoryType() override { return HistoryType::Xsheet; }
+};
+
//-----------------------------------------------------------------------------
namespace XsheetGUI {
@@ -371,9 +441,9 @@ void ChangeObjectParent::onTextChanged(const QString &text) {
hide();
return;
}
- bool isPegbar = false;
+ bool isPegbar = false;
if (text.startsWith("Peg")) isPegbar = true;
- QString number = text;
+ QString number = text;
number.remove(0, 4);
int index = number.toInt() - 1;
if (index < 0) {
@@ -446,7 +516,7 @@ void ChangeObjectHandle::onTextChanged(const QString &text) {
assert(m_objectHandle);
TStageObjectId currentObjectId = m_objectHandle->getObjectId();
QString handle = text;
- if (text.toInt() != 0) handle = QString("H") + handle;
+ if (text.toInt() != 0) handle = QString("H") + handle;
if (handle.isEmpty()) return;
std::vector<TStageObjectId> ids;
ids.push_back(currentObjectId);
@@ -614,7 +684,7 @@ void ColumnArea::DrawHeader::levelColors(QColor &columnColor,
}
enum { Normal, Reference, Control } usage = Reference;
if (column) {
- if (column->isControl()) usage = Control;
+ if (column->isControl()) usage = Control;
if (column->isRendered() || column->getMeshColumn()) usage = Normal;
}
@@ -632,7 +702,7 @@ void ColumnArea::DrawHeader::paletteColors(QColor &columnColor,
QColor &dragColor) const {
enum { Normal, Reference, Control } usage = Reference;
if (column) { // Check if column is a mask
- if (column->isControl()) usage = Control;
+ if (column->isControl()) usage = Control;
if (column->isRendered()) usage = Normal;
}
@@ -1168,7 +1238,6 @@ ColumnArea::ColumnArea(XsheetViewer *parent, Qt::WFlags flags)
, m_isPanning(false)
, m_soundColumnPopup(0) {
TXsheetHandle *xsheetHandle = TApp::instance()->getCurrentXsheet();
-#ifndef LINETEST
TObjectHandle *objectHandle = TApp::instance()->getCurrentObject();
m_changeObjectParent = new ChangeObjectParent(0);
m_changeObjectParent->setObjectHandle(objectHandle);
@@ -1179,7 +1248,10 @@ ColumnArea::ColumnArea(XsheetViewer *parent, Qt::WFlags flags)
m_changeObjectHandle->setObjectHandle(objectHandle);
m_changeObjectHandle->setXsheetHandle(xsheetHandle);
m_changeObjectHandle->hide();
-#else
+
+#ifdef LINETEST
+ // linetest had options around a motion path
+ // you could configure from the column header
m_motionPathMenu = new MotionPathMenu(0);
#endif
@@ -1699,11 +1771,11 @@ m_value->setFont(font);*/
bool ret = connect(m_slider, SIGNAL(sliderReleased()), this,
SLOT(onSliderReleased()));
- ret = ret && connect(m_slider, SIGNAL(sliderMoved(int)), this,
+ ret = ret && connect(m_slider, SIGNAL(sliderMoved(int)), this,
SLOT(onSliderChange(int)));
- ret = ret && connect(m_slider, SIGNAL(valueChanged(int)), this,
+ ret = ret && connect(m_slider, SIGNAL(valueChanged(int)), this,
SLOT(onSliderValueChanged(int)));
- ret = ret && connect(m_value, SIGNAL(textChanged(const QString &)), this,
+ ret = ret && connect(m_value, SIGNAL(textChanged(const QString &)), this,
SLOT(onValueChanged(const QString &)));
ret = ret && connect(m_filterColorCombo, SIGNAL(activated(int)), this,
@@ -1816,11 +1888,11 @@ SoundColumnPopup::SoundColumnPopup(QWidget *parent)
bool ret = connect(m_slider, SIGNAL(sliderReleased()), this,
SLOT(onSliderReleased()));
- ret = ret && connect(m_slider, SIGNAL(sliderMoved(int)), this,
+ ret = ret && connect(m_slider, SIGNAL(sliderMoved(int)), this,
SLOT(onSliderChange(int)));
- ret = ret && connect(m_slider, SIGNAL(valueChanged(int)), this,
+ ret = ret && connect(m_slider, SIGNAL(valueChanged(int)), this,
SLOT(onSliderValueChanged(int)));
- ret = ret && connect(m_value, SIGNAL(textChanged(const QString &)), this,
+ ret = ret && connect(m_value, SIGNAL(textChanged(const QString &)), this,
SLOT(onValueChanged(const QString &)));
assert(ret);
}
@@ -2184,8 +2256,8 @@ void ColumnArea::mouseMoveEvent(QMouseEvent *event) {
return;
}
- int col = m_viewer->xyToPosition(pos).layer();
- if (col < -1) col = 0;
+ int col = m_viewer->xyToPosition(pos).layer();
+ if (col < -1) col = 0;
TXsheet *xsh = m_viewer->getXsheet();
TXshColumn *column = xsh->getColumn(col);
QPoint mouseInCell = pos - m_viewer->positionToXY(CellPosition(0, col));
@@ -2334,15 +2406,16 @@ void ColumnArea::mouseReleaseEvent(QMouseEvent *event) {
QDesktopWidget *desktop = qApp->desktop();
QRect screenRect = desktop->screenGeometry(app->getMainWindow());
- int popupLeft = event->globalPos().x() + x;
+ int popupLeft = event->globalPos().x() + x;
int popupRight = popupLeft + m_columnTransparencyPopup->width();
// first condition checks if popup is on same monitor as main app;
// if popup is on different monitor, leave as is
if (popupLeft < screenRect.right() && popupRight > screenRect.right()) {
int distance = popupRight - screenRect.right();
- m_columnTransparencyPopup->move(m_columnTransparencyPopup->x() - distance,
- m_columnTransparencyPopup->y());
+ m_columnTransparencyPopup->move(
+ m_columnTransparencyPopup->x() - distance,
+ m_columnTransparencyPopup->y());
}
openTransparencyPopup();
@@ -2418,11 +2491,6 @@ void ColumnArea::mouseDoubleClickEvent(QMouseEvent *event) {
QPoint topLeft = m_viewer->positionToXY(cellPosition);
QPoint mouseInCell = pos - topLeft;
-#ifdef LINETEST
- // Camera column
- if (col == -1) return;
-#endif
-
QRect nameRect = o->rect((col < 0) ? PredefinedRect::CAMERA_LAYER_NAME
: PredefinedRect::LAYER_NAME);
if (!nameRect.contains(mouseInCell)) return;
@@ -2591,6 +2659,22 @@ void ColumnArea::contextMenuEvent(QContextMenuEvent *event) {
if (!xsh->isColumnEmpty(col)) {
menu.addAction(cmdManager->getAction(MI_ReplaceLevel));
menu.addAction(cmdManager->getAction(MI_ReplaceParentDirectory));
+
+ if (containsVectorLevel(col)) {
+ menu.addSeparator();
+ QAction *setMask =
+ new QAction(tr("Temporary Mask (Not in final render)"), this);
+ setMask->setCheckable(true);
+ setMask->setChecked(xsh->getColumn(col)->isMask());
+ setMask->setToolTip(
+ tr("Only Toonz Vector levels can be used as masks. \n Masks don't "
+ "show up in final renders."));
+ bool ret = true;
+ ret = ret &&
+ connect(setMask, &QAction::toggled, [=]() { onSetMask(col); });
+ assert(ret);
+ menu.addAction(setMask);
+ }
}
}
@@ -2624,6 +2708,20 @@ void ColumnArea::contextMenuEvent(QContextMenuEvent *event) {
//-----------------------------------------------------------------------------
+void ColumnArea::onSetMask(int col) {
+ TXshColumn *column = m_viewer->getXsheet()->getColumn(m_col);
+
+ std::string name = m_viewer->getXsheet()
+ ->getStageObject(TStageObjectId::ColumnId(col))
+ ->getName();
+ ColumnMaskUndo *undo = new ColumnMaskUndo(col, column->isMask(), name);
+ undo->redo();
+ TUndoManager::manager()->add(undo);
+ update();
+}
+
+//-----------------------------------------------------------------------------
+
void ColumnArea::onSubSampling(QAction *action) {
int subsampling;
if (action == m_subsampling1)
diff --git a/toonz/sources/toonz/xshcolumnviewer.h b/toonz/sources/toonz/xshcolumnviewer.h
index 3c1bd76ce..a57f23dbc 100644
--- a/toonz/sources/toonz/xshcolumnviewer.h
+++ b/toonz/sources/toonz/xshcolumnviewer.h
@@ -382,6 +382,7 @@ protected slots:
void openCameraColumnPopup(QPoint pos);
void onCameraColumnChangedTriggered();
void onXsheetCameraChange(int);
+ void onSetMask(int);
};
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonzlib/imagestyles.cpp b/toonz/sources/toonzlib/imagestyles.cpp
index 7e8080818..d4d93ab4b 100644
--- a/toonz/sources/toonzlib/imagestyles.cpp
+++ b/toonz/sources/toonzlib/imagestyles.cpp
@@ -7,7 +7,6 @@
#include "ttessellator.h"
#include "trop.h"
#include "drawutil.h"
-#include "tflash.h"
#include "tpixelutils.h"
#include "tlevel_io.h"
#include "timage_io.h"
@@ -331,18 +330,6 @@ void TTextureStyle::drawRegion(const TColorFunction *cf,
if (m_tessellator)
m_tessellator->tessellate(cf, antiAliasing, boundary, m_texture);
}
-//-----------------------------------------------------------------------------
-void TTextureStyle::drawRegion(TFlash &flash, const TRegion *r) const {
- flash.setTexture(m_texture);
- flash.setFillStyleMatrix(TAffine());
- flash.drawRegion(*r);
- // rd.setTexture(m_colorStyle->getMainColor());
-}
-//-----------------------------------------------------------------------------
-
-void TTextureStyle::setFill(TFlash &flash) const {
- flash.setTexture(getTexture());
-}
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonzlib/scenefx.cpp b/toonz/sources/toonzlib/scenefx.cpp
index 077fbeb10..f10bfb3fa 100644
--- a/toonz/sources/toonzlib/scenefx.cpp
+++ b/toonz/sources/toonzlib/scenefx.cpp
@@ -99,12 +99,6 @@ public:
std::string getPluginId() const override { return std::string(); }
- void compute(TFlash &flash, int frame) override {
- if (!m_port.isConnected()) return;
-
- TRasterFxP(m_port.getFx())->compute(flash, m_frame);
- }
-
void doCompute(TTile &tile, double frame,
const TRenderSettings &ri) override {
if (!m_port.isConnected()) {
diff --git a/toonz/sources/toonzlib/tcolumnfx.cpp b/toonz/sources/toonzlib/tcolumnfx.cpp
index f865c3e19..2127157a2 100644
--- a/toonz/sources/toonzlib/tcolumnfx.cpp
+++ b/toonz/sources/toonzlib/tcolumnfx.cpp
@@ -7,7 +7,6 @@
#include "tconvert.h"
#include "tstopwatch.h"
#include "tlevel_io.h"
-#include "tflash.h"
#include "trasterimage.h"
#include "ttoonzimage.h"
#include "tvectorimage.h"
@@ -1544,17 +1543,6 @@ TXshColumn *TLevelColumnFx::getXshColumn() const { return m_levelColumn; }
//-------------------------------------------------------------------
-void TLevelColumnFx::compute(TFlash &flash, int frame) {
- if (!m_levelColumn) return;
-
- TImageP img = m_levelColumn->getCell(frame).getImage(false);
- if (!img) return;
-
- flash.draw(img, 0);
-}
-
-//-------------------------------------------------------------------
-
TAffine TLevelColumnFx::getDpiAff(int frame) {
if (!m_levelColumn) return TAffine();
@@ -1697,10 +1685,6 @@ std::string TPaletteColumnFx::getAlias(double frame,
//-------------------------------------------------------------------
-void TPaletteColumnFx::compute(TFlash &flash, int frame) {}
-
-//-------------------------------------------------------------------
-
int TPaletteColumnFx::getColumnIndex() const {
return m_paletteColumn ? m_paletteColumn->getIndex() : -1;
}
diff --git a/toonz/sources/toonzlib/txshsimplelevel.cpp b/toonz/sources/toonzlib/txshsimplelevel.cpp
index cf2ff705e..335893d47 100644
--- a/toonz/sources/toonzlib/txshsimplelevel.cpp
+++ b/toonz/sources/toonzlib/txshsimplelevel.cpp
@@ -800,8 +800,7 @@ void TXshSimpleLevel::setFrame(const TFrameId &fid, const TImageP &img) {
if (frameStatus == Normal) {
// Only a normal frame can have these. Justified since:
- // a) PLIs have nothing to share with cleanup stuff
- // b) The latter is used only in LineTest - which does not have Cleanup
+ // PLIs have nothing to share with cleanup stuff
if (m_type == PLI_XSHLEVEL) {
const std::string &imageId2 = rasterized(imageId);
@@ -920,7 +919,6 @@ void TXshSimpleLevel::loadData(TIStream &is) {
if (is.getTagParam("isStopMotionLevel", v))
isStopMotionLevel = std::stoi(v);
-
m_properties->setDpiPolicy(dpiPolicy);
m_properties->setDpi(TPointD(xdpi, ydpi));
m_properties->setSubsampling(subsampling);