Loading...
Searching...
No Matches
ImageRects.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith. All rights reserved.
2// Malena Framework — Proprietary Software. See LICENSE for terms.
3
4//
5// Created by Dave Smith on 4/9/25.
6//
7
8#ifndef MALENA_IMAGERECTS_H
9#define MALENA_IMAGERECTS_H
10
13#include <vector>
14
15namespace ml
16{
41 {
42 private:
43 std::vector<sf::IntRect> _intRects;
44 int _rows;
45 int _cols;
46
47 struct RowProxy
48 {
49 const ImageRects& owner;
50 int row;
51 const sf::IntRect& operator[](int col) const { return owner.getIntRect(row, col); }
52 };
53
54 public:
61 ImageRects(int cols);
62
70 const sf::IntRect& getIntRect(int row, int col) const;
71
80 RowProxy operator[](int row) const { return {*this, row}; }
81
90 void push(const sf::IntRect& int_rect);
91 };
92
93} // namespace ml
94
95#endif // MALENA_IMAGERECTS_H
const sf::IntRect & getIntRect(int row, int col) const
Return the rect for a given row and column.
RowProxy operator[](int row) const
Row-indexed access — returns a proxy for column subscript.
Definition ImageRects.h:80
ImageRects(int cols)
Construct an empty ImageRects with a known column count.
void push(const sf::IntRect &int_rect)
Append a rect to the collection.
#define MALENA_API
Definition Component.h:22
Rect< int > IntRect