[TIMOB-27881] Android: ImageView tintColor has no effect
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-05-14T14:33:28.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.0.2 |
Components | Android |
Labels | n/a |
Reporter | Gary Mathews |
Assignee | Gary Mathews |
Created | 2020-05-05T18:15:58.000+0000 |
Updated | 2020-05-14T14:33:28.000+0000 |
Description
-
Ti.UI.ImageView.tintColor
fails to apply the defined color to the ImageView
*TEST CASE*
const win = Ti.UI.createWindow({ backgroundColor: 'white' });
const img = Ti.UI.createImageView({
width: '80%',
image: 'https://about.gitlab.com/images/press/logo/png/gitlab-icon-1-color-black-rgb.png',
tintColor: 'red'
});
win.add(img);
win.open();
*EXPECTED*
- Image should tint to defined color (red).
*ACTUAL*
- Image does not tint to defined color and remains black.
Attachments
File | Date | Size |
---|---|---|
Screen Shot 2020-05-06 at 1.49.07 PM.png | 2020-05-06T17:49:30.000+0000 | 17690 |
Screen Shot 2020-05-06 at 2.00.13 PM.png | 2020-05-06T18:00:41.000+0000 | 36035 |
master: https://github.com/appcelerator/titanium_mobile/pull/11690
We need to double check iOS' behavior. I'm pretty sure iOS's tint feature does a color "fill" in all non-transparent pixels. As in it replaces the original RGB values with the tint color and retains the alpha (or possibly multiples the alpha channels together).
For reference, here's what iOS looks like for this code sample: !Screen Shot 2020-05-06 at 1.49.07 PM.png|thumbnail!
It'd be nice to have some pre-defined images with/without alpha, including with segments with partial translucency so we could easily compare originals versus expectations here. iOS uses UIImageRenderingModeAlwaysTemplate on the original image (the gitlab icon) - which the docs say ignores the color info and applies tint over it. So, I assume the color doesn't really matter but the alpha values do for the input image.
Here's an image with full to partial transparency in a radial gradient: https://pngimage.net/wp-content/uploads/2018/06/png-partial-transparency-2.png - which on iOS looks like this (with the above sample modified to point to the new image): !Screen Shot 2020-05-06 at 2.00.13 PM.png|thumbnail!
I have mask images we can use in the "MaskedImage.zip" project attached to [TIMOB-17363]. I created all of the images... except for "MaskCamera.png" and "MaskCircleLock.png" which came from the Android SDK and are Apache licensed.
9_0_X: https://github.com/appcelerator/titanium_mobile/pull/11696
FR Passed, waiting on Jenkins build for master and 9_0_X.
merged to master for 9.1.0 target, 9_0_X for 9.0.2 target.
*Closing ticket.* Fix verified in SDK version 9.1.0.v20200506102029 and 9.0.2.v20200511101656 *Test and other information can be found at:* master: https://github.com/appcelerator/titanium_mobile/pull/11690 9_0_X: https://github.com/appcelerator/titanium_mobile/pull/11696