MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / af_delete_image_memory

Function af_delete_image_memory

src/api/c/imageio.cpp:1039–1063  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1037}
1038
1039af_err af_delete_image_memory(void* ptr) {
1040 try {
1041 ARG_ASSERT(0, ptr != NULL);
1042
1043 FreeImage_Module& _ = getFreeImagePlugin();
1044
1045 // set your own FreeImage error handler
1046 _.FreeImage_SetOutputMessage(FreeImageErrorHandler);
1047
1048 auto* stream = static_cast<FIMEMORY*>(ptr);
1049 _.FreeImage_SeekMemory(stream, 0L, SEEK_SET);
1050
1051 // Ensure data is freeimage compatible
1052 FREE_IMAGE_FORMAT fif =
1053 _.FreeImage_GetFileTypeFromMemory(static_cast<FIMEMORY*>(ptr), 0);
1054 if (fif == FIF_UNKNOWN) {
1055 AF_ERROR("FreeImage Error: Unknown Filetype", AF_ERR_NOT_SUPPORTED);
1056 }
1057
1058 _.FreeImage_CloseMemory(static_cast<FIMEMORY*>(ptr));
1059 }
1060 CATCHALL;
1061
1062 return AF_SUCCESS;
1063}
1064
1065#else // WITH_FREEIMAGE
1066#include <common/err_common.hpp>

Callers 1

deleteImageMemFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected