summaryrefslogtreecommitdiff
path: root/platform/ios/src/UIColor+MGLAdditions.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/ios/src/UIColor+MGLAdditions.mm')
-rw-r--r--platform/ios/src/UIColor+MGLAdditions.mm26
1 files changed, 26 insertions, 0 deletions
diff --git a/platform/ios/src/UIColor+MGLAdditions.mm b/platform/ios/src/UIColor+MGLAdditions.mm
new file mode 100644
index 0000000000..23aea162f7
--- /dev/null
+++ b/platform/ios/src/UIColor+MGLAdditions.mm
@@ -0,0 +1,26 @@
+#import "UIColor+MGLAdditions.hpp"
+
+#import "MGLStyleAttributeValue.h"
+#import "MGLStyleAttributeValue_Private.hpp"
+
+@implementation UIColor (MGLAdditions)
+
+- (mbgl::Color)mbgl_color
+{
+ CGFloat r, g, b, a;
+ [self getRed:&r green:&g blue:&b alpha:&a];
+ return { (float)r, (float)g, (float)b, (float)a };
+}
+
+- (mbgl::style::PropertyValue<mbgl::Color>)mbgl_colorPropertyValue
+{
+ mbgl::Color color = self.mbgl_color;
+ return {{ color.r, color.g, color.b, color.a }};
+}
+
++ (UIColor *)mbgl_colorWithColor:(mbgl::Color)color
+{
+ return [UIColor colorWithRed:color.r green:color.g blue:color.b alpha:color.a];
+}
+
+@end