[Xastir-dev] GraphicsMagick QuantumDepth issue.
Tom Russo
russo at bogodyn.org
Sun Apr 26 11:10:16 EDT 2009
Folks:
Lately we're getting more and more emails about black map images due to
the changed default setting of QuantumDepth in GraphicsMagick.
Clearly, our raster rendering code has a bug that can't deal with QuantumDepth
other than 16. It's probably time for someone to fix it, but I can't volunteer
because I don't know what the issue is.
Anyone know what the default QuantumDepth in GraphicsMagick is now?
I have been looking at the code in Xastir that depends on QuantumDepth and
it is puzzling. It is very old code, pre-dates the initial import of Xastir
into Sourceforge's CVS in 2002.
Here's a relevant section:
if (QuantumDepth == 16) { // Defined in /usr/include/magick/image.h
if (debug_level & 512)
fprintf(stderr,"Color quantum is [0..65535]\n");
my_colors[l].red = temp_pack.red * raster_map_intensity;
my_colors[l].green = temp_pack.green * raster_map_intensity;
my_colors[l].blue = temp_pack.blue * raster_map_intensity;
}
else { // QuantumDepth = 8
if (debug_level & 512)
fprintf(stderr,"Color quantum is [0..255]\n");
my_colors[l].red = (temp_pack.red << 8) * raster_map_intensity;
my_colors[l].green = (temp_pack.green << 8) * raster_map_intensity;
my_colors[l].blue = (temp_pack.blue << 8) * raster_map_intensity;
}
Here, we assume that if QuantumDepth isn't 16, it must be 8, and shift the
low-order byte of the pixel color into the high byte, then use that. Presumably
that's because we need the value in the high bits for the Xcolor (my_colors),
but I don't grok that (another reason why I don't volunteer to fix it).
Clearly it's this code that's causing the issue, because for the new default
QuantumDepth value in GraphicsMagick, we're getting black out of it. Anyone
able to see what's wrong?
--
Tom Russo KM5VY SAR502 DM64ux http://www.swcp.com/~russo/
Tijeras, NM QRPL#1592 K2#398 SOC#236 http://kevan.org/brain.cgi?DDTNM
In some cultures what I do would be considered normal.
-- Ineffective daily affirmation
More information about the Xastir-dev
mailing list