示例#1
0
        public bool IsVisible(Rectangle_ rect)
        {
            bool result;

            Status status = GDIPlus.GdipIsVisibleRegionRectI(nativeRegion, rect.X, rect.Y,
                                                             rect.Width, rect.Height, IntPtr.Zero, out result);

            GDIPlus.CheckStatus(status);

            return(result);
        }
示例#2
0
        public bool IsVisible(Rectangle_ rect, Graphics g)
        {
            IntPtr ptr = (g == null) ? IntPtr.Zero : g.NativeObject;
            bool   result;

            Status status = GDIPlus.GdipIsVisibleRegionRectI(nativeRegion, rect.X, rect.Y,
                                                             rect.Width, rect.Height, ptr, out result);

            GDIPlus.CheckStatus(status);

            return(result);
        }
示例#3
0
        public TextureBrush(Image image, Rectangle_ dstRect, ImageAttributes imageAttr)
        {
            if (image == null)
            {
                throw new ArgumentNullException("image");
            }

            IntPtr attr   = imageAttr == null ? IntPtr.Zero : imageAttr.NativeObject;
            Status status = GDIPlus.GdipCreateTextureIAI(image.nativeObject, attr, dstRect.X, dstRect.Y,
                                                         dstRect.Width, dstRect.Height, out nativeObject);

            GDIPlus.CheckStatus(status);
        }
示例#4
0
        /// <summary>
        ///	Intersect Shared Method
        /// </summary>
        ///
        /// <remarks>
        ///	Produces a new Rectangle_ by intersecting 2 existing
        ///	Rectangles. Returns null if there is no	intersection.
        /// </remarks>

        public static Rectangle_ Intersect(Rectangle_ a, Rectangle_ b)
        {
            // MS.NET returns a non-empty Rectangle_ if the two rectangles
            // touch each other
            if (!a.IntersectsWithInclusive(b))
            {
                return(Empty);
            }

            return(Rectangle_.FromLTRB(
                       Math.Max(a.Left, b.Left),
                       Math.Max(a.Top, b.Top),
                       Math.Min(a.Right, b.Right),
                       Math.Min(a.Bottom, b.Bottom)));
        }
示例#5
0
        //
        // GetBounds
        //
        public RectangleF_ GetBounds(Graphics g)
        {
            if (g == null)
            {
                throw new ArgumentNullException("g");
            }

            RectangleF_ rect = new Rectangle_();

            Status status = GDIPlus.GdipGetRegionBounds(nativeRegion, g.NativeObject, ref rect);

            GDIPlus.CheckStatus(status);

            return(rect);
        }
示例#6
0
        public TextureBrush(Image image, WrapMode wrapMode, Rectangle_ dstRect)
        {
            if (image == null)
            {
                throw new ArgumentNullException("image");
            }
            if ((wrapMode < WrapMode.Tile) || (wrapMode > WrapMode.Clamp))
            {
                throw new InvalidEnumArgumentException("WrapMode");
            }

            Status status = GDIPlus.GdipCreateTexture2I(image.nativeObject, wrapMode, dstRect.X, dstRect.Y,
                                                        dstRect.Width, dstRect.Height, out nativeObject);

            GDIPlus.CheckStatus(status);
        }
        public BufferedGraphics Allocate(Graphics targetGraphics, Rectangle_ targetRectangle)
        {
            BufferedGraphics graphics = new BufferedGraphics(targetGraphics, targetRectangle);

            return(graphics);
        }
示例#8
0
 private bool IntersectsWithInclusive(Rectangle_ r)
 {
     return(!((Left > r.Right) || (Right < r.Left) ||
              (Top > r.Bottom) || (Bottom < r.Top)));
 }
示例#9
0
        /// <summary>
        ///	IntersectsWith Method
        /// </summary>
        ///
        /// <remarks>
        ///	Checks if a Rectangle_ intersects with this one.
        /// </remarks>

        public bool IntersectsWith(Rectangle_ rect)
        {
            return(!((Left >= rect.Right) || (Right <= rect.Left) ||
                     (Top >= rect.Bottom) || (Bottom <= rect.Top)));
        }
示例#10
0
        /// <summary>
        ///	Contains Method
        /// </summary>
        ///
        /// <remarks>
        ///	Checks if a Rectangle_ lies entirely within this
        ///	Rectangle.
        /// </remarks>

        public bool Contains(Rectangle_ rect)
        {
            return(rect == Intersect(this, rect));
        }
示例#11
0
        /// <summary>
        ///	Intersect Method
        /// </summary>
        ///
        /// <remarks>
        ///	Replaces the Rectangle_ with the intersection of itself
        ///	and another Rectangle.
        /// </remarks>

        public void Intersect(Rectangle_ rect)
        {
            this = Rectangle_.Intersect(this, rect);
        }
示例#12
0
 public TextureBrush(Image image, Rectangle_ dstRect) :
     this(image, WrapMode.Tile, dstRect)
 {
 }
示例#13
0
        public Region(Rectangle_ rect)
        {
            Status status = GDIPlus.GdipCreateRegionRectI(ref rect, out nativeRegion);

            GDIPlus.CheckStatus(status);
        }
示例#14
0
        public void Xor(Rectangle_ rect)
        {
            Status status = GDIPlus.GdipCombineRegionRectI(nativeRegion, ref rect, CombineMode.Xor);

            GDIPlus.CheckStatus(status);
        }
 public BufferedGraphics Allocate(IntPtr targetDC, Rectangle_ targetRectangle)
 {
     throw new NotImplementedException();
 }
示例#16
0
        public BitmapData LockBits(Rectangle_ rect, ImageLockMode flags, PixelFormat format)
        {
            BitmapData result = new BitmapData();

            return(LockBits(rect, flags, format, result));
        }
 internal BufferedGraphics(Graphics targetGraphics, Rectangle_ targetRectangle)
 {
     size   = targetRectangle;
     target = targetGraphics;
     membmp = new Bitmap(size.Width, size.Height);
 }