private void UpdatePixels(ZXChar chr) { for (int y = chr.Area.Y; y < chr.Area.Bottom; y++) { for (int x = chr.Area.X; x < chr.Area.Right; x++) { if (pixels.GetPixel(x, y).A != 0) { pixels.SetPixel(x, y, chr.Attribute.RGBInk); } } } }
private void CheckAttribute(ZXChar Chr) { if (Chr == null) { return; } bool updatePixels = false; if (Mode == SpeccyDrawControlMode.Ink || Mode == SpeccyDrawControlMode.InkPaper) { if (Chr.Attribute.Ink != ActiveAttribute.Ink || Chr.Attribute.Bright != ActiveAttribute.Bright) { Chr.Attribute.Ink = ActiveAttribute.Ink; Chr.Attribute.Bright = ActiveAttribute.Bright; updatePixels = true; } } if (Mode == SpeccyDrawControlMode.Paper || Mode == SpeccyDrawControlMode.InkPaper) { if (Chr.Attribute.Paper != ActiveAttribute.Paper || Chr.Attribute.Bright != ActiveAttribute.Bright) { if (Chr.Attribute.Bright != ActiveAttribute.Bright) { updatePixels = true; } Chr.Attribute.Paper = ActiveAttribute.Paper; Chr.Attribute.Bright = ActiveAttribute.Bright; } } if (updatePixels) { UpdatePixels(Chr); } Invalidate(); }
public void Cleanup() { for (int x = 0; x < 32; x++) { for (int y = 0; y < 24; y++) { chars[x, y] = new ZXChar(x, y); } } if (pixels != null) { pixels.Dispose(); } pixels = new Bitmap(256, 192, System.Drawing.Imaging.PixelFormat.Format32bppArgb); Graphics g = Graphics.FromImage(pixels); g.Clear(Color.Transparent); g.Dispose(); drawBox.Image = pixels; foreach (var state in undo) { state.Dispose(); } foreach (var state in redo) { state.Dispose(); } undo.Clear(); redo.Clear(); actions.Clear(); Invalidate(); }
private bool DeletePixels(ZXChar chrD) { if (chrD == null) { return(false); } bool didClear = false; for (int y = chrD.Area.Y; y < chrD.Area.Bottom; y++) { for (int x = chrD.Area.X; x < chrD.Area.Right; x++) { if (pixels.GetPixel(x, y).A != 0) { pixels.SetPixel(x, y, Color.Transparent); didClear = true; } } } return(didClear); }