Commit 5dffcc3c authored by Boudewijn Rempt's avatar Boudewijn Rempt

Added HACKING file with 'coding standards' -- still needs some editing,

began porting tabbar to Ariya's koffice lib tabbar (the tabbar is broken
now, but it was already broken, too), started work on adding some more
painting properties like spacing to resources, started work on re-adding
tool dialogs, extended new layer dialog to include more useful options,
added composition op choice to layers -- like Gimp's layer effects, took
composition ops out of the main colour strategy file and started porting
a few more of GraphicsMagick's composite ops to Krita and removed some
obsolete files. Oh, and made sure that one image can consist of layers
of more than one image type.

svn path=/trunk/koffice/; revision=283681
parent a8a28cb3
Since 1999, people have been hacking on Krita. Everyone brought their
own coding style, their own code conventions, their own likes and
dislikes. Me, (Boudewijn that is), I like indents of four spaces, and
no scope prefixes for variables. However, in the interests of
consistency, these are the rules new code should adhere to:
Indentation
With real tabs, each tab eight spaces. Use the default Linux indentation
style of (X)Emacs or KDevelop -- also for brace placement.
Includes
Avoid as much as possible #includes in header files; use forward declarations
of classes.
Initializers
Avoid as much as possible initializers in the body of the constructor. Use
initializer lists instead.
Scope prefixes
Use only m_ for class-level variables. No other scope prefixes; no g_, l_,
no 'p' for pointer variables.
Shared pointers
Use shared pointers wherever possible.
Getter/setter
Krita doesn't use Qt's properties -- yet. If you want to introduce use of
properties, convert any and all classes in Krita before committing.
Getter/setters are named 'getX() for getters and x(int x) for setters. If you
come across violations of this rule, change the code.
Note that this does not hold for dialogs: getter in dialogs
have no 'get' prefix. I guess.
Class naming
If you use a well-known design pattern, name the class according to the design
pattern.
Designer
Krita doesn't use .ui files. Yet. When we get down to the great UI redesign,
all dialogs should be done in Designer.
Enums
All enums should be prefixed with 'enum'.
Namespaces
Currently, we only use anonymous (right term?) namespaces for things like undo
commands. For the rest, some classes have a 'Kis' prefix, others don't. This should
be made consistent, and we might want to use namespaces to keep all of Krita
inside.
\ No newline at end of file
* The tabs for images inside a document seem to be broken :-(
* The custom cursor show up in a white block if not run using a graphics card with hardware cursors.
* The tabs for images inside a document seem to be broken :-( -- use Aditya's new common tabbar when it's done
* Brush cursor shapes for tools (updating cursors from the tools doesn't work yet).
* Give each layer its own imagetype; allow layers of diverse types in one image. Add layer composition choice
* Give each layer its own imagetype; allow layers of diverse types in one image.
* Option dialog for tools
* Make tools kparts
* Fix scrollbars
......
......@@ -5,7 +5,7 @@ INCLUDES = -I$(srcdir)/builder/ -I$(srcdir)/visitors/ -I$(srcdir)/helper/ -I$(s
noinst_LTLIBRARIES = libkiscore.la
libkiscore_la_LIBADD = tiles/libkistile.la helper/libkishelper.la builder/libkiscorebuilder.la strategy/libkisstrategy.la color_strategy/libkiscolor_strategy.la
libkiscore_la_SOURCES = kis_paint_device.cc kis_layer.cc kis_channel.cc kis_mask.cc kis_image.cc kis_doc.cc kis_view.cc kis_factory.cc kis_pluginserver.cc kis_resourceserver.cc kis_brush.cc kis_pattern.cc kis_nameserver.cc kis_painter.cc kis_tool_factory.cc kis_cursor.cc kis_selection.cc kis_command.cc kis_background.cc kis_global.cc kis_config.cc kis_tool.cc kis_resource.cc kis_resource_mediator.cc kis_guide.cc kis_memento_originator.cc kis_canvas_subject.cc kis_canvas_controller.cc kis_canvas_observer.cc kis_tool_controller.cc kis_tile_command.cc kis_alpha_mask.cc kis_imagepipe_brush.cc
libkiscore_la_SOURCES = kis_paint_device.cc kis_layer.cc kis_channel.cc kis_mask.cc kis_image.cc kis_doc.cc kis_view.cc kis_factory.cc kis_pluginserver.cc kis_resourceserver.cc kis_brush.cc kis_pattern.cc kis_nameserver.cc kis_painter.cc kis_tool_factory.cc kis_cursor.cc kis_selection.cc kis_command.cc kis_background.cc kis_global.cc kis_config.cc kis_tool.cc kis_resource.cc kis_resource_mediator.cc kis_guide.cc kis_memento_originator.cc kis_canvas_subject.cc kis_canvas_controller.cc kis_canvas_observer.cc kis_tool_controller.cc kis_tile_command.cc kis_alpha_mask.cc kis_imagepipe_brush.cc kis_gradient.cc
libkiscore_la_METASOURCES = AUTO
libkiscore_la_LDFLAGS = $(KDE_RPATH)
......
This diff is collapsed.
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -18,13 +19,17 @@
#include <limits.h>
#include <stdlib.h>
#include <qimage.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <kdebug.h>
#include "kis_image.h"
#include "kis_strategy_colorspace_rgb.h"
#include "tiles/kispixeldata.h"
#include "composite.h"
namespace {
const Q_INT32 MAX_CHANNEL_RGB = 3;
......@@ -147,101 +152,11 @@ void KisStrategyColorSpaceRGB::tileBlt(Q_INT32 stride,
Q_INT32 cols,
CompositeOp op) const
{
Q_INT32 linesize = stride * sizeof(QUANTUM) * cols;
QUANTUM *d;
QUANTUM *s;
QUANTUM alpha;
Q_INT32 i;
if (rows <= 0 || cols <= 0)
return;
switch (op) {
case COMPOSITE_COPY:
d = dst;
s = src;
while (rows-- > 0) {
memcpy(d, s, linesize);
d += dststride;
s += srcstride;
}
break;
case COMPOSITE_CLEAR:
d = dst;
s = src;
while (rows-- > 0) {
memset(d, 0, linesize);
d += dststride;
}
break;
case COMPOSITE_OVER:
while (rows-- > 0) {
d = dst;
s = src;
for (i = cols; i > 0; i--, d += stride, s += stride) {
if (s[PIXEL_ALPHA] == OPACITY_TRANSPARENT)
continue;
if (d[PIXEL_ALPHA] == OPACITY_TRANSPARENT || (d[PIXEL_ALPHA] == OPACITY_OPAQUE && s[PIXEL_ALPHA] == OPACITY_OPAQUE)) {
memcpy(d, s, stride * sizeof(QUANTUM));
continue;
}
d[PIXEL_RED] = (d[PIXEL_RED] * (QUANTUM_MAX - s[PIXEL_ALPHA]) + s[PIXEL_RED] * s[PIXEL_ALPHA]) / QUANTUM_MAX;
d[PIXEL_GREEN] = (d[PIXEL_GREEN] * (QUANTUM_MAX - s[PIXEL_ALPHA]) + s[PIXEL_GREEN] * s[PIXEL_ALPHA]) / QUANTUM_MAX;
d[PIXEL_BLUE] = (d[PIXEL_BLUE] * (QUANTUM_MAX - s[PIXEL_ALPHA]) + s[PIXEL_BLUE] * s[PIXEL_ALPHA]) / QUANTUM_MAX;
alpha = (d[PIXEL_ALPHA] * (QUANTUM_MAX - s[PIXEL_ALPHA]) + s[PIXEL_ALPHA]) / QUANTUM_MAX;
d[PIXEL_ALPHA] = (d[PIXEL_ALPHA] * (QUANTUM_MAX - alpha) + s[PIXEL_ALPHA]) / QUANTUM_MAX;
}
dst += dststride;
src += srcstride;
}
break;
case COMPOSITE_NORMAL:
while (rows-- > 0) {
d = dst;
s = src;
for (i = cols; i > 0; i--, d += stride, s += stride) {
if (s[PIXEL_ALPHA] == OPACITY_TRANSPARENT)
continue;
if (d[PIXEL_ALPHA] == OPACITY_TRANSPARENT || (d[PIXEL_ALPHA] == OPACITY_OPAQUE && s[PIXEL_ALPHA] == OPACITY_OPAQUE)) {
memcpy(d, s, stride * sizeof(QUANTUM));
continue;
}
if (s[PIXEL_ALPHA] == OPACITY_OPAQUE) {
memcpy(d, s, stride * sizeof(QUANTUM));
continue;
}
tileBlt(stride, dst, dststride, src, srcstride, OPACITY_OPAQUE, rows, cols, op);
d[PIXEL_RED] = (d[PIXEL_RED] * (QUANTUM_MAX - s[PIXEL_ALPHA]) + s[PIXEL_RED] * s[PIXEL_ALPHA]) / QUANTUM_MAX;
d[PIXEL_GREEN] = (d[PIXEL_GREEN] * (QUANTUM_MAX - s[PIXEL_ALPHA]) + s[PIXEL_GREEN] * s[PIXEL_ALPHA]) / QUANTUM_MAX;
d[PIXEL_BLUE] = (d[PIXEL_BLUE] * (QUANTUM_MAX - s[PIXEL_ALPHA]) + s[PIXEL_BLUE] * s[PIXEL_ALPHA]) / QUANTUM_MAX;
if (d[PIXEL_ALPHA] + s[PIXEL_ALPHA] > OPACITY_OPAQUE) {
d[PIXEL_ALPHA] = OPACITY_OPAQUE;
}
else {
d[PIXEL_ALPHA] = d[PIXEL_ALPHA] + s[PIXEL_ALPHA];
}
}
dst += dststride;
src += srcstride;
}
break;
default:
kdDebug() << "Not Implemented.\n";
return;
}
}
void KisStrategyColorSpaceRGB::tileBlt(Q_INT32 stride,
......@@ -254,45 +169,127 @@ void KisStrategyColorSpaceRGB::tileBlt(Q_INT32 stride,
Q_INT32 cols,
CompositeOp op) const
{
if (opacity == OPACITY_OPAQUE)
return tileBlt(stride, dst, dststride, src, srcstride, rows, cols, op);
QUANTUM *d;
QUANTUM *s;
QUANTUM alpha;
QUANTUM invAlpha;
Q_INT32 i;
if (rows <= 0 || cols <= 0)
return;
switch (op) {
case COMPOSITE_OVER:
while (rows-- > 0) {
d = dst;
s = src;
for (i = cols; i > 0; i--, d += stride, s += stride) {
if (s[PIXEL_ALPHA] == OPACITY_TRANSPARENT)
continue;
alpha = (s[PIXEL_ALPHA] * opacity) / QUANTUM_MAX;
invAlpha = QUANTUM_MAX - alpha;
d[PIXEL_RED] = (d[PIXEL_RED] * invAlpha + s[PIXEL_RED] * alpha) / QUANTUM_MAX;
d[PIXEL_GREEN] = (d[PIXEL_GREEN] * invAlpha + s[PIXEL_GREEN] * alpha) / QUANTUM_MAX;
d[PIXEL_BLUE] = (d[PIXEL_BLUE] * invAlpha + s[PIXEL_BLUE] * alpha) / QUANTUM_MAX;
alpha = (d[PIXEL_ALPHA] * (QUANTUM_MAX - s[PIXEL_ALPHA]) + s[PIXEL_ALPHA]) / QUANTUM_MAX;
d[PIXEL_ALPHA] = (d[PIXEL_ALPHA] * (QUANTUM_MAX - alpha) + s[PIXEL_ALPHA]) / QUANTUM_MAX;
}
dst += dststride;
src += srcstride;
}
break;
default:
kdDebug() << "Not Implemented.\n";
return;
case COMPOSITE_UNDEF:
// Undefined == no composition
break;
case COMPOSITE_OVER:
compositeOver(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_IN:
compositeIn(stride, dst, dststride, src, srcstride, rows, cols, opacity);
case COMPOSITE_OUT:
compositeOut(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_ATOP:
compositeAtop(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
#if 0
case COMPOSITE_XOR:
compositeXor(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_PLUS:
compositePlus(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_MINUS:
compositeMinus(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_ADD:
compositeAdd(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_SUBTRACT:
compositeSubtract(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_DIFF:
compositeDiff(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_MULT:
compositeMult(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_BUMPMAP:
compositeBumpmap(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
#endif
case COMPOSITE_COPY:
compositeCopy(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_COPY_RED:
compositeCopyRed(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_COPY_GREEN:
compositeCopyGreen(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_COPY_BLUE:
compositeCopyBlue(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_COPY_OPACITY:
compositeCopyOpacity(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_CLEAR:
compositeClear(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
#if 0
case COMPOSITE_DISSOLVE:
compositeDissolve(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_DISPLACE:
compositeDisplace(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_MODULATE:
compositeModulate(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_THRESHOLD:
compositeThreshold(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_NO:
// No composition.
break;
case COMPOSITE_DARKEN:
compositeDarken(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_LIGHTEN:
compositeLighten(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_HUE:
compositeHue(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_SATURATE:
compositeSaturate(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_COLORIZE:
compositeColorize(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_LUMINIZE:
compositeLuminize(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_SCREEN:
compositeScreen(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_OVERLAY:
compositeOverlay(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
#endif
case COMPOSITE_COPY_CYAN:
compositeCopyCyan(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_COPY_MAGENTA:
compositeCopyMagenta(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_COPY_YELLOW:
compositeCopyYellow(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_COPY_BLACK:
compositeCopyBlack(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
case COMPOSITE_NORMAL:
compositeNormal(stride, dst, dststride, src, srcstride, rows, cols, opacity);
break;
default:
kdDebug() << "Not Implemented.\n";
return;
}
}
......@@ -2,6 +2,6 @@ INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../../tools $(KOFFICE_INCLUDES) -I$(inter
noinst_LTLIBRARIES = libkishelper.la
libkishelper_la_SOURCES = kisscopedlock.cpp kis_timer.cc
libkishelper_la_SOURCES = kisscopedlock.cpp
libkishelper_la_METASOURCES = AUTO
......@@ -274,11 +274,12 @@ namespace {
public:
LayerPropsCmd(KisLayerSP layer,
KisImageSP img,
KisDoc *doc,
KisUndoAdapter *adapter,
const QString& name,
Q_INT32 opacity) : super(i18n("Layer Property Changes"))
KisImageSP img,
KisDoc *doc,
KisUndoAdapter *adapter,
const QString& name,
Q_INT32 opacity,
CompositeOp compositeOp) : super(i18n("Layer Property Changes"))
{
m_layer = layer;
m_img = img;
......@@ -286,6 +287,7 @@ namespace {
m_adapter = adapter;
m_name = name;
m_opacity = opacity;
m_compositeOp = compositeOp;
}
virtual ~LayerPropsCmd()
......@@ -297,12 +299,18 @@ namespace {
{
QString name = m_layer -> name();
Q_INT32 opacity = m_layer -> opacity();
CompositeOp compositeOp = m_layer -> compositeOp();
m_adapter -> setUndo(false);
m_doc -> layerProperties(m_img, m_layer, m_opacity, m_name);
m_doc -> setLayerProperties(m_img,
m_layer,
m_opacity,
m_compositeOp,
m_name);
m_adapter -> setUndo(true);
m_name = name;
m_opacity = opacity;
m_compositeOp = compositeOp;
m_img -> notify();
}
......@@ -318,6 +326,7 @@ namespace {
KisDoc *m_doc;
QString m_name;
Q_INT32 m_opacity;
CompositeOp m_compositeOp;
};
}
......@@ -421,6 +430,7 @@ bool KisDoc::init()
return true;
}
// XXX: wasn't this done in the colourspace strategy factory?
void KisDoc::setupColorspaces()
{
KisStrategyColorSpaceSP p = new KisStrategyColorSpaceRGB;
......@@ -1239,6 +1249,46 @@ KisLayerSP KisDoc::layerAdd(KisImageSP img, Q_INT32 width, Q_INT32 height, const
return layer;
}
KisLayerSP KisDoc::layerAdd(KisImageSP img,
Q_INT32 width,
Q_INT32 height,
const QString& name,
CompositeOp compositeOp,
QUANTUM opacity,
QPoint pos,
enumImgType type)
{
KisLayerSP layer;
if (!contains(img)) return 0;
if (img) {
layer = new KisLayer(width, height, type, name);
layer -> setOpacity(opacity);
layer -> setCompositeOp(compositeOp);
layer -> move(pos);
if (layer && img -> add(layer, -1)) {
layer = img -> activate(layer);
if (layer) {
KisPainter gc(layer.data());
gc.fillRect(0, 0, layer -> width(), layer -> height(), KoColor::black(), OPACITY_TRANSPARENT);
gc.end();
img -> top(layer);
if (m_undo)
addCommand(new LayerAddCmd(this, this, img, layer));
img -> invalidate();
setModified(true);
layer -> visible(true);
emit layersUpdated(img);
}
}
}
return layer;
}
KisLayerSP KisDoc::layerAdd(KisImageSP img, const QString& name, KisSelectionSP selection)
{
KisLayerSP layer;
......@@ -1417,7 +1467,11 @@ void KisDoc::layerPrev(KisImageSP img, KisLayerSP layer)
}
}
void KisDoc::layerProperties(KisImageSP img, KisLayerSP layer, QUANTUM opacity, const QString& name)
void KisDoc::setLayerProperties(KisImageSP img,
KisLayerSP layer,
QUANTUM opacity,
CompositeOp compositeOp,
const QString& name)
{
if (!contains(img))
return;
......@@ -1426,13 +1480,15 @@ void KisDoc::layerProperties(KisImageSP img, KisLayerSP layer, QUANTUM opacity,
if (m_undo) {
QString oldname = layer -> name();
Q_INT32 oldopacity = layer -> opacity();
CompositeOp oldCompositeOp = layer -> compositeOp();
layer -> setName(name);
layer -> opacity(opacity);
addCommand(new LayerPropsCmd(layer, img, this, this, oldname, oldopacity));
layer -> setOpacity(opacity);
layer -> setCompositeOp(compositeOp);
addCommand(new LayerPropsCmd(layer, img, this, this, oldname, oldopacity, oldCompositeOp));
} else {
layer -> setName(name);
layer -> opacity(opacity);
layer -> setOpacity(opacity);
layer -> setCompositeOp(compositeOp);
}
img -> invalidate();
......
......@@ -65,6 +65,14 @@ private:
public:
KisLayerSP layerAdd(KisImageSP img, Q_INT32 width, Q_INT32 height, const QString& name, QUANTUM devOpacity);
KisLayerSP layerAdd(KisImageSP img,
Q_INT32 width,
Q_INT32 height,
const QString& name,
CompositeOp compositeOp,
QUANTUM opacity,
QPoint pos,
enumImgType type);
KisLayerSP layerAdd(KisImageSP img, const QString& name, KisSelectionSP selection);
KisLayerSP layerAdd(KisImageSP img, KisLayerSP layer, Q_INT32 position);
void layerRemove(KisImageSP img, KisLayerSP layer);
......@@ -72,7 +80,12 @@ public:
void layerLower(KisImageSP img, KisLayerSP layer);
void layerNext(KisImageSP img, KisLayerSP layer);
void layerPrev(KisImageSP img, KisLayerSP layer);
void layerProperties(KisImageSP img, KisLayerSP layer, QUANTUM opacity, const QString& name);
// Set the layerproperties
void setLayerProperties(KisImageSP img,
KisLayerSP layer,
QUANTUM opacity,
CompositeOp compositeOp,
const QString& name);
Q_INT32 undoLimit() const;
void setUndoLimit(Q_INT32 limit);
......
......@@ -60,22 +60,28 @@ const int TILE_WIDTH = TILE_SIZE;
const int TILE_HEIGHT = TILE_SIZE;
/**
* Size of a quantum
* Size of a quantum -- this could be 8, 16, 32 or 64 -- but for now, only 8 is possible.
*/
typedef Q_UINT8 QUANTUM;
#if !defined(QUANTUM_DEPTH)
#define QUANTUM_DEPTH 8
#endif
#if (QUANTUM_DEPTH == 8)
typedef Q_UINT8 QUANTUM;
const QUANTUM QUANTUM_MAX = UCHAR_MAX;
const QUANTUM OPACITY_TRANSPARENT = 0;
const QUANTUM OPACITY_OPAQUE = QUANTUM_MAX;
#endif
const QUANTUM MAXCHANNELS = 5;
const Q_INT32 IMG_DEFAULT_DEPTH = 4;
const Q_INT32 RENDER_HEIGHT = TILE_SIZE * 4;
const Q_INT32 RENDER_WIDTH = TILE_SIZE * 4;
/*
* Most wacom pads have 500 levels of pressure; this is downscaled
* to 100 levels with steps of 5 because the line would be too jittery
* otherwise.
* Most wacom pads have 512 levels of pressure; Qt only supports 256, and even
* this is downscaled to 127 levels because the line would be too jittery, and
* the amount of masks take too much memory otherwise.
*/
const Q_INT32 PRESSURE_LEVELS=127;
......@@ -83,6 +89,7 @@ enum CompositeOp {
COMPOSITE_UNDEF,
COMPOSITE_OVER,
COMPOSITE_IN,
COMPOSITE_OUT,
COMPOSITE_ATOP,
COMPOSITE_XOR,
COMPOSITE_PLUS,
......@@ -102,6 +109,19 @@ enum CompositeOp {
COMPOSITE_DISPLACE,
COMPOSITE_MODULATE,
COMPOSITE_THRESHOLD,
COMPOSITE_NO,
COMPOSITE_DARKEN,
COMPOSITE_LIGHTEN,
COMPOSITE_HUE,
COMPOSITE_SATURATE,
COMPOSITE_COLORIZE,
COMPOSITE_LUMINIZE,
COMPOSITE_SCREEN,
COMPOSITE_OVERLAY,
COMPOSITE_COPY_CYAN,
COMPOSITE_COPY_MAGENTA,
COMPOSITE_COPY_YELLOW,
COMPOSITE_COPY_BLACK,
COMPOSITE_NORMAL
};
......
......@@ -96,7 +96,7 @@ QUANTUM KisLayer::opacity() const
return m_opacity;
}
void KisLayer::opacity(QUANTUM val)
void KisLayer::setOpacity(QUANTUM val)
{
m_opacity = val;
}
......
......@@ -45,7 +45,7 @@ public:
KisMaskSP mask() const;
QUANTUM opacity() const;
void opacity(QUANTUM val);
void setOpacity(QUANTUM val);
bool linked() const;
void linked(bool l);
......
......@@ -225,6 +225,7 @@ void KisPaintDevice::configure(KisImageSP image,
m_owner = image;
m_name = name;
m_projectionValid = false;
kdDebug() << "composite op: " << compositeOp << "\n";
m_compositeOp = compositeOp;
}
......
......@@ -702,7 +702,7 @@ void KisPainter::computeDab(KisAlphaMask* mask)
mask -> height(),
m_device -> image() -> imgType(),
"dab");
m_dab -> opacity(OPACITY_TRANSPARENT);
m_dab -> setOpacity(OPACITY_TRANSPARENT);
for (int y = 0; y < mask -> height(); y++) {
for (int x = 0; x < mask -> width(); x++) {
m_dab -> setPixel(x, y, m_paintColor, mask -> alphaAt(x, y));
......
This diff is collapsed.
......@@ -35,11 +35,15 @@ class QButton;
class QPaintEvent;
class QScrollBar;
class QWidget;
class DCOPObject;
class KAction;
class KPrinter;
class KToggleAction;
class KoIconItem;
class KoTabBar;
class KisCanvasObserver;
class KisRuler;
class KisBrush;
......@@ -54,7 +58,6 @@ class KisPattern;
class KisResource;
class KisResourceMediator;
class KisSideBar;
class KisTabBar;
class KisUndoAdapter;
class KisView : public KoView,
......@@ -277,7 +280,7 @@ private:
KisCanvas *m_canvas;
// Fringe benefits
KisTabBar *m_tabBar;
KoTabBar *m_tabBar;
QButton *m_tabFirst;
QButton *m_tabLeft;
QButton *m_tabRight;
......
......@@ -171,7 +171,7 @@ private:
sy = QMAX(sy + y1, 0);
dx = QMAX(dx + x1, dev -> x());
dy = QMAX(dy + y1, dev -> y());
gc.bitBlt(dx, dy, COMPOSITE_OVER, dev, opacity, sx, sy, w, h);
gc.bitBlt(dx, dy, dev -> compositeOp(), dev, opacity, sx, sy, w, h);
}
private:
......
INCLUDES = -I$(srcdir)/../core -I$(srcdir)/../core/tiles -I$(srcdir)/../ui -I$(srcdir)/../tools $(KOFFICE_INCLUDES) $(all_includes) $(KOPAINTER_INCLUDES)
bin_PROGRAMS = kis_mutex_test tilestest
tilestest_SOURCES = tiles.cpp
tilestest_LDFLAGS = $(all_libraries) $(KDE_RPATH)