public void DrawPathTwoTimes() { InitBlank (50, 50); var p = new DrawingPath (); p.Rectangle (15, 15, 20, 20); p.Rectangle (20, 20, 10, 10); context.AppendPath (p); context.Stroke (); context.Rotate (15); context.AppendPath (p); context.Stroke (); CheckImage ("DrawPathTwoTimes.png"); }
void DrawGradientButton(Xwt.Drawing.Context G, GradientButton B) { DrawingPath P = new DrawingPath(); P.Rectangle(new Xwt.Rectangle(B.Position, B.Size)); LinearGradient gr; G.AppendPath(P); Pattern pat = gr = new LinearGradient(B.Position.X, B.Position.Y, B.Position.X + B.Size.Width, B.Position.Y + B.Size.Height); gr.AddColorStop(0, B.Color.BlendWith(Colors.White, 0.8)); gr.AddColorStop(0.5, B.Color); gr.AddColorStop(1, B.Color.BlendWith(Colors.White, 0.8)); G.Pattern = pat; G.Fill(); G.AppendPath(P); G.SetColor(Xwt.Drawing.Colors.Black); G.SetLineWidth(1); G.Stroke(); TextLayout L = new TextLayout() { Font = B.Font, Text = B.Text }; Size TextSize = new Size(0.6 * L.Font.Size * L.Text.Count(), L.Font.Size); G.DrawTextLayout(L, new Xwt.Point(B.Position.X + B.Size.Width / 2 - TextSize.Width / 2, B.Position.Y + B.Size.Height / 2 - TextSize.Height / 2)); }
public void DrawingPathPointInFill() { DrawingPath p = new DrawingPath (); p.Rectangle (10, 10, 20, 20); Assert.IsTrue (p.IsPointInFill (15, 15)); Assert.IsFalse (p.IsPointInFill (9, 9)); }