using PaintDotNet.SystemLayer;
using System;
using System.Drawing;
namespace PaintDotNet
{
///
/// Provides a set of standard UnaryPixelOps.
///
public sealed class UnaryPixelOps
{
private UnaryPixelOps()
{
}
///
/// Always returns a constant color.
///
[Serializable]
public class Constant : UnaryPixelOp
{
private ColorBgra setColor;
public override ColorBgra Apply(ColorBgra color)
{
return setColor;
}
public unsafe override void Apply(ColorBgra* dst, ColorBgra* src, int length)
{
while (length > 0)
{
*dst = setColor;
++dst;
--length;
}
}
public unsafe override void Apply(ColorBgra* ptr, int length)
{
while (length > 0)
{
*ptr = setColor;
++ptr;
--length;
}
}
public Constant(ColorBgra setColor)
{
this.setColor = setColor;
}
}
}
}