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
GeilPMagico
Posts: 17
Registered: ‎11-08-2012
My Device: Z10 Limited Edition

QPainer Container on Image

Hi,
I am having difficulty using QPainter to overlay a Container on an Image, you can run this overlap?

 

In addition, since they are able to overlay two images I tried to see if it was possible with QPainter to print to a local file of the Container, but without results.

 

I know that with version 10.2 was introduced class ScreenShot but I'm trying to avoid it.

Developer
Hithredin
Posts: 404
Registered: ‎06-03-2010
My Device: Z10 Red

Re: QPainer Container on Image

I'm not sure of what you want.

But as QPainter draw on a ImageView, it's not a problem to overlay a container on it within a DockLayout.

 

What do you mean by "to print to a local file of the Container" ?

New Developer
GeilPMagico
Posts: 17
Registered: ‎11-08-2012
My Device: Z10 Limited Edition

Re: QPainer Container on Image

Hi Hithredin,

 

I'm sorry for my english, I'm using Google Translate.
The correct sentence is:
In addition, since they are able to overlay two images I tried to see if it was possible with QPrinter print the Container in a local file, but to no avail.

Through QPainter I want to paint a Container on an existing image.

Would it be possible to have a link to an example that refers to cases of this kind?

Developer
Hithredin
Posts: 404
Registered: ‎06-03-2010
My Device: Z10 Red

Re: QPainer Container on Image

QPrinter does not seems to be supported by BlackBerry. Why don't you want to use Screenshot instead?

 

 

About QPainter, this worked for me to draw a circle:

 

QImage image(QSize(100, 100), QImage::Format_ARGB32_Premultiplied);
image.fill(QColor(0,0,0,50));
QPainter painter(&image);
painter.setPen(Qt::yellow);
painter.drawEllipse(50, 30, 30, 30);

ImageData pxBuffer = ImageData::fromPixels(image.rgbSwapped().bits(),
                              bb::PixelFormat::RGBA_Premultiplied,
                              image.width(),
                              image.height(),
                              image.bytesPerLine());
Image bb10image = Image(pxBuffer);
imageView->setImage(bb10image);

 

 

New Developer
GeilPMagico
Posts: 17
Registered: ‎11-08-2012
My Device: Z10 Limited Edition

Re: QPainer Container on Image

I do not want to use because ScreenShot will be supported by 10.2 and there are no reports its actual release date. QPainter provides methods to add points, lines, circles, squares, text, images, etc. ... but as I understand it does not allow to draw other objects, right? Should I then turn to the Container in Image