Last change
on this file since 13792 was
12762,
checked in by aballeit, 9 years ago
|
#2283 GUI updates, Tree-chart, MCTS Version 2 (prune leaves)
|
File size:
1.4 KB
|
Rev | Line | |
---|
[12762] | 1 | using System;
|
---|
| 2 | using System.IO;
|
---|
| 3 | using System.Text;
|
---|
| 4 | using System.Windows;
|
---|
| 5 | using System.Collections.Generic;
|
---|
| 6 |
|
---|
| 7 | using System.Windows.Media;
|
---|
| 8 | using System.Windows.Media.Imaging;
|
---|
| 9 |
|
---|
| 10 | using SharpVectors.Dom.Svg;
|
---|
| 11 | using SharpVectors.Renderers.Wpf;
|
---|
| 12 |
|
---|
| 13 | using SharpVectors.Runtime;
|
---|
| 14 |
|
---|
| 15 | namespace SharpVectors.Converters
|
---|
| 16 | {
|
---|
| 17 | public sealed class EmbeddedImageVisitor : WpfEmbeddedImageVisitor
|
---|
| 18 | {
|
---|
| 19 | public EmbeddedImageVisitor()
|
---|
| 20 | {
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | public override BitmapSource Visit(SvgImageElement element,
|
---|
| 24 | WpfDrawingContext context)
|
---|
| 25 | {
|
---|
| 26 | string sURI = element.Href.AnimVal;
|
---|
| 27 | int nColon = sURI.IndexOf(":");
|
---|
| 28 | int nSemiColon = sURI.IndexOf(";");
|
---|
| 29 | int nComma = sURI.IndexOf(",");
|
---|
| 30 |
|
---|
| 31 | string sMimeType = sURI.Substring(nColon + 1,
|
---|
| 32 | nSemiColon - nColon - 1);
|
---|
| 33 |
|
---|
| 34 | string sContent = sURI.Substring(nComma + 1);
|
---|
| 35 | byte[] imageBytes = Convert.FromBase64CharArray(sContent.ToCharArray(),
|
---|
| 36 | 0, sContent.Length);
|
---|
| 37 |
|
---|
| 38 | //BitmapImage imageSource = new BitmapImage();
|
---|
| 39 | //imageSource.BeginInit();
|
---|
| 40 | //imageSource.StreamSource = new MemoryStream(imageBytes);
|
---|
| 41 | //imageSource.EndInit();
|
---|
| 42 |
|
---|
| 43 | return new EmbeddedBitmapSource(new MemoryStream(imageBytes));
|
---|
| 44 | }
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.