From 46b32c1628f07f32f84c5d117fe5d657d59e1546 Mon Sep 17 00:00:00 2001 From: adv Date: Wed, 11 Sep 2013 07:06:23 +0000 Subject: [PATCH] Dump arguments of color mask operator to python string representation. --- .../ImageComposer_ColorMaskOperator.cxx | 28 +++++++++++++++++++ .../ImageComposer_ColorMaskOperator.h | 7 +++++ 2 files changed, 35 insertions(+) diff --git a/src/ImageComposer/ImageComposer_ColorMaskOperator.cxx b/src/ImageComposer/ImageComposer_ColorMaskOperator.cxx index 8f0f64b25..45ee5c901 100644 --- a/src/ImageComposer/ImageComposer_ColorMaskOperator.cxx +++ b/src/ImageComposer/ImageComposer_ColorMaskOperator.cxx @@ -48,6 +48,34 @@ QString ImageComposer_ColorMaskOperator::name() const return "colormask"; } +QStringList ImageComposer_ColorMaskOperator::dumpArgsToPython( QString& theArrayName ) const +{ + QStringList aResList = ImageComposer_Operator::dumpArgsToPython( theArrayName ); + + QString aStreamName = theArrayName + "_stream"; + + //Dump operator arguments + aResList << QString( "" ); + aResList << QString( "mask_color = QColor( %1, %2, %3, %4 );" ) + .arg( myRefColor.red() ).arg( myRefColor.green() ) + .arg( myRefColor.blue() ).arg( myRefColor.alpha() ); + aResList << QString( "%1 << mask_color;" ).arg( aStreamName ); + + aResList << QString( "" ); + aResList << QString( "make_transparent = %1;" ).arg( myIsMakeTransparent ); + aResList << QString( "%1 << make_transparent;" ).arg( aStreamName ); + + aResList << QString( "" ); + aResList << QString( "rgb_threshold = %1;" ).arg( myRGBThreshold ); + aResList << QString( "%1 << rgb_threshold;" ).arg( aStreamName ); + + aResList << QString( "" ); + aResList << QString( "alpha_threshold = %1;" ).arg( myAlphaThreshold ); + aResList << QString( "%1 << alpha_threshold;" ).arg( aStreamName ); + + return aResList; +} + /** */ QRectF ImageComposer_ColorMaskOperator::calcResultBoundingRect( const QRectF& theImage1Bounds, diff --git a/src/ImageComposer/ImageComposer_ColorMaskOperator.h b/src/ImageComposer/ImageComposer_ColorMaskOperator.h index fec0c9025..1e5131560 100644 --- a/src/ImageComposer/ImageComposer_ColorMaskOperator.h +++ b/src/ImageComposer/ImageComposer_ColorMaskOperator.h @@ -22,6 +22,13 @@ public: virtual QString name() const; + /** + Dumps arguments of operator to python script representation + @param theArrayName name of result \c QByteArray array variable + @return list of strings with python representation + **/ + QStringList dumpArgsToPython( QString& theArrayName ) const; + protected: virtual QRectF calcResultBoundingRect( const QRectF& theImage1Bounds, const QRectF& theImage2Bounds ) const; -- 2.39.2