Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12593] iOS: Caps not working for View/ImageView

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-02-27T19:18:15.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sRelease 3.1.0, 2013 Sprint 05 API, 2013 Sprint 05
ComponentsiOS
LabelsiOS, module_imageview, module_views, qe-testadded
ReporterVarun Joshi
AssigneeVishal Duggal
Created2013-02-05T18:45:54.000+0000
Updated2014-06-19T12:43:16.000+0000

Description

Issue

Using backgroundLeftCaps and backgroundTopCaps on views/imageviews does not have the same effect as the button. The image in imageview/view interpolates/blends the stretched region unlike a button image.

Steps to Reproduce

1. Run the sample code here: http://pastie.org/private/h9rbm8ky381wvtob04ghww Copy the attached image "testimage.png" to Resources folder. 2. Notice the output in the screenshot attached. The button version at the top is correct, it only shows the pixels we want and it does not do any interpolation. However the view and imageview with the same "caps" data, blends/interpolates the stretched region.

Expected Output

The imageview/view should look the same as a button.

Attachments

FileDateSize
Screen Shot 2013-02-05 at 10.41.25 AM.png2013-02-05T18:45:54.000+000098681
testimage.png2013-02-05T18:45:54.000+00001357

Comments

  1. Vishal Duggal 2013-02-22

    Test Case
       var win = Ti.UI.createWindow({
         backgroundColor: 'white'
       })
       
       var scroll = Ti.UI.createScrollView({
         layout: 'vertical'
       })
       win.add(scroll)
       
       scroll.add(createTest(20, 20, 'button'))
       scroll.add(createTest(20, 20, 'view'))
       scroll.add(createTest(20, 20, 'imageview'))
       
       win.open()
       
       
       function createTest(left, top, type) {
         var img = 'testimage.png'
         
         var view = Ti.UI.createView({
           layout: 'horizontal',
           width: 300,
           height: 100,
           top: 10
         })  
         
         switch (type) {
         case 'button':
           var sub = Ti.UI.createButton({
             backgroundImage: img,
             width: 100,
             height: 100,
             backgroundLeftCap: left,
             backgroundTopCap: top
           })    
           view.add(sub)
           break
         case 'view':
           var sub = Ti.UI.createView({
             backgroundImage: img,
             width: 100,
             height: 100,
             backgroundLeftCap: left,
             backgroundTopCap: top
           })
           view.add(sub)
           break
         case 'imageview':
           var sub = Ti.UI.createImageView({
             backgroundImage: img,
             width: 100,
             height: 100,
             backgroundLeftCap: left,
             backgroundTopCap: top
           })
           view.add(sub)
           break
         }
         
         var label = Ti.UI.createLabel({
           left: 5,
           text: 'left:' + left + ' top:' + top + ' ' + type  
         })
         view.add(label)
         
         return view
       }
       
  2. Vishal Duggal 2013-02-22

    Pull pending against master https://github.com/appcelerator/titanium_mobile/pull/3898
  3. Olga Romero 2013-03-08

    Verified fix with: Titanium Studio, build: 3.0.2.201302191606 Titanium Studio, build: 3.1.0.v20130306185542 Devices: iPad mini iOS 6.0 iPhone5 iOS 6.1.2
  4. Trevor Borgmeier 2013-04-25

JSON Source