0

I am creating an application in which I have to draw a Quadratic Curve. I did this using Polyline as:

BindPoints = new PointCollection();
for (int i = 0; i < 100; i++)
  {
            double val = i * i - 5;
            var point = new Point(i, val);
            Points.Add(new Point(i, i));
            BindPoints.Add(point);
   }

<Polyline Name="MyLine" Points="{Binding BindPoints,Mode=TwoWay} Stroke="Black" StrokeThickness="4" />

Now the issue is that I want to replace each point with an Image of 1 Pixel height. So it gives me an effect of a line but drawn with Images instead of points.

The Goal is to stack images on top of each other so they look like a line/curve.

  • Just write to `WriteableBitmap` directly. – wingerse May 03 '16 at 19:32
  • Hi Emperor, can you give an example as how to draw a line using WriteableBitmap? – user2675267 May 03 '16 at 19:35
  • There are lots of tutorials online. Here's a [link](http://stackoverflow.com/questions/3000591/drawing-line-using-wpf-writeablebitmap-backbuffer), not the best way to do it, but yeah – wingerse May 03 '16 at 19:37
  • Any suggestions on the best way to accomplish this? – user2675267 May 03 '16 at 19:42
  • You just fill in a byte array with the correct pixels and set it. But there are things to be careful about, like stride and format. I don't remember off the top of my head, but have a look [here](https://msdn.microsoft.com/en-us/library/system.windows.media.imaging.writeablebitmap(v=vs.110).aspx) – wingerse May 03 '16 at 19:54

0 Answers0