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


C# Rect.ToSharpDX方法代码示例

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


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

示例1: DrawImage

 /// <summary>
 /// Draws a bitmap image.
 /// </summary>
 /// <param name="source">The bitmap image.</param>
 /// <param name="opacity">The opacity to draw with.</param>
 /// <param name="sourceRect">The rect in the image to draw.</param>
 /// <param name="destRect">The rect in the output to draw to.</param>
 public void DrawImage(IBitmap source, double opacity, Rect sourceRect, Rect destRect)
 {
     BitmapImpl impl = (BitmapImpl)source.PlatformImpl;
     Bitmap d2d = impl.GetDirect2DBitmap(_renderTarget);
     _renderTarget.DrawBitmap(
         d2d,
         destRect.ToSharpDX(),
         (float)opacity,
         BitmapInterpolationMode.Linear,
         sourceRect.ToSharpDX());
 }
开发者ID:tshcherban,项目名称:Perspex,代码行数:18,代码来源:DrawingContext.cs

示例2: PushClip

        /// <summary>
        /// Pushes a clip rectange.
        /// </summary>
        /// <param name="clip">The clip rectangle.</param>
        /// <returns>A disposable used to undo the clip rectangle.</returns>
        public IDisposable PushClip(Rect clip)
        {
            this.renderTarget.PushAxisAlignedClip(clip.ToSharpDX(), AntialiasMode.PerPrimitive);

            return Disposable.Create(() =>
            {
                this.renderTarget.PopAxisAlignedClip();
            });
        }
开发者ID:Scellow,项目名称:Perspex,代码行数:14,代码来源:DrawingContext.cs

示例3: PushClip

 /// <summary>
 /// Pushes a clip rectange.
 /// </summary>
 /// <param name="clip">The clip rectangle.</param>
 /// <returns>A disposable used to undo the clip rectangle.</returns>
 public void PushClip(Rect clip)
 {
     _renderTarget.PushAxisAlignedClip(clip.ToSharpDX(), AntialiasMode.PerPrimitive);
 }
开发者ID:Core2D,项目名称:Avalonia,代码行数:9,代码来源:DrawingContext.cs

示例4: DrawImage

        public override void DrawImage(ImageSource imageSource, double opacity, Rect sourceRectangle, Rect destinationRectangle)
        {
            BitmapSource bitmapSource = imageSource as BitmapSource;

            if (bitmapSource == null)
            {
                throw new NotSupportedException("Cannot draw ImageSource that is not a BitmapSource.");
            }

            WicBitmapSource wic = (WicBitmapSource)bitmapSource.PlatformImpl;
            Bitmap bitmap = wic.GetDirect2DBitmap(this.target);

            this.target.DrawBitmap(
                bitmap,
                destinationRectangle.ToSharpDX(),
                (float)opacity,
                BitmapInterpolationMode.Linear,
                sourceRectangle.ToSharpDX());
        }
开发者ID:modulexcite,项目名称:Avalonia,代码行数:19,代码来源:Direct2D1DrawingContext.cs

示例5: DrawRoundedRectangle

        public override void DrawRoundedRectangle(Brush brush, Pen pen, Rect rectangle, double radiusX, double radiusY)
        {
            RoundedRectangle roundedRect = new RoundedRectangle
            {
                Rect = rectangle.ToSharpDX(),
                RadiusX = (float)radiusX,
                RadiusY = (float)radiusY,
            };

            if (brush != null)
            {
                using (var brush2D = brush.ToSharpDX(this.target))
                {
                    this.target.FillRoundedRectangle(roundedRect, brush2D);
                }
            }

            if (pen != null)
            {
                using (var brush2D = pen.Brush.ToSharpDX(this.target))
                {
                    this.target.DrawRoundedRectangle(roundedRect, brush2D, (float)pen.Thickness);
                }
            }
        }
开发者ID:modulexcite,项目名称:Avalonia,代码行数:25,代码来源:Direct2D1DrawingContext.cs

示例6: DrawRectangle

        public override void DrawRectangle(Brush brush, Pen pen, Rect rectangle)
        {
            if (brush != null)
            {
                using (var brush2D = brush.ToSharpDX(this.target))
                {
                    this.target.FillRectangle(
                        rectangle.ToSharpDX(),
                        brush2D);
                }
            }

            if (pen != null)
            {
                using (var brush2D = pen.Brush.ToSharpDX(this.target))
                {
                    this.target.DrawRectangle(
                        rectangle.ToSharpDX(),
                        brush2D,
                        (float)pen.Thickness);
                }
            }
        }
开发者ID:modulexcite,项目名称:Avalonia,代码行数:23,代码来源:Direct2D1DrawingContext.cs


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