Miro
Miro

Reputation: 135

C# WPF Convert StrokeCollection to ImageSource

I have stored StrokeCollection in bytes. After convert back to StrokeCollection I want StrokeCollection tranfer to imagesource for image.

    private byte[] strokeCollections;

    public void UpdateImage()
    {
        using (Stream stream = new MemoryStream(strokeCollection))
        {
            //converted back to StrokeCollection
            StrokeCollection strokes = new StrokeCollection(stream);
            //Set image control source to strokes image
            DrawingImg.Source = ---.
        }
    }

Thanks.

Upvotes: 0

Views: 221

Answers (1)

Michel Michels
Michel Michels

Reputation: 2138

I wrote a library which extends the StrokeCollection class to help with these kind of problems. You can find it here: InkSharp.

Compile the library and add the dll to your project. Use the InkSharp.Drawing class and the function ToImageSource(). You can also convert it to a BitMap and a byte array.

Upvotes: 1

Related Questions