// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using Avalonia.Visuals.Media.Imaging;
using Avalonia.VisualTree;
namespace Avalonia.Media.Immutable
{
///
/// Paints an area with an .
///
internal class ImmutableVisualBrush : ImmutableTileBrush, IVisualBrush
{
///
/// Initializes a new instance of the class.
///
/// The visual to draw.
/// The horizontal alignment of a tile in the destination.
/// The vertical alignment of a tile in the destination.
/// The rectangle on the destination in which to paint a tile.
/// The opacity of the brush.
/// The rectangle of the source image that will be displayed.
///
/// How the source rectangle will be stretched to fill the destination rect.
///
/// The tile mode.
/// Controls the quality of interpolation.
public ImmutableVisualBrush(
IVisual visual,
AlignmentX alignmentX = AlignmentX.Center,
AlignmentY alignmentY = AlignmentY.Center,
RelativeRect? destinationRect = null,
double opacity = 1,
RelativeRect? sourceRect = null,
Stretch stretch = Stretch.Uniform,
TileMode tileMode = TileMode.None,
BitmapInterpolationMode bitmapInterpolationMode = BitmapInterpolationMode.Default)
: base(
alignmentX,
alignmentY,
destinationRect ?? RelativeRect.Fill,
opacity,
sourceRect ?? RelativeRect.Fill,
stretch,
tileMode,
bitmapInterpolationMode)
{
Visual = visual;
}
///
/// Initializes a new instance of the class.
///
/// The brush from which this brush's properties should be copied.
public ImmutableVisualBrush(IVisualBrush source)
: base(source)
{
Visual = source.Visual;
}
///
public IVisual Visual { get; }
}
}