Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 34aae67a authored by Boudewijn Rempt's avatar Boudewijn Rempt

Add an erase composite op for the ctlcs-based colorspaces

Also, fix the id for alpha darken.
parent ec38fbaf
......@@ -128,8 +128,12 @@ QString KoCTLCompositeOp::idForFile(const std::string& _file)
QString basename = fi.baseName();
if (basename == "over") {
return COMPOSITE_OVER;
} else if (basename == "alphadarken") {
return COMPOSITE_DARKEN;
}
else if (basename == "alphadarken") {
return COMPOSITE_ALPHA_DARKEN;
}
else if (basename == "erase") {
return COMPOSITE_ERASE;
}
qFatal("No id for: %s", _file.c_str());
return QString::null; // Make gcc 4.5.1 happy
......@@ -141,9 +145,13 @@ QString KoCTLCompositeOp::descriptionForFile(const std::string& _file)
QString basename = fi.baseName();
if (basename == "over") {
return i18n("Normal");
} else if (basename == "alphadarken") {
}
else if (basename == "alphadarken") {
return i18n("Alpha darken");
}
else if (basename == "erase") {
return i18n("Erase");
}
qFatal("No description for: %s", _file.c_str());
return QString::null; // Make gcc 4.5.1 happy
}
......@@ -152,7 +160,9 @@ QString KoCTLCompositeOp::categoryForFile(const std::string& _file)
{
QFileInfo fi(_file.c_str());
QString basename = fi.baseName();
if (basename == "over" || basename == "alphadarken") {
if (basename == "over"
|| basename == "alphadarken"
|| basename == "erase") {
return KoCompositeOp::categoryMix();
}
qFatal("No category for: %s", _file.c_str());
......
install(FILES
over.ctlt
alphadarken.ctlt
erase.ctlt
DESTINATION ${DATA_INSTALL_DIR}/pigmentcms/ctlcompositeops)
install(FILES
......
@operation(compositeWithmask, inputs=2, arguments=int mask, optional_arguments=int opacity = 255)
{
// @in(0) -> dst
// @in(1) -> src
@alphachannel( @type newalpha = @in(1); )
@alphachannel( @type dstalpha = @in(0); )
if (mask != 0) {
newalpha = (newalpha * mask) / 255;
}
else {
newalpha = 0;
}
if (opacity != 255) {
newalpha = (newalpha * opacity) / 255;
}
newalpha = 1.0 - newalpha;
newalpha = newalpha * dstalpha;
@colorchannels( @out = @in(0); )
@alphachannel( @out = newalpha; )
}
@operation(compositeWithoutmask, inputs=2, optional_arguments=int opacity = 255)
{
compositeWithmask(@in(0), @in(1), 255, @out, opacity);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment