Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7499] Android: UI.View - toImage method returns transparent backgroundImage as fully opaque

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-09-13T02:48:12.000+0000
Affected Version/sRelease 1.8.1
Fix Version/sSprint 2012-17 Core, Release 3.0.0
ComponentsAndroid
Labelscore, module_view, parity, qe-review, qe-testadded
ReporterBrice Lechatellier
AssigneeOpie Cyrus
Created2011-11-14T18:27:34.000+0000
Updated2012-09-13T02:48:12.000+0000

Description

Problem

Alpha channel is black opaque when using toImage() when it should be transparent. Same behavior the view is set with backgroundColor: 'transparent'. The background works as expected on iOS, ie it is transparent.

Test case

See attached screenshot for results.
Ti.UI.backgroundColor = 'yellow';
var win = Ti.UI.createWindow();

// the same issue exists when using an imageView here rather than a View
var view = Ti.UI.createView({
  backgroundColor:'transparent',
  backgroundImage: 'alpha.png',
  top: 50,
  width: 300,
  height: 300
});
win.add(view);

var blob = view.toImage();
var rendered = Ti.UI.createImageView({
  backgroundColor:'transparent',
  image: blob,
  top: 200,
  width: 300,
  height: 300
});

win.add(rendered);
win.open();

Discussions

Q&A: [android - toimage no transparency](http://developer.appcelerator.com/question/127966/android---toimage-no-transparency)

Attachments

FileDateSize
alpha.png2012-01-05T14:24:30.000+00004511
screenshot_485.png2012-02-01T12:22:34.000+000019010

Comments

  1. Paul Dowsett 2012-01-05

    Brice So that I may escalate this ticket, would you please provide the missing info to the environment field (in accordance with [JIRA Ticket Checklist](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist)), and attach the alpha.png image? Many thanks
  2. Brice Lechatellier 2012-01-05

    Thanks Paul, the alpha.png image is attached. The Android SDK version is 2.3.4.
  3. Paul Dowsett 2012-01-05

    Brice, I need to test this before moving it across. However, some suggestions: * have you tried this with 1.8.0.1? Is there any reason why you are not using this version? * with the view variable, rather than using a Titanium View object, try an imageView and with an image property rather than backgroundImage Let me know how you get on with this. Cheers
  4. Sasa Savic 2012-01-27

    Any updates? any time frame as to when this will be resolved?
  5. Sasa Savic 2012-05-08

    Can someone put a priority on this bug please; it has been opened up last november and still has not been fixed. I really need this to be fixed soon
  6. Opie Cyrus 2012-08-19

    PR opened: https://github.com/appcelerator/titanium_mobile/pull/2780
  7. Anshu Mittal 2012-08-28

    Verified on: SDK:2.2.0.v20120827143312 Studio:2.1.2.201208201549 Devices: Android Emulator,LG-P970(v 2.2.2) toImage method returns transparent backgroundImage as fully transparent.
  8. Anshu Mittal 2012-09-13

    Reopening to update labels

JSON Source