Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16245] Android: Ti.UI.ImageView.toImage() returns KrollDict object instead of Blob object

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
Reportergrebulon
AssigneeUnknown
Created2014-01-19T10:46:51.000+0000
Updated2019-10-27T20:50:54.000+0000

Description

ImageView.toImage() is supposed to return a TiBlob according to the doc, but it returns a KrollDict, where the blob is in the media key. This is implemented in the TiUIView superclass, which calls TiUIHelper.viewToImage. TiUIImageView should override toImage and return a TiBlob, or you can just change the documentation...

Comments

  1. Ritu Agrawal 2014-01-20

    Moving this ticket to engineering as I verified that Ti.UI.ImageView does not implement toImage method but inherits it.
  2. Rainer Schleevoigt 2019-10-27

    In a native module I tried:
       KrollDict imageBlob = TiUIHelper.viewToImage(proxy.getProperties(), myScrollView.getOuterView());
       Object data = imageBlob.get("media");
       byte[] byteArray =  (byte[])data;  // this creashes (cannot cast blob to byte array)
       Bitmap bitmap = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
       
    How can I use a toImage() for BitmapFactory?

JSON Source