[Interest] QImage::Format_Grayscale8 work working
Jason H
jhihn at gmx.com
Fri Mar 16 15:48:36 CET 2018
Neat! That works! Thanks!!
> Sent: Friday, March 16, 2018 at 10:28 AM
> From: "Nikolai Tasev" <nikolai at nand.bg>
> To: "Jason H" <jhihn at gmx.com>
> Cc: "Interestqt-project.org" <Interest at qt-project.org>
> Subject: Re: [Interest] QImage::Format_Grayscale8 work working
>
> Sorry a typo qRgb(qRed(rgbVal), qRed(rgbVal), qRed(rgbVal)) for setting
> the pixel on the red channel
>
> On 3/16/2018 4:25 PM, Nikolai Tasev wrote:
> > Yes that confirms my suspicions that setPixel for Format_Grayscale8
> > expect different things ( as I wrote in my previous email).
> > You need to pass qRgb(qRed(rgbVal), 0, 0) for red, not qRed(rgbVal).
> >
> > On 3/16/2018 4:09 PM, Jason H wrote:
> >> 5.10.1
> >>
> >> Yes, that's a good idea. So I wrote some code:
> >>
> >> QImage gray8 = color8(image, Qt::gray,
> >> QImage::Format_Grayscale8); // modded my function to take the format.
> >> QImage index = color8(image, Qt::gray, QImage::Format_Indexed8);
> >>
> >> int differences = 0;
> >> int same = 0;
> >> for (int y=0; y < gray8.height(); y++) {
> >> for (int x=0; x < gray8.width(); x++) {
> >> qDebug() << "gray" << gray8.pixel(x,y) << "index" <<
> >> index.pixel(x,y);
> >> if (gray8.pixel(x,y) != index.pixel(x,y) )
> >> differences++;
> >> else
> >> same++;
> >> }
> >> }
> >>
> >> qDebug() << "differences" << differences;
> >> qDebug() << "same" << same;
> >>
> >> With output:
> >> differences 8048393
> >> same 72951
> >>
> >> It seems every pixel from "gray8" is 4278190080 == 0xFF000000.
> >> So it seems that setPixel in my color8 function never sets the pixel.
> >>
> >> I'm thinking this is a bug, unless someone has an idea?
>
>
More information about the Interest
mailing list