|
Scroom 0.14-48-ga0fee447
|
#include <tiledbitmapinterface.hh>


Public Types | |
| using | Ptr = std::shared_ptr< LayerOperations > |
Public Member Functions | |
| virtual int | getBpp ()=0 |
| virtual void | initializeCairo (cairo_t *cr)=0 |
| virtual 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)=0 |
| virtual void | drawState (cairo_t *cr, TileState s, Scroom::Utils::Rectangle< double > viewArea)=0 |
| virtual Scroom::Utils::Stuff | cache (const ConstTile::Ptr &) |
| virtual Scroom::Utils::Stuff | cacheZoom (const ConstTile::Ptr &, int, Scroom::Utils::Stuff &) |
| virtual void | reduce (Tile::Ptr target, ConstTile::Ptr source, int x, int y)=0 |
Additional Inherited Members | |
Private Member Functions inherited from Interface | |
| Interface ()=default | |
| Interface (const Interface &)=delete | |
| Interface & | operator= (const Interface &)=delete |
| Interface (Interface &&)=delete | |
| Interface & | operator= (Interface &&)=delete |
| virtual | ~Interface ()=default |
Operations on a layer in the TiledBitmap
Tasks of LayerOperations objects include:
| using LayerOperations::Ptr = std::shared_ptr<LayerOperations> |
|
inlinevirtual |
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.
| tile | the Tile for which caching is requested |
Reimplemented in Operations1bpp, Operations8bpp, Operations24bpp, Operations, OperationsColormapped, OperationsCMYK32, OperationsCMYK16, OperationsCMYK8, and OperationsCMYK4.
Referenced by CommonOperations::cacheZoom(), and CommonOperations::draw().

|
inlinevirtual |
Cache data for use during later draw() calls.
This function is called for a given tile and zoom level, and then the results are passed to the draw() 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.
| tile | the Tile for which caching is requested |
| zoom | the requested zoom level |
| cache | the output of cache(const ConstTile::Ptr) |
Reimplemented in CommonOperations, and Operations1bppClipped.
|
pure virtual |
Draw the given tileArea into the given viewArea at the requested zoom level
| cr | The canvas on which to draw |
| tile | The tile to take data from |
| tileArea | Area of the tile that needs to be drawn |
| viewArea | Area of the canvas that the tile needs to be drawn in |
| zoom | The requested zoom level. One pixel of your presentation should have size 2**zoom when drawn. zoom will be negative for all but the first layer. |
| cache | Depending on whether the cacheZoom() function finished already, this may either be an empty reference, or a reference to the value returned by cacheZoom() |
Implemented in DummyLayerOperations, CommonOperations, Operations1bpp, Operations8bpp, and Operations.
|
pure virtual |
Draw the given state into the given viewArea
The associated tile is likely not loaded or not initialized or in whatever other TileState that doesn't allow its contents to be drawn.
Something needs to be drawn in the given viewArea anyway. Implementors might want to just draw an empty rectangle, maybe color-coded to reflect the state of the tile.
Implemented in DummyLayerOperations, and CommonOperations.
|
pure virtual |
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
Implemented in Operations1bpp, Operations8bpp, Operations24bpp, Operations, OperationsColormapped, Operations1bppClipped, OperationsCMYK32, OperationsCMYK16, OperationsCMYK8, OperationsCMYK4, and DummyLayerOperations.
|
pure virtual |
Initialize the canvas for drawing the bitmap
When TiledBitmapInterface::redraw() is called, (a portion of) the Layer needs to be redrawn. TiledBitmap will compute which tiles are involved in the redraw, and call draw() or drawState() for each of them, as appropriate. However, before doing so, it will first call initializeCairo(). You can take this opportunity to set various properties that are needed in all subsequent calls to draw() and drawState(), such as anti-aliasing and line caps.
Implemented in DummyLayerOperations, and CommonOperations.
|
pure virtual |
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
| 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 |
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() Implemented in Operations1bpp, Operations8bpp, Operations24bpp, Operations, OperationsColormapped, Operations1bppClipped, OperationsCMYK32, OperationsCMYK16, OperationsCMYK8, OperationsCMYK4, and DummyLayerOperations.