本文整理匯總了C#中System.Drawing.RectangleF.ToD2DRectangleF方法的典型用法代碼示例。如果您正苦於以下問題:C# RectangleF.ToD2DRectangleF方法的具體用法?C# RectangleF.ToD2DRectangleF怎麽用?C# RectangleF.ToD2DRectangleF使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Drawing.RectangleF
的用法示例。
在下文中一共展示了RectangleF.ToD2DRectangleF方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: FillRectangle
public override void FillRectangle(Brush brush, RectangleF rect)
{
var textureBrushCache = _renderTargetCache[_renderTarget].TextureBrushCache;
var textureBrush = brush as TextureBrush;
SharpDX.Direct2D1.BitmapBrush bitmapBrush;
if (!textureBrushCache.TryGetValue(textureBrush, out bitmapBrush))
{
Bitmap bitmap = textureBrush.Image as Bitmap;
bitmapBrush = new SharpDX.Direct2D1.BitmapBrush(_renderTarget, bitmap.ToD2DBitmap(_renderTarget),
new SharpDX.Direct2D1.BitmapBrushProperties
{
ExtendModeX = SharpDX.Direct2D1.ExtendMode.Wrap,
ExtendModeY = SharpDX.Direct2D1.ExtendMode.Wrap,
InterpolationMode = SharpDX.Direct2D1.BitmapInterpolationMode.Linear
});
textureBrushCache[textureBrush] = bitmapBrush;
}
_renderTarget.FillRectangle(rect.ToD2DRectangleF(), bitmapBrush);
}
示例2: DrawImage
public override void DrawImage(Image image, RectangleF rect)
{
using (var bitmap = new Bitmap(image))
using (var d2dBitmap = bitmap.ToD2DBitmap(_renderTarget))
{
_renderTarget.DrawBitmap(d2dBitmap, rect.ToD2DRectangleF(), 1.0f, SharpDX.Direct2D1.BitmapInterpolationMode.Linear);
}
}