Permalink
Browse files

Provide default values and documentation on all effect constructors.

  • Loading branch information...
1 parent aff6e93 commit 6a49a0034a2a83fa352dc1f052b8a6c473805aa2 @jpobst jpobst committed Dec 26, 2012
Showing with 194 additions and 28 deletions.
  1. +10 −1 Pinta.ImageManipulation/Effects/CloudsEffect.cs
  2. +5 −1 Pinta.ImageManipulation/Effects/EdgeDetectEffect.cs
  3. +5 −1 Pinta.ImageManipulation/Effects/EmbossEffect.cs
  4. +7 −1 Pinta.ImageManipulation/Effects/FragmentEffect.cs
  5. +5 −1 Pinta.ImageManipulation/Effects/FrostedGlassEffect.cs
  6. +5 −1 Pinta.ImageManipulation/Effects/GaussianBlurEffect.cs
  7. +7 −1 Pinta.ImageManipulation/Effects/GlowEffect.cs
  8. +7 −1 Pinta.ImageManipulation/Effects/HueSaturationEffect.cs
  9. +6 −1 Pinta.ImageManipulation/Effects/InkSketchEffect.cs
  10. +7 −0 Pinta.ImageManipulation/Effects/InvertColorsEffect.cs
  11. +8 −1 Pinta.ImageManipulation/Effects/JuliaFractalEffect.cs
  12. +9 −1 Pinta.ImageManipulation/Effects/MandelbrotFractalEffect.cs
  13. +6 −1 Pinta.ImageManipulation/Effects/MedianEffect.cs
  14. +7 −1 Pinta.ImageManipulation/Effects/MotionBlurEffect.cs
  15. +6 −1 Pinta.ImageManipulation/Effects/OilPaintingEffect.cs
  16. +6 −1 Pinta.ImageManipulation/Effects/OutlineEffect.cs
  17. +6 −1 Pinta.ImageManipulation/Effects/PencilSketchEffect.cs
  18. +5 −1 Pinta.ImageManipulation/Effects/PixelateEffect.cs
  19. +10 −1 Pinta.ImageManipulation/Effects/PolarInversionEffect.cs
  20. +7 −1 Pinta.ImageManipulation/Effects/RadialBlurEffect.cs
  21. +6 −1 Pinta.ImageManipulation/Effects/RedEyeRemoveEffect.cs
  22. +6 −1 Pinta.ImageManipulation/Effects/ReduceNoiseEffect.cs
  23. +5 −1 Pinta.ImageManipulation/Effects/ReliefEffect.cs
  24. +7 −0 Pinta.ImageManipulation/Effects/SepiaEffect.cs
  25. +5 −1 Pinta.ImageManipulation/Effects/SharpenEffect.cs
  26. +7 −1 Pinta.ImageManipulation/Effects/SoftenPortraitEffect.cs
  27. +7 −1 Pinta.ImageManipulation/Effects/TileEffect.cs
  28. +6 −1 Pinta.ImageManipulation/Effects/TwistEffect.cs
  29. +5 −1 Pinta.ImageManipulation/Effects/UnfocusEffect.cs
  30. +6 −1 Pinta.ImageManipulation/Effects/ZoomBlurEffect.cs
