Skip to content

Conversation

@JacobBorden
Copy link
Owner

I've integrated file input/output directly into the BmpTool API by adding new overloads for BmpTool::load and BmpTool::save.

Changes include:

  • Added BmpTool::load(const std::string& filepath): Reads a BMP file from the given path and returns a BmpTool::Bitmap.
  • Added BmpTool::save(const BmpTool::Bitmap&, const std::string& filepath): Saves a BmpTool::Bitmap to the specified file path.
  • I implemented these functions in src/format/bitmap.cpp, adapting file reading/writing logic previously found in main.cpp. The filepath-based load calls the existing span-based load. The filepath-based save calls the existing span-based save using a temporary buffer and then writes the actual data size to the file.
  • I updated the main.cpp example to use these new, more convenient API overloads, removing the local readFile and writeFile utility functions and associated includes.

This change makes the BmpTool library easier for you to use for common file-based operations without requiring you to implement your own file I/O routines.

I've integrated file input/output directly into the BmpTool API by adding new overloads for `BmpTool::load` and `BmpTool::save`.

Changes include:
- Added `BmpTool::load(const std::string& filepath)`: Reads a BMP file from the given path and returns a `BmpTool::Bitmap`.
- Added `BmpTool::save(const BmpTool::Bitmap&, const std::string& filepath)`: Saves a `BmpTool::Bitmap` to the specified file path.
- I implemented these functions in `src/format/bitmap.cpp`, adapting file reading/writing logic previously found in `main.cpp`. The filepath-based `load` calls the existing span-based `load`. The filepath-based `save` calls the existing span-based `save` using a temporary buffer and then writes the actual data size to the file.
- I updated the `main.cpp` example to use these new, more convenient API overloads, removing the local `readFile` and `writeFile` utility functions and associated includes.

This change makes the BmpTool library easier for you to use for common file-based operations without requiring you to implement your own file I/O routines.
@JacobBorden JacobBorden merged commit 96fac3e into development Jun 1, 2025
6 checks passed
@JacobBorden JacobBorden deleted the feat/add-file-io-overloads branch June 1, 2025 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants