public LLMarker(DrawStyle style, PointT point, Coord radius, MarkerPolygon type) : base(style) { Point = point; Radius = radius; Type = type; }
private void DrawLayers() { if (IsDesignTime) { _designStyle = _designStyle ?? new DrawStyle(); _designStyle.Font = Font; _designStyle.TextColor = ForeColor; if (_layers.Count != 0 && _layers.All(l => !l.Shapes.Any())) { _layers[0].Shapes = new LLShape[] { new LLTextShape(_designStyle, GetType().Name, null, new Point <float>(3, 3)) } } ; } try { Bitmap combined = null; for (int i = 0; i < _layers.Count; i++) { LLShapeLayer layer = _layers[i]; var bmp = layer.AutoDraw(combined, Width, Height); if (layer.UseAlpha && bmp != combined) { // Blit this layer onto the previous one if (combined == null) { // oops, bottom layer has an alpha channel combined = new Bitmap(bmp.Width, bmp.Height, PixelFormat.Format24bppRgb); var g_ = Graphics.FromImage(combined); g_.Clear(BackColor); g_.Dispose(); } var g = Graphics.FromImage(combined); g.DrawImage(bmp, new Point()); g.Dispose(); } else { combined = bmp; } } _completeFrame = combined; base.Invalidate(); } finally { _needRedraw = _drawPending = false; } }
/// <summary>Draws a polygon with holes.</summary> /// <param name="points">All points of all parts of the shape. Holes must /// wind in the opposite direction as the shape in which they are embedded.</param> /// <param name="divisions">Indexes of divisions between sub-polygons. Must be sorted.</param> protected static void DrawPolygon(Graphics g, DrawStyle style, IList <PointT> points, IList <int> divisions, byte opacity) { if (style.FillColor.A + style.LineColor.A == 0) { return; } Pen pen = style.Pen(opacity); Brush brush = style.Brush(opacity); if (divisions != null && divisions.Count != 0) { using (var gp = new GraphicsPath()) { AddPolygon(points, divisions, gp); if (style.OutlineBehindFill && style.LineColor.A > 0) { g.DrawPath(pen, gp); } if (style.FillColor.A > 0) { g.FillPath(brush, gp); } if (!style.OutlineBehindFill && style.LineColor.A > 0) { g.DrawPath(pen, gp); } } } else { var array = points.SelectArray(p => p.AsBCL()); if (style.OutlineBehindFill && style.LineColor.A > 0) { g.DrawPolygon(pen, array); } if (style.FillColor.A > 0) { g.FillPolygon(brush, array); } if (!style.OutlineBehindFill && style.LineColor.A > 0) { g.DrawPolygon(pen, array); } } }
public LLTextShape(DrawStyle style, string text, StringFormat justify, PointT location, VectorT?maxSize = null) : base(style) { Text = text; Justify = justify ?? Justify; Location = location; MaxSize = maxSize; }
public LLTextShape(DrawStyle style) : base(style) { }
public LLShape(DrawStyle style) { ZOrder = NextZOrder++; Style = style ?? DefaultStyle; Opacity = 255; }
LLQuadraticCurve(DrawStyle style, IList <PointT> points) : base(style) { _points = points ?? EmptyList <PointT> .Value; }
public LLPolygon(DrawStyle style, IList <PointT> points, IList <int> divisions = null) : base(style, points) { _divisions = divisions ?? EmptyList <int> .Value; }
public LLEllipse(DrawStyle style, BoundingBoxT rect) : base(style, rect) { }
public LLRectangle(DrawStyle style, BoundingBoxT rect) : base(style) { Rect = rect; }
public LLPolyline(DrawStyle style, IList <PointT> points) : base(style) { _points = points; }
public LLMarkerRotated(DrawStyle style, PointT point, Coord radius, MarkerPolygon type, Coord angleDeg) : base(style, point, radius, type) { AngleDeg = angleDeg; }
public LLShapeGroup(DrawStyle basis = null) : base(basis) { }