//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp.Drawing
{
using ImageSharp.PixelFormats;
///
/// Options for influencing the drawing functions.
///
public struct GraphicsOptions
{
///
/// Represents the default .
///
public static readonly GraphicsOptions Default = new GraphicsOptions(true);
private float? blendPercentage;
private int? antialiasSubpixelDepth;
private bool? antialias;
private PixelBlenderMode blenderMode;
///
/// Initializes a new instance of the struct.
///
/// If set to true [enable antialiasing].
public GraphicsOptions(bool enableAntialiasing)
{
this.blenderMode = PixelBlenderMode.Normal;
this.blendPercentage = 1;
this.antialiasSubpixelDepth = 16;
this.antialias = enableAntialiasing;
}
///
/// Gets or sets a value indicating whether antialiasing should be applied.
///
public bool Antialias
{
get => this.antialias ?? true;
set => this.antialias = value;
}
///
/// Gets or sets a value indicating the number of subpixels to use while rendering with antialiasing enabled.
///
public int AntialiasSubpixelDepth
{
get => this.antialiasSubpixelDepth ?? 16;
set => this.antialiasSubpixelDepth = value;
}
///
/// Gets or sets a value indicating the blending percentage to apply to the drawing operation
///
public float BlendPercentage
{
get => this.blendPercentage ?? 1;
set => this.blendPercentage = value;
}
// In the future we could expose a PixelBlender directly on here
// or some forms of PixelBlender factory for each pixel type. Will need
// some API thought post V1.
///
/// Gets or sets a value indicating the blending percentage to apply to the drawing operation
///
public PixelBlenderMode BlenderMode
{
get => this.blenderMode;
set => this.blenderMode = value;
}
}
}