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
pmpascua
Posts: 11
Registered: ‎02-21-2013
My Device: BB10

How to write text on image

Hi, Im having trouble figuring out a way to write a text, more specifically 1 character, on an image, either through QImage or a cascade Image. I have tried the following but all failed

  • Using the QPainter::drawText() on a QImage to draw a text but it has been reported to crash everytime its called
  • Using existing image as an asset but its memory extensive as any language could have a thousand characters/ligatures
  • Labels, hmm could be but theres no way to style the text to be more.. outlined. Plus, i need an image to compare with other images, if possible

Any hints, advice or even a link for a sample code would be appreciated. Thanks in advance

Please use plain text.
Developer
javayoung
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900

Re: How to write text on image

Have you tried with this one? :0)

 

http://developer.blackberry.com/cascades/documentation/ui/custom_components/custom_components_tutori...




p(^_^)q
Good good study, day day up
Please use plain text.
Contributor
pmpascua
Posts: 11
Registered: ‎02-21-2013
My Device: BB10

Re: How to write text on image

I forgot to mention that this process should be done on C++ instead of QML
Please use plain text.
Developer
javayoung
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900

Re: How to write text on image

[ Edited ]

I don't think that there is big difference between QML and C++. You can do the similar thing by C++ based on that sample. Ok. I got what you mean. You just want to get a set of updated images with text. It is similar with the topic how to add watermark on image by QT




p(^_^)q
Good good study, day day up
Please use plain text.
Developer
smiley
Posts: 1,473
Registered: ‎07-14-2008
My Device: Z10

Re: How to write text on image

If you find a solution let me know.

 

If you search the forum you will find out why there isn't a solution.

 

the QT framework has the method to write text the image but it is not implementing on BB10 QT version.  Go figure.

 

I a submit a bug report and got a reply saying QT gui is not supported.  I asked then why have the api if it doesn't work.

 

This is just another set back.  50% of apis are still missing and still waiting for BB to release them like Phone, background, call log, profiles etc...

Please use plain text.
Developer
javayoung
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900

Re: How to write text on image

Yes, I agree. QT is not equlas with BlackBerry QT.




p(^_^)q
Good good study, day day up
Please use plain text.
Developer
javayoung
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900

Re: How to write text on image

Maybe you should better temporarily use QML to do this feature until it is possible by BlackBerry QT.




p(^_^)q
Good good study, day day up
Please use plain text.
Developer
smiley
Posts: 1,473
Registered: ‎07-14-2008
My Device: Z10

Re: How to write text on image

is the link for the sample app you mention from above link here?

 

http://developer.blackberry.com/cascades/documentation/ui/custom_components/custom_components_tutori...

 

 

Please use plain text.
Developer
javayoung
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900

Re: How to write text on image

Yes, but I think that he want to realize the features like adding watermark in the background.




p(^_^)q
Good good study, day day up
Please use plain text.
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: How to write text on image

Qt used in BB10 is original unmodified Qt distribution. Cascades is a framework on top of Qt. I compiled and runned native Qt apps and they were working fine. :smileyhappy:

 

drawText() crashes because QApplication instance is not initialized and drawText relies on it. 

 

But QApplication seems to conflict with Cascades Application class so the following does not work:

 

Q_DECL_EXPORT int main(int argc, char** argv)
{
  QApplication qtApp(argc, argv);

 It might work if created in different thread but I haven't tried that yet.

 


Andrey Fidrya, @zmeyc on twitter
Please use plain text.