12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using PaintDotNet.SystemLayer;
- using System;
- using System.Drawing;
- namespace PaintDotNet
- {
- /// <summary>
- /// Provides a set of standard UnaryPixelOps.
- /// </summary>
- public sealed class UnaryPixelOps
- {
- private UnaryPixelOps()
- {
- }
- /// <summary>
- /// Always returns a constant color.
- /// </summary>
- [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;
- }
- }
- }
- }
|