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
Regular Contributor
Posts: 76
Registered: ‎07-31-2012
My Device: Blackberry
My Carrier: Vodafone
Accepted Solution

Missing PixelBufferData class

I guess PixelBufferData class has been removed or replaced in beta 3 sdk. Even the sample application QImageScratchPad exploring this class has been removed:

https://github.com/blackberry/Cascades-Samples/tree/master/QImageScratchPad

 

I had to display pretty large images on ImageViews in a listview, so I used this class to paint images. Has it been replaced by any other class ?

 

Is there any other way to display large images on ImageView apart from this?

Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: Missing PixelBufferData class

It was replaced by bb::ImageData which is in bb/core

Like all of my posts
Highlighted
Regular Contributor
Posts: 76
Registered: ‎07-31-2012
My Device: Blackberry
My Carrier: Vodafone

Re: Missing PixelBufferData class

Thanx kylefowler, it worked for me.

 

I just used method given in the documentation of ImageData & it worked fine:

 

bb::ImageData CascadeImagePainter::fromQImage(const QImage &qImage) {
bb::ImageData imageData(bb::PixelFormat::RGBA_Premultiplied, qImage.width(),
qImage.height());

unsigned char *dstLine = imageData.pixels();
for (int y = 0; y < imageData.height(); y++) {
unsigned char * dst = dstLine;
for (int x = 0; x < imageData.width(); x++) {
QRgb srcPixel = qImage.pixel(x, y);
*dst++ = qRed(srcPixel);
*dst++ = qGreen(srcPixel);
*dst++ = qBlue(srcPixel);
*dst++ = qAlpha(srcPixel);
}
dstLine += imageData.bytesPerLine();
}

return imageData;
}

 

& I passed returned object to set Image on Cascade ImageView like this:

 

imageView->setImage(fromQImage(qImage));