This code generates an exception with the latest LINQPad 4.28 beta
new System.Drawing.Bitmap(200, 200).Dump();
Is this a problem in my code or a problem with LINQPad's .Dump() extension method?
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes. A Bitmap is an object used to work with images defined by pixel data.
Being able to dump bitmaps is a new feature of the LINQPad 4.28 beta - but it seems there's a bug. I'll upload a fix later today.
Edit: The new build has now been uploaded. You can test it by running this:
using (var b = new System.Drawing.Bitmap (400, 200))
using (var g = Graphics.FromImage (b))
using (var f = new Font ("Arial", 40))
{
g.SmoothingMode = SmoothingMode.AntiAlias;
g.FillEllipse (Brushes.CadetBlue, 0, 0, 400, 200);
g.DrawString ("LINQPad", f, Brushes.Black, 75, 70);
b.Dump();
}
Note that you can also dump images by calling Util.Image, passing in a filename or URI. You can use the latter to draw graphs using Google's Chart API; for example, the following:
Util.Image ("http://chart.apis.google.com/chart?cht=p3&chd=s:Uf9a&chs=350x140&chl=January|February|March|April")
generates this output:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With