예제 #1
0
        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";
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        private void GSButton_Click(object sender, EventArgs e)
        {
            GerchbergSaxton.SetParameters(GerchbergSaxtonForm);

            GerchbergSaxtonForm.Show();
            GerchbergSaxtonForm.BringToFront();

            if (GerchbergSaxtonForm.WindowState == FormWindowState.Minimized)
            {
                GerchbergSaxtonForm.WindowState = FormWindowState.Normal;
            }
        }
예제 #4
0
        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);
            }
        }