Multiline wrapping text in a newScrollView with a mask

Brent, I reviewed the documentation again and can’t see any indication that scrollView will not support dynamic mask application post-creation using scrollView:setMask(mask). Can you kindly confirm if this is the case?

Dynamic mask creation and application is very important to be able to cope with the ever increasing Android display variation so it would be wonderful if this capability is supported. Thanks

Hi Kerem,

It may seem like this is possible, but I checked into it further and it probably wouldn’t work. The widget “unit” itself is sort of a compilation of several elements, so you’d have to access lower-level aspects of it (private variables) to target the group and apply a mask to it. You probably  can  do this with some extra effort, especially if you dig into the open-source code and figure out how to pinpoint that… but simply saying “myScrollView:setMask()” probably isn’t going to work, sorry.  :frowning:

 

Take care,

Brent

Hi Brent, 

Thanks for confirming this ‘shortcoming’. I am still hopeful the whole dynamic masking issue will be addressed in a neat manner in the near future… With the graphics 2.0 in the making I hope this key challenge is being considered. It will make life easier for many app developers. game or business app alike. 

Best regards,

Kerem

Hi alexfx,
I wrote a very similar function to the getMask function you have in your example but I’ve been having difficulties with this when running my app on different devices with different content scaling. In my case this seems to be because display.save() creates an image that is too big. ie on iphone 4 it’s 640px wide rather than 320px wide and the mask just appears to do nothing because it’s  bigger than the screen. 

This is what it says in the docs for display.save()

NOTE:  When dynamic content scaling is enabled, display.save() saves the image in the device’s native resolution. For instance, if this method is used to save a 100 x 200 pixel display object, it will be saved as a 100 x 200 image on iPhone3 but it will be a 200 x 400 image on an iPhone4 (which would have the same content dimensions but more actual pixels). This is assuming that the config.lua file specifies the content width/height as 320x480 respectively.

Do you have any suggestions for this?

Hi Julius, take a look at my solution. Uses a different approach : http://developer.coronalabs.com/code/runtime-bitmap-maskfile-creation

Server created maskfiles downloaded at runtime and saved in Documents directory. Hope this works for you. Cheers