private void PasteImpl(DrawingBox drawingBox, float?[] scans)
        {
            var bitmap = drawingBox.Bitmap;

            bitmap.Clear();

            var dx = (float)scans.Length / (float)bitmap.Current.Width;
            var sx = 0.0f;

            bool lastWasNull = true;

            for (var x = 0; x < bitmap.Current.Width; x++)
            {
                var scan = scans[(int)sx];
                if (scan == null)
                {
                    sx         += dx;
                    lastWasNull = true;
                    continue;
                }

                var y = (int)((1.0f - scan) * (float)bitmap.Current.Height);
                bitmap.Current.SetPixel(x, y, System.Drawing.Color.Red);
                if (lastWasNull)
                {
                    bitmap.MoveTo(x, y);
                    lastWasNull = false;
                }
                else
                {
                    bitmap.DrawTo(x, y);
                }
            }
            drawingBox.Invalidate();
        }
Beispiel #2
0
 private void DrawingBox_MouseMove(object sender, MouseEventArgs e)
 {
     if (currentPollygon != null)
     {
         currentPollygon.MovePoint(e.Location.X - recentLocation.X, e.Location.Y - recentLocation.Y);
         DrawingBox.Invalidate();
     }
     recentLocation = e.Location;
 }
Beispiel #3
0
 private void Timer_Tick(object sender, EventArgs e)
 {
     LightSettings.MoveLightSource((double)timer.Interval / 1000);
     DrawingBox.Invalidate();
 }