当前位置: 首页>>代码示例>>C#>>正文


C# FastBitmap.GetBounds方法代码示例

本文整理汇总了C#中System.Drawing.FastBitmap.GetBounds方法的典型用法代码示例。如果您正苦于以下问题:C# FastBitmap.GetBounds方法的具体用法?C# FastBitmap.GetBounds怎么用?C# FastBitmap.GetBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.FastBitmap的用法示例。


在下文中一共展示了FastBitmap.GetBounds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Apply

        public void Apply(FastBitmap surface, Rectangle[] roi, int startIndex, int length)
        {
            Rectangle regionBounds = Utility.GetRegionBounds (roi, startIndex, length);

            if (regionBounds != Rectangle.Intersect (surface.GetBounds (), regionBounds))
                throw new ArgumentOutOfRangeException ("roi", "Region is out of bounds");

            unsafe {
                for (int x = startIndex; x < startIndex + length; ++x)
                    ApplyRectangle (surface, roi[x]);
            }
        }
开发者ID:garuma,项目名称:apachai,代码行数:12,代码来源:UnaryPixelOp.cs

示例2: ApplyBase

        /// <summary>
        /// Provides a default implementation for performing dst = F(dst, src) or F(src) over some rectangle 
        /// of interest. May be slightly faster than calling the other multi-parameter Apply method, as less 
        /// variables are used in the implementation, thus inducing less register pressure.
        /// </summary>
        /// <param name="dst">The Surface to write pixels to, and from which pixels are read and used as the lhs parameter for calling the method <b>PixelData Apply(PixelData, PixelData)</b>.</param>
        /// <param name="dstOffset">The pixel offset that defines the upper-left of the rectangle-of-interest for the dst Surface.</param>
        /// <param name="src">The Surface to read pixels from for the rhs parameter given to the method <b>PixelData Apply(PixelData, PixelData)</b>b>.</param></param>
        /// <param name="srcOffset">The pixel offset that defines the upper-left of the rectangle-of-interest for the src Surface.</param>
        /// <param name="roiSize">The size of the rectangles-of-interest for all Surfaces.</param>
        public void ApplyBase(FastBitmap dst, Point dstOffset, FastBitmap src, Point srcOffset, Size roiSize)
        {
            // Create bounding rectangles for each Surface
            Rectangle dstRect = new Rectangle (dstOffset, roiSize);

            if (dstRect.Width == 0 || dstRect.Height == 0)
                return;

            Rectangle srcRect = new Rectangle (srcOffset, roiSize);

            if (srcRect.Width == 0 || srcRect.Height == 0)
                return;

            // Clip those rectangles to those Surface's bounding rectangles
            Rectangle dstClip = Rectangle.Intersect (dstRect, dst.GetBounds ());
            Rectangle srcClip = Rectangle.Intersect (srcRect, src.GetBounds ());

            // If any of those Rectangles actually got clipped, then throw an exception
            if (dstRect != dstClip)
                throw new ArgumentOutOfRangeException
                (
                    "roiSize",
                    "Destination roi out of bounds" +
                    string.Format (", dst.Size=({0},{1}", dst.Width, dst.Height) +
                    ", dst.Bounds=" + dst.GetBounds ().ToString () +
                    ", dstOffset=" + dstOffset.ToString () +
                    string.Format (", src.Size=({0},{1}", src.Width, src.Height) +
                    ", srcOffset=" + srcOffset.ToString () +
                    ", roiSize=" + roiSize.ToString () +
                    ", dstRect=" + dstRect.ToString () +
                    ", dstClip=" + dstClip.ToString () +
                    ", srcRect=" + srcRect.ToString () +
                    ", srcClip=" + srcClip.ToString ()
                );

            if (srcRect != srcClip)
                throw new ArgumentOutOfRangeException ("roiSize", "Source roi out of bounds");

            // Cache the width and height properties
            int width = roiSize.Width;
            int height = roiSize.Height;

            // Do the work.
            unsafe {
                for (int row = 0; row < roiSize.Height; ++row) {
                    PixelData* dstPtr = dst.GetPointAddress (dstOffset.X, dstOffset.Y + row);
                    PixelData* srcPtr = src.GetPointAddress (srcOffset.X, srcOffset.Y + row);
                    Apply (dstPtr, srcPtr, width);
                }
            }
        }
开发者ID:garuma,项目名称:apachai,代码行数:61,代码来源:PixelOp.cs


注:本文中的System.Drawing.FastBitmap.GetBounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。