#include <pipette.hh>
|
| void | render (ViewInterface::Ptr const &vi, cairo_t *cr, Scroom::Utils::Rectangle< double > presentationArea, int zoom) override |
| |
| std::string | getSelectionType () override |
| |
| void | onSelectionStart (Selection p, ViewInterface::Ptr view) override |
| |
| void | onSelectionUpdate (Selection s, ViewInterface::Ptr view) override |
| |
| void | onSelectionEnd (Selection s, ViewInterface::Ptr view) override |
| |
| void | onEnable () override |
| |
| void | onDisable () override |
| |
| virtual void | computeValues (const ViewInterface::Ptr &view, Scroom::Utils::Rectangle< double > sel_rect) |
| |
| virtual void | displayValues (const ViewInterface::Ptr &view, Scroom::Utils::Rectangle< double > rect, const PipetteLayerOperations::PipetteColor &colors) |
| |
| std::optional< Selection > | getSelection () const |
| |
| bool | isEnabled () const |
| |
| virtual void | render (boost::shared_ptr< ViewInterface > const &vi, cairo_t *cr, Scroom::Utils::Rectangle< double > presentationArea, int zoom)=0 |
| |
| virtual void | onSelectionStart (Selection selection, boost::shared_ptr< ViewInterface > view)=0 |
| |
| virtual void | onSelectionUpdate (Selection selection, boost::shared_ptr< ViewInterface > view)=0 |
| |
| virtual void | onSelectionEnd (Selection selection, boost::shared_ptr< ViewInterface > view)=0 |
| |
| | Base ()=default |
| |
| | Base (const Base &)=delete |
| |
| | Base (Base &&)=delete |
| |
| Base & | operator= (const Base &)=delete |
| |
| Base & | operator= (Base &&)=delete |
| |
| virtual | ~Base ()=default |
| |
| template<typename R > |
| boost::shared_ptr< R > | shared_from_this () |
| |
| template<typename R > |
| boost::shared_ptr< R const > | shared_from_this () const |
| |
◆ Ptr
◆ computeValues()
68 auto pipette = boost::dynamic_pointer_cast<PipetteViewInterface>(presentation);
71 spdlog::error(
"Presentation does not implement PipetteViewInterface!");
76 auto image = presentation->getRect();
78 auto colors = pipette->getPixelAverages(rect);
80 const auto display_rect =
roundOutward(rect / presentation->getAspectRatio());
◆ create()
◆ displayValues()
96 std::stringstream info;
98 info << fmt::format(
"Top-left: {}, Bottom-right: {}, Height: {}, Width: {}",
107 for(
const auto& [name, value]:
colors)
109 info << fmt::format(
" {}: {:.2f}", name, value);
Referenced by computeValues().
◆ getSelection()
| std::optional<Selection> PipetteHandler::getSelection |
( |
| ) |
const |
|
inline |
◆ getSelectionType()
| std::string PipetteHandler::getSelectionType |
( |
| ) |
|
|
overridevirtual |
◆ isEnabled()
| bool PipetteHandler::isEnabled |
( |
| ) |
const |
|
inline |
◆ onDisable()
| void PipetteHandler::onDisable |
( |
| ) |
|
|
overridevirtual |
Then function is called whenever the tool button is deselected.
Implements ToolStateListener.
◆ onEnable()
| void PipetteHandler::onEnable |
( |
| ) |
|
|
overridevirtual |
This function is called whenever the tool button is selected.
Implements ToolStateListener.
◆ onSelectionEnd()
142 Sequentially()->schedule([me = shared_from_this<PipetteHandler>(), view, sel_rect] { me->computeValues(view, sel_rect); },
◆ onSelectionStart()
◆ onSelectionUpdate()
◆ render()
163 cairo_set_line_width(cr, 1);
164 cairo_set_source_rgb(cr, 0, 0, 1);
165 cairo_move_to(cr, end.x, start.y);
166 cairo_line_to(cr, start.x, start.y);
167 cairo_line_to(cr, start.x, end.y);
168 cairo_line_to(cr, end.x, end.y);
169 cairo_line_to(cr, end.x, start.y);
◆ currentJob
◆ enabled
| bool PipetteHandler::enabled {false} |
|
private |
◆ jobMutex
| std::mutex PipetteHandler::jobMutex |
|
private |
◆ selection
| std::optional<Selection> PipetteHandler::selection |
|
private |
◆ wasDisabled
| std::atomic_flag PipetteHandler::wasDisabled = ATOMIC_FLAG_INIT |
|
private |
The documentation for this class was generated from the following files:
boost::shared_ptr< PipetteHandler > Ptr
Definition: pipette.hh:27
#define UNUSED(x)
Definition: unused.hh:10
xy_type getTopLeft() const
Definition: rectangle.hh:133
virtual void displayValues(const ViewInterface::Ptr &view, Scroom::Utils::Rectangle< double > rect, const PipetteLayerOperations::PipetteColor &colors)
Definition: pipette.cc:92
std::optional< Selection > selection
Definition: pipette.hh:30
const std::list< Color > colors
Definition: transparentoverlaypresentation.cc:21
Rectangle intersection(const Rectangle &other) const
Definition: rectangle.hh:95
ThreadPool::Ptr Sequentially()
Definition: threadpoolimpl.cc:459
const std::string PIXEL("PixelSelection")
value_type getHeight() const
Definition: rectangle.hh:123
const std::string PIPETTE_PROPERTY_NAME
Definition: pipetteviewinterface.hh:14
void sync_on_ui_thread(T f)
Definition: gtk-helpers.hh:59
std::atomic_flag wasDisabled
Definition: pipette.hh:32
std::mutex jobMutex
Definition: pipette.hh:33
xy_type getBottomRight() const
Definition: rectangle.hh:139
boost::shared_ptr< PresentationInterface > Ptr
Definition: presentationinterface.hh:74
value_type getWidth() const
Definition: rectangle.hh:121
ThreadPool::Queue::Ptr currentJob
Definition: pipette.hh:34
Rectangle< T > make_rect_from_start_end(Point< T > start, Point< T > end)
Definition: rectangle.hh:296
double pixelSizeFromZoom(int zoom)
Definition: cairo-helpers.cc:112
Definition: pipette.hh:20
Segment< double > roundOutward(Segment< double > s)
Definition: linearsegment.hh:240
bool enabled
Definition: pipette.hh:31