File tree Expand file tree Collapse file tree 2 files changed +14
-16
lines changed
Expand file tree Collapse file tree 2 files changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -77,26 +77,23 @@ void native_image_destroy(native_image_t image) {
7777}
7878
7979// Get the size of an image in pixels
80- void native_image_get_size (native_image_t image,
81- double * width,
82- double * height) {
83- if (!image || !width || !height) {
84- if (width)
85- *width = 0.0 ;
86- if (height)
87- *height = 0.0 ;
88- return ;
80+ native_size_t native_image_get_size (native_image_t image) {
81+ native_size_t result = {0.0 , 0.0 };
82+
83+ if (!image) {
84+ return result;
8985 }
9086
9187 try {
9288 auto img = static_cast <std::shared_ptr<Image>*>(image);
9389 auto size = (*img)->GetSize ();
94- * width = size.width ;
95- * height = size.height ;
90+ result. width = size.width ;
91+ result. height = size.height ;
9692 } catch (...) {
97- *width = 0.0 ;
98- *height = 0.0 ;
93+ // Return zero size on error
9994 }
95+
96+ return result;
10097}
10198
10299// Get the image format string for debugging purposes
Original file line number Diff line number Diff line change 44#include <stddef.h>
55#include <stdint.h>
66
7+ #include "geometry_c.h"
8+
79#if _WIN32
810#define FFI_PLUGIN_EXPORT __declspec(dllexport)
911#else
@@ -57,11 +59,10 @@ void native_image_destroy(native_image_t image);
5759/**
5860 * Get the size of an image in pixels
5961 * @param image The image
60- * @param width Pointer to store the width (will be set to 0 if invalid)
61- * @param height Pointer to store the height (will be set to 0 if invalid)
62+ * @return Size of the image (width and height will be 0 if invalid)
6263 */
6364FFI_PLUGIN_EXPORT
64- void native_image_get_size (native_image_t image , double * width , double * height );
65+ native_size_t native_image_get_size (native_image_t image );
6566
6667/**
6768 * Get the image format string for debugging purposes
You can’t perform that action at this time.
0 commit comments