private void CalculateButton_Click(object sender, EventArgs e) { CalculateButton.Enabled = false; SaveHologramButton.Enabled = false; SLM.RemoveBitmap("Computed Hologram"); PhaseForm.Text = "Computing Hologram ..."; GerchbergSaxton.CopyParameters(this); GetInput(); GerchbergSaxton.Free(Images.PhaseBitmap); Images.PhaseBitmap = GerchbergSaxton.Compute(Target); if (Images.PhaseBitmap != null) { RenderBitmap(ref Images.PhaseBitmap); SaveHologramButton.Enabled = true; SLM.AddBitmap("Computed Hologram", Images.PhaseBitmap); } CalculateButton.Enabled = true; PhaseForm.Text = "ImageGS"; }
void RenderBitmap(ref Bitmap bitmap) { if (bitmap != null) { GerchbergSaxton.Free(PhasePicture.Image); PhasePicture.Image = bitmap.Clone(new Rectangle(0, 0, bitmap.Width, bitmap.Height), bitmap.PixelFormat); } }
private void GSButton_Click(object sender, EventArgs e) { GerchbergSaxton.SetParameters(GerchbergSaxtonForm); GerchbergSaxtonForm.Show(); GerchbergSaxtonForm.BringToFront(); if (GerchbergSaxtonForm.WindowState == FormWindowState.Minimized) { GerchbergSaxtonForm.WindowState = FormWindowState.Normal; } }
private void ResizePatternWindow(int sizex, int sizey) { PhaseForm.Width = sizex + 16; PhaseForm.Height = sizey + 40; PhaseForm.Width = sizex; PhaseForm.Height = sizey; PhasePicture.Width = sizex; PhasePicture.Height = sizey; GerchbergSaxton.Free(PhasePicture.Image); PhasePicture.Image = new Bitmap(sizex, sizey); using (var gr = Graphics.FromImage(PhasePicture.Image)) { gr.Clear(Color.Black); } }