-
Notifications
You must be signed in to change notification settings - Fork 122
Fixing issue where UIColor with alpha < 1 was being rendered incorrectly #266
Conversation
4e4d615
to
74455fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this fix! A suggestion for the iOS and macOS changelogs:
- Fixed an issue where properties such as
MGLFillStyleLayer.fillColor
andMGLLineStyleLayer.lineColor
misinterpreted non-opaqueUIColor
s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the comments below, please rebase onto master and remove the mbgl submodule bump, which I don’t think is necessary here.
Will do, it's weird that there's a change in the |
|
||
NSArray *jsonExpression = @[@"rgba", @255.0, @239.0, @213.0, @0.5]; | ||
NSExpression *papayawhipExpression = [NSExpression expressionWithMGLJSONObject:jsonExpression]; | ||
MGLColor *papayaWhipColor = [papayawhipExpression expressionValueWithObject:nil context:nil]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, papayawhipExpression
is a constant value expression, so this is equivalent to getting its constantValue
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a changelog nitpick that we can fold into the prerelease PR if it’s more convenient.
Co-Authored-By: Minh Nguyễn <[email protected]>
Co-Authored-By: Minh Nguyễn <[email protected]>
<changelog> Fixed an issue where properties such as MGLFillStyleLayer.fillColor and MGLLineStyleLayer.lineColor misinterpreted non-opaque UIColors.</changelog>
Fixes #125
This issue was being caused due to an incorrect assumption that the R, G, B color components needed to be multiplied with the alpha value. The changes fix this by using the newly exposed
mgl_colorForPremultipliedValue
category method onUIColor
.