protected override void OnRender(IDrawingContext context, Rect bounds, double opacity) { base.OnRender(context, bounds, opacity); Image image = WpfElement as Image; DrawingStyle style = DrawingStyle.FromElement(this); style.Opacity = opacity; context.DrawImage(bounds, image.Source as BitmapSource, style); }
protected override void OnRender(IDrawingContext context, Rect bounds, double opacity) { base.OnRender(context, bounds, opacity); Line line = WpfElement as Line; DrawingStyle style = DrawingStyle.FromElement(this); style.Stroke = line.Stroke; style.StrokeThickness = new Thickness(line.StrokeThickness); style.Opacity = opacity; context.DrawLine(bounds, new Point(line.X1, line.Y1), new Point(line.X2, line.Y2), style); }
protected override void OnRender(IDrawingContext context, Rect bounds, double opacity) { base.OnRender(context, bounds, opacity); Path path = WpfElement as Path; DrawingStyle style = DrawingStyle.FromElement(this); style.Fill = path.Fill; style.Stroke = path.Stroke; style.StrokeThickness = new Thickness(path.StrokeThickness); style.Opacity = opacity; context.DrawGeometry(bounds, path.Data, style); }
protected override void OnRender(IDrawingContext context, Rect bounds, double opacity) { base.OnRender(context, bounds, opacity); Rectangle rectangle = WpfElement as Rectangle; DrawingStyle style = DrawingStyle.FromElement(this); style.Fill = rectangle.Fill; style.Stroke = rectangle.Stroke; style.StrokeThickness = new Thickness(rectangle.StrokeThickness); style.Opacity = opacity; context.DrawRect(bounds, style); }
protected override void OnRender(IDrawingContext context, Rect bounds, double opacity) { base.OnRender(context, bounds, opacity); Ellipse ellipse = WpfElement as Ellipse; DrawingStyle style = DrawingStyle.FromElement(this); style.Fill = ellipse.Fill; style.Stroke = ellipse.Stroke; style.StrokeThickness = new Thickness(ellipse.StrokeThickness); style.Opacity = opacity; context.DrawEllipse(bounds, style); }
protected override void OnRender(IDrawingContext context, Rect bounds, double opacity) { base.OnRender(context, bounds, opacity); TextBlock textBlock = WpfElement as TextBlock; DrawingStyle style = DrawingStyle.FromElement(this); style.Fill = textBlock.Foreground; style.FontFamily = textBlock.FontFamily; style.FontSize = textBlock.FontSize; style.FontStyle = textBlock.FontStyle; style.FontWeight = textBlock.FontWeight; style.Opacity = opacity; context.DrawText(bounds, textBlock.Text, style); }
protected override void OnRender(IDrawingContext context, Rect bounds, double opacity) { base.OnRender(context, bounds, opacity); Polygon polygon = WpfElement as Polygon; if (polygon.Points != null) { DrawingStyle style = DrawingStyle.FromElement(this); style.Fill = polygon.Fill; style.Stroke = polygon.Stroke; style.StrokeThickness = new Thickness(polygon.StrokeThickness); style.Opacity = opacity; context.DrawPolygon(bounds, polygon.Points.ToArray(), style); } }
protected override void OnRender(IDrawingContext context, Rect bounds, double opacity) { base.OnRender(context, bounds, opacity); Border border = WpfElement as Border; DrawingStyle style = DrawingStyle.FromElement(this); style.CornerRadius = border.CornerRadius; style.Fill = border.Background; style.Stroke = border.BorderBrush; style.StrokeThickness = border.BorderThickness; style.Opacity = opacity; context.DrawRect(bounds, style); if (border.ClipToBounds) { context.ClipRect(bounds, border.CornerRadius); } }