コード例 #1
0
ファイル: LLShapes.cs プロジェクト: modulexcite/ecsharp
 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
ファイル: LLShapes.cs プロジェクト: modulexcite/ecsharp
        /// <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
ファイル: LLShapes.cs プロジェクト: modulexcite/ecsharp
 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
ファイル: LLShapes.cs プロジェクト: modulexcite/ecsharp
 public LLTextShape(DrawStyle style) : base(style)
 {
 }
コード例 #6
0
ファイル: LLShapes.cs プロジェクト: modulexcite/ecsharp
 public LLShape(DrawStyle style)
 {
     ZOrder  = NextZOrder++;
     Style   = style ?? DefaultStyle;
     Opacity = 255;
 }
コード例 #7
0
ファイル: LLShapes.cs プロジェクト: modulexcite/ecsharp
 LLQuadraticCurve(DrawStyle style, IList <PointT> points) : base(style)
 {
     _points = points ?? EmptyList <PointT> .Value;
 }
コード例 #8
0
ファイル: LLShapes.cs プロジェクト: modulexcite/ecsharp
 public LLPolygon(DrawStyle style, IList <PointT> points, IList <int> divisions = null) : base(style, points)
 {
     _divisions = divisions ?? EmptyList <int> .Value;
 }
コード例 #9
0
ファイル: LLShapes.cs プロジェクト: modulexcite/ecsharp
 public LLEllipse(DrawStyle style, BoundingBoxT rect) : base(style, rect)
 {
 }
コード例 #10
0
ファイル: LLShapes.cs プロジェクト: modulexcite/ecsharp
 public LLRectangle(DrawStyle style, BoundingBoxT rect) : base(style)
 {
     Rect = rect;
 }
コード例 #11
0
ファイル: LLShapes.cs プロジェクト: modulexcite/ecsharp
 public LLPolyline(DrawStyle style, IList <PointT> points) : base(style)
 {
     _points = points;
 }
コード例 #12
0
ファイル: LLShapes.cs プロジェクト: modulexcite/ecsharp
 public LLMarkerRotated(DrawStyle style, PointT point, Coord radius, MarkerPolygon type, Coord angleDeg) : base(style, point, radius, type)
 {
     AngleDeg = angleDeg;
 }
コード例 #13
0
ファイル: LLShapes.cs プロジェクト: modulexcite/ecsharp
 public LLShapeGroup(DrawStyle basis = null) : base(basis)
 {
 }