本文整理汇总了C#中System.Windows.Media.DrawingContext.Pop方法的典型用法代码示例。如果您正苦于以下问题:C# DrawingContext.Pop方法的具体用法?C# DrawingContext.Pop怎么用?C# DrawingContext.Pop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.DrawingContext
的用法示例。
在下文中一共展示了DrawingContext.Pop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnRender
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
drawingContext.PushTransform(new TranslateTransform(AdornedElement.RenderSize.Width - 14, (AdornedElement.RenderSize.Height - 18) / 2.0));
drawingContext.DrawGeometry(ArrowBrush, null, sda_render_geometry);
drawingContext.Pop();
}
示例2: DrawPointElement
protected override void DrawPointElement(DrawingContext dc, int Zoom)
{
dc.DrawLine(new Pen(Brushes.Black, 2), new Point(), new Point(0, -BodyOffset));
dc.PushTransform(new TranslateTransform(0, - 0.5 * BodyHeight - BodyOffset));
dc.DrawRectangle(Brushes.Black, null,
new Rect(-0.5 * BodyWidth, -0.5 * BodyHeight, BodyWidth, BodyHeight));
for (int i = 0; i < Lights.Length; i++)
dc.DrawEllipse(Lights[i], null, new Point(0, (2 + LightRadius + 1) * (i - 1)), LightRadius, LightRadius);
dc.PushTransform(new TranslateTransform(0.5 * BodyWidth + 2, -0.5 * BodyHeight));
if (Zoom > 11)
{
PrintStack(dc,
new FormattedText(Target.Name, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Verdana"), 10, Brushes.Black),
new FormattedText(OrdinateString, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Verdana"), 8, Brushes.Blue));
}
dc.Pop();
dc.Pop();
}
示例3: drawLimb
public void drawLimb(DrawingContext dc, Point p1, Point p2, int margin)
{
dc.PushTransform(new TranslateTransform(p1.X, p1.Y));
Vector diff = p2 - p1;
diff.Normalize();
double angle = Math.Acos(diff.Y) * (180.0 / Math.PI);
if (Double.IsNaN(angle))
angle = 0;
if (Double.IsNaN(diff.X))
diff.X = 0;
dc.PushTransform(new RotateTransform(Math.Sign(diff.X) * (-1) * angle));
Vector diff2 = p2 - p1;
double scale = diff2.Length / (this.Height - 2 * margin);
dc.PushTransform(new ScaleTransform(1, scale));
dc.PushTransform(new TranslateTransform(-this.Width / 2.0, -margin));
dc.DrawImage(this.Image, new Rect(0, 0, this.Width, this.Height));
dc.Pop();
dc.Pop();
dc.Pop();
dc.Pop();
}
示例4: InnerDraw
protected override void InnerDraw(DrawingContext drawingContext)
{
drawingContext.PushTransform(_translateTransform);
drawingContext.PushTransform(_rotateTransform);
base.InnerDraw(drawingContext);
drawingContext.Pop();
drawingContext.Pop();
}
示例5: DrawTriangle
private void DrawTriangle(DrawingContext drawingContext, Point origin, double rotation)
{
drawingContext.PushTransform(new TranslateTransform(origin.X, origin.Y));
drawingContext.PushTransform(new RotateTransform(rotation));
drawingContext.DrawGeometry(m_Pen.Brush, null, m_Triangle);
drawingContext.Pop();
drawingContext.Pop();
}
示例6: RenderHeader
/// <summary>This method performs the actual render operation to show a text label</summary>
/// <param name="dc">Drawing context</param>
/// <param name="info">Render info</param>
/// <param name="scale">The scale.</param>
/// <param name="offset">The offset.</param>
public virtual void RenderHeader(DrawingContext dc, AutoHeaderTextRenderInfo info, double scale, Point offset)
{
dc.PushTransform(new TranslateTransform(offset.X, offset.Y));
dc.PushTransform(new ScaleTransform(scale, scale));
dc.PushClip(new RectangleGeometry(info.RenderRect));
info.FormattedText.SetMaxTextWidths(new[] { info.RenderRect.Width });
info.FormattedText.MaxLineCount = 1;
info.FormattedText.Trimming = TextTrimming.CharacterEllipsis;
dc.DrawText(info.FormattedText, info.RenderRect.TopLeft);
dc.Pop();
dc.Pop();
dc.Pop();
}
示例7: InnerDraw
//private const int Margin = 3;
protected override void InnerDraw(DrawingContext drawingContext)
{
base.InnerDraw(drawingContext);
if (_scaleTransform != null)
drawingContext.PushTransform(_scaleTransform);
if (_clipGeometry != null)
drawingContext.PushClip(_clipGeometry);
drawingContext.DrawDrawing(_textDrawing);
if (_clipGeometry != null)
drawingContext.Pop();
if (_scaleTransform != null)
drawingContext.Pop();
}
示例8: OnRender
protected override void OnRender(DrawingContext drawingContext)
{
AnimationControl();
var width = Width < 1 ? 1 : Width;
drawingContext.PushTransform(new TranslateTransform(RenderSize.Width / 2, RenderSize.Height / 2));
for (int i = 0; i < c_Blobs; i++)
{
drawingContext.PushTransform(new RotateTransform((360 / c_Blobs) * i));
drawingContext.DrawRectangle(m_Brushes[i], null, new Rect(0, width / 4.25, width / 16.0, width / 4.0));
drawingContext.Pop();
}
drawingContext.Pop();
}
示例9: RenderBackground
/// <summary>This method draws a rectangular background around a group of elements</summary>
/// <param name="dc">The drawing context.</param>
/// <param name="info">Render info</param>
/// <param name="scale">The scale.</param>
/// <param name="offset">The offset.</param>
public virtual void RenderBackground(DrawingContext dc, GroupBackgroundRenderInfo info, double scale, Point offset)
{
dc.PushTransform(new TranslateTransform(offset.X, offset.Y));
dc.PushTransform(new ScaleTransform(scale, scale));
dc.DrawRectangle(info.Background, null, info.RenderRect);
if (info.Border != null && info.BorderWidth > 0)
{
var rect2 = new Rect(info.RenderRect.X + (info.BorderWidth/2),
info.RenderRect.Y + (info.BorderWidth/2),
info.RenderRect.Width + info.BorderWidth,
info.RenderRect.Height + info.BorderWidth);
dc.DrawRectangle(null, new Pen(info.Border, info.BorderWidth), rect2);
}
dc.Pop();
dc.Pop();
}
示例10: OnRender
protected override void OnRender(DrawingContext drawingContext)
{
PushButton pushButton = Visual as PushButton;
if (pushButton.Pushed && _pushedImage != null)
{
drawingContext.DrawImage(_pushedImage, _imageRect);
}
else if (_image != null)
{
drawingContext.DrawImage(_image, _imageRect);
}
if (pushButton.Pushed)
{
drawingContext.PushTransform(new TranslateTransform(pushButton.TextPushOffset.X, pushButton.TextPushOffset.Y));
}
if (pushButton.Glyph != PushButtonGlyph.None)
{
drawingContext.DrawGeometry(_glyphBrush, _glyphPen, _glyphPath);
}
pushButton.TextFormat.RenderText(drawingContext, _textBrush, pushButton.Text, _imageRect);
if (pushButton.Pushed)
{
drawingContext.Pop();
}
}
示例11: InnerDraw
protected override void InnerDraw(DrawingContext drawingContext)
{
base.InnerDraw(drawingContext);
drawingContext.PushTransform(_scaleTransform);
drawingContext.DrawDrawing(_textDrawing);
drawingContext.Pop();
}
示例12: RenderImportanceArrow
private void RenderImportanceArrow(DrawingContext dc, FrameworkElement mostImportant, FrameworkElement leastImportant)
{
var startPoint = FindPoint(mostImportant, new Point(mostImportant.ActualWidth/2, mostImportant.ActualHeight));
var endPoint = FindPoint(leastImportant, new Point(leastImportant.ActualWidth/2, 0));
var vector = Point.Subtract(endPoint, startPoint);
var midPoint = Point.Add(startPoint, Vector.Multiply(vector, 0.66));
Transform arrowTransform = Transform.Identity;
double angle;
if (Math.Abs((angle = Vector.AngleBetween(vector, new Vector(0, -1))) - 0) > double.Epsilon)
{
arrowTransform = new RotateTransform(angle, midPoint.X, midPoint.Y);
}
var line = BuildPath.From(startPoint).LineTo(endPoint.X, endPoint.Y).Build();
var arrow = BuildPath.From(midPoint.X - 3, midPoint.Y - 3).LineTo(midPoint.X, midPoint.Y)
.LineTo(midPoint.X + 3, midPoint.Y - 3).Build();
dc.DrawGeometry(null, _pen, line);
dc.PushTransform(arrowTransform);
dc.DrawGeometry(null, _pen, arrow);
dc.Pop();
}
示例13: Draw
public void Draw(LayerPropertiesModel props, LayerPropertiesModel applied, DrawingContext c)
{
if (applied?.Brush == null)
return;
const int scale = 4;
// Set up variables for this frame
var rect = props.Contain
? new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale)
: new Rect(props.X*scale, props.Y*scale, props.Width*scale, props.Height*scale);
var clip = new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale);
// Take an offset of 4 to allow layers to slightly leave their bounds
var progress = (6.0 - props.AnimationProgress)*10.0;
if (progress < 0)
{
// Can't meddle with the original brush because it's frozen.
var brush = applied.Brush.Clone();
brush.Opacity = 1 + 0.025*progress;
if (brush.Opacity < 0)
brush.Opacity = 0;
if (brush.Opacity > 1)
brush.Opacity = 1;
applied.Brush = brush;
}
rect.Inflate(-rect.Width/100.0*progress, -rect.Height/100.0*progress);
clip.Inflate(-clip.Width/100.0*progress, -clip.Height/100.0*progress);
c.PushClip(new RectangleGeometry(clip));
c.DrawRectangle(applied.Brush, null, rect);
c.Pop();
}
示例14: ApplyFilter
protected override void ApplyFilter(FastBitmap source, DrawingContext dc, int width, int height)
{
Vector offsetSize = GetOffsetSize() + new Vector(Size, Size);
dc.PushTransform(new TranslateTransform(offsetSize.X, offsetSize.Y));
base.ApplyFilter(source, dc, width, height);
dc.Pop();
}
示例15: Draw
public void Draw(LayerModel layer, DrawingContext c)
{
// If an animation is present, let it handle the drawing
if (layer.LayerAnimation != null && !(layer.LayerAnimation is NoneAnimation))
{
layer.LayerAnimation.Draw(layer.Properties, layer.AppliedProperties, c);
return;
}
// Otherwise draw the rectangle with its layer.AppliedProperties dimensions and brush
var rect = layer.Properties.Contain
? new Rect(layer.AppliedProperties.X*4,
layer.AppliedProperties.Y*4,
layer.AppliedProperties.Width*4,
layer.AppliedProperties.Height*4)
: new Rect(layer.Properties.X*4,
layer.Properties.Y*4,
layer.Properties.Width*4,
layer.Properties.Height*4);
var clip = new Rect(layer.AppliedProperties.X*4, layer.AppliedProperties.Y*4,
layer.AppliedProperties.Width*4, layer.AppliedProperties.Height*4);
c.PushClip(new RectangleGeometry(clip));
c.DrawRectangle(layer.AppliedProperties.Brush, null, rect);
c.Pop();
}