Is there a way to access juce::imageToNSImage?

It seems it is defined in some mac specific juce header file, and not declared static. I tried it declaring it as extern in my sources, but it seems i cannot call it. Why those utilities are not public ?

1 Like

found this in the headers:

#if JUCE_GRAPHICS_INCLUDE_COREGRAPHICS_HELPERS && (JUCE_MAC || JUCE_IOS)
 #include "native/juce_mac_CoreGraphicsHelpers.h"
 #include "native/juce_mac_CoreGraphicsContext.h"
#endif

does it mean that i can freely define JUCE_GRAPHICS_INCLUDE_COREGRAPHICS_HELPERS in my code to get it exposed ?

That’s me being silly. Sorry for the confusion :smiley:

It seems you have figured this out… I’m trying to access juce::imageToNSImage in a .mm MODULE file.
So far I’m failing hard… If I just define #define JUCE_GRAPHICS_INCLUDE_COREGRAPHICS_HELPERS 1 I’m running into a bunch of errors saying Unknown type name CGRect and the likes.

Any hints?

//EDIT:
I figured it out :slight_smile: For anyone else wondering: the trick is to just include these in your .mm file:

#include “juce_graphics/native/juce_mac_CoreGraphicsHelpers.h”
#include “juce_graphics/native/juce_mac_CoreGraphicsContext.h”