Remove SvgImageView.

This commit is contained in:
2020-04-17 05:26:15 +01:00
parent 003fc0967c
commit ce16776754
2 changed files with 0 additions and 99 deletions

View File

@@ -1213,7 +1213,6 @@
<e p="Controls" t="Include">
<e p="BlockMap.cs" t="Include" />
<e p="LineChart.cs" t="Include" />
<e p="SvgImageView.cs" t="Include" />
</e>
<e p="Models" t="Include">
<e p="AssemblyModel.cs" t="Include" />

View File

@@ -1,98 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : SvgImageView.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : SVG image view.
//
// --[ Description ] ----------------------------------------------------------
//
// Implements a SVG rendering that can be used in the place of an Eto.ImageView.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General public License for more details.
//
// You should have received a copy of the GNU General public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2020 Natalia Portillo
// ****************************************************************************/
using System;
using System.IO;
using Eto.Drawing;
using Eto.Forms;
namespace Aaru.Gui.Controls
{
public class SvgImageView : ImageView
{
byte[] cachedRender;
Stream svgStream;
public new Image Image => base.Image;
public Stream SvgStream
{
get => svgStream;
set
{
if(svgStream == value)
return;
svgStream = value;
Redraw();
}
}
void Redraw()
{
if(Width == -1 ||
Height == -1 ||
svgStream == null)
return;
svgStream.Position = 0;
// TODO: Upstream library not working property: https://github.com/mono/SkiaSharp.Extended/issues/51
/*SKSvg svg = new SKSvg();
SKEncodedImageFormat skFormat = SKEncodedImageFormat.Png;
svg.Load(svgStream);
//SKRect svgSize = svg.Picture.CullRect;
float canvasMin = Math.Min(Width, Height);
float svgMax = Math.Max(svg.Picture.CullRect.Width, svg.Picture.CullRect.Height);
float scale = canvasMin / svgMax;
var matrix = SKMatrix.MakeScale(scale, scale);
SKBitmap bitmap = new SKBitmap((int)Width, (int)Height);
SKCanvas canvas = new SKCanvas(bitmap);
canvas.DrawPicture(svg.Picture, ref matrix);
canvas.Flush();
SKImage image = SKImage.FromBitmap(bitmap);
SKData data = image.Encode(skFormat, 100);
MemoryStream outMs = new MemoryStream();
data.SaveTo(outMs);
cachedRender = outMs.ToArray();
base.Image = new Bitmap(cachedRender);
*/
}
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
Redraw();
}
}
}