|
|
@@ -5,6 +5,7 @@ using System;
|
|
|
using Perspex.Layout;
|
|
|
using Perspex.Media;
|
|
|
using Perspex.Rendering;
|
|
|
+using SharpDX;
|
|
|
using SharpDX.Direct2D1;
|
|
|
|
|
|
namespace Perspex.Direct2D1.Media
|
|
|
@@ -57,56 +58,16 @@ namespace Perspex.Direct2D1.Media
|
|
|
using (ctx.PushClip(drawRect))
|
|
|
using (ctx.PushPostTransform(transform))
|
|
|
{
|
|
|
+ intermediate.Clear(new Color4(0));
|
|
|
ctx.Render(visual);
|
|
|
}
|
|
|
+
|
|
|
this.PlatformBrush = new BitmapBrush(
|
|
|
target,
|
|
|
intermediate.Bitmap,
|
|
|
GetBitmapBrushProperties(brush),
|
|
|
GetBrushProperties(brush, destinationRect));
|
|
|
}
|
|
|
-
|
|
|
- //var sourceRect = brush.SourceRect.ToPixels(layoutable.Bounds.Size);
|
|
|
- //var destinationRect = brush.DestinationRect.ToPixels(targetSize);
|
|
|
- //var bitmapSize = brush.TileMode == TileMode.None ? targetSize : destinationRect.Size;
|
|
|
- //var scale = brush.Stretch.CalculateScaling(destinationRect.Size, sourceRect.Size);
|
|
|
- //var translate = CalculateTranslate(brush, sourceRect, destinationRect, scale);
|
|
|
- //var options = CompatibleRenderTargetOptions.None;
|
|
|
-
|
|
|
- //using (var brt = new BitmapRenderTarget(target, options, bitmapSize.ToSharpDX()))
|
|
|
- //{
|
|
|
- // var renderer = new Renderer(brt);
|
|
|
- // var transform = Matrix.CreateTranslation(-sourceRect.Position) *
|
|
|
- // Matrix.CreateScale(scale) *
|
|
|
- // Matrix.CreateTranslation(translate);
|
|
|
-
|
|
|
- // Rect drawRect;
|
|
|
-
|
|
|
- // if (brush.TileMode == TileMode.None)
|
|
|
- // {
|
|
|
- // drawRect = destinationRect;
|
|
|
- // transform *= Matrix.CreateTranslation(destinationRect.Position);
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // drawRect = new Rect(0, 0, destinationRect.Width, destinationRect.Height);
|
|
|
- // }
|
|
|
-
|
|
|
- // renderer.Render(visual, null, transform, drawRect);
|
|
|
-
|
|
|
- // var result = new BitmapBrush(brt, brt.Bitmap);
|
|
|
- // result.ExtendModeX = GetExtendModeX(brush.TileMode);
|
|
|
- // result.ExtendModeY = GetExtendModeY(brush.TileMode);
|
|
|
-
|
|
|
- // if (brush.TileMode != TileMode.None)
|
|
|
- // {
|
|
|
- // result.Transform = SharpDX.Matrix3x2.Translation(
|
|
|
- // (float)destinationRect.X,
|
|
|
- // (float)destinationRect.Y);
|
|
|
- // }
|
|
|
-
|
|
|
- // PlatformBrush = result;
|
|
|
- //}
|
|
|
}
|
|
|
}
|
|
|
}
|