public bool LoadXML_palette256(XmlNode xnode) { short nColors = 0; foreach (XmlNode xn in xnode.ChildNodes) { if (xn.Name == "color") { string strRGB = XMLUtils.GetXMLAttribute(xn, "rgb"); int nRGB; if (!Palette.ParseRGBColorValue(strRGB, out nRGB)) { m_doc.ErrorString("Unable to parse color value '{0}' in palette '{1}'.", strRGB, Name); return(false); } Color c = Color555.CalcColor(nRGB); if (nColors < 256) { m_mapId2Color.Add(nColors, c); } nColors++; } } if (nColors != 256) { m_doc.ErrorString("Incorrect number of colors in background image palette"); return(false); } return(true); }
public void UpdateColor(int nIndex, int cRed, int cGreen, int cBlue) { m_data.cRed[nIndex] = cRed; m_data.cGreen[nIndex] = cGreen; m_data.cBlue[nIndex] = cBlue; if (m_Brush[nIndex] != null) { m_Brush[nIndex].Dispose(); } m_Brush[nIndex] = new SolidBrush(Color555.CalcColor(cRed, cGreen, cBlue)); }