本文整理汇总了C#中Rect.ToRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.ToRectangle方法的具体用法?C# Rect.ToRectangle怎么用?C# Rect.ToRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect
的用法示例。
在下文中一共展示了Rect.ToRectangle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Begin
public void Begin(Rect clippingRect)
{
if (this.currentClippingRect != clippingRect)
{
this.currentClippingRect = clippingRect;
if (this.isBatchOpen)
{
this.End();
}
if (clippingRect.IsEmpty)
{
this.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
}
else
{
this.spriteBatch.GraphicsDevice.ScissorRectangle = clippingRect.ToRectangle();
this.spriteBatch.Begin(
SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, ScissorTestingRasterizerState);
}
this.isBatchOpen = true;
}
}
示例2: CaptureArea
public virtual Bitmap CaptureArea(Rect rect)
{
var rectangle = rect.ToRectangle();
var width = rectangle.Right - rectangle.Left;
var height = rectangle.Bottom - rectangle.Top;
var bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb);
var graphics = Graphics.FromImage(bmp);
graphics.CopyFromScreen(rectangle.Left, rectangle.Top, 0, 0, new Size(width, height), CopyPixelOperation.SourceCopy);
return bmp;
}
示例3: CopyFromScreenSnapshot
internal BitmapSource CopyFromScreenSnapshot(Rect region)
{
var sourceRect = region.ToRectangle();
var destRect = new Rectangle(0, 0, sourceRect.Width, sourceRect.Height);
if (screenSnapshot != null)
{
var bitmap = new Bitmap(sourceRect.Width, sourceRect.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
using (Graphics g = Graphics.FromImage(bitmap))
{
g.DrawImage(screenSnapshot, destRect, sourceRect, GraphicsUnit.Pixel);
}
return bitmap.ToBitmapSource();
}
return null;
}
示例4: DrawFilledRect
public void DrawFilledRect(Rect rect, Color colorTint)
{
var patt =LineStroke.Solid.PatternProvider;
Batch.Draw(patt, rect.ToRectangle(), patt.Bounds, colorTint);
}
示例5: SurfaceImageSourceCanvas
public SurfaceImageSourceCanvas(SurfaceImageSource surfaceImageSource, Rect updateRect, Direct2DFactories factories = null)
: base(factories)
{
sisn = ComObject.As<DXGI.ISurfaceImageSourceNative> (surfaceImageSource);
SharpDX.Point offset;
var surface = sisn.BeginDraw (updateRect.ToRectangle (), out offset);
var dpi = 96.0;
var properties = new D2D1.RenderTargetProperties (D2D1.RenderTargetType.Default, new D2D1.PixelFormat (DXGI.Format.Unknown, D2D1.AlphaMode.Unknown), (float)(dpi), (float)(dpi), D2D1.RenderTargetUsage.None, D2D1.FeatureLevel.Level_DEFAULT);
Initialize (new D2D1.RenderTarget (this.factories.D2DFactory, surface, properties));
}