17 m_imageOriginal (pixmapOriginal.toImage()),
18 m_rgbBackground (rgbBackground),
23 m_restartTimer.setSingleShot (
false);
24 connect (&m_restartTimer, SIGNAL (timeout ()),
this, SLOT (slotRestartTimeout()));
39 m_inputCommandQueue.push_back (command);
41 if (!m_restartTimer.isActive()) {
48 void DlgFilterWorker::slotRestartTimeout ()
50 if (m_inputCommandQueue.count() > 0) {
53 m_inputCommandQueue.clear ();
65 }
else if (m_xLeft < m_imageOriginal.width ()) {
69 if (xStop >= m_imageOriginal.width()) {
70 xStop = m_imageOriginal.width();
79 int processedWidth = xStop - m_xLeft;
80 QImage imageProcessed (processedWidth,
81 m_imageOriginal.height(),
82 QImage::Format_RGB32);
83 for (
int xFrom = m_xLeft, xTo = 0; (xFrom < xStop) && (m_inputCommandQueue.count() == 0); xFrom++, xTo++) {
84 for (
int y = 0; (y < m_imageOriginal.height ()) && (m_inputCommandQueue.count() == 0); y++) {
85 QColor pixel = m_imageOriginal.pixel (xFrom, y);
87 if (pixel.rgb() != m_rgbBackground) {
96 imageProcessed.setPixel (xTo, y, (isOn ?
97 QColor (Qt::black).rgb () :
98 QColor (Qt::white).rgb ()));
102 if (m_inputCommandQueue.count() == 0) {
105 m_xLeft += processedWidth;
108 if ((xStop < m_imageOriginal.width()) ||
109 (m_inputCommandQueue.count () > 0)) {
Command pattern object for receiving new parameters in DlgFilterWorker from GUI thread.
double low0To1() const
Get method for low value.
#define LOG4CPP_INFO_S(logger)
Class for filtering image to remove unimportant information.
void slotNewParameters(ColorFilterMode colorFilterMode, double low, double high)
Start processing with a new set of parameters. Any ongoing processing is interrupted when m_filterMod...
void signalTransferPiece(int xLeft, QImage image)
Send a processed vertical piece of the original pixmap. The destination is between xLeft and xLeft+pi...
const int COLUMNS_PER_PIECE
log4cpp::Category * mainCat
double high0To1() const
Get method for high value.
bool pixelUnfilteredIsOn(ColorFilterMode colorFilterMode, const QColor &pixel, QRgb rgbBackground, double low0To1, double high0To1) const
Return true if specified unfiltered pixel is on.
ColorFilterMode colorFilterMode() const
Get method for filter mode.
DlgFilterWorker(const QPixmap &pixmapOriginal, QRgb m_rgbBackground)
Single constructor.