示例#1
0
 void EmptyPlot()
 {
     // using LockBitmap for faster SetPixel and faster GetPixel
     // allows working with class Parallel, making it super fast
     var bmp = new LockBitmap(Plot);
     bmp.LockBits();
     Parallel.For(0, Width, x =>
     {
         Parallel.For(0, Height, y =>
         {
             bmp.SetPixel(x, y, Background);
         });
     });
     bmp.UnlockBits();
 }
示例#2
0
        void DrawPoints(IEnumerable<double> xs, IEnumerable<double> ys, Color c)
        {
            var xValues = xs.ToArray();
            var yValues = ys.ToArray();
            var bmp = new LockBitmap(Plot);
            bmp.LockBits();

            // for each point within the plot-box, draw the point
            Parallel.For(0, xValues.Length, i => {
                var x = xValues[i];
                var y = yValues[i];
                if (y > 0 && y < Height)
                    bmp.SetPixel((int)x, (int)y, c);
            });
            bmp.UnlockBits();
        }