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


C# IImage.Width方法代码示例

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


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

示例1: copy_from

        public void copy_from(IImage src,
                       RectangleI rect_src_ptr,
                       int dx,
                       int dy)
        {
            RectangleI rsrc = new RectangleI(rect_src_ptr.x1, rect_src_ptr.y1, rect_src_ptr.x2 + 1, rect_src_ptr.y2 + 1);

            // Version with xdst, ydst (absolute positioning)
            //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1);

            // Version with dx, dy (relative positioning)
            RectangleI rdst = new RectangleI(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy);

            RectangleI rc = clip_rect_area(ref rdst, ref rsrc, (int)src.Width(), (int)src.Height());

            if (rc.x2 > 0)
            {
                int incy = 1;
                if (rdst.y1 > rsrc.y1)
                {
                    rsrc.y1 += rc.y2 - 1;
                    rdst.y1 += rc.y2 - 1;
                    incy = -1;
                }
                int getDistanceBetweenPixelsInclusive = src.GetDistanceBetweenPixelsInclusive();
                while (rc.y2 > 0)
                {
                    base.CopyFrom(src,
                                     rdst.x1, rdst.y1,
                                     rsrc.x1, rsrc.y1,
                                     rc.x2 * getDistanceBetweenPixelsInclusive);
                    rdst.y1 += incy;
                    rsrc.y1 += incy;
                    --rc.y2;
                }
            }
        }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:37,代码来源:ClippingProxy.cs

示例2: ImageBuffer

        public ImageBuffer(IImage image, IBlender blender, GammaLookUpTable gammaTable)
        {
            unsafe
            {
                AttachBuffer(image.GetBuffer(), image.Width(), image.Height(), image.StrideInBytes(), image.BitDepth, image.GetDistanceBetweenPixelsInclusive());
            }

            SetRecieveBlender(blender);
        }
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:9,代码来源:ImageBuffer.cs

示例3: LinkToImage

 public override void LinkToImage(IImage ren)
 {
     base.LinkToImage(ren);
     m_clip_box = new RectangleI(0, 0, (int)ren.Width() - 1, (int)ren.Height() - 1);
 }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:5,代码来源:ClippingProxy.cs

示例4: ImageClippingProxy

 public ImageClippingProxy(IImage ren)
     : base(ren)
 {
     m_clip_box = new RectangleI(0, 0, (int)ren.Width() - 1, (int)ren.Height() - 1);
 }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:5,代码来源:ClippingProxy.cs

示例5: CalculateRoiFromNormalizedBounds

        private static Rectangle CalculateRoiFromNormalizedBounds(Rect inputRect, IImage inputImage, int marginX = 0, int marginY = 0)
        {
            var width = inputImage.Width();
            var height = inputImage.Height();

            var offsetX = (int)(inputRect.X * width);
            var offsetY = (int)(inputRect.Y * height);

            var roiX = Math.Max(0, offsetX - marginX);
            var roiY = Math.Max(0, offsetY - marginY);
            var roiWidth = (int)Math.Min(width - roiX, inputRect.Width * width + 2 * marginX);
            var roiHeight = (int)Math.Min(height - roiY, inputRect.Height * height + 2 * marginY);

            return new Rectangle(
                    roiX,
                    roiY,
                    roiWidth,
                    roiHeight
                    );
        }
开发者ID:AlternateIf,项目名称:huddle-engine,代码行数:20,代码来源:FindDisplay.cs

