I've noticed on my system (64-bit Qt 4.7) the rendering of colored note
heads is pretty rough in the raster-graphics mode. No problem in the
native mode, though. The issue involves the alpha channel.
The image of a colored note head is carved out of a solid, filled-in
rectangle of color pixels by the action of an alpha channel that has been
retrieved from an original black image. But in this context the alpha
channel seems to be inverting color hues rather than simply adjusting
pixel transparency. The result is ragged, multicolored halos of pixel
debris surrounding the note heads.
1. In the raster (fast) graphics mode, open a piece using the notation
editor.
2. If no colored notes are present, create some by selecting ordinary
black notes.
3. Use the zoom wheel in the lower-right corner to zoom in on a colored
note.
4. Any problem should be obvious.
I've come up with a workaround that solves the problem, at least on my
platform. It appears compatible with both native and raster graphics.
I suspect I'm hacking around some Qt4 bugginess here, so I don't know how
this will play out on different setups using different revisions.
Tim Munro
--- src/gui/general/PixmapFunctions.cpp 2013-01-07 13:43:42.000000000 -0800
+++ src/gui/general/PixmapFunctions.cpp 2013-04-11 04:19:40.468789434 -0700
@@ -87,8 +87,9 @@
QImage image = map.toImage();
+// This function has become obsolete and is no longer needed here anyway.
// save a copy of the original alpha channel
- QImage alpha = image.alphaChannel();
+// QImage alpha = image.alphaChannel();
int s, v;
@@ -99,7 +100,11 @@
for (int x = 0; x < image.width(); ++x) {
QRgb oldPixel = image.pixel(x, y);
- QColor oldColour(oldPixel);
+ QColor oldColour(oldPixel); // This doesn't seem to pick up the
alpha channel.
+
+ // Explicitly set the alpha channel, making it a little stronger
so that
+ // colored note heads won't appear smaller than ordinary black
ones.
+ oldColour.setAlpha(int(qAlpha(oldPixel) * 1.5) > 255 ? 255 :
int(qAlpha(oldPixel) * 1.5));
int oldHue;
oldColour.getHsv(&oldHue, &s, &v);
@@ -127,20 +132,33 @@
newSaturation,
v > minimum ? v : minimum);
- QRgb newPixel = qRgba(newColour.red(),
- newColour.green(),
- newColour.blue(),
- qAlpha(oldPixel));
+// QRgb newPixel = qRgba(newColour.red(),
+// newColour.green(),
+// newColour.blue(),
+// qAlpha(oldPixel));
+
+ // For some reason, while in the raster-graphics mode, the alpha
channel
+ // inverts the hues, rather than simply controlling pixel
transparency.
+ //
+ // One way around the problem seems to be to modulate the
individual
+ // color components with the alpha channel, in addition to
applying the
+ // alpha channel in the usual way.
+ QRgb newPixel = qRgba(int(newColour.red() * oldColour.alphaF()),
+ int(newColour.green() * oldColour.alphaF()),
+ int(newColour.blue() * oldColour.alphaF()),
+ oldColour.alpha());
image.setPixel(x, y, newPixel);
}
}
+// This function has become obsolete and is no longer needed here anyway.
// restore the original alpha channel
- image.setAlphaChannel(alpha);
+// image.setAlphaChannel(alpha);
QPixmap rmap = QPixmap::fromImage(image);
- if (!map.mask().isNull()) rmap.setMask(map.mask());
+// This function is no longer needed here.
+// if (!map.mask().isNull()) rmap.setMask(map.mask());
return rmap;
}
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel