private void Render(bool renderEffects = false) { Playground.AlphaComposite(Original, new TextureBitmap.Color(255, 255, 255, 10)); if (renderEffects) { Playground.SetPixel(FoodPosition.X, FoodPosition.Y, new TextureBitmap.Color(255, 255, 255, 255)); } else { Playground.SetPixel(FoodPosition.X, FoodPosition.Y, CurrentFoodColor); } for (int i = 0; i < Points.Count; i++) { if (renderEffects) { Original.SetPixel(Points[i].X, Points[i].Y, Original.GetPixel(Points[i].X, Points[i].Y).AlphaComposite(new TextureBitmap.Color(CurrentSnakeColor.R, CurrentSnakeColor.G, CurrentSnakeColor.B, 20))); } Playground.SetPixel(Points[i].X, Points[i].Y, CurrentSnakeColor); } Playground.Apply(); }
public void Start() { var colors = Pattern.GetPixels(); var bitmap = new TextureBitmap(Pattern.Width, Pattern.Height); for (var y = 0; y < Pattern.Width; y++) { for (var x = 0; x < Pattern.Height; x++) { bitmap.SetPixel(x, y, new TextureBitmap.Color((byte)(colors[x + y * Pattern.Width].a * 255f), (byte)(colors[x + y * Pattern.Width].r * 255f), (byte)(colors[x + y * Pattern.Width].g * 255f), (byte)(colors[x + y * Pattern.Width].b * 255f))); } } var path = StandaloneFileBrowser.SaveFilePanel("Export image", "", "image.png", new ExtensionFilter[] { new ExtensionFilter("Image", new string[] { "png", "jpg", "jpeg", "bmp", "gif" }) }); if (path != null && path.Length > 0) { bitmap.Save(path); _IsFinished = true; } }