示例6: DrawImage

        void DrawImage(IImage sourceImage,
            double DestX, double DestY,
            double HotspotOffsetX, double HotspotOffsetY,
            double ScaleX, double ScaleY,
            double AngleRad,
            RGBA_Bytes Color32,
            ref RectangleD pFinalBlitBounds,
            bool doDrawing,
            bool oneMinusSourceAlphaOne)
        {
            Affine destRectTransform = Affine.NewIdentity();

            if (HotspotOffsetX != 0.0f || HotspotOffsetY != 0.0f)
            {
                destRectTransform *= Affine.NewTranslation(-HotspotOffsetX, -HotspotOffsetY);
            }

            if (ScaleX != 1 || ScaleY != 1)
            {
                destRectTransform *= Affine.NewScaling(ScaleX, ScaleY);
            }

            if (AngleRad != 0)
            {
                destRectTransform *= Affine.NewRotation(AngleRad);
            }

            if (DestX != 0 || DestY != 0)
            {
                destRectTransform *= Affine.NewTranslation(DestX, DestY);
            }

            int SourceBufferWidth = (int)sourceImage.Width();
            int SourceBufferHeight = (int)sourceImage.Height();

            RectPath.Clear();

            RectPath.MoveTo(0, 0);
            RectPath.LineTo(SourceBufferWidth, 0);
            RectPath.LineTo(SourceBufferWidth, SourceBufferHeight);
            RectPath.LineTo(0, SourceBufferHeight);
            RectPath.ClosePolygon();


            // Calculate the bounds. LBB [10/5/2004]
            const int ERROR_ADD = 0;
            double BoundXDouble, BoundYDouble;
            BoundXDouble = 0; BoundYDouble = 0;
            destRectTransform.Transform(ref BoundXDouble, ref BoundYDouble);
            double BoundX = (double)BoundXDouble;
            double BoundY = (double)BoundYDouble;

            pFinalBlitBounds.Left = Math.Floor(BoundX - ERROR_ADD);
            pFinalBlitBounds.Right = Math.Ceiling(BoundX + ERROR_ADD);
            pFinalBlitBounds.Top = Math.Floor(BoundY - ERROR_ADD);
            pFinalBlitBounds.Bottom = Math.Ceiling(BoundY + ERROR_ADD);

            BoundXDouble = SourceBufferWidth; BoundYDouble = 0;
            destRectTransform.Transform(ref BoundXDouble, ref BoundYDouble);
            BoundX = (double)BoundXDouble;
            BoundY = (double)BoundYDouble;
            pFinalBlitBounds.Left = Math.Min((long)Math.Floor(BoundX - ERROR_ADD), pFinalBlitBounds.Left);
            pFinalBlitBounds.Right = Math.Max((long)Math.Ceiling(BoundX + ERROR_ADD), pFinalBlitBounds.Right);
            pFinalBlitBounds.Top = Math.Min((long)Math.Floor(BoundY - ERROR_ADD), pFinalBlitBounds.Top);
            pFinalBlitBounds.Bottom = Math.Max((long)Math.Ceiling(BoundY + ERROR_ADD), pFinalBlitBounds.Bottom);

            BoundXDouble = SourceBufferWidth; BoundYDouble = SourceBufferHeight;
            destRectTransform.Transform(ref BoundXDouble, ref BoundYDouble);
            BoundX = (double)BoundXDouble;
            BoundY = (double)BoundYDouble;
            pFinalBlitBounds.Left = Math.Min((long)Math.Floor(BoundX - ERROR_ADD), pFinalBlitBounds.Left);
            pFinalBlitBounds.Right = Math.Max((long)Math.Ceiling(BoundX + ERROR_ADD), pFinalBlitBounds.Right);
            pFinalBlitBounds.Top = Math.Min((long)Math.Floor(BoundY - ERROR_ADD), pFinalBlitBounds.Top);
            pFinalBlitBounds.Bottom = Math.Max((long)Math.Ceiling(BoundY + ERROR_ADD), pFinalBlitBounds.Bottom);

            BoundXDouble = 0; BoundYDouble = SourceBufferHeight;
            destRectTransform.Transform(ref BoundXDouble, ref BoundYDouble);
            BoundX = (double)BoundXDouble;
            BoundY = (double)BoundYDouble;
            pFinalBlitBounds.Left = Math.Min((long)Math.Floor(BoundX - ERROR_ADD), pFinalBlitBounds.Left);
            pFinalBlitBounds.Right = Math.Max((long)Math.Ceiling(BoundX + ERROR_ADD), pFinalBlitBounds.Right);
            pFinalBlitBounds.Top = Math.Min((long)Math.Floor(BoundY - ERROR_ADD), pFinalBlitBounds.Top);
            pFinalBlitBounds.Bottom = Math.Max((long)Math.Ceiling(BoundY + ERROR_ADD), pFinalBlitBounds.Bottom);

            if (!doDrawing)
            {
                return;
            }

            if (m_DestImage.OriginOffset.x != 0 || m_DestImage.OriginOffset.y != 0)
            {
                destRectTransform *= Affine.NewTranslation(-m_DestImage.OriginOffset.x, -m_DestImage.OriginOffset.y);
            }

            Affine sourceRectTransform = new Affine(destRectTransform);
            // We invert it because it is the transform to make the image go to the same position as the polygon. LBB [2/24/2004]
            sourceRectTransform.Invert();

            span_allocator spanAllocator = new span_allocator();

//.........这里部分代码省略.........
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:101,代码来源:renderer_scanline.cs


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