// -----------------------------------------------------------------------
//
// Copyright 2014 MIT Licence. See licence.md for more information.
//
// -----------------------------------------------------------------------
namespace Perspex.Media
{
using System;
using Perspex.Platform;
///
/// Defines a geometric shape.
///
public abstract class Geometry : PerspexObject
{
///
/// Defines the property.
///
public static readonly PerspexProperty TransformProperty =
PerspexProperty.Register("Transform");
///
/// Initializes static members of the class.
///
static Geometry()
{
TransformProperty.Changed.Subscribe(x =>
{
((Geometry)x.Sender).PlatformImpl.Transform = ((Transform)x.NewValue).Value;
});
}
///
/// Gets the geometry's bounding rectangle.
///
public abstract Rect Bounds
{
get;
}
///
/// Gets the platform-specific implementation of the geometry.
///
public IGeometryImpl PlatformImpl
{
get;
protected set;
}
///
/// Gets or sets a transform to apply to the geometry.
///
public Transform Transform
{
get { return this.GetValue(TransformProperty); }
set { this.SetValue(TransformProperty, value); }
}
///
/// Clones the geometry.
///
/// A cloned geometry.
public abstract Geometry Clone();
///
/// Gets the geometry's bounding rectangle with the specified stroke thickness.
///
/// The stroke thickness.
/// The bounding rectangle.
public Rect GetRenderBounds(double strokeThickness)
{
return this.PlatformImpl.GetRenderBounds(strokeThickness);
}
}
}