Scroom 0.14-49-gb7ae7a6d
Loading...
Searching...
No Matches
PipetteCommonOperationsCMYK Class Reference

#include <layeroperations.hh>

Inheritance diagram for PipetteCommonOperationsCMYK:
Inheritance graph
Collaboration diagram for PipetteCommonOperationsCMYK:
Collaboration graph

Public Types

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

Public Member Functions

 PipetteCommonOperationsCMYK (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 >
std::shared_ptr< R > shared_from_this ()
 
template<typename R >
std::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 &)
 
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

◆ PipetteCommonOperationsCMYK()

PipetteCommonOperationsCMYK::PipetteCommonOperationsCMYK ( int  bps_)
inlineexplicit
47 : bps(bps_) {};
int bps
Definition layeroperations.hh:40

Member Function Documentation

◆ sumPixelValues()

PipetteLayerOperations::PipetteColor PipetteCommonOperationsCMYK::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.

208{
209 const int offset = 4 * (area.getTop() * tile->width + area.getLeft());
210 const int stride = 4 * (tile->width - area.getWidth());
211 Scroom::Bitmap::SampleIterator<const uint8_t> si(tile->data.get(), 0, bps);
212 si += offset;
213
214 size_t sum_c = 0;
215 size_t sum_m = 0;
216 size_t sum_y = 0;
217 size_t sum_k = 0;
218
219 for(int y = area.getTop(); y < area.getBottom(); y++)
220 {
221 for(int x = area.getLeft(); x < area.getRight(); x++)
222 {
223 sum_c += *si++;
224 sum_m += *si++;
225 sum_y += *si++;
226 sum_k += *si++;
227 }
228 si += stride;
229 }
230 return {{"C", sum_c}, {"M", sum_m}, {"Y", sum_y}, {"K", sum_k}};
231}
Definition bitmap-helpers.hh:62
value_type getTop() const
Definition rectangle.hh:108
value_type getWidth() const
Definition rectangle.hh:121
value_type getRight() const
Definition rectangle.hh:114
value_type getLeft() const
Definition rectangle.hh:110
value_type getBottom() const
Definition rectangle.hh:112
Here is the call graph for this function:

Member Data Documentation

◆ bps

int PipetteCommonOperationsCMYK::bps
protected

Referenced by sumPixelValues().


The documentation for this class was generated from the following files: