private void CalcRGBWord() { int nIndex = 0; m_nRGBWordBits[nIndex++] = 0; int cBlue = m_subpalette.Blue(); m_nRGBWordBits[nIndex++] = (cBlue & 0x10) == 0x10 ? 1 : 0; m_nRGBWordBits[nIndex++] = (cBlue & 0x08) == 0x08 ? 1 : 0; m_nRGBWordBits[nIndex++] = (cBlue & 0x04) == 0x04 ? 1 : 0; m_nRGBWordBits[nIndex++] = (cBlue & 0x02) == 0x02 ? 1 : 0; m_nRGBWordBits[nIndex++] = (cBlue & 0x01) == 0x01 ? 1 : 0; int cGreen = m_subpalette.Green(); m_nRGBWordBits[nIndex++] = (cGreen & 0x10) == 0x10 ? 1 : 0; m_nRGBWordBits[nIndex++] = (cGreen & 0x08) == 0x08 ? 1 : 0; m_nRGBWordBits[nIndex++] = (cGreen & 0x04) == 0x04 ? 1 : 0; m_nRGBWordBits[nIndex++] = (cGreen & 0x02) == 0x02 ? 1 : 0; m_nRGBWordBits[nIndex++] = (cGreen & 0x01) == 0x01 ? 1 : 0; int cRed = m_subpalette.Red(); m_nRGBWordBits[nIndex++] = (cRed & 0x10) == 0x10 ? 1 : 0; m_nRGBWordBits[nIndex++] = (cRed & 0x08) == 0x08 ? 1 : 0; m_nRGBWordBits[nIndex++] = (cRed & 0x04) == 0x04 ? 1 : 0; m_nRGBWordBits[nIndex++] = (cRed & 0x02) == 0x02 ? 1 : 0; m_nRGBWordBits[nIndex++] = (cRed & 0x01) == 0x01 ? 1 : 0; }
public void Copy(Subpalette pal) { for (int i = 0; i < k_nColors; i++) { UpdateColor(i, pal.Red(i), pal.Green(i), pal.Blue(i)); } RecordSnapshot(); }
/// <summary> /// Get the pixel at the given (x,y) coord. /// Assumes that x,y are valid pixel coords. /// </summary> /// <returns>The rgb color value of the specified pixel</returns> public Color GetPixelColor(int pxX, int pxY) { Subpalette p = m_sprite.Subpalette; int nIndex = m_data.pixels[pxX, pxY]; int cRed = p.Red(nIndex); int cGreen = p.Green(nIndex); int cBlue = p.Blue(nIndex); return(Color.FromArgb(cRed * 8, cGreen * 8, cBlue * 8)); }
private void UpdateColorScrollbars() { // Record the RGB values because once we start updating the scrollbars, // sbColor_ValueChanged will be called which will write the scrollbar // values (all 3) into the palette. int r = m_subpalette.Red(); int g = m_subpalette.Green(); int b = m_subpalette.Blue(); sbRed.Value = r; sbGreen.Value = g; sbBlue.Value = b; }
public void Copy(Subpalette pal) { for (int i = 0; i < k_nColors; i++) UpdateColor(i, pal.Red(i), pal.Green(i), pal.Blue(i)); RecordSnapshot(); }