Example #1
0
        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();
            }
        }
Example #2
0
        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);
                }
            }
        }
Example #3
0
 private void ImageGSTimer_Tick(object sender, EventArgs e)
 {
     if (SpatialLightModulator.IsVisible())
     {
         SpatialLightModulator.Render();
         SpatialLightModulator.Show();
     }
 }
Example #4
0
        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();
            }
        }
Example #5
0
        private void SLMButton_Click(object sender, EventArgs e)
        {
            SpatialLightModulator.Detect();

            SpatialLightModulatorForm.Show();
            SpatialLightModulatorForm.BringToFront();

            if (SpatialLightModulatorForm.WindowState == FormWindowState.Minimized)
            {
                SpatialLightModulatorForm.WindowState = FormWindowState.Normal;
            }
        }
Example #6
0
        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);
        }
Example #7
0
        private void OutputHeight_ValueChanged(object sender, EventArgs e)
        {
            SpatialLightModulator.Height = Convert.ToInt32(OutputHeight.Value);

            SpatialLightModulator.Resize();
        }
Example #8
0
        private void DetectButton_Click(object sender, System.EventArgs e)
        {
            SpatialLightModulator.Detect();

            SetParameters();
        }
Example #9
0
 private void HideButton_Click(object sender, EventArgs e)
 {
     SpatialLightModulator.Hide();
 }
Example #10
0
        private void Top_ValueChanged(object sender, EventArgs e)
        {
            SpatialLightModulator.Top = Convert.ToInt32(SLMTop.Value);

            SpatialLightModulator.Move();
        }
Example #11
0
        private void Left_ValueChanged(object sender, EventArgs e)
        {
            SpatialLightModulator.Left = Convert.ToInt32(SLMLeft.Value);

            SpatialLightModulator.Move();
        }
Example #12
0
        private void Width_ValueChanged(object sender, EventArgs e)
        {
            SpatialLightModulator.Width = Convert.ToInt32(SLMWidth.Value);

            SpatialLightModulator.Resize();
        }