Beispiel #1
0
        public override RectD TransformBounds(RectD r1)
        {
            InternalPointD tmp0 = new InternalPointD(r1.Left, r1.Top);
            InternalPointD tmp1 = new InternalPointD(r1.Right, r1.Top);
            InternalPointD tmp2 = new InternalPointD(r1.Right, r1.Bottom);
            InternalPointD tmp3 = new InternalPointD(r1.Left, r1.Bottom);

            affine.Transform(ref tmp0.X, ref tmp0.Y);
            affine.Transform(ref tmp1.X, ref tmp1.Y);
            affine.Transform(ref tmp2.X, ref tmp2.Y);
            affine.Transform(ref tmp3.X, ref tmp3.Y);


            //_tmp2[0] = new System.Drawing.PointF((float)r1.Left, (float)r1.Top);
            //_tmp2[1] = new System.Drawing.PointF((float)r1.Right, (float)r1.Top);
            //_tmp2[2] = new System.Drawing.PointF((float)r1.Right, (float)r1.Bottom);
            //_tmp2[3] = new System.Drawing.PointF((float)r1.Left, (float)r1.Bottom);
            ////find a new bound

            //return new RectD(_tmp2[0].X, _tmp2[0].Y, _tmp2[2].X - _tmp[0].X, _tmp2[2].Y - _tmp2[1].Y);

            return(new RectD(tmp0.X, tmp0.Y, tmp2.X - tmp0.X, tmp2.Y - tmp1.Y));
        }
 /// <summary>
 /// Creates a new cropped WriteableBitmap.
 /// </summary>
 /// <param name="bmp">The WriteableBitmap.</param>
 /// <param name="region">The rectangle that defines the crop region.</param>
 /// <returns>A new WriteableBitmap that is a cropped version of the input.</returns>
 public static BitmapBuffer Crop(this BitmapBuffer bmp, RectD region)
 {
     return(bmp.Crop((int)region.X, (int)region.Y, (int)region.Width, (int)region.Height));
 }
Beispiel #3
0
        /// <summary>
        ///	Intersect Method
        /// </summary>
        ///
        /// <remarks>
        ///	Replaces the Rectangle with the intersection of itself
        ///	and another Rectangle.
        /// </remarks>

        public void Intersect(RectD rect)
        {
            this = RectD.Intersect(this, rect);
        }
Beispiel #4
0
 private bool IntersectsWithInclusive(RectD r)
 {
     return(!((Left > r.Right) || (Right < r.Left) ||
              (Top > r.Bottom) || (Bottom < r.Top)));
 }
Beispiel #5
0
 public abstract RectD TransformBounds(RectD r1);