#include <stddef.h>
#include <stdint.h>
#include "nvdialog_platform.h"
#include "nvdialog_types.h"
Go to the source code of this file.
|
| typedef struct _NvdImage | NvdImage |
| | Data that can be interpeted as an image.
|
◆ __nvdialog_image_h__
| #define __nvdialog_image_h__ 1 |
◆ NvdImage
Data that can be interpeted as an image.
The data format is RGBA for library-wide compatibility across various operating systems. Other formats are supported and automatically converted.
- Note
- Using image functionality does not require nvd_init, although doing anything useful with the image probably does. This may come in handy if you wish to load images early on and use them later, possibly caching them in memory.
- Since
- v0.9.0
◆ nvd_create_image()
| NVD_API NvdImage * nvd_create_image |
( |
const uint8_t * | data, |
|
|
int | width, |
|
|
int | height ) |
Creates an NvdImage from the given buffer (data). Although recommended, it is not necessary to use nvd_image_from_filename since other libraries can also provide RGBA data.
- Warning
- As described in the NvdImage documentation, the pointer provided in data MUST be in RGBA format. Not using nvd_image_from_filename carries the additional burden of ensuring this manually.
- Parameters
-
| data | The data to use as the image |
| width | The width of the image |
| height | The height of the image |
- Returns
- NvdImage* A pointer to an NvdImage object.
◆ nvd_destroy_image()
Destroys an NvdImage.
- Parameters
-
| image | The image to destroy |
- Since
- v0.9.0
◆ nvd_image_from_filename()
| NVD_API const uint8_t * nvd_image_from_filename |
( |
const char * | filename, |
|
|
int * | width, |
|
|
int * | height ) |
- Parameters
-
| filename | The path to the file to be loaded. For best compatibility, provide a full path or use NvdFileDialog |
| width | A pointer to a variable to hold the width of the image |
| height | A pointer to a variable to hold the height of the image |
- Since
- v0.9.0
- Returns
- A pointer to dynamically allocated image data. The returned pointer must not be freed manually; Instead use nvd_destroy_image.
◆ nvd_image_to_bytes()
Returns the raw image bytes that the given image contains.
- Note
- Format, as with every NvdImage, is always RGBA.
- Parameters
-
| image | The image to get the bytes from |
- Since
- v0.10.1