public void SendImage(Bitmap signImage) { lock (this) { SignConfiguration config = CurrentConfig; // For each element in the configuration, render it. for (int i = 0; i < config.Components.Length; i++) { SignComponent c = config.Components[i]; uint[] elementData = new uint[32 * 32]; try { for (int y = 0; y < 32; y++) { for (int x = 0; x < 32; x++) { elementData[x + y * 32] = (uint)signImage.GetPixel(x + c.X, y + c.Y).ToArgb(); } } TestBoard.SendImage32x32(i, elementData); } catch { } // Exceptions are generally due to configuration changes leading bitmap changes. } } }
public SignPreview() { lockObj = new object(); SignName = "Sign Preview"; if (PreviewIndex > 1) { SignName += " " + PreviewIndex; } PreviewIndex++; InitializeComponent(); Text = SignName; SignComponent[] c = new SignComponent[2]; c[0] = new SignComponent() { X = 0, Y = 0, Width = 32, Height = 32 }; c[1] = new SignComponent() { X = 32, Y = 0, Width = 32, Height = 32 }; CurrentConfig = new SignConfiguration(c); ResizeForConfiguration(); }
public TargetTestBoard() { TestBoard = null; foreach (var dev in SignTest.Enumerate()) { try { TestBoard = new SignTest(dev); break; } catch { } } if (TestBoard == null) { throw new Exception("Unable to attach to a Sign Test board."); } SignComponent[] c = new SignComponent[1]; c[0] = new SignComponent() { X = 0, Y = 0, Width = 32, Height = 32 }; CurrentConfig = new SignConfiguration(c); // Initialize test board. TestBoard.SetMode(SignTest.DeviceMode.On); TestBoard.SetMode(SignTest.DeviceMode.FpgaActive); }
public void SetTarget(SignTargetUI toConfigure) { ResponseObject = toConfigure; Configuring = toConfigure.Target; InitialConfiguration = Configuring.CurrentConfiguration(); ResetView(); }
public void ApplyConfiguration(SignConfiguration configuration) { lock (lockObj) { CurrentConfig = configuration; } ResizeForConfiguration(); }
public void ConfigurationChange() { SignConfiguration newConfiguration = new SignConfiguration(Elements.Select(e => e.Location).ToArray()); Configuring.ApplyConfiguration(newConfiguration); SetIdentify(checkBox1.Checked); ParentWindow.UpdateConfiguration(ResponseObject); }
public void SetConfiguration(SignConfiguration c) { lock (this) { if (Render == null) { Render = new SignRender(); } Render.SetConfiguration(c); } }
public void UpdateConfiguration(SignTargetUI target) { // Apply configuration to all other displays for now. Maybe support multiple configurations in the future. SignConfiguration c = target.Target.CurrentConfiguration(); foreach (SignTargetUI t in Targets) { if (t != target) { t.Target.ApplyConfiguration(c); } } Animate.SetConfiguration(c); }
public void SetConfiguration(SignConfiguration c) { Configuration = c; if (c.Width > 0 && c.Height > 0) { SignOutput = new Bitmap(Configuration.Width, Configuration.Height); SignGraphics = Graphics.FromImage(SignOutput); SignGraphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; SignGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; // (Disables cleartype, which doesn't make much sense on the LED sign) } else { SignOutput = null; } }
public void ApplyConfiguration(SignConfiguration configuration) { CurrentConfig = configuration; }
public bool SupportsConfiguration(SignConfiguration configuration) { return(true); }