|
WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
|
CPU-side image buffer storing BGRA pixel data. More...
#include <SoftwareImage.h>
Public Member Functions | |
| SoftwareImage ()=default | |
| SoftwareImage (int width, int height) | |
| Create a blank image with the given dimensions. | |
| SoftwareImage (const uint8_t *bgraData, int width, int height) | |
| Construct from existing BGRA pixel data (copies the data). | |
| int | width () const |
| Image width in pixels. | |
| int | height () const |
| Image height in pixels. | |
| bool | empty () const |
| True if the image has zero dimensions. | |
| uint8_t * | data () |
| Mutable pointer to the raw BGRA pixel buffer. | |
| const uint8_t * | data () const |
| Const pointer to the raw BGRA pixel buffer. | |
| SoftwareImage | scaled (int newWidth, int newHeight) const |
| Return a scaled copy using bilinear interpolation. | |
| SoftwareImage | mirrored () const |
| Return a vertically mirrored copy. | |
| bool | savePNG (const std::string &path) const |
| Save as PNG to the given file path. | |
| bool | savePNG (const std::wstring &path) const |
| Save as PNG to the given wide-string file path. | |
| void | composite (const SoftwareImage &src, int destX, int destY, int blendMode=1) |
| Composite a source image onto this image at the given position. | |
| void | assign (const SoftwareImage &src) |
| Replace contents entirely with a copy of src. | |
Static Public Member Functions | |
| static SoftwareImage | loadFromMemory (const uint8_t *data, int size) |
| Load a JPEG image from a memory buffer. | |
Private Attributes | |
| int | w_ = 0 |
| int | h_ = 0 |
| std::vector< uint8_t > | pixels_ |
CPU-side image buffer storing BGRA pixel data.
Provides scaling, mirroring, compositing, and PNG save operations. Used for texture composition in the WoW Model Viewer.
Definition at line 11 of file SoftwareImage.h.
|
default |
| SoftwareImage::SoftwareImage | ( | int | width, |
| int | height | ||
| ) |
Create a blank image with the given dimensions.
Definition at line 12 of file SoftwareImage.cpp.
| SoftwareImage::SoftwareImage | ( | const uint8_t * | bgraData, |
| int | width, | ||
| int | height | ||
| ) |
Construct from existing BGRA pixel data (copies the data).
Definition at line 17 of file SoftwareImage.cpp.
| void SoftwareImage::assign | ( | const SoftwareImage & | src | ) |
Replace contents entirely with a copy of src.
Definition at line 206 of file SoftwareImage.cpp.
| void SoftwareImage::composite | ( | const SoftwareImage & | src, |
| int | destX, | ||
| int | destY, | ||
| int | blendMode = 1 |
||
| ) |
Composite a source image onto this image at the given position.
| src | Source image to composite. |
| destX | Horizontal offset in this image. |
| destY | Vertical offset in this image. |
| blendMode | 1 = SourceOver (default), 4 = Multiply, 6 = Overlay. |
Definition at line 143 of file SoftwareImage.cpp.
|
inline |
Mutable pointer to the raw BGRA pixel buffer.
Definition at line 32 of file SoftwareImage.h.
|
inline |
Const pointer to the raw BGRA pixel buffer.
Definition at line 35 of file SoftwareImage.h.
|
inline |
True if the image has zero dimensions.
Definition at line 29 of file SoftwareImage.h.
|
inline |
Image height in pixels.
Definition at line 26 of file SoftwareImage.h.
|
static |
Load a JPEG image from a memory buffer.
Definition at line 213 of file SoftwareImage.cpp.
| SoftwareImage SoftwareImage::mirrored | ( | ) | const |
Return a vertically mirrored copy.
Definition at line 67 of file SoftwareImage.cpp.
| bool SoftwareImage::savePNG | ( | const std::string & | path | ) | const |
Save as PNG to the given file path.
Internally converts BGRA → RGBA for stb_image_write.
Definition at line 92 of file SoftwareImage.cpp.
| bool SoftwareImage::savePNG | ( | const std::wstring & | path | ) | const |
Save as PNG to the given wide-string file path.
Definition at line 104 of file SoftwareImage.cpp.
| SoftwareImage SoftwareImage::scaled | ( | int | newWidth, |
| int | newHeight | ||
| ) | const |
Return a scaled copy using bilinear interpolation.
Definition at line 22 of file SoftwareImage.cpp.
|
inline |
Image width in pixels.
Definition at line 23 of file SoftwareImage.h.
|
private |
Definition at line 67 of file SoftwareImage.h.
|
private |
Definition at line 68 of file SoftwareImage.h.
|
private |
Definition at line 66 of file SoftwareImage.h.