Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Developer
Posts: 610
Registered: ‎10-17-2010
My Device: (BlackBerry Z10)-> Q10/Passport Dual Use
Accepted Solution

ImageView Black screen Issue on DA - Anomaly or Something else?

Hello friends,

 

I'm developing a connected local transit application. Basically part of it includes maps for each bus line. I am using ImageView nested inside a ScrollPane. Many of the maps are greater than 1280 and 768 in dimension.

 

 

Issue

 

ScrollPane ImageView displays BLACK on some images, but not others. I cannot figure out why and how to fix



My Application Setup

  1. Standard C++/Cascades Project 
  2. Directory Structure
    [Standard Empty Project Template]
  3. + assets
       - main.qml 
       
    import bb.cascades 1.0
    
    //-- create one page with a label and text
    
    Page {
        content: Container {
            layout: DockLayout {
            }
            background: Color.create("#FFFFFF")
            preferredWidth: 768
            preferredHeight: 1280
            ScrollView {
                id: mapScroll
                scrollViewProperties {
                    scrollMode: ScrollMode.Both
                }
                // This ImageView Appears Black on the DA - qml preview in IDE ok
                /*ImageView {
                    id: m45ustock
                    preferredWidth: 2913
                    preferredHeight: 2283
                    imageSource: "asset:///images/m45ustock.png"
                    onTouch: {
                        mapScroll.scrollViewProperties.scrollMode = ScrollMode.Both
                    }
                }
                */
                // THIS ImageView DISPLAYS CORRECTLY
                 ImageView {
                    id: m10town
                    preferredWidth: 1287
                    preferredHeight: 1631
                    imageSource: "asset:///images/m10townsend.png"
                    onTouch: {
                        mapScroll.scrollViewProperties.scrollMode = ScrollMode.Both
                    }
                }
            }
        }
    }


    Create new folder "images" add attached images. 

    - images
         - m10townsend.png
         - m45ustock.png

     

    Notes


    I have commented out the ImageView that displays BLACK. Toggle the comments to test.

     

     

    Why Is This Happening?

    Ideas? Is this a bug? Are there any limitations on the ImageView in terms of file size, rendering dimensions, etc? 



    Thank you! 

 

Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: ImageView Black screen Issue on DA - Anomaly or Something else?

I suspect you are exceeding a limit.

 

2,913px × 2,283px (scaled to 1,172px × 919px)

 

I found this:  http://supportforums.blackberry.com/t5/Cascades-Development/ImageView-cascades-noob-question/m-p/170...

 

Stuart

Developer
Posts: 610
Registered: ‎10-17-2010
My Device: (BlackBerry Z10)-> Q10/Passport Dual Use

Re: ImageView Black screen Issue on DA - Anomaly or Something else?

Do you have suggestions on how to get the images into a readable size?

 

My thoughts...

 

  1. Reduce ratio (this will decrease image content - not ideal, map legibility small)
  2. Scale image down into view, but add custom control for zooming when image tapped
  3. Something else?

Is anyone else running into similar application design dilemmas? How are you addressing them?

 

 

 

 

 

Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: ImageView Black screen Issue on DA - Anomaly or Something else?

Did you get anywhere on this?

If you need to do this programmatically, one way is to use http://supportforums.blackberry.com/t5/Cascades-Development-Knowledge/Using-QImage-and-QPainter-to-P...

 

Was this the root cause of your issue?

 

Stuart

Developer
Posts: 610
Registered: ‎10-17-2010
My Device: (BlackBerry Z10)-> Q10/Passport Dual Use

Re: ImageView Black screen Issue on DA - Anomaly or Something else?

I guess I will just have to make the image dimensions smaller. There was another suggestion in the forum that I could slice up the image and create multiple Scrollable image views. That works too.

 

I will mark this thread resolves. This is sort of low-priority in the grand scheme of things.

 

Thank you.