C API: add ragephoto_clear()

This commit is contained in:
Syping 2021-11-05 16:20:43 +01:00
parent 67ed433f6b
commit 4c43596e2a
3 changed files with 14 additions and 0 deletions

View file

@ -915,6 +915,12 @@ ragephoto_t ragephoto_open()
return static_cast<ragephoto_t>(new RagePhoto); return static_cast<ragephoto_t>(new RagePhoto);
} }
void ragephoto_clear(ragephoto_t instance)
{
RagePhoto *ragePhoto = static_cast<RagePhoto*>(instance);
ragePhoto->clear();
}
int ragephoto_load(ragephoto_t instance, const char *data, size_t size) int ragephoto_load(ragephoto_t instance, const char *data, size_t size)
{ {
RagePhoto *ragePhoto = static_cast<RagePhoto*>(instance); RagePhoto *ragePhoto = static_cast<RagePhoto*>(instance);

View file

@ -193,6 +193,11 @@ typedef void* ragephoto_t;
/** Opens a \p ragephoto_t instance. */ /** Opens a \p ragephoto_t instance. */
LIBRAGEPHOTO_EXPORT ragephoto_t ragephoto_open(); LIBRAGEPHOTO_EXPORT ragephoto_t ragephoto_open();
/** Resets the RagePhoto instance to default values.
* \param instance \p ragephoto_t instance
*/
LIBRAGEPHOTO_EXPORT void ragephoto_clear(ragephoto_t instance);
/** Loads a Photo from a const char*. /** Loads a Photo from a const char*.
* \param instance \p ragephoto_t instance * \param instance \p ragephoto_t instance
* \param data Photo data * \param data Photo data

View file

@ -37,6 +37,9 @@ public:
~RagePhotoA() { ~RagePhotoA() {
ragephoto_close(instance); ragephoto_close(instance);
} }
void clear() {
ragephoto_clear(instance);
}
bool load(const char *data, size_t size) { bool load(const char *data, size_t size) {
return ragephoto_load(instance, data, size); return ragephoto_load(instance, data, size);
} }