|
CGVIS Utils
|
Classes | |
| class | BMPException |
| Exception type thrown by BMP I/O helpers. More... | |
Functions | |
| bool | save (const std::string &filename, const Image &source, bool ignoreSize=false) |
Save an Image to a BMP file. | |
| bool | save (const std::string &filename, uint32_t w, uint32_t h, const std::vector< float > &data, uint8_t iComponentCount=3, bool ignoreSize=false) |
| Save raw floating-point component data to a BMP file. | |
| bool | save (const std::string &filename, uint32_t w, uint32_t h, const std::vector< uint8_t > &data, uint8_t iComponentCount=3, bool ignoreSize=false) |
| Save raw 8-bit component data to a BMP file. | |
| Image | load (const std::string &filename) |
Load a BMP file into an Image. | |
| void | blit (const Image &source, const Vec2ui &sourceStart, const Vec2ui &sourceEnd, Image &target, const Vec2ui &targetStart, bool skipChecks=false) |
Copy a rectangular region from source to target (blit). | |
| void BMP::blit | ( | const Image & | source, |
| const Vec2ui & | sourceStart, | ||
| const Vec2ui & | sourceEnd, | ||
| Image & | target, | ||
| const Vec2ui & | targetStart, | ||
| bool | skipChecks = false ) |
Copy a rectangular region from source to target (blit).
Copies pixels in the half-open region [sourceStart, sourceEnd) from source into target with its top-left corner placed at targetStart. When skipChecks is false, component count compatibility and bounds are validated. If the destination would overflow, target is grown to fit and the original contents are preserved.
| source | Source image. |
| sourceStart | Min corner (inclusive) of the source region. |
| sourceEnd | Max corner (exclusive) of the source region. |
| target | Destination image to write into (may be resized). |
| targetStart | Destination top-left position where the region is placed. |
| skipChecks | If true, skip validation and resizing logic (caller is responsible for safety). |
| Image BMP::load | ( | const std::string & | filename | ) |
Load a BMP file into an Image.
| filename | Source file path. |
| BMPException | On I/O errors, unsupported bit depth, or invalid file. |
| bool BMP::save | ( | const std::string & | filename, |
| const Image & | source, | ||
| bool | ignoreSize = false ) |
| filename | Destination file path. |
| source | Source image (RGB or RGBA expected). |
| ignoreSize | If false, validate that total size fits into 32-bit BMP header fields; if too large, throw BMPException. If true, skip the size check (use with care). |
true on success; false if the file could not be opened. | bool BMP::save | ( | const std::string & | filename, |
| uint32_t | w, | ||
| uint32_t | h, | ||
| const std::vector< float > & | data, | ||
| uint8_t | iComponentCount = 3, | ||
| bool | ignoreSize = false ) |
Save raw floating-point component data to a BMP file.
| filename | Destination file path. |
| w | Image width in pixels. |
| h | Image height in pixels. |
| data | Interleaved pixel data of size w*h*iComponentCount in RGB(A) order per pixel. Each channel should be in [0,1]. |
| iComponentCount | Number of components per pixel (3 for RGB, 4 for RGBA). |
| ignoreSize | If false, validate that total size fits 32-bit BMP fields and throw on overflow; if true, skip this validation. |
true on success; false if the file could not be opened. | bool BMP::save | ( | const std::string & | filename, |
| uint32_t | w, | ||
| uint32_t | h, | ||
| const std::vector< uint8_t > & | data, | ||
| uint8_t | iComponentCount = 3, | ||
| bool | ignoreSize = false ) |
Save raw 8-bit component data to a BMP file.
| filename | Destination file path. |
| w | Image width in pixels. |
| h | Image height in pixels. |
| data | Interleaved pixel data of size w*h*iComponentCount in RGB(A) order per pixel. |
| iComponentCount | Number of components per pixel (3 for RGB, 4 for RGBA). |
| ignoreSize | If false, validate that total size fits 32-bit BMP fields and throw on overflow; if true, skip this validation. |
true on success; false if the file could not be opened.