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
Contributor
cocoalabs
Posts: 11
Registered: ‎05-07-2012
My Device: Blackberry 10 Alpha Device - Blacbkerry 9830

Cascades Custom Painting & Alcoholism

Just joking about the alcoholism.... A couple questions regarding Cascades....

Is there a way to have a custom cascades view object where I use painting techniquest to render my view i.e. stroke, fill, drawPath etc..? So far it seems like all you can do is create a composite component of other prebuilt Cascades components.

 

Secondly is there away to have a view and all of its subviews render to a single in memory image? What i'd love to do is take some ui I created in QML and have some C++ code turn it into a texture for use with opengl so I can add some of my own 3d effects ala Core Animation.

 

All replies greatly appreciated.

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Cascades Custom Painting & Alcoholism

Not a useful answer, but Qt5, which we should have by BB10, supports a "canvas": http://doc-snapshot.qt-project.org/5.0/qml-qtquick2-canvas.html

I have no idea if that will work with Cascades however, or whether it will in effect be part of QtGui and, therefore, not available for Cascades apps.

Good question though...

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Contributor
cocoalabs
Posts: 11
Registered: ‎05-07-2012
My Device: Blackberry 10 Alpha Device - Blacbkerry 9830

Re: Cascades Custom Painting & Alcoholism

From my research, it seems as if you don't really use most of Qt's UI classes, you use the ones in the bb:cascades namespace. The one notable exception would be the WebView. I guess you could always use ForeignWindow to create an OpenGL ES based window to draw contents into it that way. Not as easy as an actually 2D Graphics API/Facade.

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Cascades Custom Painting & Alcoholism

Well, it's definitely true you don't use most of Qt's UI classes...

The Cascades rendering engine is entirely different from those (what with handling all of it in a separate thread, with async message passing to the UI thread), so apparently *none* of the QtGui stuff can be used in a Cascades app. There are BB10 Jam sessions where they discussed this type of thing.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
BlackBerry Development Advisor
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer

Re: Cascades Custom Painting & Alcoholism

Regarding your second question...

 

It's possible you could make your cascades window invisible by either changing transparency or just moving it behind some other window.  There is a screen API to read-back the data from a window, so long as you have a handle to it:

 

https://bdsc.webapps.blackberry.com/native/reference/com.qnx.doc.screen.lib_ref/topic/rscreen_read_w...

 

Whether you can get a handle to the main cascades window or not, I am not sure.  I would hope so :smileyhappy:

 

Cheers,

Sean

Developer
Zingam
Posts: 195
Registered: ‎05-09-2012
My Device: Playbook, Z10 LE

Re: Cascades Custom Painting & Alcoholism

Interesting topics indeed. BTW Qt 5 comes with a 3D package included.

Contributor
cocoalabs
Posts: 11
Registered: ‎05-07-2012
My Device: Blackberry 10 Alpha Device - Blacbkerry 9830

Re: Cascades Custom Painting & Alcoholism

Yes, but we have no reason to beleive we'd have access to that as we don't have access to the standard ui classes now (from within a cascades app)
BlackBerry Development Advisor (Retired)
smacmartin
Posts: 499
Registered: ‎05-07-2012
My Device: developer

Re: Cascades Custom Painting & Alcoholism

Getting back to the original question...

 

Check out the sample helloforeignwindow. This demonstrates using a foreign window to do your drawing.  To share your drawing, your different views can have access to the same pixmaps or other objects.

 

Does this answer your question?

Retired
Suavek
Posts: 10
Registered: ‎07-28-2010
My Device: All

Re: Cascades Custom Painting & Alcoholism

Hi,

 

At this point you don't have anything equivalent to a Canvas in Cascades. This means you can't perform operations like drawPath etc... Also, you can't use Qt UI and Cascades at the same time. If you want to draw an object, you could create your own custom Cascades component and scale/animate that. Alternatively, the WebView/Canvas will support drawing on top of Web Content - but that probably doesn't solve your problem. Of course, as was mentioned before, you can draw in the OpenGL window (though it looks like that wasn't your question either).

 

 

Developer
blackqtcoder
Posts: 146
Registered: ‎05-18-2012
My Device: PlayBook & STL100-1 LE Z10 & Dev Alpha C

Re: Cascades Custom Painting & Alcoholism

I agree with you. The presence of a custom painter library on view/scene easy framework in cascades is an important thing for many developers. QtGui have classes like QGraphicsView, QGraphicsScene and QGraphicsItem that make easier our life. OpenGl is like kill flyers with gunshots!!

 

A canvas and QPainter mechanism is required on Cascades, please.

---------------------------------------------------------------
Leandro Cerdan - Duantox Apps
BlackBerry Elite dev
TapyHold, Built for Blackberry multimedia scrapbook