Scroom  0.14
tiledbitmapinterface.hh
Go to the documentation of this file.
1 /*
2  * Scroom - Generic viewer for 2D data
3  * Copyright (C) 2009-2022 Kees-Jan Dijkzeul
4  *
5  * SPDX-License-Identifier: LGPL-2.1
6  */
7 
8 #pragma once
9 
10 #include <vector>
11 
12 #include <boost/shared_ptr.hpp>
13 
14 #include <gdk/gdk.h>
15 #include <gtk/gtk.h>
16 
17 #include <cairo.h>
18 
19 #include <scroom/interface.hh>
21 #include <scroom/rectangle.hh>
23 #include <scroom/stuff.hh>
24 #include <scroom/tile.hh>
25 #include <scroom/unused.hh>
26 #include <scroom/viewinterface.hh>
27 
33 {
38 };
39 
50 class LayerOperations : private Interface
51 {
52 public:
53  using Ptr = boost::shared_ptr<LayerOperations>;
54 
55 public:
62  virtual int getBpp() = 0;
63 
75  virtual void initializeCairo(cairo_t* cr) = 0;
76 
91  virtual void draw(cairo_t* cr,
92  const ConstTile::Ptr& tile,
95  int zoom,
97 
109  virtual void drawState(cairo_t* cr, TileState s, Scroom::Utils::Rectangle<double> viewArea) = 0;
110 
127  {
128  UNUSED(tile);
129  return {};
130  }
131 
151  {
152  UNUSED(tile);
153  UNUSED(zoom);
154  UNUSED(cache);
155  return {};
156  }
157 
175  virtual void reduce(Tile::Ptr target, ConstTile::Ptr source, int x, int y) = 0;
176 };
177 
190 using LayerSpec = std::vector<LayerOperations::Ptr>;
191 
196 {
197 public:
198  using Ptr = boost::shared_ptr<SourcePresentation>;
199 
200 public:
219  virtual void fillTiles(int startLine, int lineCount, int tileWidth, int firstTile, std::vector<Tile::Ptr>& tiles) = 0;
220 
226  virtual void done() = 0;
227 
228  virtual std::string getName() = 0;
229 };
230 
231 class Layer;
232 
237 {
238 public:
239  using Ptr = boost::shared_ptr<TiledBitmapInterface>;
240 
249  virtual void setSource(SourcePresentation::Ptr sp) = 0;
250 
258  virtual boost::shared_ptr<Layer> getBottomLayer() = 0;
259 
267  virtual void
268  redraw(ViewInterface::Ptr const& vi, cairo_t* cr, const Scroom::Utils::Rectangle<double>& presentationArea, int zoom) = 0;
269 
278  virtual void clearCaches(ViewInterface::Ptr vi) = 0;
279 };
280 
320 TiledBitmapInterface::Ptr createTiledBitmap(int bitmapWidth, int bitmapHeight, LayerSpec const& ls);
LayerOperations::initializeCairo
virtual void initializeCairo(cairo_t *cr)=0
UNUSED
#define UNUSED(x)
Definition: unused.hh:10
createTiledBitmap
TiledBitmapInterface::Ptr createTiledBitmap(int bitmapWidth, int bitmapHeight, LayerSpec const &ls)
Definition: tiled-bitmap.cc:28
LayerOperations::draw
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
TILE_UNLOADED
@ TILE_UNLOADED
Definition: tiledbitmapinterface.hh:35
LayerOperations::getBpp
virtual int getBpp()=0
LayerOperations::cacheZoom
virtual Scroom::Utils::Stuff cacheZoom(const ConstTile::Ptr &tile, int zoom, Scroom::Utils::Stuff &cache)
Definition: tiledbitmapinterface.hh:150
presentationinterface.hh
TiledBitmapInterface::setSource
virtual void setSource(SourcePresentation::Ptr sp)=0
SourcePresentation::getName
virtual std::string getName()=0
ConstTile::Ptr
boost::shared_ptr< ConstTile > Ptr
Definition: tile.hh:47
ViewInterface::Ptr
boost::shared_ptr< ViewInterface > Ptr
Definition: viewinterface.hh:193
SourcePresentation::Ptr
boost::shared_ptr< SourcePresentation > Ptr
Definition: tiledbitmapinterface.hh:198
LayerSpec
std::vector< LayerOperations::Ptr > LayerSpec
Definition: tiledbitmapinterface.hh:190
LayerOperations::drawState
virtual void drawState(cairo_t *cr, TileState s, Scroom::Utils::Rectangle< double > viewArea)=0
Layer
Definition: tiledbitmaplayer.hh:242
TILE_LOADED
@ TILE_LOADED
Definition: tiledbitmapinterface.hh:36
LayerOperations
Definition: tiledbitmapinterface.hh:50
LayerOperations::reduce
virtual void reduce(Tile::Ptr target, ConstTile::Ptr source, int x, int y)=0
TileState
TileState
Definition: tiledbitmapinterface.hh:32
TILE_OUT_OF_BOUNDS
@ TILE_OUT_OF_BOUNDS
Definition: tiledbitmapinterface.hh:37
SourcePresentation::fillTiles
virtual void fillTiles(int startLine, int lineCount, int tileWidth, int firstTile, std::vector< Tile::Ptr > &tiles)=0
SourcePresentation::done
virtual void done()=0
LayerOperations::cache
virtual Scroom::Utils::Stuff cache(const ConstTile::Ptr &tile)
Definition: tiledbitmapinterface.hh:126
TiledBitmapInterface::clearCaches
virtual void clearCaches(ViewInterface::Ptr vi)=0
tile.hh
TiledBitmapInterface::redraw
virtual void redraw(ViewInterface::Ptr const &vi, cairo_t *cr, const Scroom::Utils::Rectangle< double > &presentationArea, int zoom)=0
stuff.hh
Tile::Ptr
boost::shared_ptr< Tile > Ptr
Definition: tile.hh:21
SourcePresentation
Definition: tiledbitmapinterface.hh:195
Scroom::Utils::Stuff
boost::shared_ptr< void > Stuff
Definition: stuff.hh:18
TiledBitmapInterface::getBottomLayer
virtual boost::shared_ptr< Layer > getBottomLayer()=0
scroominterface.hh
viewinterface.hh
Interface
Definition: interface.hh:10
TILE_UNINITIALIZED
@ TILE_UNINITIALIZED
Definition: tiledbitmapinterface.hh:34
LayerOperations::Ptr
boost::shared_ptr< LayerOperations > Ptr
Definition: tiledbitmapinterface.hh:53
TiledBitmapInterface::Ptr
boost::shared_ptr< TiledBitmapInterface > Ptr
Definition: tiledbitmapinterface.hh:239
Viewable
Definition: presentationinterface.hh:32
unused.hh
Scroom::Utils::Rectangle< double >
Viewable::Ptr
boost::shared_ptr< Viewable > Ptr
Definition: presentationinterface.hh:35
interface.hh
rectangle.hh
TiledBitmapInterface
Definition: tiledbitmapinterface.hh:236