#include <layeroperations.hh>
|
| | OperationsCMYK4 () |
| |
| int | getBpp () override |
| |
| Scroom::Utils::Stuff | cache (const ConstTile::Ptr &tile) override |
| |
| void | reduce (Tile::Ptr target, ConstTile::Ptr source, int x, int y) override |
| |
| | PipetteCommonOperationsCMYK (int bps_) |
| |
| PipetteLayerOperations::PipetteColor | sumPixelValues (Scroom::Utils::Rectangle< int > area, const ConstTile::Ptr &tile) override |
| |
| | 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 |
| |
| 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 |
| |
◆ OperationsCMYK4()
| OperationsCMYK4::OperationsCMYK4 |
( |
| ) |
|
◆ cache()
Cache the given tile
Reimplemented from LayerOperations.
325 const int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, tile->width);
326 boost::shared_ptr<uint8_t>
const data =
shared_malloc(
static_cast<size_t>(stride * tile->height));
329 auto* row =
reinterpret_cast<uint32_t*
>(data.get());
331 const uint8_t* cur = tile->data.get();
334 for(
int i = 0; i < tile->height * tile->width; i++)
346 C_i =
static_cast<uint8_t
>(((cur[i / 2]) >> 7) - 1);
347 M_i =
static_cast<uint8_t
>(((cur[i / 2] & 0x40) >> 6) - 1);
348 Y_i =
static_cast<uint8_t
>(((cur[i / 2] & 0x20) >> 5) - 1);
349 K_i =
static_cast<uint8_t
>(((cur[i / 2] & 0x10) >> 4) - 1);
353 C_i =
static_cast<uint8_t
>(((cur[i / 2] & 0x08) >> 3) - 1);
354 M_i =
static_cast<uint8_t
>(((cur[i / 2] & 0x04) >> 2) - 1);
355 Y_i =
static_cast<uint8_t
>(((cur[i / 2] & 0x02) >> 1) - 1);
356 K_i =
static_cast<uint8_t
>(((cur[i / 2] & 0x01)) - 1);
359 uint32_t
const R =
static_cast<uint8_t
>((C_i * K_i) / 255);
360 uint32_t
const G =
static_cast<uint8_t
>((M_i * K_i) / 255);
361 uint32_t
const B =
static_cast<uint8_t
>((Y_i * K_i) / 255);
364 row[i] = 255u << 24 | R << 16 | G << 8 |
B;
◆ create()
◆ getBpp()
| int OperationsCMYK4::getBpp |
( |
| ) |
|
|
overridevirtual |
Return the number of bits per pixel that the layer will use.
This number will be used to compute the amount of memory required to store one tile
Implements LayerOperations.
◆ reduce()
Reduce the source tile by a factor of 8
The target tile will contain data for 8*8 source tiles. Offsets x and y indicate which of those 64 source tiles is currently being processed
- Parameters
-
| target | Tile that will contain the reduced bitmap |
| source | Tile that is to be reduced |
| x | x-offset (0..7) of the source tile in the target tile |
| y | y-offset (0..7) of the source tile in the target tile |
- Note
- The
target tile belongs to a different layer, and hence possibly has a different bpp than the current one, depending on the LayerSpec given to createTiledBitmap()
Implements LayerOperations.
373 const int sourceStride = source->width / 2;
374 const byte* sourceBase = source->data.get();
376 const int targetStride = 8 * target->width / 2;
377 byte* targetBase = target->data.get() + (target->height * top_left_y + top_left_x) * targetStride / 8;
379 for(
int y = 0; y < source->height / 8; y++)
381 for(
int x = 0; x < source->width / 8; x++)
385 const byte* base = sourceBase + 4 * x;
386 const byte* end = base + 8 * sourceStride;
392 for(
const byte* row = base; row < end; row += sourceStride)
403 targetBase[4 * x] =
static_cast<uint8_t
>(sum_c * 255 / 64);
404 targetBase[4 * x + 1] =
static_cast<uint8_t
>(sum_m * 255 / 64);
405 targetBase[4 * x + 2] =
static_cast<uint8_t
>(sum_y * 255 / 64);
406 targetBase[4 * x + 3] =
static_cast<uint8_t
>(sum_k * 255 / 64);
409 targetBase += targetStride;
410 sourceBase += sourceStride * 8;
The documentation for this class was generated from the following files: