using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
const int w = 640;
const int h = 480;
Bitmap bmp1 = new Bitmap(w, h, PixelFormat.Format32bppArgb);
using (Graphics g = Graphics.FromImage(bmp1))
{
g.SmoothingMode = SmoothingMode.AntiAlias;
g.FillRectangle(Brushes.Transparent, 0, 0, w, h);
g.FillEllipse(Brushes.Blue, 0, 0, w, h);
}
Bitmap bmp2 = new Bitmap(w, h, PixelFormat.Format32bppArgb);
using (Graphics g = Graphics.FromImage(bmp2))
{
g.SmoothingMode = SmoothingMode.AntiAlias;
g.FillRectangle(Brushes.Gray, 0, 0, w, h);
Matrix m = new Matrix();
m.Scale(0.5f, 0.5f);
g.Transform = m;
g.DrawImage(bmp1,0,0);
m.Reset();
g.Transform = m;
}
PictureBox p = new PictureBox();
p.Dock = DockStyle.Fill;
this.Controls.Add(p);
this.ClientSize = new Size(w, h);
p.Image = bmp2;
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLkNvbXBvbmVudE1vZGVsOwp1c2luZyBTeXN0ZW0uRGF0YTsKdXNpbmcgU3lzdGVtLkRyYXdpbmc7CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uVGV4dDsKdXNpbmcgU3lzdGVtLldpbmRvd3MuRm9ybXM7Cgp1c2luZyBTeXN0ZW0uRHJhd2luZy5EcmF3aW5nMkQ7CnVzaW5nIFN5c3RlbS5EcmF3aW5nLkltYWdpbmc7CgpuYW1lc3BhY2UgV2luZG93c0Zvcm1zQXBwbGljYXRpb24xCnsKICAgIHB1YmxpYyBwYXJ0aWFsIGNsYXNzIEZvcm0xIDogRm9ybQogICAgewogICAgICAgIHB1YmxpYyBGb3JtMSgpCiAgICAgICAgewogICAgICAgICAgICBJbml0aWFsaXplQ29tcG9uZW50KCk7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHZvaWQgRm9ybTFfTG9hZChvYmplY3Qgc2VuZGVyLCBFdmVudEFyZ3MgZSkKICAgICAgICB7CiAgICAgICAgICAgIGNvbnN0IGludCB3ID0gNjQwOwogICAgICAgICAgICBjb25zdCBpbnQgaCA9IDQ4MDsKICAgICAgICAgICAgQml0bWFwIGJtcDEgPSBuZXcgQml0bWFwKHcsIGgsIFBpeGVsRm9ybWF0LkZvcm1hdDMyYnBwQXJnYik7CiAgICAgICAgICAgIHVzaW5nIChHcmFwaGljcyBnID0gR3JhcGhpY3MuRnJvbUltYWdlKGJtcDEpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBnLlNtb290aGluZ01vZGUgPSBTbW9vdGhpbmdNb2RlLkFudGlBbGlhczsKICAgICAgICAgICAgICAgIGcuRmlsbFJlY3RhbmdsZShCcnVzaGVzLlRyYW5zcGFyZW50LCAwLCAwLCB3LCBoKTsKICAgICAgICAgICAgICAgIGcuRmlsbEVsbGlwc2UoQnJ1c2hlcy5CbHVlLCAwLCAwLCB3LCBoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBCaXRtYXAgYm1wMiA9IG5ldyBCaXRtYXAodywgaCwgUGl4ZWxGb3JtYXQuRm9ybWF0MzJicHBBcmdiKTsKICAgICAgICAgICAgdXNpbmcgKEdyYXBoaWNzIGcgPSBHcmFwaGljcy5Gcm9tSW1hZ2UoYm1wMikpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGcuU21vb3RoaW5nTW9kZSA9IFNtb290aGluZ01vZGUuQW50aUFsaWFzOwogICAgICAgICAgICAgICAgZy5GaWxsUmVjdGFuZ2xlKEJydXNoZXMuR3JheSwgMCwgMCwgdywgaCk7CgogICAgICAgICAgICAgICAgTWF0cml4IG0gPSBuZXcgTWF0cml4KCk7CiAgICAgICAgICAgICAgICBtLlNjYWxlKDAuNWYsIDAuNWYpOwogICAgICAgICAgICAgICAgZy5UcmFuc2Zvcm0gPSBtOwoKICAgICAgICAgICAgICAgIGcuRHJhd0ltYWdlKGJtcDEsMCwwKTsKCiAgICAgICAgICAgICAgICBtLlJlc2V0KCk7CiAgICAgICAgICAgICAgICBnLlRyYW5zZm9ybSA9IG07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgUGljdHVyZUJveCBwID0gbmV3IFBpY3R1cmVCb3goKTsKICAgICAgICAgICAgcC5Eb2NrID0gRG9ja1N0eWxlLkZpbGw7CiAgICAgICAgICAgIHRoaXMuQ29udHJvbHMuQWRkKHApOwogICAgICAgICAgICB0aGlzLkNsaWVudFNpemUgPSBuZXcgU2l6ZSh3LCBoKTsKICAgICAgICAgICAgcC5JbWFnZSA9IGJtcDI7CiAgICAgICAgfQogICAgfQp9Cg==