7 #include "BackgroundStateContext.h" 8 #include "BackgroundStateCurve.h" 9 #include "DocumentModelColorFilter.h" 10 #include "DocumentModelGridRemoval.h" 11 #include "FilterImage.h" 12 #include "GraphicsScene.h" 13 #include "GraphicsView.h" 16 #include "Transformation.h" 27 LOG4CPP_INFO_S ((*mainCat)) <<
"BackgroundStateCurve::begin";
34 LOG4CPP_INFO_S ((*mainCat)) <<
"BackgroundStateCurve::end";
41 LOG4CPP_INFO_S ((*mainCat)) <<
"BackgroundStateCurve::fitInView";
43 view.fitInView (
imageItem ().boundingRect());
46 void BackgroundStateCurve::processImageFromSavedInputs (
const Transformation &transformation,
50 LOG4CPP_INFO_S ((*mainCat)) <<
"BackgroundStateCurve::processImageFromSavedInputs";
53 if (!m_curveSelected.isEmpty()) {
57 QPixmap pixmapFiltered = filterImage.
filter (m_pixmapOriginal.toImage(),
76 const QString &curveSelected)
78 LOG4CPP_INFO_S ((*mainCat)) <<
"BackgroundStateCurve::setCurveSelected" 79 <<
" curve=" << curveSelected.toLatin1().data();
83 m_curveSelected = curveSelected;
84 processImageFromSavedInputs (transformation,
92 const QPixmap &pixmapOriginal)
94 LOG4CPP_INFO_S ((*mainCat)) <<
"BackgroundStateCurve::setPixmap";
96 m_pixmapOriginal = pixmapOriginal;
97 processImageFromSavedInputs (transformation,
104 return "BackgroundStateCurve";
111 LOG4CPP_INFO_S ((*mainCat)) <<
"BackgroundStateCurve::updateColorFilter";
113 processImageFromSavedInputs (transformation,
QGraphicsPixmapItem & imageItem() const
Graphics image item for the current state.
virtual void begin()
Method that is called at the exact moment a state is entered. Typically called just after end for the...
void setImageVisible(bool visible)
Show/hide background image.
void setProcessedPixmap(const QPixmap &pixmap)
Save the image for this state after it has been processed by the leaf class.
virtual QString state() const
State name for debugging.
BackgroundStateCurve(BackgroundStateContext &context, GraphicsScene &scene)
Single constructor.
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
Context class that manages the background image state machine.
QGraphicsView class with event handling added. Typically the events are sent to the active digitizing...
virtual void setCurveSelected(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter, const QString &curveSelected)
Update the currently selected curve name.
QPixmap filter(const QImage &imageUnfiltered, const Transformation &transformation, const QString &curveSelected, const DocumentModelColorFilter &modelColorFilter, const DocumentModelGridRemoval &modelGridRemoval) const
Filter original unfiltered image into filtered pixmap.
Background image state machine state base class.
virtual void fitInView(GraphicsView &view)
Zoom so background fills the window.
Filters an image using a combination of color filtering and grid removal.
virtual void setPixmap(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QPixmap &pixmapOriginal)
Update the image for this state, after the leaf class processes it appropriately. ...
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before begin for t...
virtual void updateColorFilter(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter)
Apply color filter settings.
Add point and line handling to generic QGraphicsScene.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...