|
NovaSVG 0.10.0
A header-only SVG library
|
#include <bitmap.h>
Public Member Functions | |
| Bitmap ()=default | |
| Constructs a null bitmap. | |
| Bitmap (int width, int height) | |
| Constructs a bitmap with the specified width and height. | |
| Bitmap (uint8_t *data, int width, int height, int stride) | |
| Constructs a bitmap with the provided pixel data, width, height, and stride. | |
| Bitmap (const Bitmap &bitmap) | |
| Copy constructor. | |
| Bitmap (Bitmap &&bitmap) | |
| Move constructor. | |
| Bitmap (surface_t *surface) | |
| ~Bitmap () | |
| Cleans up any resources associated with the bitmap. | |
| Bitmap & | operator= (const Bitmap &bitmap) |
| Copy assignment operator. | |
| Bitmap & | operator= (Bitmap &&bitmap) |
| Move assignment operator. | |
| void | swap (Bitmap &bitmap) |
| Swaps the content of this bitmap with another. | |
| uint8_t * | data () const |
| Gets the pointer to the raw pixel data. | |
| int | width () const |
| Gets the width of the bitmap. | |
| int | height () const |
| Gets the height of the bitmap. | |
| int | stride () const |
| Gets the stride of the bitmap. | |
| void | clear (const Color &value) |
| Clears the bitmap with the specified color. | |
| void | convertToRGBA () |
| Converts the bitmap pixel data from ARGB32 Premultiplied to RGBA Plain format in place. | |
| bool | isNull () const |
| Checks if the bitmap is null. | |
| bool | valid () const |
| Checks if the bitmap is valid. | |
| bool | writeToPng (const std::string &filename) const |
| Writes the bitmap to a PNG file. | |
| bool | writeToPng (novasvg_write_func_t callback, void *closure) const |
| Writes the bitmap to a PNG stream. | |
| bool | writeToBmp (const std::string &filename) const |
| Writes the bitmap to a BMP file. | |
| bool | writeToBmp (novasvg_write_func_t callback, void *closure) const |
| Writes the bitmap to a BMP stream. | |
| bool | writeToTga (const std::string &filename) const |
| Writes the bitmap to a TGA file. | |
| bool | writeToTga (novasvg_write_func_t callback, void *closure) const |
| Writes the bitmap to a TGA stream. | |
| bool | writeToJpg (const std::string &filename, int quality=80) const |
| Writes the bitmap to a JPEG file. | |
| bool | writeToJpg (novasvg_write_func_t callback, void *closure, int quality=80) const |
| Writes the bitmap to a JPEG stream. | |
| bool | write (const std::string &filename, int jpgQuality=80) const |
Writes the bitmap to a file, picking PNG/BMP/TGA/JPEG from filename's extension (.png/.bmp/.tga/.jpg/.jpeg; PNG if unrecognized or missing). A convenience over calling writeToPng()/writeToBmp()/etc yourself when the format doesn't need to be pinned down explicitly. | |
| surface_t * | surface () const |
|
default |
Constructs a null bitmap.
Referenced by operator=(), and operator=().
| NOVASVG_INLINE novasvg::Bitmap::Bitmap | ( | int | width, |
| int | height | ||
| ) |
| NOVASVG_INLINE novasvg::Bitmap::Bitmap | ( | uint8_t * | data, |
| int | width, | ||
| int | height, | ||
| int | stride | ||
| ) |
Constructs a bitmap with the provided pixel data, width, height, and stride.
| data | A pointer to the raw pixel data in ARGB32 Premultiplied format. |
| width | The width of the bitmap in pixels. |
| height | The height of the bitmap in pixels. |
| stride | The number of bytes per row of pixel data (stride). |
| NOVASVG_INLINE novasvg::Bitmap::Bitmap | ( | const Bitmap & | bitmap | ) |
| NOVASVG_INLINE novasvg::Bitmap::Bitmap | ( | Bitmap && | bitmap | ) |
| NOVASVG_INLINE novasvg::Bitmap::~Bitmap | ( | ) |
Cleans up any resources associated with the bitmap.
Definition at line 1658 of file bitmap.h.
References novasvg::render::surface_destroy().
| NOVASVG_INLINE void novasvg::Bitmap::clear | ( | const Color & | value | ) |
Clears the bitmap with the specified color.
| value | The color to clear with. |
Definition at line 1702 of file bitmap.h.
References novasvg::render::color_init_rgba32(), novasvg::render::surface_clear(), and novasvg::Color::value().
Referenced by novasvg::Element::renderToBitmap().
| NOVASVG_INLINE void novasvg::Bitmap::convertToRGBA | ( | ) |
Converts the bitmap pixel data from ARGB32 Premultiplied to RGBA Plain format in place.
Definition at line 1711 of file bitmap.h.
References novasvg::render::convert_argb_to_rgba(), data(), height(), stride(), novasvg::render::surface_get_data(), novasvg::render::surface_get_height(), novasvg::render::surface_get_stride(), novasvg::render::surface_get_width(), and width().
| NOVASVG_INLINE uint8_t * novasvg::Bitmap::data | ( | ) | const |
Gets the pointer to the raw pixel data.
Definition at line 1674 of file bitmap.h.
References novasvg::render::surface_get_data().
Referenced by convertToRGBA().
| NOVASVG_INLINE int novasvg::Bitmap::height | ( | ) | const |
Gets the height of the bitmap.
Definition at line 1688 of file bitmap.h.
References novasvg::render::surface_get_height().
Referenced by convertToRGBA(), and novasvg::SVGImageElement::render().
|
inline |
Checks if the bitmap is null.
Definition at line 132 of file bitmap.h.
Referenced by novasvg::Element::render(), and novasvg::SVGImageElement::render().
| NOVASVG_INLINE Bitmap & novasvg::Bitmap::operator= | ( | Bitmap && | bitmap | ) |
| NOVASVG_INLINE Bitmap & novasvg::Bitmap::operator= | ( | const Bitmap & | bitmap | ) |
| NOVASVG_INLINE int novasvg::Bitmap::stride | ( | ) | const |
Gets the stride of the bitmap.
Definition at line 1695 of file bitmap.h.
References novasvg::render::surface_get_stride().
Referenced by convertToRGBA().
| NOVASVG_INLINE void novasvg::Bitmap::swap | ( | Bitmap & | bitmap | ) |
Swaps the content of this bitmap with another.
| bitmap | The bitmap to swap with. |
Definition at line 1669 of file bitmap.h.
References width().
Referenced by operator=(), and operator=().
|
inline |
Checks if the bitmap is valid.
isNull() instead to check whether the bitmap is null. | NOVASVG_INLINE int novasvg::Bitmap::width | ( | ) | const |
Gets the width of the bitmap.
Definition at line 1681 of file bitmap.h.
References novasvg::render::surface_get_width().
Referenced by convertToRGBA(), operator=(), operator=(), novasvg::SVGImageElement::render(), swap(), write(), writeToBmp(), writeToJpg(), writeToJpg(), writeToPng(), and writeToTga().
| NOVASVG_INLINE bool novasvg::Bitmap::write | ( | const std::string & | filename, |
| int | jpgQuality = 80 |
||
| ) | const |
Writes the bitmap to a file, picking PNG/BMP/TGA/JPEG from filename's extension (.png/.bmp/.tga/.jpg/.jpeg; PNG if unrecognized or missing). A convenience over calling writeToPng()/writeToBmp()/etc yourself when the format doesn't need to be pinned down explicitly.
| filename | The name of the file to write. |
| jpgQuality | JPEG quality (1-100), used only when the extension picks JPEG. |
Definition at line 1838 of file bitmap.h.
References width(), writeToBmp(), writeToJpg(), writeToPng(), and writeToTga().
| NOVASVG_INLINE bool novasvg::Bitmap::writeToBmp | ( | const std::string & | filename | ) | const |
Writes the bitmap to a BMP file.
Definition at line 1790 of file bitmap.h.
References novasvg::BitmapCodec::write_bmp().
Referenced by write().
| NOVASVG_INLINE bool novasvg::Bitmap::writeToBmp | ( | novasvg_write_func_t | callback, |
| void * | closure | ||
| ) | const |
Writes the bitmap to a BMP stream.
Definition at line 1798 of file bitmap.h.
References width(), and novasvg::BitmapCodec::write_bmp_to_func().
| NOVASVG_INLINE bool novasvg::Bitmap::writeToJpg | ( | const std::string & | filename, |
| int | quality = 80 |
||
| ) | const |
Writes the bitmap to a JPEG file.
| quality | JPEG quality, from 1 to 100. |
Definition at line 1822 of file bitmap.h.
References width(), and novasvg::BitmapCodec::write_jpg().
Referenced by write().
| NOVASVG_INLINE bool novasvg::Bitmap::writeToJpg | ( | novasvg_write_func_t | callback, |
| void * | closure, | ||
| int | quality = 80 |
||
| ) | const |
Writes the bitmap to a JPEG stream.
| quality | JPEG quality, from 1 to 100. |
Definition at line 1830 of file bitmap.h.
References width(), and novasvg::BitmapCodec::write_jpg_to_func().
| NOVASVG_INLINE bool novasvg::Bitmap::writeToPng | ( | const std::string & | filename | ) | const |
Writes the bitmap to a PNG file.
| filename | The name of the file to write. |
Definition at line 1774 of file bitmap.h.
References novasvg::BitmapCodec::write_png().
Referenced by write().
| NOVASVG_INLINE bool novasvg::Bitmap::writeToPng | ( | novasvg_write_func_t | callback, |
| void * | closure | ||
| ) | const |
Writes the bitmap to a PNG stream.
| callback | Callback function for writing data. |
| closure | User-defined data passed to the callback. |
Definition at line 1782 of file bitmap.h.
References width(), and novasvg::BitmapCodec::write_png_to_func().
| NOVASVG_INLINE bool novasvg::Bitmap::writeToTga | ( | const std::string & | filename | ) | const |
Writes the bitmap to a TGA file.
Definition at line 1806 of file bitmap.h.
References novasvg::BitmapCodec::write_tga().
Referenced by write().
| NOVASVG_INLINE bool novasvg::Bitmap::writeToTga | ( | novasvg_write_func_t | callback, |
| void * | closure | ||
| ) | const |
Writes the bitmap to a TGA stream.
Definition at line 1814 of file bitmap.h.
References width(), and novasvg::BitmapCodec::write_tga_to_func().