public void RemoveBitmap(string name) { bool found = false; int index = -1; for (var i = 0; i < Bitmaps.Count; i++) { var item = Bitmaps[i]; if (name.Equals(item.Name)) { found = true; index = i; } } if (found && index >= 0) { Bitmaps.RemoveAt(index); BitmapList.Items.RemoveAt(index); SpatialLightModulator.ResetBitmap(); } }
public void AddBitmap(string name, Bitmap bitmap) { if (bitmap != null) { bool found = false; for (var i = 0; i < Bitmaps.Count; i++) { var item = Bitmaps[i]; if (name.Equals(item.Name)) { found = true; break; } } if (!found) { Bitmaps.Add(new BitmapItem(name, bitmap)); BitmapList.Items.Add(name); BitmapList.SelectedIndex = BitmapList.Items.Count - 1; SpatialLightModulator.SetBitmap(ref bitmap); } } }
private void ImageGSTimer_Tick(object sender, EventArgs e) { if (SpatialLightModulator.IsVisible()) { SpatialLightModulator.Render(); SpatialLightModulator.Show(); } }
private void SetBitmapButton_Click(object sender, System.EventArgs e) { if (BitmapList.SelectedIndex >= 0 && Bitmaps.Count > 0 && BitmapList.SelectedIndex <= Bitmaps.Count) { SpatialLightModulator.SetBitmap(ref Bitmaps[BitmapList.SelectedIndex].Bitmap); SpatialLightModulator.Show(); } }
private void SLMButton_Click(object sender, EventArgs e) { SpatialLightModulator.Detect(); SpatialLightModulatorForm.Show(); SpatialLightModulatorForm.BringToFront(); if (SpatialLightModulatorForm.WindowState == FormWindowState.Minimized) { SpatialLightModulatorForm.WindowState = FormWindowState.Normal; } }
public ImageGSForm() { InitializeComponent(); Initialize(); InitializeBitmaps(); InitializePhaseForm(); SpatialLightModulator.Initialize(); SpatialLightModulatorForm = new frmSpatialLightModulator(); SpatialLightModulatorForm.SetLimits(); SpatialLightModulatorForm.SetParameters(); SpatialLightModulatorForm.AddBitmap("Target", Images.InputBitmap); GerchbergSaxtonForm = new frmGerchbergSaxton(); GerchbergSaxtonForm.SetLimits(); GerchbergSaxtonForm.SetTarget(this, PhaseImage, SpatialLightModulatorForm); }
private void OutputHeight_ValueChanged(object sender, EventArgs e) { SpatialLightModulator.Height = Convert.ToInt32(OutputHeight.Value); SpatialLightModulator.Resize(); }
private void DetectButton_Click(object sender, System.EventArgs e) { SpatialLightModulator.Detect(); SetParameters(); }
private void HideButton_Click(object sender, EventArgs e) { SpatialLightModulator.Hide(); }
private void Top_ValueChanged(object sender, EventArgs e) { SpatialLightModulator.Top = Convert.ToInt32(SLMTop.Value); SpatialLightModulator.Move(); }
private void Left_ValueChanged(object sender, EventArgs e) { SpatialLightModulator.Left = Convert.ToInt32(SLMLeft.Value); SpatialLightModulator.Move(); }
private void Width_ValueChanged(object sender, EventArgs e) { SpatialLightModulator.Width = Convert.ToInt32(SLMWidth.Value); SpatialLightModulator.Resize(); }