Пример #1
0
 public LLMarker(DrawStyle style, PointT point, Coord radius, MarkerPolygon type)
     : base(style)
 {
     Point  = point;
     Radius = radius;
     Type   = type;
 }
Пример #2
0
        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;
            }
        }
Пример #3
0
        /// <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);
                }
            }
        }
Пример #4
0
 public LLTextShape(DrawStyle style, string text, StringFormat justify, PointT location, VectorT?maxSize = null)
     : base(style)
 {
     Text = text; Justify = justify ?? Justify; Location = location; MaxSize = maxSize;
 }
Пример #5
0
 public LLTextShape(DrawStyle style) : base(style)
 {
 }
Пример #6
0
 public LLShape(DrawStyle style)
 {
     ZOrder  = NextZOrder++;
     Style   = style ?? DefaultStyle;
     Opacity = 255;
 }
Пример #7
0
 LLQuadraticCurve(DrawStyle style, IList <PointT> points) : base(style)
 {
     _points = points ?? EmptyList <PointT> .Value;
 }
Пример #8
0
 public LLPolygon(DrawStyle style, IList <PointT> points, IList <int> divisions = null) : base(style, points)
 {
     _divisions = divisions ?? EmptyList <int> .Value;
 }
Пример #9
0
 public LLEllipse(DrawStyle style, BoundingBoxT rect) : base(style, rect)
 {
 }
Пример #10
0
 public LLRectangle(DrawStyle style, BoundingBoxT rect) : base(style)
 {
     Rect = rect;
 }
Пример #11
0
 public LLPolyline(DrawStyle style, IList <PointT> points) : base(style)
 {
     _points = points;
 }
Пример #12
0
 public LLMarkerRotated(DrawStyle style, PointT point, Coord radius, MarkerPolygon type, Coord angleDeg) : base(style, point, radius, type)
 {
     AngleDeg = angleDeg;
 }
Пример #13
0
 public LLShapeGroup(DrawStyle basis = null) : base(basis)
 {
 }