Commit e390a99c authored by Cyrille Berger's avatar Cyrille Berger

alpha/alpha2 -> opacityU8/opacityF

svn path=/trunk/koffice/; revision=1092247
parent fb551cac
......@@ -58,7 +58,7 @@ void KisStrokeBenchmark::benchmarkStroke()
int height = TEST_IMAGE_HEIGHT;
KisImageSP image = new KisImage(0, width, height, m_colorSpace, "stroke sample image", false);
KisLayerSP layer = new KisPaintLayer(image, "temporary for stroke sample", OPACITY_OPAQUE, m_colorSpace);
KisLayerSP layer = new KisPaintLayer(image, "temporary for stroke sample", OPACITY_OPAQUE_U8, m_colorSpace);
KoColor white(m_colorSpace);
white.fromQColor(Qt::white);
......@@ -99,7 +99,7 @@ void KisStrokeBenchmark::benchmarkRandomLines()
int height = TEST_IMAGE_HEIGHT;
KisImageSP image = new KisImage(0, width, height, m_colorSpace, "stroke sample image", false);
KisLayerSP layer = new KisPaintLayer(image, "temporary for stroke sample", OPACITY_OPAQUE, m_colorSpace);
KisLayerSP layer = new KisPaintLayer(image, "temporary for stroke sample", OPACITY_OPAQUE_U8, m_colorSpace);
KoColor white(m_colorSpace);
white.fromQColor(Qt::white);
......
......@@ -98,7 +98,7 @@ QImage KisPaintOpSettings::sampleStroke(const QSize& size)
int width = size.width();
int height = size.height();
KisLayerSP layer = new KisPaintLayer(0, "temporary for stroke sample", OPACITY_OPAQUE, cs);
KisLayerSP layer = new KisPaintLayer(0, "temporary for stroke sample", OPACITY_OPAQUE_U8, cs);
KisImageSP image = new KisImage(0, width, height, cs, "stroke sample image", false);
KisPainter painter(layer->paintDevice());
painter.setPaintColor(KoColor(Qt::black, cs));
......
......@@ -81,7 +81,7 @@ KisPaintDeviceSP KisBaseNode::projection() const
quint8 KisBaseNode::opacity() const
{
return nodeProperties().intProperty("opacity", OPACITY_OPAQUE);
return nodeProperties().intProperty("opacity", OPACITY_OPAQUE_U8);
}
void KisBaseNode::setOpacity(quint8 val)
......
......@@ -99,7 +99,7 @@ void KisFillPainter::fillRect(qint32 x1, qint32 y1, qint32 w, qint32 h, const Ko
KoColor kc2(kc); // get rid of const
kc2.convertTo(device()->colorSpace());
quint8 * data = kc2.data();
device()->colorSpace()->setAlpha(data, opacity, 1);
device()->colorSpace()->setOpacity(data, opacity, 1);
device()->fill(x1, y1, w, h, data);
......@@ -334,7 +334,7 @@ KisSelectionSP KisFillPainter::createFloodSelection(int startX, int startY, KisP
selIt += x;
if (m_fuzzy) {
colorSpace->fromQColor(Qt::white, selIt.rawData());
colorSpace->setAlpha(selIt.rawData(), MAX_SELECTED - diff, 1);
colorSpace->setOpacity(selIt.rawData(), quint8(MAX_SELECTED - diff), 1);
} else
colorSpace->fromQColor(Qt::white, selIt.rawData());
......@@ -376,7 +376,7 @@ KisSelectionSP KisFillPainter::createFloodSelection(int startX, int startY, KisP
if (m_fuzzy) {
colorSpace->fromQColor(Qt::white, selIt.rawData());
colorSpace->setAlpha(selIt.rawData(), MAX_SELECTED - diff, 1);
colorSpace->setOpacity(selIt.rawData(), quint8(MAX_SELECTED - diff), 1);
} else
colorSpace->fromQColor(Qt::white, selIt.rawData());
......@@ -435,7 +435,7 @@ KisSelectionSP KisFillPainter::createFloodSelection(int startX, int startY, KisP
if (m_fuzzy) {
colorSpace->fromQColor(Qt::white, selIt.rawData());
colorSpace->setAlpha(selIt.rawData(), MAX_SELECTED - diff, 1);
colorSpace->setOpacity(selIt.rawData(), quint8(MAX_SELECTED - diff), 1);
} else
colorSpace->fromQColor(Qt::white, selIt.rawData());
......
......@@ -225,13 +225,13 @@ private:
inline
void KisFillPainter::fillRect(qint32 x, qint32 y, qint32 w, qint32 h, const KoColor& c)
{
fillRect(x, y, w, h, c, OPACITY_OPAQUE);
fillRect(x, y, w, h, c, OPACITY_OPAQUE_U8);
}
inline
void KisFillPainter::fillRect(const QRect& rc, const KoColor& c)
{
fillRect(rc.x(), rc.y(), rc.width(), rc.height(), c, OPACITY_OPAQUE);
fillRect(rc.x(), rc.y(), rc.width(), rc.height(), c, OPACITY_OPAQUE_U8);
}
inline
......@@ -239,7 +239,7 @@ void KisFillPainter::eraseRect(qint32 x1, qint32 y1, qint32 w, qint32 h)
{
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KoColor c(Qt::black, cs);
fillRect(x1, y1, w, h, c, OPACITY_TRANSPARENT);
fillRect(x1, y1, w, h, c, OPACITY_TRANSPARENT_U8);
}
inline
......@@ -247,7 +247,7 @@ void KisFillPainter::eraseRect(const QRect& rc)
{
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KoColor c(Qt::black, cs);
fillRect(rc.x(), rc.y(), rc.width(), rc.height(), c, OPACITY_TRANSPARENT);
fillRect(rc.x(), rc.y(), rc.width(), rc.height(), c, OPACITY_TRANSPARENT_U8);
}
inline
......
......@@ -160,7 +160,7 @@ void KisFixedPaintDevice::clear(const QRect & rc)
KoColor c(Qt::black, m_colorSpace);
quint8* black = m_colorSpace->allocPixelBuffer(1);
memcpy(black, c.data(), m_colorSpace->pixelSize());
m_colorSpace->setAlpha(black, OPACITY_TRANSPARENT, 1);
m_colorSpace->setOpacity(black, OPACITY_TRANSPARENT_U8, 1);
fill(rc.x(), rc.y(), rc.width(), rc.height(), black);
delete[] black;
}
......
......@@ -187,18 +187,18 @@ public:
return false;
}
virtual quint8 alpha(const quint8 * /*pixel*/) const {
virtual quint8 opacityU8(const quint8 * /*pixel*/) const {
return 0;
}
virtual qreal alpha2(const quint8 * /*pixel*/) const {
virtual qreal opacityF(const quint8 * /*pixel*/) const {
return 0;
}
virtual void setAlpha(quint8 * /*pixels*/, quint8 /*alpha*/, qint32 /*nPixels*/) const { }
virtual void setOpacity(quint8 * /*pixels*/, quint8 /*alpha*/, qint32 /*nPixels*/) const { }
virtual void setAlpha2(quint8 * /*pixels*/, qreal /*alpha*/, qint32 /*nPixels*/) const { }
virtual void setOpacity(quint8 * /*pixels*/, qreal /*alpha*/, qint32 /*nPixels*/) const { }
virtual void multiplyAlpha(quint8 * /*pixels*/, quint8 /*alpha*/, qint32 /*nPixels*/) const { }
......
......@@ -628,7 +628,7 @@ bool KisGradientPainter::paintGradient(const QPointF& gradientVectorStart,
double maxDistance = 0;
quint8* thisPixel = colorSpace->allocPixelBuffer(1);
memcpy(thisPixel, iter.rawData(), pixelSize);
quint8 thisPixelOpacity = colorSpace->alpha(thisPixel);
quint8 thisPixelOpacity = colorSpace->opacityU8(thisPixel);
// XXX: Move the distance computation into the colorspace when it works.
for (int yOffset = -1; yOffset < 2; yOffset++) {
......@@ -644,7 +644,7 @@ bool KisGradientPainter::paintGradient(const QPointF& gradientVectorStart,
accessor.moveTo(x, y);
quint8 * pixel = accessor.rawData();
quint8 opacity = colorSpace->alpha(pixel);
quint8 opacity = colorSpace->opacityU8(pixel);
double totalDistance = 0;
......@@ -738,7 +738,7 @@ bool KisGradientPainter::paintGradient(const QPointF& gradientVectorStart,
}
}
}
totalOpacity += colorSpace->alpha(color.data());
totalOpacity += colorSpace->opacityU8(color.data());
}
}
accessor.moveTo(x - startx, y - starty);
......@@ -750,7 +750,7 @@ bool KisGradientPainter::paintGradient(const QPointF& gradientVectorStart,
memcpy(pixel + pos, &val, channel->size());
}
}
colorSpace->setAlpha(pixel, totalOpacity, 1);
colorSpace->setOpacity(pixel, quint8(totalOpacity), 1);
}
pixelsProcessed++;
......
......@@ -110,7 +110,7 @@ KisPaintDeviceSP KisGroupLayer::tryObligeChild() const
child->channelFlags().isEmpty() &&
child->projection() &&
child->visible() &&
child->opacity() == OPACITY_OPAQUE &&
child->opacity() == OPACITY_OPAQUE_U8 &&
*child->projection()->colorSpace() == *colorSpace()) {
return child->projection();
......
......@@ -307,7 +307,7 @@ void KisImage::init(KisUndoAdapter *adapter, qint32 width, qint32 height, const
m_d->colorSpace = colorSpace;
setRootLayer(new KisGroupLayer(this, "root", OPACITY_OPAQUE));
setRootLayer(new KisGroupLayer(this, "root", OPACITY_OPAQUE_U8));
m_d->xres = 1.0;
m_d->yres = 1.0;
......@@ -744,7 +744,7 @@ void KisImage::flatten()
{
KisGroupLayerSP oldRootLayer = m_d->rootLayer;
KisGroupLayerSP newRootLayer =
new KisGroupLayer(this, "root", OPACITY_OPAQUE);
new KisGroupLayer(this, "root", OPACITY_OPAQUE_U8);
// - synchronous?
// - no =(
......@@ -758,7 +758,7 @@ void KisImage::flatten()
unlock();
KisPaintLayerSP flattenLayer =
new KisPaintLayer(this, nextLayerName(), OPACITY_OPAQUE, projectionCopy);
new KisPaintLayer(this, nextLayerName(), OPACITY_OPAQUE_U8, projectionCopy);
Q_CHECK_PTR(flattenLayer);
m_d->adapter->beginMacro(i18n("Flatten Image"));
......@@ -797,7 +797,7 @@ KisLayerSP KisImage::mergeLayer(KisLayerSP layer, const KisMetaData::MergeStrate
// FIXME: "Merge Down"?
undoAdapter()->beginMacro(i18n("Merge with Layer Below"));
KisPaintLayerSP mergedLayer = new KisPaintLayer(this, prevLayer->name(), OPACITY_OPAQUE, mergedDevice);
KisPaintLayerSP mergedLayer = new KisPaintLayer(this, prevLayer->name(), OPACITY_OPAQUE_U8, mergedDevice);
Q_CHECK_PTR(mergedLayer);
......
......@@ -141,7 +141,7 @@ KisPaintDevice::KisPaintDevice(KisNodeWSP parent, const KoColorSpace * colorSpac
quint8 *defaultPixel = new quint8[ m_d->pixelSize ];
m_d->colorSpace->fromQColor(Qt::black, defaultPixel);
m_d->colorSpace->setAlpha(defaultPixel, OPACITY_TRANSPARENT, 1);
m_d->colorSpace->setOpacity(defaultPixel, OPACITY_TRANSPARENT_U8, 1);
m_datamanager = new KisDataManager(m_d->pixelSize, defaultPixel);
delete [] defaultPixel;
......
......@@ -135,7 +135,7 @@ void KisPainter::init()
d->transaction = 0;
d->paintOp = 0;
d->pattern = 0;
d->opacity = OPACITY_OPAQUE;
d->opacity = OPACITY_OPAQUE_U8;
d->sourceLayer = 0;
d->fillStyle = FillStyleNone;
d->strokeStyle = StrokeStyleBrush;
......@@ -756,10 +756,10 @@ void KisPainter::fillPainterPath(const QPainterPath& path)
// Currently unsupported, fall through
warnImage << "Unknown or unsupported fill style in fillPolygon\n";
case FillStyleForegroundColor:
d->fillPainter->fillRect(fillRect, paintColor(), OPACITY_OPAQUE);
d->fillPainter->fillRect(fillRect, paintColor(), OPACITY_OPAQUE_U8);
break;
case FillStyleBackgroundColor:
d->fillPainter->fillRect(fillRect, backgroundColor(), OPACITY_OPAQUE);
d->fillPainter->fillRect(fillRect, backgroundColor(), OPACITY_OPAQUE_U8);
break;
case FillStylePattern:
Q_ASSERT(d->pattern != 0);
......@@ -778,12 +778,12 @@ void KisPainter::fillPainterPath(const QPainterPath& path)
}
// Break the mask up into chunks so we don't have to allocate a potentially very large QImage.
const QColor opaqueColor(OPACITY_OPAQUE, OPACITY_OPAQUE, OPACITY_OPAQUE, 255);
const QColor opaqueColor(OPACITY_OPAQUE_U8, OPACITY_OPAQUE_U8, OPACITY_OPAQUE_U8, 255);
const QBrush brush(opaqueColor);
for (qint32 x = fillRect.x(); x < fillRect.x() + fillRect.width(); x += d->maskImageWidth) {
for (qint32 y = fillRect.y(); y < fillRect.y() + fillRect.height(); y += d->maskImageHeight) {
d->polygonMaskImage.fill(qRgba(OPACITY_TRANSPARENT, OPACITY_TRANSPARENT, OPACITY_TRANSPARENT, 255));
d->polygonMaskImage.fill(qRgba(OPACITY_TRANSPARENT_U8, OPACITY_TRANSPARENT_U8, OPACITY_TRANSPARENT_U8, 255));
d->maskPainter->translate(-x, -y);
d->maskPainter->fillPath(path, brush);
d->maskPainter->translate(x, y);
......@@ -916,13 +916,13 @@ void KisPainter::drawWobblyLine(const QPointF & start, const QPointF & end)
accessor.moveTo(x, y);
if (accessor.isSelected()) {
mycolor.setOpacity((int)(255*br1));
mycolor.setOpacity((quint8)(255*br1));
memcpy(accessor.rawData(), mycolor.data(), pixelSize);
}
accessor.moveTo(x + 1, y);
if (accessor.isSelected()) {
mycolor.setOpacity((int)(255*br2));
mycolor.setOpacity((quint8)(255*br2));
memcpy(accessor.rawData(), mycolor.data(), pixelSize);
}
}
......@@ -944,13 +944,13 @@ void KisPainter::drawWobblyLine(const QPointF & start, const QPointF & end)
accessor.moveTo(x, y);
if (accessor.isSelected()) {
mycolor.setOpacity((int)(255*br1));
mycolor.setOpacity((quint8)(255*br1));
memcpy(accessor.rawData(), mycolor.data(), pixelSize);
}
accessor.moveTo(x, y + 1);
if (accessor.isSelected()) {
mycolor.setOpacity((int)(255*br2));
mycolor.setOpacity((quint8)(255*br2));
memcpy(accessor.rawData(), mycolor.data(), pixelSize);
}
}
......@@ -975,7 +975,7 @@ void KisPainter::drawWuLine(const QPointF & start, const QPointF & end)
float brightness1, brightness2;
int ix1, ix2, iy1, iy2;
int c1, c2;
quint8 c1, c2;
const float MaxPixelValue = 255.0f;
// gradient of line
......@@ -1220,7 +1220,7 @@ void KisPainter::drawThickLine(const QPointF & start, const QPointF & end, int s
int tp0, tn0, tp1, tn1;
int horizontal = 0;
float opacity = OPACITY_OPAQUE;
float opacity = 1.0;
tp0 = startWidth / 2;
tn0 = startWidth / 2;
......@@ -1290,16 +1290,16 @@ void KisPainter::drawThickLine(const QPointF & start, const QPointF & end, int s
if (horizontal) {
accessor.moveTo(x0a, y0a - 1);
if (accessor.isSelected()) {
quint8 alpha = cs->alpha(accessor.rawData());
opacity = .25 * c1.opacity() + (1 - .25) * alpha;
qreal alpha = cs->opacityF(accessor.rawData());
opacity = .25 * c1.opacityF() + (1 - .25) * alpha;
col1.setOpacity(opacity);
memcpy(accessor.rawData(), col1.data(), pixelSize);
}
accessor.moveTo(x1b, y1b + 1);
if (accessor.isSelected()) {
quint8 alpha = cs->alpha(accessor.rawData());
opacity = .25 * c2.opacity() + (1 - .25) * alpha;
qreal alpha = cs->opacityF(accessor.rawData());
opacity = .25 * c2.opacityF() + (1 - .25) * alpha;
col1.setOpacity(opacity);
memcpy(accessor.rawData(), col1.data(), pixelSize);
}
......@@ -1307,16 +1307,16 @@ void KisPainter::drawThickLine(const QPointF & start, const QPointF & end, int s
} else {
accessor.moveTo(x0a - 1, y0a);
if (accessor.isSelected()) {
quint8 alpha = cs->alpha(accessor.rawData());
opacity = .25 * c1.opacity() + (1 - .25) * alpha;
qreal alpha = cs->opacityF(accessor.rawData());
opacity = .25 * c1.opacityF() + (1 - .25) * alpha;
col1.setOpacity(opacity);
memcpy(accessor.rawData(), col1.data(), pixelSize);
}
accessor.moveTo(x1b + 1, y1b);
if (accessor.isSelected()) {
quint8 alpha = cs->alpha(accessor.rawData());
opacity = .25 * c2.opacity() + (1 - .25) * alpha;
qreal alpha = cs->opacityF(accessor.rawData());
opacity = .25 * c2.opacityF() + (1 - .25) * alpha;
col1.setOpacity(opacity);
memcpy(accessor.rawData(), col1.data(), pixelSize);
}
......@@ -1368,13 +1368,13 @@ void KisPainter::drawThickLine(const QPointF & start, const QPointF & end, int s
b2b = fracb;
// color first pixel of bottom line
opacity = ((x - ix1) / dx) * c2.opacity() + (1 - (x - ix1) / dx) * c1.opacity();
c3.setOpacity(static_cast<int>(opacity));
opacity = ((x - ix1) / dx) * c2.opacityF() + (1 - (x - ix1) / dx) * c1.opacityF();
c3.setOpacity(opacity);
accessor.moveTo(x, (int)yfa);
if (accessor.isSelected()) {
quint8 alpha = cs->alpha(accessor.rawData());
opacity = b1a * c3.opacity() + (1 - b1a) * alpha;
qreal alpha = cs->opacityF(accessor.rawData());
opacity = b1a * c3.opacityF() + (1 - b1a) * alpha;
col1.setOpacity(opacity);
memcpy(accessor.rawData(), col1.data(), pixelSize);
}
......@@ -1383,8 +1383,8 @@ void KisPainter::drawThickLine(const QPointF & start, const QPointF & end, int s
if (!(startWidth == 1 && endWidth == 1)) {
accessor.moveTo(x, (int)yfb);
if (accessor.isSelected()) {
quint8 alpha = cs->alpha(accessor.rawData());
opacity = b1b * c3.opacity() + (1 - b1b) * alpha;
qreal alpha = cs->opacityF(accessor.rawData());
opacity = b1b * c3.opacityF() + (1 - b1b) * alpha;
col1.setOpacity(opacity);
memcpy(accessor.rawData(), col1.data(), pixelSize);
}
......@@ -1394,8 +1394,8 @@ void KisPainter::drawThickLine(const QPointF & start, const QPointF & end, int s
if (grada != 0 && grada != 1) { // if not flat or exact diagonal
accessor.moveTo(x, int (yfa) + 1);
if (accessor.isSelected()) {
quint8 alpha = cs->alpha(accessor.rawData());
opacity = b2a * c3.opacity() + (1 - b2a) * alpha;
qreal alpha = cs->opacityF(accessor.rawData());
opacity = b2a * c3.opacityF() + (1 - b2a) * alpha;
col2.setOpacity(opacity);
memcpy(accessor.rawData(), col2.data(), pixelSize);
}
......@@ -1406,8 +1406,8 @@ void KisPainter::drawThickLine(const QPointF & start, const QPointF & end, int s
if (gradb != 0 && gradb != 1 && !(startWidth == 1 && endWidth == 1)) {
accessor.moveTo(x, int (yfb) + 1);
if (accessor.isSelected()) {
quint8 alpha = cs->alpha(accessor.rawData());
opacity = b2b * c3.opacity() + (1 - b2b) * alpha;
qreal alpha = cs->opacityF(accessor.rawData());
opacity = b2b * c3.opacityF() + (1 - b2b) * alpha;
col2.setOpacity(opacity);
memcpy(accessor.rawData(), col2.data(), pixelSize);
}
......@@ -1470,13 +1470,13 @@ void KisPainter::drawThickLine(const QPointF & start, const QPointF & end, int s
b2b = fracb;
// color first pixel of left line
opacity = ((y - iy1) / dy) * c2.opacity() + (1 - (y - iy1) / dy) * c1.opacity();
c3.setOpacity(static_cast<int>(opacity));
opacity = ((y - iy1) / dy) * c2.opacityF() + (1 - (y - iy1) / dy) * c1.opacityF();
c3.setOpacity(opacity);
accessor.moveTo(int (xfa), y);
if (accessor.isSelected()) {
quint8 alpha = cs->alpha(accessor.rawData());
opacity = b1a * c3.opacity() + (1 - b1a) * alpha;
qreal alpha = cs->opacityF(accessor.rawData());
opacity = b1a * c3.opacityF() + (1 - b1a) * alpha;
col1.setOpacity(opacity);
memcpy(accessor.rawData(), col1.data(), pixelSize);
}
......@@ -1485,8 +1485,8 @@ void KisPainter::drawThickLine(const QPointF & start, const QPointF & end, int s
if (!(startWidth == 1 && endWidth == 1)) {
accessor.moveTo(int(xfb), y);
if (accessor.isSelected()) {
quint8 alpha = cs->alpha(accessor.rawData());
opacity = b1b * c3.opacity() + (1 - b1b) * alpha;
qreal alpha = cs->opacityF(accessor.rawData());
opacity = b1b * c3.opacityF() + (1 - b1b) * alpha;
col1.setOpacity(opacity);
memcpy(accessor.rawData(), col1.data(), pixelSize);
}
......@@ -1496,8 +1496,8 @@ void KisPainter::drawThickLine(const QPointF & start, const QPointF & end, int s
if (grada != 0 && grada != 1) { // if not flat or exact diagonal
accessor.moveTo(int(xfa) + 1, y);
if (accessor.isSelected()) {
quint8 alpha = cs->alpha(accessor.rawData());
opacity = b2a * c3.opacity() + (1 - b2a) * alpha;
qreal alpha = cs->opacityF(accessor.rawData());
opacity = b2a * c3.opacityF() + (1 - b2a) * alpha;
col2.setOpacity(opacity);
memcpy(accessor.rawData(), col2.data(), pixelSize);
}
......@@ -1508,8 +1508,8 @@ void KisPainter::drawThickLine(const QPointF & start, const QPointF & end, int s
if (gradb != 0 && gradb != 1 && !(startWidth == 1 && endWidth == 1)) {
accessor.moveTo(int(xfb) + 1, y);
if (accessor.isSelected()) {
quint8 alpha = cs->alpha(accessor.rawData());
opacity = b2b * c3.opacity() + (1 - b2b) * alpha;
qreal alpha = cs->opacityF(accessor.rawData());
opacity = b2b * c3.opacityF() + (1 - b2b) * alpha;
col2.setOpacity(opacity);
memcpy(accessor.rawData(), col2.data(), pixelSize);
}
......
......@@ -47,7 +47,7 @@ public:
KisSelectionBasedLayer::KisSelectionBasedLayer(KisImageWSP image,
const QString &name,
KisSelectionSP selection)
: KisLayer(image.data(), name, OPACITY_OPAQUE),
: KisLayer(image.data(), name, OPACITY_OPAQUE_U8),
m_d(new Private())
{
if (!selection)
......
......@@ -359,7 +359,7 @@ void KisTransformWorker::transformPass(KisPaintDevice *src, KisPaintDevice *dst,
while (i < srcLen + extraLen) {
data = srcIt.rawData();
memcpy(&tmpLine[i*pixelSize], data, pixelSize);
cs->setAlpha(data, 0, 1);
cs->setOpacity(data, quint8(0), 1);
if (i < srcLen + extraLen - 1) // duplicate pixels along edge
++srcIt;
i++;
......
......@@ -287,7 +287,7 @@ void KisRecordedPaintAction::play(KisNodeSP node, const KisPlayInfo& info) const
painter->setOpacity(d->opacity * 255);
} else {
painter->setCompositeOp(node->paintDevice()->colorSpace()->compositeOp(COMPOSITE_ALPHA_DARKEN));
painter->setOpacity(OPACITY_OPAQUE);
painter->setOpacity(OPACITY_OPAQUE_U8);
}
......@@ -451,7 +451,7 @@ KoColor KisRecordedPaintActionFactory::colorFromXML(const QDomElement& elt, cons
if (!colorElt.isNull()) {
bC = KoColor::fromXML(colorElt.firstChildElement(), Integer8BitsColorDepthID.id(), QHash<QString, QString>());
bC.setOpacity(255);
bC.setOpacity(quint8(255));
dbgImage << elementName << " color : " << bC.toQColor();
} else {
dbgImage << "Warning: no <" << elementName << " /> found";
......
......@@ -64,8 +64,8 @@ void KisAsyncMergerTest::testMerger()
KisFilterConfiguration *configuration = filter->defaultConfiguration(0);
Q_ASSERT(configuration);
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE, device1);
KisLayerSP paintLayer2 = new KisPaintLayer(image, "paint2", OPACITY_OPAQUE, device2);
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE_U8, device1);
KisLayerSP paintLayer2 = new KisPaintLayer(image, "paint2", OPACITY_OPAQUE_U8, device2);
KisLayerSP groupLayer = new KisGroupLayer(image, "group", 200/*OPACITY_OPAQUE*/);
KisLayerSP blur1 = new KisAdjustmentLayer(image, "blur1", configuration, 0);
......@@ -142,8 +142,8 @@ void KisAsyncMergerTest::debugObligeChild()
KisPaintDeviceSP device1 = new KisPaintDevice(colorSpace);
device1->convertFromQImage(sourceImage1, "", 0, 0);
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE, device1);
KisLayerSP groupLayer = new KisGroupLayer(image, "group", OPACITY_OPAQUE);
KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE_U8, device1);
KisLayerSP groupLayer = new KisGroupLayer(image, "group", OPACITY_OPAQUE_U8);
image->addNode(groupLayer, image->rootLayer());
image->addNode(paintLayer1, groupLayer);
......
......@@ -32,10 +32,9 @@ void KisCloneLayerTest::testCreation()
{
const KoColorSpace * colorSpace = KoColorSpaceRegistry::instance()->rgb8();
KisImageWSP image = new KisImage(0, 512, 512, colorSpace, "layer test");
KisLayerSP layer = new KisPaintLayer(image, "clone test", OPACITY_OPAQUE);
KisLayerSP layer = new KisPaintLayer(image, "clone test", OPACITY_OPAQUE_U8);
KisCloneLayer test(layer, image, "clonetest", OPACITY_OPAQUE
);
KisCloneLayer test(layer, image, "clonetest", OPACITY_OPAQUE_U8);
}
......
......@@ -37,7 +37,7 @@ void KisColorSpaceConvertVisitorTest::testCreation()
QVERIFY(lab);