public ImageBrushImpl( ITileBrush brush, SharpDX.Direct2D1.RenderTarget target, BitmapImpl bitmap, Size targetSize) { var dpi = new Vector(target.DotsPerInch.Width, target.DotsPerInch.Height); var calc = new TileBrushCalculator(brush, bitmap.PixelSize.ToSizeWithDpi(dpi), targetSize); if (!calc.NeedsIntermediate) { _bitmap = bitmap.GetDirect2DBitmap(target); PlatformBrush = new BitmapBrush( target, _bitmap.Value, GetBitmapBrushProperties(brush), GetBrushProperties(brush, calc.DestinationRect)); } else { using (var intermediate = RenderIntermediate(target, bitmap, calc)) { PlatformBrush = new BitmapBrush( target, intermediate.Bitmap, GetBitmapBrushProperties(brush), GetBrushProperties(brush, calc.DestinationRect)); } } _bitmapInterpolationMode = brush.BitmapInterpolationMode; }
public ImageBrushImpl( ITileBrush brush, SharpDX.Direct2D1.RenderTarget target, BitmapImpl bitmap, Size targetSize) { var calc = new TileBrushCalculator(brush, new Size(bitmap.PixelWidth, bitmap.PixelHeight), targetSize); if (!calc.NeedsIntermediate) { _bitmap = bitmap.GetDirect2DBitmap(target); PlatformBrush = new BitmapBrush( target, _bitmap.Value, GetBitmapBrushProperties(brush), GetBrushProperties(brush, calc.DestinationRect)); } else { using (var intermediate = RenderIntermediate(target, bitmap, calc)) { PlatformBrush = new BitmapBrush( target, intermediate.Bitmap, GetBitmapBrushProperties(brush), GetBrushProperties(brush, calc.DestinationRect)); } } }