Scroom  0.14
PipetteCommonOperationsRGB Class Reference

#include <layeroperations.hh>

Inheritance diagram for PipetteCommonOperationsRGB:
Inheritance graph
Collaboration diagram for PipetteCommonOperationsRGB:
Collaboration graph

Public Types

using Ptr = boost::shared_ptr< PipetteCommonOperationsRGB >
 
- Public Types inherited from PipetteLayerOperations
using Ptr = boost::shared_ptr< PipetteLayerOperations >
 
using PipetteColor = std::vector< std::pair< std::string, double > >
 
- Public Types inherited from LayerOperations
using Ptr = boost::shared_ptr< LayerOperations >
 

Public Member Functions

 PipetteCommonOperationsRGB (int bps_)
 
PipetteLayerOperations::PipetteColor sumPixelValues (Scroom::Utils::Rectangle< int > area, const ConstTile::Ptr &tile) override
 
- Public Member Functions inherited from Scroom::Utils::Base
 Base ()=default
 
 Base (const Base &)=delete
 
 Base (Base &&)=delete
 
Baseoperator= (const Base &)=delete
 
Baseoperator= (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
 
- Public Member Functions inherited from CommonOperations
void initializeCairo (cairo_t *cr) override
 
void drawState (cairo_t *cr, TileState s, Scroom::Utils::Rectangle< double > viewArea) override
 
Scroom::Utils::Stuff cacheZoom (const ConstTile::Ptr &tile, int zoom, Scroom::Utils::Stuff &cache) override
 
void draw (cairo_t *cr, const ConstTile::Ptr &tile, Scroom::Utils::Rectangle< double > tileArea, Scroom::Utils::Rectangle< double > viewArea, int zoom, Scroom::Utils::Stuff cache) override
 
- Public Member Functions inherited from LayerOperations
virtual int getBpp ()=0
 
virtual Scroom::Utils::Stuff cache (const ConstTile::Ptr &tile)
 
virtual void reduce (Tile::Ptr target, ConstTile::Ptr source, int x, int y)=0
 

Protected Attributes

int bps
 

Additional Inherited Members

- Static Public Member Functions inherited from CommonOperations
static void drawPixelValue (cairo_t *cr, int x, int y, int size, int value)
 
static void drawPixelValue (cairo_t *cr, int x, int y, int size, int value, Color const &bgColor)
 

Member Typedef Documentation

◆ Ptr

Constructor & Destructor Documentation

◆ PipetteCommonOperationsRGB()

PipetteCommonOperationsRGB::PipetteCommonOperationsRGB ( int  bps_)
inlineexplicit
62  : bps(bps_){};

Member Function Documentation

◆ sumPixelValues()

PipetteLayerOperations::PipetteColor PipetteCommonOperationsRGB::sumPixelValues ( Scroom::Utils::Rectangle< int >  area,
const ConstTile::Ptr tile 
)
overridevirtual

Sums the samples of each pixel contained in the area of the tile.

Parameters
areaThe rectangular area in which pixels are summed up.
tileThe tile in which the pixels are located in.

Implements PipetteLayerOperations.

235 {
236  const int offset = 3 * (area.getTop() * tile->width + area.getLeft());
237  const int stride = 3 * (tile->width - area.getWidth());
238  Scroom::Bitmap::SampleIterator<const uint8_t> si(tile->data.get(), 0, bps);
239  si += offset;
240 
241  size_t sum_r = 0;
242  size_t sum_g = 0;
243  size_t sum_b = 0;
244 
245  for(int y = area.getTop(); y < area.getBottom(); y++)
246  {
247  for(int x = area.getLeft(); x < area.getRight(); x++)
248  {
249  sum_r += *si++;
250  sum_g += *si++;
251  sum_b += *si++;
252  }
253  si += stride;
254  }
255 
256  return {{"R", sum_r}, {"G", sum_g}, {"B", sum_b}};
257 }
Here is the call graph for this function:

Member Data Documentation

◆ bps

int PipetteCommonOperationsRGB::bps
protected

The documentation for this class was generated from the following files:
Scroom::Bitmap::SampleIterator
Definition: bitmap-helpers.hh:61
Scroom::Utils::Rectangle::getBottom
value_type getBottom() const
Definition: rectangle.hh:112
Scroom::Utils::Rectangle::getWidth
value_type getWidth() const
Definition: rectangle.hh:121
PipetteCommonOperationsRGB::bps
int bps
Definition: layeroperations.hh:55
Scroom::Utils::Rectangle::getRight
value_type getRight() const
Definition: rectangle.hh:114
Scroom::Utils::Rectangle::getLeft
value_type getLeft() const
Definition: rectangle.hh:110
Scroom::Utils::Rectangle::getTop
value_type getTop() const
Definition: rectangle.hh:108