|
Scroom 0.14-48-ga0fee447
|
#include "tiled-bitmap.hh"#include <cmath>#include <cstdio>#include <fmt/format.h>#include <spdlog/spdlog.h>#include <boost/thread/mutex.hpp>#include <scroom/cairo-helpers.hh>#include <scroom/semaphore.hh>#include "tileviewstate.hh"
Functions | |
| TiledBitmapInterface::Ptr | createTiledBitmap (int bitmapWidth, int bitmapHeight, LayerSpec const &ls) |
| Scroom::Utils::Rectangle< int > | TileAreaForIndex (Scroom::Utils::Point< int > tileIndex) |
| TiledBitmapInterface::Ptr createTiledBitmap | ( | int | bitmapWidth, |
| int | bitmapHeight, | ||
| LayerSpec const & | ls | ||
| ) |
Create a tiled bitmap.
In a TiledBitmap, your bitmap is distributed over tiles, that each contain a square portion of your bitmap. These tiles will be swapped in or out as required, depending on the amount of available memory. This way, you can "load" bitmaps that are larger than your amount of memory would normally allow.
Of course, when zooming out, you'd still need all the data in your bitmap, in order to show the scaled down version. To avoid this, createTiledBitmap() creates pre-scaled versions of your bitmap, that are reduced by a factor 8. Such a pre-scaled version is called a Layer. If your bitmap gets very large, several pre-scaled versions are created, reduced by a factor 8, 64, 512, 4096, etc.
So, to summarize, createTiledBitmap() creates several layers of your bitmap, at zoom levels 1:1, 1:8, 1:64, etc. Each layer is then divided into tiles, such that only the relevant part can be loaded into memory.
Of course createTiledBitmap() doesn't know anything about how you choose to represent your bitmap data, so you'll have to specify (by implementing LayerOperations) how to draw portions of your bitmap at given zoom levels, and how to pre-scale your bitmap.
| bitmapWidth | the width of the bitmap |
| bitmapHeight | the height of the bitmap |
| ls | LayerOperations objects, specifying how to draw (portions of) your bitmap at given zoom levels |
Referenced by setupTest1bpp(), setupTest2bpp(), setupTest4bpp(), setupTest8bpp(), and setupTest8bppColormapped().


|
inline |
Referenced by TiledBitmap::redraw().
