void Prepare() { cx = w / 2; cy = h / 2; //clear background drawer.Clear(Colors.White); //draw a black rectangle in center Fill fill = Fills.Gray; int size = 15; drawer.DrawRectangle(fill, cx - size, cy - size, size * 2, size * 2); }
private void btnPushPop_Click(object sender, EventArgs e) { //original view drawer = new Drawer(buffer); Prepare(); Fill fill = Fills.Red; fill.Opacity = 0.2; drawer.DrawRectangle(fill, 50, 0, 150, 50); drawer.PushMatrix(); drawer.Rotate(20); drawer.DrawRectangle(fill, 50, 0, 150, 50); drawer.PushMatrix(); drawer.Rotate(30); drawer.DrawRectangle(fill, 50, 0, 150, 50); //revert transformations fill = Fills.Blue; fill.Opacity = 0.2; drawer.DrawRectangle(fill, 50, 0, 50, 20); drawer.PopMatrix(); drawer.DrawRectangle(fill, 50, 0, 50, 20); drawer.PopMatrix(); drawer.DrawRectangle(fill, 50, 0, 50, 20); DisplayOriginal(buffer); //discard after view 1, 2, 3 DisplayAfter1(null); DisplayAfter2(null); DisplayAfter3(null); txtDesc1.Text = ""; txtDesc2.Text = ""; txtDesc3.Text = ""; }
public override void Draw(IDrawer drawer) { drawer.DrawRectangle(4, 5); }
public void Draw(IDrawer drawer) { drawer.DrawRectangle(this); }