You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,9 @@ All notable changes to this project will be documented in this file.
20
20
21
21
### Changed
22
22
- The `bitmap` library now exposes the `BmpTool` API via `include/bitmap.hpp` for simplified bitmap operations.
23
+
-**Documentation**:
24
+
- Reviewed and significantly updated `README.md` for accuracy regarding features, API examples (old vs. new), build instructions, and added "Code Documentation" and "Contributing" sections.
25
+
- Reviewed and extensively updated `src/matrix/Documentation/Matrix.MD` to align with the current `src/matrix/matrix.h` implementation, including documenting move semantics, new functions, and correcting outdated information.
Note: The old API (`src/bitmap/bitmap.h` and `src/bitmapfile/bitmap_file.h`) provides file-based loading/saving and additional pixel-level operations. The new `BmpTool` API (`include/bitmap.hpp`) focuses on memory span-based operations and provides a more modern interface for whole-image manipulations.
***Bitmap File Handler (`src/bitmapfile`)**: Handles loading and saving of BMP files.
40
-
***Matrix Library (`src/matrix`)**: A generic matrix manipulation library used by the bitmap processing functions.
43
+
***New Bitmap API (`include/bitmap.hpp`)**: Provides the `BmpTool` namespace for modern, span-based image processing. This is the recommended API for new projects.
44
+
***Old Bitmap Library (`src/bitmap`)**: Provides older image processing functions using the `Bitmap::File` class.
45
+
***Bitmap File Handler (`src/bitmapfile`)**: Contains structures and functions for handling BMP file headers and low-level data, used by both APIs.
46
+
***Matrix Library (`src/matrix`)**: A generic matrix manipulation library, primarily used by the old bitmap library.
41
47
42
48
## New Span-Based API (`BmpTool`)
43
49
44
-
For more direct memory-based operations and a stable interface, the `BmpTool` API is provided.
50
+
For more direct memory-based operations and a stable interface, the `BmpTool` API is provided. This API operates on image data in memory buffers (`std::span`).
45
51
46
52
The main header for this API is `include/bitmap.hpp`.
47
53
48
54
Core components include:
49
-
*`BmpTool::Bitmap`: A struct holding image dimensions (width, height, bits-per-pixel) and a `std::vector<uint8_t>` for RGBA pixel data.
50
-
*`BmpTool::load()`: Loads BMP data from a `std::span<const uint8_t>` into a `BmpTool::Bitmap`.
51
-
*`BmpTool::save()`: Saves a `BmpTool::Bitmap` to a `std::span<uint8_t>`.
52
-
*`BmpTool::Result<T, E>`: Used for functions that can return a value or an error, with `BmpTool::BitmapError` providing specific error codes.
55
+
*`BmpTool::Bitmap`: A struct holding image dimensions (width, height, bits-per-pixel) and a `std::vector<uint8_t>` for pixel data (typically RGBA).
56
+
*`BmpTool::load(std::span<const uint8_t> bmp_data)`: Loads BMP data from a memory span into a `BmpTool::Bitmap`.
57
+
*`BmpTool::save(const BmpTool::Bitmap& bitmap, std::span<uint8_t> out_bmp_buffer)`: Saves a `BmpTool::Bitmap` to a memory span. The size of the output BMP data can be determined from the `bfSize` field of the `BITMAPFILEHEADER` written to the beginning of the `out_bmp_buffer`.
58
+
*`BmpTool::Result<T, BmpTool::BitmapError>`: Used by functions to return either a value `T` or a `BmpTool::BitmapError` enum, indicating the outcome of the operation. For functions that don't return a value on success (like `save`), `BmpTool::Result<void, BmpTool::BitmapError>` is used (internally represented as `Result<Success, BitmapError>`).
59
+
60
+
All image manipulation functions in the `BmpTool` namespace (e.g., `BmpTool::greyscale`, `BmpTool::shrink`) take a `const BmpTool::Bitmap&` as input and return a `BmpTool::Result<BmpTool::Bitmap, BmpTool::BitmapError>`.
53
61
54
62
### `BmpTool` API Usage Example
55
63
64
+
The following example demonstrates loading a BMP file into a buffer, processing it using `BmpTool`, and saving the result. This example is a simplified version of `main.cpp`.
65
+
56
66
```cpp
57
-
#include"include/bitmap.hpp"// Public API
67
+
#include"include/bitmap.hpp"// Public API for BmpTool
68
+
#include"src/bitmapfile/bitmap_file.h"// For BITMAPFILEHEADER definition (to get actual size)
69
+
58
70
#include<vector>
59
-
#include<fstream>// For reading/writing files to/from buffer for example
60
-
#include<iostream>
71
+
#include<fstream>// For std::ifstream, std::ofstream
72
+
#include<iostream>// For std::cerr, std::cout
73
+
#include<cstring>// For std::memcpy if reading header manually
if (!processedBitmap.SaveAs("output_old_api.bmp")) {
223
+
std::cerr << "Error saving output_old_api.bmp using old API" << std::endl;
191
224
return 1;
192
225
}
193
226
194
-
std::cout << "Image processed and saved as output.bmp" << std::endl;
227
+
std::cout << "Image processed and saved as output_old_api.bmp using old API" << std::endl;
195
228
return 0;
196
229
}
197
230
```
198
-
Refer to `main.cpp` for more examples.
231
+
The `main.cpp` in the root of the repository demonstrates usage of the **new `BmpTool` API**.
232
+
233
+
## Code Documentation
234
+
235
+
The public API for `BmpTool` in `include/bitmap.hpp` is documented using Doxygen-style comments.
236
+
237
+
If Doxygen is installed, you can generate the full HTML documentation by:
238
+
1. Installing Doxygen.
239
+
2. Creating a Doxyfile configuration (e.g., `doxygen -g Doxyfile` in the project root).
240
+
3. Customizing the `Doxyfile` (e.g., set `INPUT` to `include/`, `RECURSIVE` to `YES`).
241
+
4. Running `doxygen Doxyfile` from the project root.
242
+
The documentation will then be available in the specified output directory (e.g., `html/`).
243
+
244
+
## Contributing
245
+
246
+
Contributions to this project are welcome! Please follow these basic guidelines:
247
+
248
+
1.**Fork the repository:** Create your own fork of the project on GitHub.
249
+
2.**Create a branch:** Make a new branch in your fork for your feature or bug fix (e.g., `feature/new-filter` or `fix/brightness-bug`).
250
+
3.**Make your changes:** Implement your changes, ensuring code is clear and follows existing style where possible.
251
+
4.**Add tests:** If you're adding a new feature or fixing a bug, please add appropriate unit tests in the `tests/` directory. Ensure all tests pass by running `ctest` or the test executable.
252
+
5.**Commit your changes:** Make clear, concise commit messages.
253
+
6.**Push to your fork:** Push your changes to your branch on your fork.
254
+
7.**Submit a Pull Request (PR):** Open a PR from your branch to the main repository's `main` branch. Provide a clear description of your changes in the PR.
0 commit comments