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
New Developer
Posts: 7
Registered: ‎11-12-2013
My Device: --
My Carrier: --
Accepted Solution

Painting in BB10

Hello. Im developing  an application which uses onTouch method to trace and get the co-ordinates of the touches. While the user is tracing on the screen, I want to display a colored trail of the trace so that the touch line is displayed. For that I have thought of using the paint module but unable to do so. I have even tried using Qt and QtWidgets but the QPainter class is not identifited in the cascades. 

 

In case of any other way to use paint in the application, or displaying a trail of the touch please notify.

Developer
Posts: 849
Registered: ‎03-03-2011
My Device: Z10

Re: Painting in BB10

A possible way: https://developer.blackberry.com/native/reference/cascades/bb__cascades__foreignwindowcontrol.html?f...
--------------------------------------------------------------------------------------
Leader of Ljubljana BlackBerry Developer Group
BlackBerry Certified Builder for Native Application Development
New Developer
Posts: 7
Registered: ‎11-12-2013
My Device: --
My Carrier: --

Re: Painting in BB10

Is there a way to color the pixel or slightly increase the opacity of the pixels in order to show a trace ? if i simply want to change pixel's color in a particular container, is it possible ?

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Painting in BB10

You say you tried QPainter but you could use this to individually change pixels within a background image.

 

Image also has a way to access pixels...

 

http://developer.blackberry.com/native/reference/cascades/bb__cascades__image.html


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 108
Registered: ‎04-14-2013
My Device: BlackBerry Z30
My Carrier: Chunghwa Telecom

Re: Painting in BB10

Hi

 

The other way maybe your can try the html wrapped in a webview to do the Painting.

Instead of using openGL to make your painting function work...

 

(Tha's how I did in my app, openGL is too hard for me, haha )

 

Simon

BlackBerry Certified Cascades Developer
Highlighted
New Developer
Posts: 7
Registered: ‎11-12-2013
My Device: --
My Carrier: --

Re: Painting in BB10

^ thanks a lot. I have used webview with html5 and javascript function. I am able to use the webview paint on the simulator but on the z10 device it doesn't work. Do i have to include some external functionality to make it work on the touch device ?

Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Painting in BB10

in your html code you need to listen for touch events not mouse click events. (huge difference)

 

http://www.html5rocks.com/en/mobile/touch/

Developer
Posts: 849
Registered: ‎03-03-2011
My Device: Z10

Re: Painting in BB10

Interesting approach Smiley Happy
--------------------------------------------------------------------------------------
Leader of Ljubljana BlackBerry Developer Group
BlackBerry Certified Builder for Native Application Development
New Developer
Posts: 7
Registered: ‎11-12-2013
My Device: --
My Carrier: --

Re: Painting in BB10

Cool. Thanks a lot Smiley Happy

New Developer
Posts: 7
Registered: ‎11-12-2013
My Device: --
My Carrier: --

Re: Painting in BB10

ohk i have resolved the touch paint problem. Is there any way to draw only on restricted area of the touch device. Suppose i want to trace on part of the screen, i have used onTouch and onTouchExit properties of the container in order to restrict the touch. Is there any way else so i can trace along the exact co-ordinates of the screen ?