本文整理汇总了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());
}
示例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();
});
}
示例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);
}
示例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());
}
示例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);
}
}
}
示例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);
}
}
}