#include <layeroperations.hh>
|
| | Operations24bpp () |
| |
| 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 |
| |
| | PipetteCommonOperationsRGB (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 |
| |
◆ Operations24bpp()
| Operations24bpp::Operations24bpp |
( |
| ) |
|
◆ cache()
Cache data for use during later cacheZoom() calls.
This function is called for a given tile, and then the results are passed to the cacheZoom() function. Because draw() is called relatively frequently (i.e. when scrolling), it is recommended to do cpu-intensive work in the cache() and cacheZoom() functions, and then re-use the data to make the draw() faster.
The default implementation returns an empty reference, meaning nothing is cached. As a result, the draw() function will receive an empty reference.
- Parameters
-
| tile | the Tile for which caching is requested |
Reimplemented from LayerOperations.
509 const int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, tile->width);
510 boost::shared_ptr<unsigned char>
const data =
shared_malloc(stride * tile->height);
511 unsigned char* row = data.get();
512 for(
int j = 0; j < tile->height; j++, row += stride)
514 const byte* cur = tile->data.get() + 3 * j * tile->width;
516 auto* pixel =
reinterpret_cast<uint32_t*
>(row);
517 for(
int i = 0; i < tile->width; i++)
520 *pixel = 0xFF000000 | cur[0] << 16 | cur[1] << 8 | cur[2];
◆ create()
◆ getBpp()
| int Operations24bpp::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.
533 const int sourceStride = 3 * source->width;
534 const byte* sourceBase = source->data.get();
536 const int targetStride = 3 * target->width;
537 byte* targetBase = target->data.get() + target->height * y * targetStride / 8 + targetStride * x / 8;
539 for(
int j = 0; j < source->height / 8; j++, targetBase += targetStride, sourceBase += sourceStride * 8)
542 const byte* sourcePtr = sourceBase;
543 byte* targetPtr = targetBase;
545 for(
int i = 0; i < source->width / 8; i++, sourcePtr += 8 * 3, targetPtr += 3)
550 const byte* base = sourcePtr;
554 for(
int k = 0; k < 8; k++, base += sourceStride)
557 for(
int l = 0; l < 8; l++,
current += 3)
564 targetPtr[0] = sum_r / 64;
565 targetPtr[1] = sum_g / 64;
566 targetPtr[2] = sum_b / 64;
The documentation for this class was generated from the following files: