private void TestButton2_Click(object sender, EventArgs e) { //Bitmap b = (Bitmap)Bitmap.FromFile(Path.GetFullPath("IMGP4154.JPG")); //FileStream s = new FileStream(Path.GetFullPath("test2.oif"), FileMode.OpenOrCreate); //Orvid.Graphics.Image i = new Orvid.Graphics.Image(b.Width, b.Height); //for (uint x = 0; x < i.Width; x++) //{ // for (uint y = 0; y < i.Height; y++) // { // i.SetPixel(x, y, b.GetPixel((int)x, (int)y)); // } //} //Orvid.Graphics.ImageFormats.OIFImage oif = new Orvid.Graphics.ImageFormats.OIFImage(); //oif.Save(i, s); //s.Flush(); //s.Close(); if (!thso) { FileStream s = new FileStream(Path.GetFullPath("Building.png"), FileMode.Open); Orvid.Graphics.ImageFormats.PngImage p = new Orvid.Graphics.ImageFormats.PngImage(); Orvid.Graphics.Image i = p.Load(s); s.Close(); s.Dispose(); Bitmap b = new Bitmap(i.Width, i.Height); for (uint x = 0; x < i.Width; x++) { for (uint y = 0; y < i.Height; y++) { b.SetPixel((int)x, (int)y, i.GetPixel(x, y)); } } pictureBox1.Image = b; thso = true; } else { if (!t2) { Bitmap b = (Bitmap)pictureBox1.Image; Orvid.Graphics.Image i = new Orvid.Graphics.Image(b.Width, b.Height); for (uint x = 0; x < i.Width; x++) { for (uint y = 0; y < i.Height; y++) { i.SetPixel(x, y, b.GetPixel((int)x, (int)y)); } } i = Orvid.Graphics.ImageManipulator.Resize(i, new Orvid.Graphics.Vec2(b.Width / 4, b.Height / 4), Orvid.Graphics.ImageManipulator.ScalingAlgorithm.Bicubic); Bitmap b2 = new Bitmap(i.Width, i.Height); for (uint x = 0; x < i.Width; x++) { for (uint y = 0; y < i.Height; y++) { b2.SetPixel((int)x, (int)y, i.GetPixel(x, y)); } } pictureBox2.Image = b2; pictureBox2.Size = new Size(b2.Width, b2.Height); t2 = true; } else { if (!t3) { Bitmap b = (Bitmap)pictureBox1.Image; Orvid.Graphics.Image i = new Orvid.Graphics.Image(b.Width, b.Height); for (uint x = 0; x < i.Width; x++) { for (uint y = 0; y < i.Height; y++) { i.SetPixel(x, y, b.GetPixel((int)x, (int)y)); } } i = Orvid.Graphics.ImageManipulator.Resize(i, new Orvid.Graphics.Vec2(b.Width / 4, b.Height / 4), Orvid.Graphics.ImageManipulator.ScalingAlgorithm.Bilinear); Bitmap b2 = new Bitmap(i.Width, i.Height); for (uint x = 0; x < i.Width; x++) { for (uint y = 0; y < i.Height; y++) { b2.SetPixel((int)x, (int)y, i.GetPixel(x, y)); } } pictureBox2.Image = b2; pictureBox2.Size = new Size(b2.Width, b2.Height); t3 = true; } else { Bitmap b = (Bitmap)pictureBox1.Image; Orvid.Graphics.Image i = new Orvid.Graphics.Image(b.Width, b.Height); for (uint x = 0; x < i.Width; x++) { for (uint y = 0; y < i.Height; y++) { i.SetPixel(x, y, b.GetPixel((int)x, (int)y)); } } i = Orvid.Graphics.ImageManipulator.Resize(i, new Orvid.Graphics.Vec2(b.Width / 2, b.Height / 2), Orvid.Graphics.ImageManipulator.ScalingAlgorithm.NearestNeighbor); Bitmap b2 = new Bitmap(i.Width, i.Height); for (uint x = 0; x < i.Width; x++) { for (uint y = 0; y < i.Height; y++) { b2.SetPixel((int)x, (int)y, i.GetPixel(x, y)); } } pictureBox2.Image = b2; pictureBox2.Size = new Size(b2.Width, b2.Height); t2 = false; t3 = false; } } } //Font f = new Font("Chiller", 64, (FontStyle)0, GraphicsUnit.Pixel); //Bitmap b = new Bitmap(1, 1); //Graphics g = Graphics.FromImage(b); //SizeF sz = g.MeasureString(new String(new char[] { (char)6 }), f); //byte height = (byte)Math.Ceiling(sz.Height + 2); //byte width = (byte)Math.Ceiling(sz.Width + 4); //b = new Bitmap(width, height); //g = Graphics.FromImage(b); //g.Clear(Color.White); //g.DrawString(new String(new char[] { (char)Int32.Parse(textBox2.Text) }), f, new SolidBrush(Color.Black), 2, 2); //g.Flush(System.Drawing.Drawing2D.FlushIntention.Flush); //pictureBox1.Image = b; //pictureBox1.Size = new Size(b.Width, b.Height); //Orvid.Graphics.Image i = new Orvid.Graphics.Image(b.Width, b.Height); //for (uint x = 0; x < i.Width; x++) //{ // for (uint y = 0; y < i.Height; y++) // { // i.SetPixel(x, y, b.GetPixel((int)x, (int)y)); // } //} //FileStream s = new FileStream("Test.oif", FileMode.OpenOrCreate); //Orvid.Graphics.ImageFormats.OIFImage t = new Orvid.Graphics.ImageFormats.OIFImage(); //t.Save(i, s); //s.Flush(); //s.Close(); //s.Dispose(); //s = new FileStream("Test.oif", FileMode.Open); //Orvid.Graphics.Image i2 = t.Load(s); //Bitmap b2 = new Bitmap(i2.Width, i2.Height); //for (uint x = 0; x < i2.Width; x++) //{ // for (uint y = 0; y < i2.Height; y++) // { // b2.SetPixel((int)x, (int)y, i2.GetPixel(x, y)); // } //} //pictureBox2.Image = b2; //pictureBox2.Size = new Size(b2.Width, b2.Height); //s.Close(); //s.Dispose(); }