/// <summary></summary> protected virtual void DrawGeometrySymbol(ScalableGeometry geometry, Point origin, Size size, Padding padding) { Debug.Assert(WpfDrawingContext != null); Point PaddedOrigin = origin.Moved(PagePadding.Left + padding.Left, PagePadding.Top + padding.Top); Size PaddedSize = new Size(size.Width - padding.Left - padding.Right, size.Height - padding.Top - padding.Bottom); Geometry GeometryAtOrigin = MoveAndScaleGeometry(geometry, PaddedOrigin, GeometryScalings.None, GeometryScalings.Stretch, PaddedSize); Brush ForegroundBrush = GetBrush(BrushSettings.Symbol); WpfDrawingContext.DrawGeometry(ForegroundBrush, null, GeometryAtOrigin); }
/// <summary></summary> protected virtual Geometry MoveAndScaleGeometry(ScalableGeometry geometry, Point origin, GeometryScalings widthScaling, GeometryScalings heightScaling, Size measuredSize) { double Width, Height; switch (widthScaling) { default: case GeometryScalings.None: Width = double.NaN; break; case GeometryScalings.Font: Width = WhitespaceWidth; break; case GeometryScalings.Stretch: Width = measuredSize.Width.Draw; break; } switch (heightScaling) { default: case GeometryScalings.None: Height = double.NaN; break; case GeometryScalings.Font: Height = LineHeight.Draw; break; case GeometryScalings.Stretch: Height = measuredSize.Height.Draw; break; } Geometry Result = geometry.Scaled(Width, Height); Result.Transform = new TranslateTransform(origin.X.Draw, origin.Y.Draw); Result.Freeze(); return(Result); }