bunjee
19th September 2008, 14:59
Hi,
I'm replacing pixels in a QImage using that code :
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
int alpha = qAlpha(image.pixel(j, i));
if (alpha > 0)
{
image.setPixel(j, i,
qRgba(color.red(),
color.green(),
color.blue(),
alpha));
}
}
}
q->QPixmap::operator=(QPixmap::fromImage(image));
My image file is a PNG file.
For some reason, everytime I replace a "transparent" pixel. The pixel goes black instead of the choosen color. Plain pixels are replaced fine.
Any idea ?
I'm replacing pixels in a QImage using that code :
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
int alpha = qAlpha(image.pixel(j, i));
if (alpha > 0)
{
image.setPixel(j, i,
qRgba(color.red(),
color.green(),
color.blue(),
alpha));
}
}
}
q->QPixmap::operator=(QPixmap::fromImage(image));
My image file is a PNG file.
For some reason, everytime I replace a "transparent" pixel. The pixel goes black instead of the choosen color. Plain pixels are replaced fine.
Any idea ?