Beispiel #1
0
        public void FillPie(Brush brush, System.Drawing.Rectangle rect, float startAngleDeg, float endAngleDeg)
        {
            SolidBrush solidBrush = brush as SolidBrush;
            // throw new NotImplementedException();
            double originX = (rect.Left + rect.Right) / 2.0;
            double originY = (rect.Top + rect.Bottom) / 2.0;
            double radiusX = (rect.Height) / 2.0;
            double radiusY = (rect.Width) / 2.0;

            IVertexSource arcpath;

            if (Math.Abs (endAngleDeg - startAngleDeg) >= 360.0) {
                // if it's a full circle, we don't need to connect to the origin
                arcpath = new arc(originX,originY,radiusX,radiusY,DegreesToRadians(startAngleDeg),DegreesToRadians(endAngleDeg),moveToStart:true);
            } else {
                // if it's a partial arc, we need to connect to the origin
                var path = new PathStorage();
                path.MoveTo(originX,originY);
                path.concat_path(new arc(originX,originY,radiusX,radiusY,DegreesToRadians(startAngleDeg),DegreesToRadians(endAngleDeg),moveToStart:false));
                path.LineTo(originX,originY);
                arcpath = path;
            }

            _InternalRender(arcpath, new RGBA_Bytes((uint)solidBrush.Color.ToArgb()));
        }
Beispiel #2
0
        public void DrawArc(Pen pen, System.Drawing.Rectangle rect, float startAngleDeg, float endAngleDeg)
        {
            // throw new NotImplementedException();
            double originX = (rect.Left + rect.Right) / 2.0;
            double originY = (rect.Top + rect.Bottom) / 2.0;
            double radiusX = (rect.Height) / 2.0;
            double radiusY = (rect.Width) / 2.0;

            var arcshape = new arc(
                originX,originY,
                radiusX,radiusY,
                DegreesToRadians(startAngleDeg),DegreesToRadians(endAngleDeg)
                );
            var stroke = new Stroke(arcshape,pen.Width);

            _InternalRender(stroke, new RGBA_Bytes((uint)pen.Color.ToArgb()) );
        }