Ejemplo n.º 1
0
 public void EnsureStrokeSamplesUpdated()
 {
     using (this.rwLock.UseWriteLock())
     {
         int num;
         if (this.strokePath.Points.Count == 0)
         {
             num = 0;
         }
         else
         {
             double d    = this.strokePath.Length / this.stampSpacingPx;
             int    num4 = (int)Math.Floor(d);
             num = num4 + 1;
         }
         for (int i = this.strokeSamples.Count; i < num; i++)
         {
             double            length        = i * this.stampSpacingPx;
             PointDouble       pointAtLength = this.strokePath.GetPointAtLength(length);
             BrushStrokeSample item          = new BrushStrokeSample(pointAtLength, 1.0);
             this.strokeSamples.Add(item);
             SizeDouble   size   = new SizeDouble(this.stampSize.Width * item.StampScale, this.stampSize.Height * item.StampScale);
             RectDouble   bounds = RectDouble.FromCenter(item.Center, size);
             Sprite <int> sprite = new Sprite <int>(bounds, i);
             this.spriteTileSorter.Add(sprite);
         }
     }
 }
Ejemplo n.º 2
0
        private static RectDouble GetClipGeometryRect(double radius)
        {
            double num        = 2.0 * (radius - 3.0);
            double edgeLength = Math.Max(0.0, num);

            return(RectDouble.FromCenter(PointDouble.Zero, edgeLength));
        }
Ejemplo n.º 3
0
        protected override SegmentedList <PointDouble> CreateShape(SegmentedList <PointDouble> tracePoints)
        {
            RectDouble  num5;
            PointDouble a    = tracePoints[0];
            PointDouble b    = tracePoints[tracePoints.Count - 1];
            PointDouble num3 = new PointDouble(b.X - a.X, b.Y - a.Y);
            double      num4 = Math.Sqrt((num3.X * num3.X) + (num3.Y * num3.Y));

            if ((base.ModifierKeys & Keys.Shift) != Keys.None)
            {
                PointDouble center = new PointDouble((a.X + b.X) / 2.0, (a.Y + b.Y) / 2.0);
                double      num7   = num4 / 2.0;
                num5 = RectDouble.FromCenter(center, (double)(num7 * 2.0));
            }
            else
            {
                num5 = RectDoubleUtil.FromPixelPoints(a, b);
            }
            PdnGraphicsPath path = new PdnGraphicsPath();

            path.AddEllipse(num5.ToGdipRectangleF());
            using (Matrix matrix = new Matrix())
            {
                path.Flatten(matrix, 0.1f);
            }
            SegmentedList <PointDouble> list = new SegmentedList <PointDouble>(path.PathPoints.Select <PointF, PointDouble>(pt => pt.ToDoublePoint()), 7);

            path.Dispose();
            return(list);
        }
Ejemplo n.º 4
0
        public bool IsPointTouchingHandle(CanvasView canvasView, PointDouble canvasPt)
        {
            base.VerifyAccess();
            double      canvasHairWidth = canvasView.CanvasHairWidth;
            PointDouble center          = this.handleTransform.Transform(this.handleLocation) + ((PointDouble)(this.handleLocationScreenOffset * canvasHairWidth));
            double      edgeLength      = this.handleDiameter * canvasHairWidth;

            return(RectDouble.FromCenter(center, edgeLength).Contains(canvasPt));
        }
Ejemplo n.º 5
0
        private RectDouble GetHandleCanvasRect(CanvasView canvasView)
        {
            double      canvasHairWidth = canvasView.CanvasHairWidth;
            double      num2            = canvasHairWidth * this.handleDiameter;
            double      num3            = num2 / 2.0;
            PointDouble center          = this.handleTransform.Transform(this.handleLocation) + ((PointDouble)(this.handleLocationScreenOffset * canvasHairWidth));

            return(RectDouble.FromCenter(center, (double)((num3 + canvasHairWidth) * 2.0)));
        }
Ejemplo n.º 6
0
        public RectDouble GetBounds(SizeDouble stampSize)
        {
            SizeDouble size = new SizeDouble(stampSize.Width * this.stampScale, stampSize.Height * this.stampScale);

            return(RectDouble.FromCenter(this.center, size));
        }
Ejemplo n.º 7
0
 private RectDouble GetGeometryRect(double radius) =>
 RectDouble.FromCenter(PointDouble.Zero, (double)(radius * 2.0));