void EditorTool::slotUpdateSpotInfo(const DColor& col, const QPoint& point) { DColor color = col; setToolInfoMessage(i18n("(%1,%2) RGBA:%3,%4,%5,%6", point.x(), point.y(), color.red(), color.green(), color.blue(), color.alpha())); }
void SharpenFilter::convolveImageMultithreaded(const Args& prm) { double maxClamp = m_destImage.sixteenBit() ? 16777215.0 : 65535.0; double* k = 0; double red, green, blue, alpha; int mx, my, sx, sy, mcx, mcy; DColor color; for (uint x = prm.start ; runningFlag() && (x < prm.stop) ; ++x) { k = prm.normal_kernel; red = green = blue = alpha = 0; sy = prm.y - prm.halfKernelWidth; for (mcy = 0 ; runningFlag() && (mcy < prm.kernelWidth) ; ++mcy, ++sy) { my = sy < 0 ? 0 : sy > (int)m_destImage.height() - 1 ? m_destImage.height() - 1 : sy; sx = x + (-prm.halfKernelWidth); for (mcx = 0 ; runningFlag() && (mcx < prm.kernelWidth) ; ++mcx, ++sx) { mx = sx < 0 ? 0 : sx > (int)m_destImage.width() - 1 ? m_destImage.width() - 1 : sx; color = m_orgImage.getPixelColor(mx, my); red += (*k) * (color.red() * 257.0); green += (*k) * (color.green() * 257.0); blue += (*k) * (color.blue() * 257.0); alpha += (*k) * (color.alpha() * 257.0); ++k; } } red = red < 0.0 ? 0.0 : red > maxClamp ? maxClamp : red + 0.5; green = green < 0.0 ? 0.0 : green > maxClamp ? maxClamp : green + 0.5; blue = blue < 0.0 ? 0.0 : blue > maxClamp ? maxClamp : blue + 0.5; alpha = alpha < 0.0 ? 0.0 : alpha > maxClamp ? maxClamp : alpha + 0.5; m_destImage.setPixelColor(x, prm.y, DColor((int)(red / 257UL), (int)(green / 257UL), (int)(blue / 257UL), (int)(alpha / 257UL), m_destImage.sixteenBit())); } }