Browse Source

Clip controls.

Messes up the treeview item expanded arrows... Probably related to the previous
problem with rendering and rotate transforms.
pull/4/head
Steven Kirk 12 years ago
parent
commit
9c74c34383
  1. 15
      Perspex.Direct2D1/Media/DrawingContext.cs
  2. 1
      Perspex.Direct2D1/Renderer.cs
  3. 7
      Perspex.SceneGraph/Media/IDrawingContext.cs
  4. 4
      TestApplication/Program.cs

15
Perspex.Direct2D1/Media/DrawingContext.cs

@ -171,6 +171,21 @@ namespace Perspex.Direct2D1.Media
}
}
/// <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();
});
}
/// <summary>
/// Pushes a matrix transformation.
/// </summary>

1
Perspex.Direct2D1/Renderer.cs

@ -135,6 +135,7 @@ namespace Perspex.Direct2D1
transform *= Matrix.Translation(visual.Bounds.Position);
using (context.PushClip(visual.Bounds))
using (context.PushTransform(transform))
{
visual.Render(context);

7
Perspex.SceneGraph/Media/IDrawingContext.cs

@ -56,6 +56,13 @@ namespace Perspex.Media
/// <param name="rect">The rectangle bounds.</param>
void FillRectange(Brush brush, Rect rect);
/// <summary>
/// Pushes a clip rectange.
/// </summary>
/// <param name="clip">The clip rectangle.</param>
/// <returns>A disposable used to undo the clip rectangle.</returns>
IDisposable PushClip(Rect clip);
/// <summary>
/// Pushes a matrix transformation.
/// </summary>

4
TestApplication/Program.cs

@ -83,8 +83,8 @@ namespace TestApplication
static void Main(string[] args)
{
LogManager.Enable(new TestLogger());
LogManager.Instance.LogLayoutMessages = true;
//LogManager.Enable(new TestLogger());
//LogManager.Instance.LogLayoutMessages = true;
App application = new App
{

Loading…
Cancel
Save