[calligra] krita/ui/openrastertk: load openraster blending modes

Elvis Stansvik elvstone at gmail.com
Fri May 13 10:44:50 BST 2011


2011/5/13 Boudewijn Rempt <boud at valdyas.org>:
> Git commit 15f2a481ef742bc6f0ded66ca854d29ae6f712ac by Boudewijn Rempt.
> Committed on 13/05/2011 at 02:36.
> Pushed by rempt into branch 'master'.
>
> load openraster blending modes
>
> These are defined as a subset of svg blending modes.
>
> M  +18   -0    krita/ui/openrastertk/kis_open_raster_stack_load_visitor.cpp
> M  +12   -0    krita/ui/openrastertk/kis_open_raster_stack_save_visitor.cpp
>
> http://commits.kde.org/calligra/15f2a481ef742bc6f0ded66ca854d29ae6f712ac
>
> diff --git a/krita/ui/openrastertk/kis_open_raster_stack_load_visitor.cpp b/krita/ui/openrastertk/kis_open_raster_stack_load_visitor.cpp
> index c1f65ab..d111175 100644
> --- a/krita/ui/openrastertk/kis_open_raster_stack_load_visitor.cpp
> +++ b/krita/ui/openrastertk/kis_open_raster_stack_load_visitor.cpp
> @@ -31,6 +31,7 @@
>  #include <filter/kis_filter_registry.h>
>  #include <kis_group_layer.h>
>  #include <kis_image.h>
> +#include <KoCompositeOp.h>
>
>  #include <kis_paint_layer.h>
>  #include <kis_png_converter.h>
> @@ -104,6 +105,23 @@ void KisOpenRasterStackLoadVisitor::loadLayerInfo(const QDomElement& elem, KisLa
>     layer->setName(elem.attribute("name"));
>     layer->setX(elem.attribute("x").toInt());
>     layer->setY(elem.attribute("y").toInt());
> +
> +    if (compop == "svg:clear") layer->setCompositeOp(COMPOSITE_CLEAR);
> +    if (compop == "svg:src-over") layer->setCompositeOp(COMPOSITE_OVER);
> +    if (compop == "svg:add") layer->setCompositeOp(COMPOSITE_ADD);
> +    if (compop == "svg:multiply") layer->setCompositeOp(COMPOSITE_MULT);
> +    if (compop == "svg:screen") layer->setCompositeOp(COMPOSITE_SCREEN);
> +    if (compop == "svg:overlay") layer->setCompositeOp(COMPOSITE_OVERLAY);
> +    if (compop == "svg:darken") layer->setCompositeOp(COMPOSITE_DARKEN);
> +    if (compop == "svg:lighten") layer->setCompositeOp(COMPOSITE_LIGHTEN);
> +    if (compop == "svg:color-dodge") layer->setCompositeOp(COMPOSITE_DODGE);
> +    if (compop == "svg:color-burn") layer->setCompositeOp(COMPOSITE_BURN);
> +    if (compop == "svg:hard-light") layer->setCompositeOp(COMPOSITE_HARD_LIGHT);
> +    if (compop == "svg:soft-light") layer->setCompositeOp(COMPOSITE_SOFT_LIGHT);
> +    if (compop == "svg:difference") layer->setCompositeOp(COMPOSITE_DIFF);
> +
> +    qDebug() << ">>>>>" << compop << layer->compositeOpId();

Also, perhaps this qDebug() wasn't supposed to be in the commit?

Elvis

> +
>  }
>
>  void KisOpenRasterStackLoadVisitor::loadAdjustmentLayer(const QDomElement& elem, KisAdjustmentLayerSP aL)
> diff --git a/krita/ui/openrastertk/kis_open_raster_stack_save_visitor.cpp b/krita/ui/openrastertk/kis_open_raster_stack_save_visitor.cpp
> index bf481f5..173df08 100644
> --- a/krita/ui/openrastertk/kis_open_raster_stack_save_visitor.cpp
> +++ b/krita/ui/openrastertk/kis_open_raster_stack_save_visitor.cpp
> @@ -22,6 +22,7 @@
>  #include <QImage>
>
>  #include <KoStore.h>
> +#include <KoCompositeOp.h>
>
>  #include "kis_adjustment_layer.h"
>  #include "filter/kis_filter.h"
> @@ -31,6 +32,7 @@
>  #include <generator/kis_generator_layer.h>
>  #include "kis_open_raster_save_context.h"
>
> +
>  struct KisOpenRasterStackSaveVisitor::Private {
>     Private() : currentElement(0) {}
>     KisOpenRasterSaveContext* saveContext;
> @@ -52,6 +54,16 @@ void KisOpenRasterStackSaveVisitor::saveLayerInfo(QDomElement& elt, KisLayer* la
>  {
>     elt.setAttribute("name", layer->name());
>     elt.setAttribute("opacity", layer->opacity() / 255.0);
> +
> +    QString compop = layer->compositeOpId();
> +    if (layer->compositeOpId() == COMPOSITE_OVER) compop = "src-over";
> +    else if (layer->compositeOpId() == COMPOSITE_BURN) compop = "color-burn";
> +    else if (layer->compositeOpId() == COMPOSITE_DODGE) compop = "color-dodge";
> +    else if (layer->compositeOpId() == COMPOSITE_HARD_LIGHT) compop = "hard-light";
> +    else if (layer->compositeOpId() == COMPOSITE_SOFT_LIGHT) compop = "soft-light";
> +    else if (layer->compositeOpId() == COMPOSITE_DIFF) compop = "difference";
> +
> +    elt.setAttribute("composite-op", "svg:" + compop);
>  }
>
>  bool KisOpenRasterStackSaveVisitor::visit(KisPaintLayer *layer)
>



More information about the calligra-devel mailing list