2 ==============================================================================
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
7 JUCE is an open source library subject to commercial or open-source
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
23 ==============================================================================
29 //==============================================================================
32 template <class RectType
>
33 Rectangle
<int> convertToRectInt (RectType r
) noexcept
35 return { (int) r
.origin
.x
,
38 (int) r
.size
.height
};
41 template <class RectType
>
42 Rectangle
<float> convertToRectFloat (RectType r
) noexcept
44 return { (float) r
.origin
.x
,
47 (float) r
.size
.height
};
50 template <class RectType
>
51 CGRect
convertToCGRect (RectType r
) noexcept
53 return CGRectMake ((CGFloat
) r
.getX(), (CGFloat
) r
.getY(), (CGFloat
) r
.getWidth(), (CGFloat
) r
.getHeight());
56 template <class PointType
>
57 Point
<float> convertToPointFloat (PointType p
) noexcept
59 return { (float) p
.x
, (float) p
.y
};
62 template <typename PointType
>
63 CGPoint
convertToCGPoint (PointType p
) noexcept
65 return CGPointMake ((CGFloat
) p
.x
, (CGFloat
) p
.y
);
68 template <class PointType
>
69 Point
<int> roundToIntPoint (PointType p
) noexcept
71 return { roundToInt (p
.x
), roundToInt (p
.y
) };
75 inline CGFloat
getMainScreenHeight() noexcept
77 if ([[NSScreen screens
] count
] == 0)
80 return [[[NSScreen screens
] objectAtIndex
: 0] frame
].size
.height
;
83 inline NSRect
flippedScreenRect (NSRect r
) noexcept
85 r
.origin
.y
= getMainScreenHeight() - (r
.origin
.y
+ r
.size
.height
);
89 inline NSPoint
flippedScreenPoint (NSPoint p
) noexcept
91 p
.y
= getMainScreenHeight() - p
.y
;
97 CGImageRef
juce_createCoreGraphicsImage (const Image
&, CGColorSpaceRef
);
98 CGContextRef
juce_getImageContext (const Image
&);
101 Image
juce_createImageFromUIImage (UIImage
*);
105 NSImage
* imageToNSImage (const ScaledImage
& image
);