Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Source/Ejecta/EJCanvas/2D/EJConvertColorRGBA.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extern "C" {

EJColorRGBA JSValueToColorRGBA( JSContextRef ctx, JSValueRef value );
JSValueRef ColorRGBAToJSValue( JSContextRef ctx, EJColorRGBA c );
UIColor* JSValueToUIColor(JSContextRef ctx, JSValueRef value);

#ifdef __cplusplus
}
Expand Down
7 changes: 7 additions & 0 deletions Source/Ejecta/EJCanvas/2D/EJConvertColorRGBA.m
Original file line number Diff line number Diff line change
Expand Up @@ -325,3 +325,10 @@ JSValueRef ColorRGBAToJSValue( JSContextRef ctx, EJColorRGBA c ) {
return ret;
}

UIColor* JSValueToUIColor(JSContextRef ctx, JSValueRef value) {
EJColorRGBA color = JSValueToColorRGBA(ctx, value);
return [UIColor colorWithRed:(CGFloat)color.rgba.r/255
green:(CGFloat)color.rgba.g/255
blue:(CGFloat)color.rgba.b/255
alpha:(CGFloat)color.rgba.a/255];
}