コード例 #1
0
ファイル: GenericControlHelper.cs プロジェクト: pascalfr/MPfm
        public static CGPath ToCGPath(BasicPath path)
        {
            // TODO: We assume for now that only path lines can exist. 
            var linePoints = new List<PointF>();
            foreach (var item in path.Items)
            {
                if (item is BasicPathLine)
                {
                    var line = item as BasicPathLine;
                    linePoints.Add(ToPoint(line.PointA));
                    linePoints.Add(ToPoint(line.PointB));
                }
            }

            var cgPath = new CGPath();
            cgPath.AddLines(linePoints.ToArray());
            return cgPath;
        }
コード例 #2
0
		public void DrawPath(BasicPath path, BasicBrush brush, BasicPen pen)
		{
		}
コード例 #3
0
 public void DrawPath(BasicPath path, BasicBrush brush, BasicPen pen)
 {
     throw new NotImplementedException();
 }
コード例 #4
0
 public void DrawPath(BasicPath path, BasicBrush brush, BasicPen pen)
 {
     // TODO: Add pen
     var cgPath = GenericControlHelper.ToCGPath(path);
     var color = GenericControlHelper.ToCGColor(brush.Color);
     CoreGraphicsHelper.FillPath(Context, cgPath, color);
 }
コード例 #5
0
ファイル: ProgressBarControl.cs プロジェクト: pascalfr/MPfm
        public void Render(IGraphicsContext context)
        {
            Frame = new BasicRectangle(0, 0, context.BoundsWidth, context.BoundsHeight);
            var rectBackground = new BasicRectangle(0, 0, context.BoundsWidth, context.BoundsHeight);
            context.DrawRectangle(rectBackground, _brushBackground, _penTransparent);

            if (_isIndeterminate)
            {
                var rectForeground = new BasicRectangle(0, 0, context.BoundsWidth, context.BoundsHeight);
                context.DrawRectangle(rectForeground, _brushForeground, _penTransparent);

                const int pixelsPerIteration = 1;
                float inclination = 15 * context.Density;
                float barSize = 20 * context.Density;
                float widthBetweenBars = 0;//2 * context.Density;
                float totalBarWidth = barSize + inclination + widthBetweenBars;
                int barCount = (int)Math.Ceiling(context.BoundsWidth / totalBarWidth);
                for (int a = -1; a < barCount + 1; a++) // bleed paths out of bounds partially visible
                {
                    float offset = (_animationCounter % totalBarWidth) * pixelsPerIteration;
                    float x = (a * totalBarWidth) + offset;
                    var path = new BasicPath();
                    path.AddLine(new BasicPathLine(new BasicPoint(x, context.BoundsHeight), new BasicPoint(x + barSize, context.BoundsHeight)));
                    path.AddLine(new BasicPathLine(new BasicPoint(x + barSize, context.BoundsHeight), new BasicPoint(x + barSize + inclination, 0)));
                    path.AddLine(new BasicPathLine(new BasicPoint(x + barSize + inclination, 0), new BasicPoint(x + inclination, 0)));
                    path.AddLine(new BasicPathLine(new BasicPoint(x + inclination, 0), new BasicPoint(x, context.BoundsHeight)));
                    context.DrawPath(path, _brushIndeterminateForeground, _penTransparent);
                }
            } 
            else
            {
                var rectForeground = new BasicRectangle(0, 0, _value * context.BoundsWidth, context.BoundsHeight);
                context.DrawRectangle(rectForeground, _brushForeground, _penTransparent);
            }
        }