From: Jean-Baptiste M. <jb...@kd...> - 2012-06-12 15:26:00
|
Git commit 5257097d158dd09feb099d642e6773d8591ea057 by Jean-Baptiste Mardelle. Committed on 12/06/2012 at 17:21. Pushed by mardelle into branch 'v0.9'. Color values in MLT should always contain alpha (0xRRGGBBAA): http://kdenlive.org/mantis/view.php?id=2644 M +1 -1 effects/chroma.xml M +1 -1 effects/chroma_hold.xml M +2 -2 effects/frei0r_balanc0r.xml M +1 -1 effects/frei0r_colordistance.xml M +2 -2 effects/frei0r_select0r.xml M +3 -3 effects/frei0r_three_point_balance.xml M +2 -2 effects/frei0r_tint0r.xml M +1 -1 effects/pan_zoom.xml M +1 -1 effects/rotation.xml M +1 -1 effects/rotation_keyframable.xml M +9 -8 src/choosecolorwidget.cpp M +3 -5 src/choosecolorwidget.h M +1 -2 src/effectstack/parametercontainer.cpp http://commits.kde.org/kdenlive/5257097d158dd09feb099d642e6773d8591ea057 diff --git a/effects/chroma.xml b/effects/chroma.xml index 91478d2..128a4cb 100644 --- a/effects/chroma.xml +++ b/effects/chroma.xml @@ -3,7 +3,7 @@ <name>Blue Screen</name> <description>Make selected color transparent</description> <author>Charles Yates</author> - <parameter type="color" name="key" default="0x0000FF"> + <parameter type="color" name="key" default="0x0000ffff"> <name>Color key</name> </parameter> <parameter type="constant" name="variance" max="100" min="0" factor="100" default="15"> diff --git a/effects/chroma_hold.xml b/effects/chroma_hold.xml index b31a589..ce6feff 100644 --- a/effects/chroma_hold.xml +++ b/effects/chroma_hold.xml @@ -3,7 +3,7 @@ <name>Chroma Hold</name> <description>Make image greyscale except for chosen color</description> <author>Charles Yates</author> - <parameter type="color" name="key" default="0x000000"> + <parameter type="color" name="key" default="0x000000ff"> <name>Color key</name> </parameter> <parameter type="constant" name="variance" max="100" min="0" factor="100" default="15" > diff --git a/effects/frei0r_balanc0r.xml b/effects/frei0r_balanc0r.xml index 6a53216..f7c55dc 100644 --- a/effects/frei0r_balanc0r.xml +++ b/effects/frei0r_balanc0r.xml @@ -4,7 +4,7 @@ <name>White Balance</name> <description>Adjust the white balance / color temperature</description> <author>Dan Dennedy</author> - <parameter type="color" name="Neutral Color" default="0xFFFFFF"> + <parameter type="color" name="Neutral Color" default="0xffffffff"> <name>Neutral Color</name> </parameter> <parameter type="simplekeyframe" name="Green Tint" default="1200" min="0" max="2500" factor="1000"> @@ -15,7 +15,7 @@ <name>White Balance</name> <description>Adjust the white balance / color temperature</description> <author>Dan Dennedy</author> - <parameter type="color" name="Neutral Color" default="0xFFFFFF"> + <parameter type="color" name="Neutral Color" default="0xffffffff"> <name>Neutral Color</name> </parameter> <parameter type="simplekeyframe" name="Green Tint" default="1333" min="0" max="10000" factor="10000"> diff --git a/effects/frei0r_colordistance.xml b/effects/frei0r_colordistance.xml index 9f1836a..d407589 100644 --- a/effects/frei0r_colordistance.xml +++ b/effects/frei0r_colordistance.xml @@ -3,7 +3,7 @@ <name>Color Distance</name> <description>Calculates the distance between the selected color and the current pixel and uses that value as new pixel value</description> <author>Richard Spindler</author> - <parameter type="color" name="Color" default="0x000000"> + <parameter type="color" name="Color" default="0x000000ff"> <name>Source Color</name> </parameter> </effect> diff --git a/effects/frei0r_select0r.xml b/effects/frei0r_select0r.xml index 021f21c..dba7c10 100644 --- a/effects/frei0r_select0r.xml +++ b/effects/frei0r_select0r.xml @@ -5,7 +5,7 @@ <description>Color based alpha selection</description> <author>Marko Cebokli</author> - <parameter type="color" name="Color to select" default="0x00FF00"> + <parameter type="color" name="Color to select" default="0x00ff00ff"> <name>Color to select</name> </parameter> @@ -52,7 +52,7 @@ <description>Color based alpha selection</description> <author>Marko Cebokli</author> - <parameter type="color" name="Color to select" default="0x00FF00"> + <parameter type="color" name="Color to select" default="0x00ff00ff"> <name>Color to select</name> </parameter> diff --git a/effects/frei0r_three_point_balance.xml b/effects/frei0r_three_point_balance.xml index becee08..03b042c 100644 --- a/effects/frei0r_three_point_balance.xml +++ b/effects/frei0r_three_point_balance.xml @@ -3,13 +3,13 @@ <name>3 point balance</name> <description>Balances colors along with 3 points</description> <author>Maksim Golovkin</author> - <parameter type="color" name="Black color" default="0x000000"> + <parameter type="color" name="Black color" default="0x000000ff"> <name>Black color</name> </parameter> - <parameter type="color" name="Gray color" default="0x808080"> + <parameter type="color" name="Gray color" default="0x808080ff"> <name>Gray color</name> </parameter> - <parameter type="color" name="White color" default="0xFFFFFF"> + <parameter type="color" name="White color" default="0xffffffff"> <name>White color</name> </parameter> <parameter type="bool" name="Split preview" default="0"> diff --git a/effects/frei0r_tint0r.xml b/effects/frei0r_tint0r.xml index d79cd5e..102a3cc 100644 --- a/effects/frei0r_tint0r.xml +++ b/effects/frei0r_tint0r.xml @@ -3,10 +3,10 @@ <name>Tint</name> <description>Maps source image luminance between two colors specified</description> <author>Maksim Golovkin</author> - <parameter type="color" name="Map black to" default="0x000000"> + <parameter type="color" name="Map black to" default="0x000000ff"> <name>Map black to</name> </parameter> - <parameter type="color" name="Map white to" default="0x80FF80"> + <parameter type="color" name="Map white to" default="0x80FF80ff"> <name>Map white to</name> </parameter> <parameter type="simplekeyframe" name="Tint amount" default="250" min="0" max="1000" factor="1000"> diff --git a/effects/pan_zoom.xml b/effects/pan_zoom.xml index 89ccf76..3f5544a 100644 --- a/effects/pan_zoom.xml +++ b/effects/pan_zoom.xml @@ -9,7 +9,7 @@ <parameter type="bool" name="transition.distort" default="0"> <name>Distort</name> </parameter> - <parameter type="color" name="background" default="colour:0x00000000" paramprefix="colour:"> + <parameter type="color" name="background" default="colour:0x00000000" alpha="1" paramprefix="colour:"> <name>Background Color</name> </parameter> </effect> diff --git a/effects/rotation.xml b/effects/rotation.xml index 0130102..1a8a8ec 100644 --- a/effects/rotation.xml +++ b/effects/rotation.xml @@ -36,7 +36,7 @@ <parameter type="geometry" name="transition.geometry" default="0%,0%:100%x100%" fixed="1" opacity="false"> <name>Pan and Zoom</name> </parameter> - <parameter type="color" name="background" default="colour:0x00000000" paramprefix="colour:"> + <parameter type="color" name="background" default="colour:0x00000000" alpha="1" paramprefix="colour:"> <name>Background Color</name> </parameter> </effect> diff --git a/effects/rotation_keyframable.xml b/effects/rotation_keyframable.xml index d78b14f..e4a8839 100644 --- a/effects/rotation_keyframable.xml +++ b/effects/rotation_keyframable.xml @@ -18,7 +18,7 @@ <parameter type="simplekeyframe" name="transition.oy" max="32000" min="-32000" default="0"> <name>Offset Y</name> </parameter> - <parameter type="color" name="background" default="colour:0x00000000" paramprefix="colour:"> + <parameter type="color" name="background" default="colour:0x00000000" alpha="1" paramprefix="colour:"> <name>Background Color</name> </parameter> <parameter type="fixed" name="transition.keyed" max="1" min="1" default="1" /> diff --git a/src/choosecolorwidget.cpp b/src/choosecolorwidget.cpp index 26c1874..8543d79 100644 --- a/src/choosecolorwidget.cpp +++ b/src/choosecolorwidget.cpp @@ -27,6 +27,7 @@ #include <KColorButton> #include <KLocalizedString> #include <kdeversion.h> +#include <KDebug> static QColor stringToColor(QString strColor) { @@ -81,10 +82,14 @@ static QString colorToString(QColor color, bool alpha) { stream << color.alpha(); } + else { + // MLT always wants 0xRRGGBBAA format + stream << "ff"; + } return colorStr; } -ChooseColorWidget::ChooseColorWidget(QString text, QString color, QWidget *parent) : +ChooseColorWidget::ChooseColorWidget(QString text, QString color, bool alphaEnabled, QWidget *parent) : QWidget(parent) { QHBoxLayout *layout = new QHBoxLayout(this); @@ -99,6 +104,9 @@ ChooseColorWidget::ChooseColorWidget(QString text, QString color, QWidget *paren rightSideLayout->setSpacing(0); m_button = new KColorButton(stringToColor(color), rightSide); +#if KDE_IS_VERSION(4,5,0) + if (alphaEnabled) m_button->setAlphaChannelEnabled(alphaEnabled); +#endif // m_button->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); ColorPickerWidget *picker = new ColorPickerWidget(rightSide); @@ -121,13 +129,6 @@ QString ChooseColorWidget::getColor() return colorToString(m_button->color(), alphaChannel); } -void ChooseColorWidget::setAlphaChannelEnabled(bool enabled) -{ -#if KDE_IS_VERSION(4,5,0) - m_button->setAlphaChannelEnabled(enabled); -#endif -} - void ChooseColorWidget::setColor(QColor color) { m_button->setColor(color); diff --git a/src/choosecolorwidget.h b/src/choosecolorwidget.h index 4c2c2ff..3f41794 100644 --- a/src/choosecolorwidget.h +++ b/src/choosecolorwidget.h @@ -38,14 +38,12 @@ class ChooseColorWidget : public QWidget public: /** @brief Sets up the widget. * @param text (optional) What the color will be used for - * @param color (optional) initial color */ - ChooseColorWidget(QString text = QString(), QString color = "0xffffffff", QWidget* parent = 0); + * @param color (optional) initial color + * @param alphaEnabled (optional) Should transparent colors be enabled */ + ChooseColorWidget(QString text = QString(), QString color = "0xffffffff", bool alphaEnabled = false, QWidget* parent = 0); /** @brief Gets the choosen color. */ QString getColor(); - /** @brief Enable the use of alpha channel. - * @param enabled (required) whether alpha is enabled or disabled */ - void setAlphaChannelEnabled(bool enabled); private: KColorButton *m_button; diff --git a/src/effectstack/parametercontainer.cpp b/src/effectstack/parametercontainer.cpp index 0fd2da7..9e5ecbd 100644 --- a/src/effectstack/parametercontainer.cpp +++ b/src/effectstack/parametercontainer.cpp @@ -269,8 +269,7 @@ ParameterContainer::ParameterContainer(QDomElement effect, ItemInfo info, Effect if (pa.hasAttribute("paramprefix")) value.remove(0, pa.attribute("paramprefix").size()); if (value.startsWith('#')) value = value.replace('#', "0x"); - ChooseColorWidget *choosecolor = new ChooseColorWidget(paramName, value, parent); - choosecolor->setAlphaChannelEnabled(true); + ChooseColorWidget *choosecolor = new ChooseColorWidget(paramName, value, pa.hasAttribute("alpha"), parent); m_vbox->addWidget(choosecolor); m_valueItems[paramName] = choosecolor; connect(choosecolor, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int))); |