public static void Test() { ImageArgb32 src = new ImageArgb32(5000, 6000); System.Drawing.Bitmap dst = new System.Drawing.Bitmap(5000, 6000, System.Drawing.Imaging.PixelFormat.Format32bppArgb); CodeTimer.Time("ToBitmap", 1, () => { src.ToBitmap(dst); }); CodeTimer.Time("ToBitmap", 1, () => { src.ToBitmap(dst); }); CodeTimer.Time("ToBitmap", 1, () => { src.ToBitmap(dst); }); CodeTimer.Time("ToBitmap", 1, () => { src.ToBitmap(dst); }); }
public void TestConvertArgb32Image() { String imgPath0 = "..\\images\\yilagou_1280_720_24.jpg"; Bitmap map = new Bitmap(imgPath0); Color c = map.GetPixel(0, 0); Console.WriteLine(c.ToString()); ImageArgb32 r = new ImageArgb32(map); Argb32 cr = r[0, 0]; Console.WriteLine(cr.ToString()); Bitmap to = r.ToBitmap(); Color tc = to.GetPixel(0, 0); Console.WriteLine(tc.ToString()); Assert.AreEqual(c.A, cr.Alpha); Assert.AreEqual(c.R, cr.Red); Assert.AreEqual(c.G, cr.Green); Assert.AreEqual(c.B, cr.Blue); Assert.AreEqual(c.R, tc.R); Assert.AreEqual(c.G, tc.G); Assert.AreEqual(c.B, tc.B); }