@@ -25,7 +25,16 @@ public class CloudsEffect : BaseEffect
//private byte instanceSeed = unchecked ((byte)DateTime.Now.Ticks);
static private int[] permuteLookup = new int[512];
- public CloudsEffect (int scale, int power, int seed, ColorBgra fromColor, ColorBgra toColor, BlendMode blendMode)
+ /// <summary>
+ /// Creates a new effect that will render clouds onto an image.
+ /// </summary>
+ /// <param name="scale">The relative size of the clouds. Valid range is 2 - 1000.</param>
+ /// <param name="power">The power of the clouds. Valid range is 0 - 100.</param>
+ /// <param name="seed">Seed value for random generator.</param>
+ /// <param name="fromColor">Initial cloud color.</param>
+ /// <param name="toColor">Final cloud color.</param>
+ /// <param name="blendMode">Blend mode to use when applying clouds.</param>
+ public CloudsEffect (int scale = 250, int power = 50, int seed = 0, ColorBgra fromColor = new ColorBgra (), ColorBgra toColor = new ColorBgra (), BlendMode blendMode = BlendMode.Normal)
{
if (scale < 2 || scale > 1000)
throw new ArgumentOutOfRangeException ("scale");
@@ -16,7 +16,11 @@ public class EdgeDetectEffect : ColorDifferenceEffect
private double[][] weights;
private double angle;
- public EdgeDetectEffect (double angle)
+ /// <summary>
+ /// Creates a new effect that enhances detected edges.
+ /// </summary>
+ /// <param name="angle">Angle used to determine edges.</param>
+ public EdgeDetectEffect (double angle = 45)
{
this.angle = angle;
@@ -15,7 +15,11 @@ public class EmbossEffect : BaseEffect
{
private double angle;
- public EmbossEffect (double angle)
+ /// <summary>
+ /// Creates a new effect that applies an embossed look.
+ /// </summary>
+ /// <param name="angle">Angle to apply emboss. Valid range is 0 - 360.</param>
+ public EmbossEffect (double angle = 0)
{
if (angle < 0 || angle > 360)
throw new ArgumentOutOfRangeException ("angle");
@@ -17,7 +17,13 @@ public class FragmentEffect : BaseEffect
private int distance;
private double rotation;
- public FragmentEffect (int fragments, int distance, double rotation)
+ /// <summary>
+ /// Creates a new effect that makes an image look fragmented.
+ /// </summary>
+ /// <param name="fragments">Number of fragments to apply. Valid range is 2 - 50.</param>
+ /// <param name="distance">Distance between fragments. Valid range is 0 - 100.</param>
+ /// <param name="rotation">Angle to apply.</param>
+ public FragmentEffect (int fragments = 4, int distance = 8, double rotation = 0)
{
if (fragments < 2 || fragments > 50)
throw new ArgumentOutOfRangeException ("fragments");
@@ -16,7 +16,11 @@ public class FrostedGlassEffect : BaseEffect
private int amount;
private Random random = new Random ();
- public FrostedGlassEffect (int amount)
+ /// <summary>
+ /// Creates a new effect that applies a frosted glass look to an image.
+ /// </summary>
+ /// <param name="amount">Amount of effect to apply. Valid range is 1 - 10.</param>
+ public FrostedGlassEffect (int amount = 1)
{
if (amount < 1 || amount > 10)
throw new ArgumentOutOfRangeException ("amount");
@@ -16,7 +16,11 @@ public class GaussianBlurEffect : BaseEffect
private int radius;
private int[] w;
- public GaussianBlurEffect (int radius)
+ /// <summary>
+ /// Creates a new effect that will apply a Gaussian blur to an image.
+ /// </summary>
+ /// <param name="radius">Radius to use for blur (higher is blurrier). Valid range is 0 - 200.</param>
+ public GaussianBlurEffect (int radius = 2)
{
if (radius < 0 || radius > 200)
throw new ArgumentOutOfRangeException ("radius");
@@ -22,7 +22,13 @@ public class GlowEffect : BaseEffect
private BrightnessContrastEffect contrast_effect;
private ScreenBlendOp screen_op;
- public GlowEffect (int radius, int brightness, int contrast)
+ /// <summary>
+ /// Creates a new effect that will add a glowing effect to an image.
+ /// </summary>
+ /// <param name="radius">Radius used to blur the image (higher is blurrier). Valid range is 1 - 20.</param>
+ /// <param name="brightness">Brightness amount to apply.</param>
+ /// <param name="contrast">Contrast amount to apply.</param>
+ public GlowEffect (int radius = 6, int brightness = 10, int contrast = 10)
{
if (radius < 1 || radius > 20)
throw new ArgumentOutOfRangeException ("radius");
@@ -16,7 +16,13 @@ public class HueSaturationEffect : BaseEffect
{
private UnaryPixelOp op;
- public HueSaturationEffect (int hue, int saturation, int lightness)
+ /// <summary>
+ /// Creates a new effect that will adjust the hue, saturation, and lightness of an image.
+ /// </summary>
+ /// <param name="hue">Amount of hue to adjust. Valid range is -180 - 180.</param>
+ /// <param name="saturation">Amount of saturation to adjust. Valid range is 0 - 200.</param>
+ /// <param name="lightness">Amount of of lightness to adjust. Valid range is -100 - 100.</param>
+ public HueSaturationEffect (int hue = 0, int saturation = 100, int lightness = 0)
{
if (hue < -180 || hue > 180)
throw new ArgumentOutOfRangeException ("hue");
@@ -41,7 +41,12 @@ static InkSketchEffect ()
conv[4] = new int[] { -1, -1, -5, -1, -1 };
}
- public InkSketchEffect (int inkOutline, int coloring)
+ /// <summary>
+ /// Creates a new effect that will make an image look like an ink sketch.
+ /// </summary>
+ /// <param name="inkOutline">Size of the ink outline. Valid range is 0 - 99.</param>
+ /// <param name="coloring">Amount of color to keep. Valid range is 0 - 100.</param>
+ public InkSketchEffect (int inkOutline = 50, int coloring = 50)
{
if (inkOutline < 0 || inkOutline > 99)
throw new ArgumentOutOfRangeException ("inkOutline");
@@ -15,6 +15,13 @@ namespace Pinta.ImageManipulation.Effects
public class InvertColorsEffect : BaseEffect
{
private InvertOp op = new InvertOp ();
+
+ /// <summary>
+ /// Creates a new effect that will invert the colors of an image.
+ /// </summary>
+ public InvertColorsEffect ()
+ {
+ }
#region Algorithm Code Ported From PDN
protected override void RenderLine (ISurface src, ISurface dest, Rectangle roi)
@@ -20,7 +20,14 @@ public class JuliaFractalEffect : BaseEffect
private static readonly double log2_10000 = Math.Log (10000);
- public JuliaFractalEffect (int factor, int quality, int zoom, double angle)
+ /// <summary>
+ /// Creates a new effect that will draw a Julia fractal.
+ /// </summary>
+ /// <param name="factor">Factor to use. Valid range is 1 - 10.</param>
+ /// <param name="quality">Quality of the fractal. Valid range is 1 - 5.</param>
+ /// <param name="zoom">Size of the fractal. Valid range is 0 - 50.</param>
+ /// <param name="angle">Angle of the fractal to render.</param>
+ public JuliaFractalEffect (int factor = 4, int quality = 2, int zoom = 1, double angle = 0)
{
if (factor < 1 || factor > 10)
throw new ArgumentOutOfRangeException ("factor");
@@ -28,7 +28,15 @@ public class MandelbrotFractalEffect : BaseEffect
private const double yOffsetBasis = -0.29;
private double yOffset = yOffsetBasis;
- public MandelbrotFractalEffect (int factor, int quality, int zoom, double angle, bool invertColors)
+ /// <summary>
+ /// Creates a new effect that will draw a Julia fractal.
+ /// </summary>
+ /// <param name="factor">Factor to use. Valid range is 1 - 10.</param>
+ /// <param name="quality">Quality of the fractal. Valid range is 1 - 5.</param>
+ /// <param name="zoom">Size of the fractal. Valid range is 0 - 100.</param>
+ /// <param name="angle">Angle of the fractal to render.</param>
+ /// <param name="invertColors">Invert the fractal colors.</param>
+ public MandelbrotFractalEffect (int factor = 1, int quality = 2, int zoom = 10, double angle = 0, bool invertColors = false)
{
if (factor < 1 || factor > 10)
throw new ArgumentOutOfRangeException ("factor");
@@ -16,7 +16,12 @@ public class MedianEffect : LocalHistogramEffect
private int radius;
private int percentile;
- public MedianEffect (int radius, int percentile)
+ /// <summary>
+ /// Creates a new effect that will apply a median effect to the image.
+ /// </summary>
+ /// <param name="radius">Radius to consider for median. Valid range is 1 - 200.</param>
+ /// <param name="percentile">Percentile to use for median. Valid range is 0 - 100.</param>
+ public MedianEffect (int radius = 10, int percentile = 50)
{
if (radius < 1 || radius > 200)
throw new ArgumentOutOfRangeException ("radius");
@@ -17,7 +17,13 @@ public class MotionBlurEffect : BaseEffect
private int distance;
private bool centered;
- public MotionBlurEffect (double angle, int distance, bool centered)
+ /// <summary>
+ /// Creates a new effect that will apply a motion blur to an image.
+ /// </summary>
+ /// <param name="angle">Angle of the motion blur.</param>
+ /// <param name="distance">Distance to apply the blur. Valid range is 1 - 200.</param>
+ /// <param name="centered">Whether the blur is centered.</param>
+ public MotionBlurEffect (double angle = 25, int distance = 10, bool centered = true)
{
if (distance < 1 || distance > 200)
throw new ArgumentOutOfRangeException ("distance");
@@ -16,7 +16,12 @@ public class OilPaintingEffect : BaseEffect
private int brush_size;
private int coarseness;
- public OilPaintingEffect (int brushSize, int coarseness)
+ /// <summary>
+ /// Creates a new effect that will make the image look like an oil painting.
+ /// </summary>
+ /// <param name="brushSize">Size of the brush to use. Valid range is 1 - 8.</param>
+ /// <param name="coarseness">Coarseness of the brush to use. Valid range is 3 - 255.</param>
+ public OilPaintingEffect (int brushSize = 3, int coarseness = 50)
{
if (brushSize < 1 || brushSize > 8)
throw new ArgumentOutOfRangeException ("brushSize");
@@ -16,7 +16,12 @@ public class OutlineEffect : LocalHistogramEffect
private int thickness;
private int intensity;
- public OutlineEffect (int thickness, int intensity)
+ /// <summary>
+ /// Creates a new effect that will outline the edges of an image.
+ /// </summary>
+ /// <param name="thickness">Thickness of the outline. Valid range is 1 - 200.</param>
+ /// <param name="intensity">Intesity of the outline. Valid range is 0 - 100.</param>
+ public OutlineEffect (int thickness = 3, int intensity = 50)
{
if (thickness < 1 || thickness > 200)
throw new ArgumentOutOfRangeException ("thickness");
@@ -24,7 +24,12 @@ public class PencilSketchEffect : BaseEffect
private int pencil_size;
private int color_range;
- public PencilSketchEffect (int pencilSize, int colorRange)
+ /// <summary>
+ /// Creates a new effect that will make the image look like a pencil sketch.
+ /// </summary>
+ /// <param name="pencilSize">Size of the pencil to use. Valid range is 1 - 20.</param>
+ /// <param name="colorRange">Range of color to use. Valid range is -20 - 20.</param>
+ public PencilSketchEffect (int pencilSize = 2, int colorRange = 0)
{
if (pencilSize < 1 || pencilSize > 20)
throw new ArgumentOutOfRangeException ("pencilSize");
@@ -15,7 +15,11 @@ public class PixelateEffect : BaseEffect
{
private int cell_size;
- public PixelateEffect (int cellSize)
+ /// <summary>
+ /// Creates a new effect that will pixelate an image.
+ /// </summary>
+ /// <param name="cellSize">Size of the pixelation. Valid range is 0 - 100.</param>
+ public PixelateEffect (int cellSize = 2)
{
if (cellSize < 0 || cellSize > 100)
throw new ArgumentOutOfRangeException ("cellSize");
@@ -15,7 +15,16 @@ public class PolarInversionEffect : WarpEffect
{
private double amount;
- public PolarInversionEffect (double amount, int quality, Point centerOffset, WarpEdgeBehavior edgeBehavior, ColorBgra primaryColor, ColorBgra secondaryColor)
+ /// <summary>
+ /// Creates a new effect that will apply a polar inversion to an image.
+ /// </summary>
+ /// <param name="amount">Amount of inversion. Valid range is -4 - 4.</param>
+ /// <param name="quality">Quality of the inversion. Valid range is 1 - 5.</param>
+ /// <param name="centerOffset">Center of the inversion.</param>
+ /// <param name="edgeBehavior">Edge behavior of the inversion.</param>
+ /// <param name="primaryColor">Primary color of the inversion.</param>
+ /// <param name="secondaryColor">Secondary color of the inversion.</param>
+ public PolarInversionEffect (double amount = 0, int quality = 2, Point centerOffset = new Point (), WarpEdgeBehavior edgeBehavior = WarpEdgeBehavior.Reflect, ColorBgra primaryColor = new ColorBgra (), ColorBgra secondaryColor = new ColorBgra ())
: base (quality, centerOffset, edgeBehavior, primaryColor, secondaryColor)
{
if (amount < -4 || amount > 4)
@@ -17,7 +17,13 @@ public class RadialBlurEffect : BaseEffect
private PointD offset;
private int quality;
- public RadialBlurEffect (double angle, PointD offset, int quality)
+ /// <summary>
+ /// Creates a new effect that will apply a radial blur to an image.
+ /// </summary>
+ /// <param name="angle">Angle of the blur.</param>
+ /// <param name="offset">Center point of the blur.</param>
+ /// <param name="quality">Quality of the radial blur. Valid range is 1 - 5.</param>
+ public RadialBlurEffect (double angle = 2, PointD offset = new PointD (), int quality = 2)
{
if (quality < 1 || quality > 5)
throw new ArgumentOutOfRangeException ("quality");
@@ -16,7 +16,12 @@ public class RedEyeRemoveEffect : BaseEffect
{
private RedEyeRemoveOp op;
- public RedEyeRemoveEffect (int tolerance, int saturation)
+ /// <summary>
+ /// Creates a new effect that will remove red within a certain tolerance from an image.
+ /// </summary>
+ /// <param name="tolerance">Tolerance of red to remove. Valid range is 0 - 100.</param>
+ /// <param name="saturation">Saturation of effect. Valid range is 0 - 100.</param>
+ public RedEyeRemoveEffect (int tolerance = 70, int saturation = 90)
{
if (tolerance < 0 || tolerance > 100)
throw new ArgumentOutOfRangeException ("tolerance");
@@ -16,7 +16,12 @@ public class ReduceNoiseEffect : LocalHistogramEffect
private int radius;
private double strength;
- public ReduceNoiseEffect (int radius, double strength)
+ /// <summary>
+ /// Creates a new effect that will reduce the noise of an image.
+ /// </summary>
+ /// <param name="radius">Radius to consider when reducing noise. Valid range is 1 - 200.</param>
+ /// <param name="strength">Strength of reduction. Valid range is 0 - 1.</param>
+ public ReduceNoiseEffect (int radius = 6, double strength = 0.4)
{
if (radius < 1 || radius > 200)
throw new ArgumentOutOfRangeException ("radius");
@@ -15,7 +15,11 @@ public class ReliefEffect : ColorDifferenceEffect
{
private double angle;
- public ReliefEffect (double angle)
+ /// <summary>
+ /// Creates a new effect that add depth to an image.
+ /// </summary>
+ /// <param name="angle">Angle to apply depth from.</param>
+ public ReliefEffect (double angle = 45)
{
this.angle = angle;
}
@@ -22,6 +22,13 @@ public class SepiaEffect : BaseEffect
ColorBgra.Black,
ColorBgra.White);
+ /// <summary>
+ /// Creates a new effect that will apply a sepia tone to an image.
+ /// </summary>
+ public SepiaEffect ()
+ {
+ }
+
#region Algorithm Code Ported From PDN
protected override void RenderLine (ISurface src, ISurface dest, Rectangle roi)
{
@@ -15,7 +15,11 @@ public class SharpenEffect : LocalHistogramEffect
{
private int amount;
- public SharpenEffect (int amount)
+ /// <summary>
+ /// Creates a new effect that will sharpen an image.
+ /// </summary>
+ /// <param name="amount">Amount of sharpness to apply. Valid range is 1 - 20.</param>
+ public SharpenEffect (int amount = 2)
{
if (amount < 1 || amount > 20)
throw new ArgumentOutOfRangeException ("amount");
@@ -51,7 +51,13 @@ public class SoftenPortraitEffect : BaseEffect
private DesaturateOp desaturate_op;
private OverlayBlendOp overlay_op;
- public SoftenPortraitEffect (int softness, int lighting, int warmth)
+ /// <summary>
+ /// Creates a new effect that will soften an image.
+ /// </summary>
+ /// <param name="softness">How much to soften the image. Valid range is 0 - 10.</param>
+ /// <param name="lighting">Amount of lighting to apply. Valid range is -20 - 20.</param>
+ /// <param name="warmth">Amount of warmth to apply. Valid range is 0 - 20.</param>
+ public SoftenPortraitEffect (int softness = 5, int lighting = 0, int warmth = 10)
{
if (softness < 0 || softness > 10)
throw new ArgumentOutOfRangeException ("softness");
@@ -17,7 +17,13 @@ public class TileEffect : BaseEffect
private int tile_size;
private int intensity;
- public TileEffect (double rotation, int tileSize, int intensity)
+ /// <summary>
+ /// Creates a new effect that will apply a tile effect to an image.
+ /// </summary>
+ /// <param name="rotation">Angle to rotate the tiles.</param>
+ /// <param name="tileSize">Size of the tiles. Valid range is 2 - 200.</param>
+ /// <param name="intensity">Intensity of the tiling effect. Valid range is -20 - 20.</param>
+ public TileEffect (double rotation = 30, int tileSize = 40, int intensity = 8)
{
if (tileSize < 2 || tileSize > 200)
throw new ArgumentOutOfRangeException ("tileSize");
Oops, something went wrong.

0 comments on commit 6a49a00

Please sign in to comment.