- bool isNone;
- if ( !GetRGBFromName(clr_def, &isNone,
- &clr_data->R, &clr_data->G, &clr_data->B) )
- {
- wxLogError(_("XPM: malformed colour definition '%s'!"), xpm_data[1+i]);
- clr_data->R = 255, clr_data->G = 0, clr_data->B = 255;
- }
- else
+ wxLogError(_("XPM: malformed colour definition '%s' at line %d!"),
+ xmpColLine, (int)(1 + i));
+ return wxNullImage;
+ }
+
+ if ( isNone )
+ {
+ img.SetMask(true);
+ img.SetMaskColour(255, 0, 255);
+ clr_data.R =
+ clr_data.B = 255;
+ clr_data.G = 0;
+ hasMask = true;
+ maskKey = key;
+ }
+
+ clr_tbl[key] = clr_data;
+ }
+
+ /*
+ * Modify colour entries with RGB = (255,0,255) to (255,0,254) if
+ * mask colour is present (so that existing pixels with (255,0,255)
+ * magenta colour are not incorrectly made transparent):
+ */
+ if (hasMask)
+ {
+ for (it = clr_tbl.begin(); it != clr_tbl.end(); ++it)
+ {
+ if (it->second.R == 255 && it->second.G == 0 &&
+ it->second.B == 255 &&
+ it->first != maskKey)