Home
Options

[LINQPAD 6-7] Edge Chromium Engine : Images should not be cached with `Util.Image()`

Images should not be cached with Util.Image() and Edge Chromium Engine
You can repeat the problem with the following code (I'm using Oxyplot.Core and Oxyplot.Wpf for this example) :

var pm = new PlotModel { Title = $"Kinds of Pet People Own : {DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss")}" };
var ps = new PieSeries { StrokeThickness = 0.25, AngleSpan = 360, StartAngle = 0, InsideLabelFormat = "", OutsideLabelFormat = "{1}: {0}", TickHorizontalLength = 20, TickRadialLength = 2, Diameter = 1, InnerDiameter = .5, };

ps.Slices.Add(new PieSlice("Rabbit", 33) { IsExploded = false, Fill = OxyColor.Parse("#3498db") });
ps.Slices.Add(new PieSlice("Dog", 196) { IsExploded = false, Fill = OxyColor.Parse("#2ecc71") });
ps.Slices.Add(new PieSlice("Cat", 152) { IsExploded = false, Fill = OxyColor.Parse("#9b59b6") });
ps.Slices.Add(new PieSlice("Goldfish", 62) { IsExploded = false, Fill = OxyColor.Parse("#34495e") });
ps.Slices.Add(new PieSlice("Hamster", 68) { IsExploded = false, Fill = OxyColor.Parse("#e74c3c") });
ps.Slices.Add(new PieSlice("Birds", 101) { IsExploded = false, Fill = OxyColor.Parse("#f1c40f") });
pm.Series.Add(ps);

// NOT CLEARING Chromium WebView cache
Util.ClearResults();
Util.BrowserEngine.IsMSIE.Dump("IsMSIE");

// Show PNG from memory
using (var ms = new MemoryStream())
{
    var pngMemoryExporter = new PngExporter { Width = 600, Height = 400, };
    pngMemoryExporter.Export(pm, ms);
    var bitmap = new Bitmap(ms, true);
    bitmap.Dump($"Memory PNG {DateTime.Now.ToString()}");
}

// Show PNG from disk
var png = @$"C:\Tmp\{Util.CurrentQuery.Name}.png";
//var png = @$"C:\Tmp\{Util.CurrentQuery.Name} {DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss")}.png";
if (File.Exists(png)) File.Delete(png);
using (var stream = new FileStream(png, FileMode.Create, FileAccess.Write))
{
    var pngExporter = new PngExporter { Width = 600, Height = 400, };
    pngExporter.Export(pm, stream);
}
// Load PNG
string urlPng = @$"file:///{png.Replace('\\', '/')}";
LINQPad.Extensions.Dump(Util.Image(urlPng), $"Disk PNG {DateTime.Now.ToString()}");`

Result with Chromium Engine : :'(

Result with MSIE : :smile:

Abouts : Engines versions

Comments

Sign In or Register to comment.