10 #ifndef BITMAP_TYPE_HPP
11 #define BITMAP_TYPE_HPP
20 std::vector<bool> data;
22 inline uint Index(uint x, uint y)
const {
return y * this->
w + x; }
39 this->data.resize(Index(this->
w, this->
h));
59 this->tile =
TileXY(r.left, r.top);
63 this->data.resize(Index(
w,
h));
72 this->data.resize(Index(
w,
h));
82 this->data[Index(
tile)] =
true;
92 this->data[Index(
tile)] =
false;
121 (*this).OrthogonalTileIterator::operator++();
123 (*this).OrthogonalTileIterator::operator++();
128 std::unique_ptr<TileIterator>
Clone()
const override
130 return std::make_unique<BitmapTileIterator>(*
this);
Represents a tile area containing containing individually set tiles.
void SetTile(TileIndex tile)
Add a tile as part of the tile area.
void ClrTile(TileIndex tile)
Clear a tile from the tile area.
bool HasTile(TileIndex tile) const
Test if a tile is part of the tile area.
void Initialize(const Rect &r)
Initialize the BitmapTileArea with the specified Rect.
void Reset()
Reset and clear the BitmapTileArea.
Iterator to iterate over all tiles belonging to a bitmaptilearea.
std::unique_ptr< TileIterator > Clone() const override
Allocate a new iterator that is a copy of this one.
TileIterator & operator++() override
Move ourselves to the next tile in the rectangle on the map.
BitmapTileIterator(const BitmapTileArea &bitmap)
Construct the iterator.
Iterator to iterate over a tile area (rectangle) of the map.
Base class for tile iterators.
static debug_inline TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
static debug_inline uint TileY(TileIndex tile)
Get the Y component of a tile.
static debug_inline uint TileX(TileIndex tile)
Get the X component of a tile.
Represents the covered area of e.g.
bool Contains(TileIndex tile) const
Does this tile area contain a tile?
uint16_t w
The width of the area.
TileIndex tile
The base tile of the area.
uint16_t h
The height of the area.
Specification of a rectangle with absolute coordinates of all edges.
int Width() const
Get width of Rect.
int Height() const
Get height of Rect.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.