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

Posts: 18
Registered: ‎08-26-2012
My Device: Z10
My Carrier: Personal

mask imageview

I want to use a circular mask my imageview. this mask does not affect the images but only show them when you change.
Posts: 613
Registered: ‎10-17-2010
My Device: (BlackBerry Z10)-> Q10/Passport Dual Use

Re: mask imageview

BUMP. Trying to do this now. Found this thread. Anyone have an answer?

Posts: 16
Registered: ‎02-08-2011
My Device: BlackBerry Z10
My Carrier: Rogers

Re: mask imageview

[ Edited ]

There may be a better way of doing it but I achieved a mask effect with some code in C++. I used the QPainter class to create a polygon (in your case you can use it to draw a circle). I then set up a QPainterPath based on my shape and use it to set a "clip region" on the QPainter object. I then load the image I want to be masked, and use the drawImage method of QPainter to draw the image inside of that clip region. Then, you will need to convert your QImage to a bb::cascades::Image. There are already threads here on how to do that. Once you have your bb::cascades::Image, you can pop it in an ImageView. 


I hope that makes sense and is what you're looking for

Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: mask imageview

I used an additional mask image and modified the pixels in C++


see here: http://supportforums.blackberry.com/t5/Native-Development/Crop-image-into-certain-shape/m-p/2652731/...

I'm a bird from outer space. But I'm not flappy o.o