diff --git a/src/ImageProcessorCore/Common/Helpers/ImageMaths.cs b/src/ImageProcessorCore/Common/Helpers/ImageMaths.cs index 19da0af187..b61fa30fab 100644 --- a/src/ImageProcessorCore/Common/Helpers/ImageMaths.cs +++ b/src/ImageProcessorCore/Common/Helpers/ImageMaths.cs @@ -165,7 +165,7 @@ namespace ImageProcessorCore /// The . /// public static Rectangle GetFilteredBoundingRectangle(ImageBase bitmap, float componentValue, RgbaComponent channel = RgbaComponent.B) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { const float Epsilon = .00001f; diff --git a/src/ImageProcessorCore/Filters/Alpha.cs b/src/ImageProcessorCore/Filters/Alpha.cs index 4cbb6342f7..10540ce944 100644 --- a/src/ImageProcessorCore/Filters/Alpha.cs +++ b/src/ImageProcessorCore/Filters/Alpha.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The new opacity of the image. Must be between 0 and 100. /// The . public static Image Alpha(this Image source, int percent) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Alpha(source, percent, source.Bounds); @@ -39,7 +39,7 @@ namespace ImageProcessorCore /// /// The . public static Image Alpha(this Image source, int percent, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new AlphaProcessor(percent)); diff --git a/src/ImageProcessorCore/Filters/BackgroundColor.cs b/src/ImageProcessorCore/Filters/BackgroundColor.cs index 5a1b39d5f0..87dab88d52 100644 --- a/src/ImageProcessorCore/Filters/BackgroundColor.cs +++ b/src/ImageProcessorCore/Filters/BackgroundColor.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The color to set as the background. /// The . public static Image BackgroundColor(this Image source, TColor color) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(source.Bounds, new BackgroundColorProcessor(color)); diff --git a/src/ImageProcessorCore/Filters/BinaryThreshold.cs b/src/ImageProcessorCore/Filters/BinaryThreshold.cs index 40538fb2a5..cbb06acc08 100644 --- a/src/ImageProcessorCore/Filters/BinaryThreshold.cs +++ b/src/ImageProcessorCore/Filters/BinaryThreshold.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The threshold to apply binerization of the image. Must be between 0 and 1. /// The . public static Image BinaryThreshold(this Image source, float threshold) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return BinaryThreshold(source, threshold, source.Bounds); @@ -39,7 +39,7 @@ namespace ImageProcessorCore /// /// The . public static Image BinaryThreshold(this Image source, float threshold, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new BinaryThresholdProcessor(threshold)); diff --git a/src/ImageProcessorCore/Filters/BlackWhite.cs b/src/ImageProcessorCore/Filters/BlackWhite.cs index 6cd0e86cde..4885049e71 100644 --- a/src/ImageProcessorCore/Filters/BlackWhite.cs +++ b/src/ImageProcessorCore/Filters/BlackWhite.cs @@ -20,7 +20,7 @@ namespace ImageProcessorCore /// The image this method extends. /// The . public static Image BlackWhite(this Image source) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return BlackWhite(source, source.Bounds); @@ -37,7 +37,7 @@ namespace ImageProcessorCore /// /// The . public static Image BlackWhite(this Image source, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new BlackWhiteProcessor()); diff --git a/src/ImageProcessorCore/Filters/Blend.cs b/src/ImageProcessorCore/Filters/Blend.cs index 6161bf1640..dbf841e68a 100644 --- a/src/ImageProcessorCore/Filters/Blend.cs +++ b/src/ImageProcessorCore/Filters/Blend.cs @@ -22,7 +22,7 @@ namespace ImageProcessorCore /// The opacity of the image image to blend. Must be between 0 and 100. /// The . public static Image Blend(this Image source, ImageBase image, int percent = 50) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Blend(source, image, percent, source.Bounds); @@ -41,7 +41,7 @@ namespace ImageProcessorCore /// /// The . public static Image Blend(this Image source, ImageBase image, int percent, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new BlendProcessor(image, percent)); diff --git a/src/ImageProcessorCore/Filters/Brightness.cs b/src/ImageProcessorCore/Filters/Brightness.cs index 47b59067e6..165db691eb 100644 --- a/src/ImageProcessorCore/Filters/Brightness.cs +++ b/src/ImageProcessorCore/Filters/Brightness.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The new brightness of the image. Must be between -100 and 100. /// The . public static Image Brightness(this Image source, int amount) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Brightness(source, amount, source.Bounds); @@ -39,7 +39,7 @@ namespace ImageProcessorCore /// /// The . public static Image Brightness(this Image source, int amount, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new BrightnessProcessor(amount)); diff --git a/src/ImageProcessorCore/Filters/ColorBlindness.cs b/src/ImageProcessorCore/Filters/ColorBlindness.cs index cb7759b465..06330f8905 100644 --- a/src/ImageProcessorCore/Filters/ColorBlindness.cs +++ b/src/ImageProcessorCore/Filters/ColorBlindness.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The type of color blindness simulator to apply. /// The . public static Image ColorBlindness(this Image source, ColorBlindness colorBlindness) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return ColorBlindness(source, colorBlindness, source.Bounds); @@ -39,7 +39,7 @@ namespace ImageProcessorCore /// /// The . public static Image ColorBlindness(this Image source, ColorBlindness colorBlindness, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { IImageFilter processor; diff --git a/src/ImageProcessorCore/Filters/Contrast.cs b/src/ImageProcessorCore/Filters/Contrast.cs index 1f4d047465..d96c01aab5 100644 --- a/src/ImageProcessorCore/Filters/Contrast.cs +++ b/src/ImageProcessorCore/Filters/Contrast.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The new contrast of the image. Must be between -100 and 100. /// The . public static Image Contrast(this Image source, int amount) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Contrast(source, amount, source.Bounds); @@ -39,7 +39,7 @@ namespace ImageProcessorCore /// /// The . public static Image Contrast(this Image source, int amount, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new ContrastProcessor(amount)); diff --git a/src/ImageProcessorCore/Filters/Glow.cs b/src/ImageProcessorCore/Filters/Glow.cs index 1e973bbf99..205966cc2c 100644 --- a/src/ImageProcessorCore/Filters/Glow.cs +++ b/src/ImageProcessorCore/Filters/Glow.cs @@ -20,7 +20,7 @@ namespace ImageProcessorCore /// The image this method extends. /// The . public static Image Glow(this Image source) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Glow(source, default(TColor), source.Bounds.Width * .5F, source.Bounds); @@ -35,7 +35,7 @@ namespace ImageProcessorCore /// The color to set as the glow. /// The . public static Image Glow(this Image source, TColor color) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Glow(source, color, source.Bounds.Width * .5F, source.Bounds); @@ -50,7 +50,7 @@ namespace ImageProcessorCore /// The the radius. /// The . public static Image Glow(this Image source, float radius) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Glow(source, default(TColor), radius, source.Bounds); @@ -67,7 +67,7 @@ namespace ImageProcessorCore /// /// The . public static Image Glow(this Image source, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Glow(source, default(TColor), 0, rectangle); @@ -86,7 +86,7 @@ namespace ImageProcessorCore /// /// The . public static Image Glow(this Image source, TColor color, float radius, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { GlowProcessor processor = new GlowProcessor { Radius = radius, }; diff --git a/src/ImageProcessorCore/Filters/Grayscale.cs b/src/ImageProcessorCore/Filters/Grayscale.cs index f496c3da87..c399171f80 100644 --- a/src/ImageProcessorCore/Filters/Grayscale.cs +++ b/src/ImageProcessorCore/Filters/Grayscale.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The formula to apply to perform the operation. /// The . public static Image Grayscale(this Image source, GrayscaleMode mode = GrayscaleMode.Bt709) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Grayscale(source, source.Bounds, mode); @@ -39,7 +39,7 @@ namespace ImageProcessorCore /// The formula to apply to perform the operation. /// The . public static Image Grayscale(this Image source, Rectangle rectangle, GrayscaleMode mode = GrayscaleMode.Bt709) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { IImageFilter processor = mode == GrayscaleMode.Bt709 diff --git a/src/ImageProcessorCore/Filters/Hue.cs b/src/ImageProcessorCore/Filters/Hue.cs index 18e3a8a1a8..fa2d988182 100644 --- a/src/ImageProcessorCore/Filters/Hue.cs +++ b/src/ImageProcessorCore/Filters/Hue.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The angle in degrees to adjust the image. /// The . public static Image Hue(this Image source, float degrees) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Hue(source, degrees, source.Bounds); @@ -39,7 +39,7 @@ namespace ImageProcessorCore /// /// The . public static Image Hue(this Image source, float degrees, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new HueProcessor(degrees)); diff --git a/src/ImageProcessorCore/Filters/Invert.cs b/src/ImageProcessorCore/Filters/Invert.cs index b2132da6fe..fd1041d0d4 100644 --- a/src/ImageProcessorCore/Filters/Invert.cs +++ b/src/ImageProcessorCore/Filters/Invert.cs @@ -20,7 +20,7 @@ namespace ImageProcessorCore /// The image this method extends. /// The . public static Image Invert(this Image source) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Invert(source, source.Bounds); @@ -37,7 +37,7 @@ namespace ImageProcessorCore /// /// The . public static Image Invert(this Image source, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new InvertProcessor()); diff --git a/src/ImageProcessorCore/Filters/Kodachrome.cs b/src/ImageProcessorCore/Filters/Kodachrome.cs index 32eb6dd9df..433c7e1702 100644 --- a/src/ImageProcessorCore/Filters/Kodachrome.cs +++ b/src/ImageProcessorCore/Filters/Kodachrome.cs @@ -20,7 +20,7 @@ namespace ImageProcessorCore /// The image this method extends. /// The . public static Image Kodachrome(this Image source) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Kodachrome(source, source.Bounds); @@ -37,7 +37,7 @@ namespace ImageProcessorCore /// /// The . public static Image Kodachrome(this Image source, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new KodachromeProcessor()); diff --git a/src/ImageProcessorCore/Filters/Lomograph.cs b/src/ImageProcessorCore/Filters/Lomograph.cs index dc5443bd24..99305bfa07 100644 --- a/src/ImageProcessorCore/Filters/Lomograph.cs +++ b/src/ImageProcessorCore/Filters/Lomograph.cs @@ -20,7 +20,7 @@ namespace ImageProcessorCore /// The image this method extends. /// The . public static Image Lomograph(this Image source) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Lomograph(source, source.Bounds); @@ -37,7 +37,7 @@ namespace ImageProcessorCore /// /// The . public static Image Lomograph(this Image source, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new LomographProcessor()); diff --git a/src/ImageProcessorCore/Filters/Polaroid.cs b/src/ImageProcessorCore/Filters/Polaroid.cs index 0801f85b7e..7182c67526 100644 --- a/src/ImageProcessorCore/Filters/Polaroid.cs +++ b/src/ImageProcessorCore/Filters/Polaroid.cs @@ -20,7 +20,7 @@ namespace ImageProcessorCore /// The image this method extends. /// The . public static Image Polaroid(this Image source) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Polaroid(source, source.Bounds); @@ -37,7 +37,7 @@ namespace ImageProcessorCore /// /// The . public static Image Polaroid(this Image source, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new PolaroidProcessor()); diff --git a/src/ImageProcessorCore/Filters/Processors/AlphaProcessor.cs b/src/ImageProcessorCore/Filters/Processors/AlphaProcessor.cs index 12b731ecda..e88ee83f34 100644 --- a/src/ImageProcessorCore/Filters/Processors/AlphaProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/AlphaProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class AlphaProcessor : ImageFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/BackgroundColorProcessor.cs b/src/ImageProcessorCore/Filters/Processors/BackgroundColorProcessor.cs index 5039d6a939..52888692c3 100644 --- a/src/ImageProcessorCore/Filters/Processors/BackgroundColorProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/BackgroundColorProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class BackgroundColorProcessor : ImageFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/Binarization/BinaryThresholdProcessor.cs b/src/ImageProcessorCore/Filters/Processors/Binarization/BinaryThresholdProcessor.cs index 7111963ea2..ad6fed7bcf 100644 --- a/src/ImageProcessorCore/Filters/Processors/Binarization/BinaryThresholdProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/Binarization/BinaryThresholdProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class BinaryThresholdProcessor : ImageFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/BlendProcessor.cs b/src/ImageProcessorCore/Filters/Processors/BlendProcessor.cs index b29ef4e420..2663730591 100644 --- a/src/ImageProcessorCore/Filters/Processors/BlendProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/BlendProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class BlendProcessor : ImageFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/BrightnessProcessor.cs b/src/ImageProcessorCore/Filters/Processors/BrightnessProcessor.cs index 04d796fcaf..c41d4c7c3a 100644 --- a/src/ImageProcessorCore/Filters/Processors/BrightnessProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/BrightnessProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class BrightnessProcessor : ImageFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/BlackWhiteProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/BlackWhiteProcessor.cs index 2c7dc644a4..47d99161f2 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/BlackWhiteProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/BlackWhiteProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class BlackWhiteProcessor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs index 310be48945..9d62483dd6 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class AchromatomalyProcessor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs index 3317d79bbd..0993705bcc 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class AchromatopsiaProcessor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs index b38f1338ec..03d678c2cd 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class DeuteranomalyProcessor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs index 593fb20928..04b79fdb8f 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class DeuteranopiaProcessor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs index c5be10d3b7..883f53dfe8 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class ProtanomalyProcessor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs index 6cb829bd5d..7db6d55bd8 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class ProtanopiaProcessor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs index 85eed5f80f..1d5cbe27fc 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class TritanomalyProcessor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs index ada7ecde22..7d63cf4f47 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class TritanopiaProcessor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorMatrixFilter.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorMatrixFilter.cs index 7bbc5c0a87..0caefaab92 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorMatrixFilter.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/ColorMatrixFilter.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public abstract class ColorMatrixFilter : ImageFilter, IColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/GrayscaleBt601Processor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/GrayscaleBt601Processor.cs index ff48a2e022..c6bd5888dc 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/GrayscaleBt601Processor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/GrayscaleBt601Processor.cs @@ -14,7 +14,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class GrayscaleBt601Processor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/GrayscaleBt709Processor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/GrayscaleBt709Processor.cs index 6da2baee39..cfe11a7a49 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/GrayscaleBt709Processor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/GrayscaleBt709Processor.cs @@ -12,7 +12,7 @@ namespace ImageProcessorCore.Processors /// ITU-R Recommendation BT.709 . /// public class GrayscaleBt709Processor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/HueProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/HueProcessor.cs index afe6dbca9b..ccbeaabb02 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/HueProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/HueProcessor.cs @@ -14,7 +14,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class HueProcessor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/IColorMatrixFilter.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/IColorMatrixFilter.cs index 4310738b04..3cd88ebf4b 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/IColorMatrixFilter.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/IColorMatrixFilter.cs @@ -14,7 +14,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public interface IColorMatrixFilter : IImageFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/KodachromeProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/KodachromeProcessor.cs index 5655cfe255..0ad46254ce 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/KodachromeProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/KodachromeProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class KodachromeProcessor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/LomographProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/LomographProcessor.cs index b4f7967d80..a03ffc912f 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/LomographProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/LomographProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class LomographProcessor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/PolaroidProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/PolaroidProcessor.cs index 6a464da841..6852ec444d 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/PolaroidProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/PolaroidProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class PolaroidProcessor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/SaturationProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/SaturationProcessor.cs index 37612357ab..d54d7b8344 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/SaturationProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/SaturationProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class SaturationProcessor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/SepiaProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/SepiaProcessor.cs index 040d488845..f9a3b2d8c7 100644 --- a/src/ImageProcessorCore/Filters/Processors/ColorMatrix/SepiaProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ColorMatrix/SepiaProcessor.cs @@ -14,7 +14,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class SepiaProcessor : ColorMatrixFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ContrastProcessor.cs b/src/ImageProcessorCore/Filters/Processors/ContrastProcessor.cs index 3e37d27224..24f56fb347 100644 --- a/src/ImageProcessorCore/Filters/Processors/ContrastProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/ContrastProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. long, float. public class ContrastProcessor : ImageFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/GlowProcessor.cs b/src/ImageProcessorCore/Filters/Processors/GlowProcessor.cs index 01eb9cd8ec..dc409748be 100644 --- a/src/ImageProcessorCore/Filters/Processors/GlowProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/GlowProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class GlowProcessor : ImageFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/IImageFilter.cs b/src/ImageProcessorCore/Filters/Processors/IImageFilter.cs index 69037f6c1f..39ea5ecbfe 100644 --- a/src/ImageProcessorCore/Filters/Processors/IImageFilter.cs +++ b/src/ImageProcessorCore/Filters/Processors/IImageFilter.cs @@ -6,7 +6,7 @@ /// The pixel format. /// The packed format. uint, long, float. public interface IImageFilter : IImageProcessor - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/ImageFilter.cs b/src/ImageProcessorCore/Filters/Processors/ImageFilter.cs index 1ac88ff529..dd7114e0b5 100644 --- a/src/ImageProcessorCore/Filters/Processors/ImageFilter.cs +++ b/src/ImageProcessorCore/Filters/Processors/ImageFilter.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public abstract class ImageFilter : ImageProcessor, IImageFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/InvertProcessor.cs b/src/ImageProcessorCore/Filters/Processors/InvertProcessor.cs index 9fe61d03bf..d99ed598bf 100644 --- a/src/ImageProcessorCore/Filters/Processors/InvertProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/InvertProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class InvertProcessor : ImageFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Processors/VignetteProcessor.cs b/src/ImageProcessorCore/Filters/Processors/VignetteProcessor.cs index f725e75c69..b7ac7dbfd7 100644 --- a/src/ImageProcessorCore/Filters/Processors/VignetteProcessor.cs +++ b/src/ImageProcessorCore/Filters/Processors/VignetteProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class VignetteProcessor : ImageFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Filters/Saturation.cs b/src/ImageProcessorCore/Filters/Saturation.cs index 6158be7fcc..d964bd6e19 100644 --- a/src/ImageProcessorCore/Filters/Saturation.cs +++ b/src/ImageProcessorCore/Filters/Saturation.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The new saturation of the image. Must be between -100 and 100. /// The . public static Image Saturation(this Image source, int amount) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Saturation(source, amount, source.Bounds); @@ -39,7 +39,7 @@ namespace ImageProcessorCore /// /// The . public static Image Saturation(this Image source, int amount, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new SaturationProcessor(amount)); diff --git a/src/ImageProcessorCore/Filters/Sepia.cs b/src/ImageProcessorCore/Filters/Sepia.cs index 5102f0772a..d4d72457ff 100644 --- a/src/ImageProcessorCore/Filters/Sepia.cs +++ b/src/ImageProcessorCore/Filters/Sepia.cs @@ -20,7 +20,7 @@ namespace ImageProcessorCore /// The image this method extends. /// The . public static Image Sepia(this Image source) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Sepia(source, source.Bounds); @@ -37,7 +37,7 @@ namespace ImageProcessorCore /// /// The . public static Image Sepia(this Image source, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new SepiaProcessor()); diff --git a/src/ImageProcessorCore/Filters/Vignette.cs b/src/ImageProcessorCore/Filters/Vignette.cs index bb0f058e90..07aafd26ca 100644 --- a/src/ImageProcessorCore/Filters/Vignette.cs +++ b/src/ImageProcessorCore/Filters/Vignette.cs @@ -20,7 +20,7 @@ namespace ImageProcessorCore /// The image this method extends. /// The . public static Image Vignette(this Image source) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Vignette(source, default(TColor), source.Bounds.Width * .5F, source.Bounds.Height * .5F, source.Bounds); @@ -35,7 +35,7 @@ namespace ImageProcessorCore /// The color to set as the vignette. /// The . public static Image Vignette(this Image source, TColor color) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Vignette(source, color, source.Bounds.Width * .5F, source.Bounds.Height * .5F, source.Bounds); @@ -51,7 +51,7 @@ namespace ImageProcessorCore /// The the y-radius. /// The . public static Image Vignette(this Image source, float radiusX, float radiusY) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Vignette(source, default(TColor), radiusX, radiusY, source.Bounds); @@ -68,7 +68,7 @@ namespace ImageProcessorCore /// /// The . public static Image Vignette(this Image source, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Vignette(source, default(TColor), 0, 0, rectangle); @@ -88,7 +88,7 @@ namespace ImageProcessorCore /// /// The . public static Image Vignette(this Image source, TColor color, float radiusX, float radiusY, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { VignetteProcessor processor = new VignetteProcessor { RadiusX = radiusX, RadiusY = radiusY }; diff --git a/src/ImageProcessorCore/Formats/Bmp/BmpDecoder.cs b/src/ImageProcessorCore/Formats/Bmp/BmpDecoder.cs index 2f24845549..ee12faf849 100644 --- a/src/ImageProcessorCore/Formats/Bmp/BmpDecoder.cs +++ b/src/ImageProcessorCore/Formats/Bmp/BmpDecoder.cs @@ -71,7 +71,7 @@ namespace ImageProcessorCore.Formats /// public void Decode(Image image, Stream stream) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { Guard.NotNull(image, "image"); diff --git a/src/ImageProcessorCore/Formats/Bmp/BmpDecoderCore.cs b/src/ImageProcessorCore/Formats/Bmp/BmpDecoderCore.cs index 3afc2c75d4..f7406f9fb1 100644 --- a/src/ImageProcessorCore/Formats/Bmp/BmpDecoderCore.cs +++ b/src/ImageProcessorCore/Formats/Bmp/BmpDecoderCore.cs @@ -61,7 +61,7 @@ namespace ImageProcessorCore.Formats /// is null. /// public void Decode(Image image, Stream stream) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { this.currentStream = stream; @@ -196,7 +196,7 @@ namespace ImageProcessorCore.Formats /// The number of bits per pixel. /// Whether the bitmap is inverted. private void ReadRgbPalette(TColor[] imageData, byte[] colors, int width, int height, int bits, bool inverted) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { // Pixels per byte (bits per pixel) @@ -259,7 +259,7 @@ namespace ImageProcessorCore.Formats /// The height of the bitmap. /// Whether the bitmap is inverted. private void ReadRgb16(TColor[] imageData, int width, int height, bool inverted) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { // We divide here as we will store the colors in our floating point format. @@ -310,7 +310,7 @@ namespace ImageProcessorCore.Formats /// The height of the bitmap. /// Whether the bitmap is inverted. private void ReadRgb24(TColor[] imageData, int width, int height, bool inverted) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { int alignment; @@ -350,7 +350,7 @@ namespace ImageProcessorCore.Formats /// The height of the bitmap. /// Whether the bitmap is inverted. private void ReadRgb32(TColor[] imageData, int width, int height, bool inverted) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { int alignment; diff --git a/src/ImageProcessorCore/Formats/Bmp/BmpEncoder.cs b/src/ImageProcessorCore/Formats/Bmp/BmpEncoder.cs index 9b19644198..52f6f73900 100644 --- a/src/ImageProcessorCore/Formats/Bmp/BmpEncoder.cs +++ b/src/ImageProcessorCore/Formats/Bmp/BmpEncoder.cs @@ -44,7 +44,7 @@ namespace ImageProcessorCore.Formats /// public void Encode(Image image, Stream stream) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { BmpEncoderCore encoder = new BmpEncoderCore(); diff --git a/src/ImageProcessorCore/Formats/Bmp/BmpEncoderCore.cs b/src/ImageProcessorCore/Formats/Bmp/BmpEncoderCore.cs index edd6639977..a01fce35b8 100644 --- a/src/ImageProcessorCore/Formats/Bmp/BmpEncoderCore.cs +++ b/src/ImageProcessorCore/Formats/Bmp/BmpEncoderCore.cs @@ -33,7 +33,7 @@ namespace ImageProcessorCore.Formats /// The to encode the image data to. /// The public void Encode(ImageBase image, Stream stream, BmpBitsPerPixel bitsPerPixel) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { Guard.NotNull(image, nameof(image)); @@ -126,7 +126,7 @@ namespace ImageProcessorCore.Formats /// The containing pixel data. /// private void WriteImage(EndianBinaryWriter writer, ImageBase image) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { using (PixelAccessor pixels = image.Lock()) @@ -152,7 +152,7 @@ namespace ImageProcessorCore.Formats /// The containing the stream to write to. /// The containing pixel data. private void Write32Bit(EndianBinaryWriter writer, PixelAccessor pixels) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { for (int y = pixels.Height - 1; y >= 0; y--) @@ -180,7 +180,7 @@ namespace ImageProcessorCore.Formats /// The containing the stream to write to. /// The containing pixel data. private void Write24Bit(EndianBinaryWriter writer, PixelAccessor pixels) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { for (int y = pixels.Height - 1; y >= 0; y--) diff --git a/src/ImageProcessorCore/Formats/Gif/GifDecoder.cs b/src/ImageProcessorCore/Formats/Gif/GifDecoder.cs index 874dc694f8..8885093abd 100644 --- a/src/ImageProcessorCore/Formats/Gif/GifDecoder.cs +++ b/src/ImageProcessorCore/Formats/Gif/GifDecoder.cs @@ -56,7 +56,7 @@ namespace ImageProcessorCore.Formats /// public void Decode(Image image, Stream stream) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { new GifDecoderCore().Decode(image, stream); diff --git a/src/ImageProcessorCore/Formats/Gif/GifDecoderCore.cs b/src/ImageProcessorCore/Formats/Gif/GifDecoderCore.cs index a587a7df30..1be0ac8ce0 100644 --- a/src/ImageProcessorCore/Formats/Gif/GifDecoderCore.cs +++ b/src/ImageProcessorCore/Formats/Gif/GifDecoderCore.cs @@ -14,7 +14,7 @@ namespace ImageProcessorCore.Formats /// The pixel format. /// The packed format. uint, long, float. internal class GifDecoderCore - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Formats/Gif/GifEncoder.cs b/src/ImageProcessorCore/Formats/Gif/GifEncoder.cs index 4b36c116f7..2e16c756f4 100644 --- a/src/ImageProcessorCore/Formats/Gif/GifEncoder.cs +++ b/src/ImageProcessorCore/Formats/Gif/GifEncoder.cs @@ -48,7 +48,7 @@ namespace ImageProcessorCore.Formats /// public void Encode(Image image, Stream stream) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { GifEncoderCore encoder = new GifEncoderCore diff --git a/src/ImageProcessorCore/Formats/Gif/GifEncoderCore.cs b/src/ImageProcessorCore/Formats/Gif/GifEncoderCore.cs index 507cc45278..0382269d85 100644 --- a/src/ImageProcessorCore/Formats/Gif/GifEncoderCore.cs +++ b/src/ImageProcessorCore/Formats/Gif/GifEncoderCore.cs @@ -47,7 +47,7 @@ namespace ImageProcessorCore.Formats /// The to encode from. /// The to encode the image data to. public void Encode(Image image, Stream stream) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { Guard.NotNull(image, nameof(image)); @@ -116,7 +116,7 @@ namespace ImageProcessorCore.Formats /// The . /// private static int GetTransparentIndex(QuantizedImage quantized) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { // Find the lowest alpha value and make it the transparent index. @@ -153,7 +153,7 @@ namespace ImageProcessorCore.Formats /// The writer to write to the stream with. /// The transparency index to set the default background index to. private void WriteLogicalScreenDescriptor(Image image, EndianBinaryWriter writer, int tranparencyIndex) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { GifLogicalScreenDescriptor descriptor = new GifLogicalScreenDescriptor @@ -227,7 +227,7 @@ namespace ImageProcessorCore.Formats /// The stream to write to. /// The index of the color in the color palette to make transparent. private void WriteGraphicalControlExtension(ImageBase image, EndianBinaryWriter writer, int transparencyIndex) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { // TODO: Check transparency logic. @@ -275,7 +275,7 @@ namespace ImageProcessorCore.Formats /// The to be encoded. /// The stream to write to. private void WriteImageDescriptor(ImageBase image, EndianBinaryWriter writer) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { writer.Write(GifConstants.ImageDescriptorLabel); // 2c @@ -302,7 +302,7 @@ namespace ImageProcessorCore.Formats /// The to encode. /// The writer to write to the stream with. private void WriteColorTable(QuantizedImage image, EndianBinaryWriter writer) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { // Grab the palette and write it to the stream. @@ -337,7 +337,7 @@ namespace ImageProcessorCore.Formats /// The containing indexed pixels. /// The stream to write to. private void WriteImageData(QuantizedImage image, EndianBinaryWriter writer) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { byte[] indexedPixels = image.Pixels; diff --git a/src/ImageProcessorCore/Formats/IImageDecoder.cs b/src/ImageProcessorCore/Formats/IImageDecoder.cs index da1b819194..75f9420092 100644 --- a/src/ImageProcessorCore/Formats/IImageDecoder.cs +++ b/src/ImageProcessorCore/Formats/IImageDecoder.cs @@ -46,7 +46,7 @@ namespace ImageProcessorCore.Formats /// The to decode to. /// The containing image data. void Decode(Image image, Stream stream) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct; } } diff --git a/src/ImageProcessorCore/Formats/IImageEncoder.cs b/src/ImageProcessorCore/Formats/IImageEncoder.cs index 445b7f645c..a23b2c6811 100644 --- a/src/ImageProcessorCore/Formats/IImageEncoder.cs +++ b/src/ImageProcessorCore/Formats/IImageEncoder.cs @@ -45,7 +45,7 @@ namespace ImageProcessorCore.Formats /// The to encode from. /// The to encode the image data to. void Encode(Image image, Stream stream) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct; } } diff --git a/src/ImageProcessorCore/Formats/Jpg/JpegDecoder.cs b/src/ImageProcessorCore/Formats/Jpg/JpegDecoder.cs index 5f6869ddfd..fcaf0529ab 100644 --- a/src/ImageProcessorCore/Formats/Jpg/JpegDecoder.cs +++ b/src/ImageProcessorCore/Formats/Jpg/JpegDecoder.cs @@ -77,7 +77,7 @@ namespace ImageProcessorCore.Formats /// public void Decode(Image image, Stream stream) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { Guard.NotNull(image, "image"); diff --git a/src/ImageProcessorCore/Formats/Jpg/JpegDecoderCore.cs.REMOVED.git-id b/src/ImageProcessorCore/Formats/Jpg/JpegDecoderCore.cs.REMOVED.git-id index 10a9e18c2d..0b8dc48f49 100644 --- a/src/ImageProcessorCore/Formats/Jpg/JpegDecoderCore.cs.REMOVED.git-id +++ b/src/ImageProcessorCore/Formats/Jpg/JpegDecoderCore.cs.REMOVED.git-id @@ -1 +1 @@ -4b157cb3b1a798514be3c1b13c1ed4294bf9d6f1 \ No newline at end of file +2338fe71c541507d3f7908df30aa09ade1705356 \ No newline at end of file diff --git a/src/ImageProcessorCore/Formats/Jpg/JpegEncoder.cs b/src/ImageProcessorCore/Formats/Jpg/JpegEncoder.cs index 83f87acb72..b6acc7784f 100644 --- a/src/ImageProcessorCore/Formats/Jpg/JpegEncoder.cs +++ b/src/ImageProcessorCore/Formats/Jpg/JpegEncoder.cs @@ -79,7 +79,7 @@ namespace ImageProcessorCore.Formats /// public void Encode(Image image, Stream stream) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { JpegEncoderCore encode = new JpegEncoderCore(); diff --git a/src/ImageProcessorCore/Formats/Jpg/JpegEncoderCore.cs b/src/ImageProcessorCore/Formats/Jpg/JpegEncoderCore.cs index 57ab791817..036346fede 100644 --- a/src/ImageProcessorCore/Formats/Jpg/JpegEncoderCore.cs +++ b/src/ImageProcessorCore/Formats/Jpg/JpegEncoderCore.cs @@ -343,7 +343,7 @@ namespace ImageProcessorCore.Formats // toYCbCr converts the 8x8 region of m whose top-left corner is p to its // YCbCr values. private void ToYCbCr(PixelAccessor pixels, int x, int y, Block yBlock, Block cbBlock, Block crBlock) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { int xmax = pixels.Width - 1; @@ -431,7 +431,7 @@ namespace ImageProcessorCore.Formats // Encode writes the Image m to w in JPEG 4:2:0 baseline format with the given // options. Default parameters are used if a nil *Options is passed. public void Encode(Image image, Stream stream, int quality, JpegSubsample sample) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { Guard.NotNull(image, nameof(image)); @@ -571,7 +571,7 @@ namespace ImageProcessorCore.Formats } private void WriteProfiles(Image image) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { WriteProfile(image.ExifProfile); @@ -711,7 +711,7 @@ namespace ImageProcessorCore.Formats /// /// The pixel accessor providing acces to the image pixels. private void WriteSOS(PixelAccessor pixels) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { // TODO: We should allow grayscale writing. @@ -738,7 +738,7 @@ namespace ImageProcessorCore.Formats /// /// The pixel accessor providing acces to the image pixels. private void Encode444(PixelAccessor pixels) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { Block b = new Block(); @@ -764,7 +764,7 @@ namespace ImageProcessorCore.Formats /// /// The pixel accessor providing acces to the image pixels. private void Encode420(PixelAccessor pixels) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { Block b = new Block(); diff --git a/src/ImageProcessorCore/Formats/Png/PngDecoder.cs b/src/ImageProcessorCore/Formats/Png/PngDecoder.cs index 0fad54dd7a..587a8e7359 100644 --- a/src/ImageProcessorCore/Formats/Png/PngDecoder.cs +++ b/src/ImageProcessorCore/Formats/Png/PngDecoder.cs @@ -82,7 +82,7 @@ namespace ImageProcessorCore.Formats /// The to decode to. /// The containing image data. public void Decode(Image image, Stream stream) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { new PngDecoderCore().Decode(image, stream); diff --git a/src/ImageProcessorCore/Formats/Png/PngDecoderCore.cs b/src/ImageProcessorCore/Formats/Png/PngDecoderCore.cs index d68bec5118..a67280be01 100644 --- a/src/ImageProcessorCore/Formats/Png/PngDecoderCore.cs +++ b/src/ImageProcessorCore/Formats/Png/PngDecoderCore.cs @@ -91,7 +91,7 @@ namespace ImageProcessorCore.Formats /// Thrown if the image is larger than the maximum allowable size. /// public void Decode(Image image, Stream stream) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { Image currentImage = image; @@ -163,7 +163,7 @@ namespace ImageProcessorCore.Formats /// The image to read to. /// The data containing physical data. private void ReadPhysicalChunk(Image image, byte[] data) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { Array.Reverse(data, 0, 4); @@ -227,7 +227,7 @@ namespace ImageProcessorCore.Formats /// The containing data. /// The pixel data. private void ReadScanlines(MemoryStream dataStream, TColor[] pixels) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { this.bytesPerPixel = this.CalculateBytesPerPixel(); @@ -260,7 +260,7 @@ namespace ImageProcessorCore.Formats /// The pixel data. /// The image pixels. private void DecodePixelData(byte[] pixelData, TColor[] pixels) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { byte[] previousScanline = new byte[this.bytesPerScanline]; @@ -322,7 +322,7 @@ namespace ImageProcessorCore.Formats /// The current image row. /// The image pixels private void ProcessDefilteredScanline(byte[] defilteredScanline, int row, TColor[] pixels) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { switch (this.PngColorType) @@ -450,7 +450,7 @@ namespace ImageProcessorCore.Formats /// The image to decode to. /// The containing data. private void ReadTextChunk(Image image, byte[] data) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { int zeroIndex = 0; diff --git a/src/ImageProcessorCore/Formats/Png/PngEncoder.cs b/src/ImageProcessorCore/Formats/Png/PngEncoder.cs index de0dbac289..2c9fec654c 100644 --- a/src/ImageProcessorCore/Formats/Png/PngEncoder.cs +++ b/src/ImageProcessorCore/Formats/Png/PngEncoder.cs @@ -73,7 +73,7 @@ namespace ImageProcessorCore.Formats /// public void Encode(Image image, Stream stream) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { PngEncoderCore encoder = new PngEncoderCore diff --git a/src/ImageProcessorCore/Formats/Png/PngEncoderCore.cs b/src/ImageProcessorCore/Formats/Png/PngEncoderCore.cs index 9f21ba47a9..8bb2dcae15 100644 --- a/src/ImageProcessorCore/Formats/Png/PngEncoderCore.cs +++ b/src/ImageProcessorCore/Formats/Png/PngEncoderCore.cs @@ -96,7 +96,7 @@ namespace ImageProcessorCore.Formats /// The to encode from. /// The to encode the image data to. public void Encode(ImageBase image, Stream stream) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { Guard.NotNull(image, nameof(image)); @@ -233,7 +233,7 @@ namespace ImageProcessorCore.Formats /// The containing image data. /// The . private void CollectIndexedBytes(ImageBase image, Stream stream, PngHeader header) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { // Quatize the image and get the pixels @@ -248,7 +248,7 @@ namespace ImageProcessorCore.Formats /// The packed format. uint, long, float. /// The image to encode. private void CollectGrayscaleBytes(ImageBase image) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { // Copy the pixels across from the image. @@ -292,7 +292,7 @@ namespace ImageProcessorCore.Formats /// The packed format. uint, long, float. /// The image to encode. private void CollectColorBytes(ImageBase image) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { // Copy the pixels across from the image. @@ -483,7 +483,7 @@ namespace ImageProcessorCore.Formats /// The image to encode. /// The private QuantizedImage WritePaletteChunk(Stream stream, PngHeader header, ImageBase image) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { if (this.Quality > 256) @@ -553,7 +553,7 @@ namespace ImageProcessorCore.Formats /// The containing image data. /// The image base. private void WritePhysicalChunk(Stream stream, ImageBase imageBase) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { Image image = imageBase as Image; diff --git a/src/ImageProcessorCore/Image/IImageBase.cs b/src/ImageProcessorCore/Image/IImageBase.cs index cc2ef9a793..91443672df 100644 --- a/src/ImageProcessorCore/Image/IImageBase.cs +++ b/src/ImageProcessorCore/Image/IImageBase.cs @@ -11,7 +11,7 @@ namespace ImageProcessorCore /// The pixel format. /// The packed format. uint, long, float. public interface IImageBase : IImageBase - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Image/IImageFrame.cs b/src/ImageProcessorCore/Image/IImageFrame.cs index 5919b7e1e8..0b67395a21 100644 --- a/src/ImageProcessorCore/Image/IImageFrame.cs +++ b/src/ImageProcessorCore/Image/IImageFrame.cs @@ -11,7 +11,7 @@ namespace ImageProcessorCore /// The pixel format. /// The packed format. uint, long, float. public interface IImageFrame : IImageBase - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { } diff --git a/src/ImageProcessorCore/Image/Image.cs b/src/ImageProcessorCore/Image/Image.cs index 178cae82a8..f3825a82d2 100644 --- a/src/ImageProcessorCore/Image/Image.cs +++ b/src/ImageProcessorCore/Image/Image.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The packed format. uint, long, float. [DebuggerDisplay("Image: {Width}x{Height}")] public class Image : ImageBase - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Image/ImageBase.cs b/src/ImageProcessorCore/Image/ImageBase.cs index e5bfb716d1..2db186747b 100644 --- a/src/ImageProcessorCore/Image/ImageBase.cs +++ b/src/ImageProcessorCore/Image/ImageBase.cs @@ -17,7 +17,7 @@ namespace ImageProcessorCore /// The packed format. uint, long, float. [DebuggerDisplay("Image: {Width}x{Height}")] public abstract class ImageBase : IImageBase - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { diff --git a/src/ImageProcessorCore/Image/ImageFrame.cs b/src/ImageProcessorCore/Image/ImageFrame.cs index 6a4ac8ba39..41fa13b309 100644 --- a/src/ImageProcessorCore/Image/ImageFrame.cs +++ b/src/ImageProcessorCore/Image/ImageFrame.cs @@ -11,7 +11,7 @@ namespace ImageProcessorCore /// The pixel format. /// The packed format. uint, long, float. public class ImageFrame : ImageBase - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Image/ImageIOExtensions.cs b/src/ImageProcessorCore/Image/ImageIOExtensions.cs index 85d9fe3fe5..de0d76d53b 100644 --- a/src/ImageProcessorCore/Image/ImageIOExtensions.cs +++ b/src/ImageProcessorCore/Image/ImageIOExtensions.cs @@ -26,7 +26,7 @@ namespace ImageProcessorCore /// The . /// public static Image SaveAsBmp(this Image source, Stream stream) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct => source.Save(stream, new BmpEncoder()); @@ -45,7 +45,7 @@ namespace ImageProcessorCore /// The . /// public static Image SaveAsPng(this Image source, Stream stream, int quality = int.MaxValue) - where TColor : IPackedVector where TPacked : struct + where TColor : struct, IPackedVector where TPacked : struct => source.Save(stream, new PngEncoder { Quality = quality }); /// @@ -61,7 +61,7 @@ namespace ImageProcessorCore /// The . /// public static Image SaveAsJpeg(this Image source, Stream stream, int quality = 75) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct => source.Save(stream, new JpegEncoder { Quality = quality }); @@ -78,7 +78,7 @@ namespace ImageProcessorCore /// The . /// public static Image SaveAsGif(this Image source, Stream stream, int quality = 256) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct => source.Save(stream, new GifEncoder { Quality = quality }); } diff --git a/src/ImageProcessorCore/Image/ImageProcessingExtensions.cs b/src/ImageProcessorCore/Image/ImageProcessingExtensions.cs index e3a0dbd182..19bbee25e7 100644 --- a/src/ImageProcessorCore/Image/ImageProcessingExtensions.cs +++ b/src/ImageProcessorCore/Image/ImageProcessingExtensions.cs @@ -23,7 +23,7 @@ namespace ImageProcessorCore /// The processor to apply to the image. /// The . internal static Image Process(this Image source, IImageFilter processor) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Process(source, source.Bounds, processor); @@ -42,7 +42,7 @@ namespace ImageProcessorCore /// The processors to apply to the image. /// The . internal static Image Process(this Image source, Rectangle sourceRectangle, IImageFilter processor) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return PerformAction(source, (sourceImage) => processor.Apply(sourceImage, sourceRectangle)); @@ -58,7 +58,7 @@ namespace ImageProcessorCore /// The processor to apply to the image. /// The . internal static Image Process(this Image source, IImageSampler processor) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Process(source, source.Bounds, processor); @@ -77,7 +77,7 @@ namespace ImageProcessorCore /// The processors to apply to the image. /// The . internal static Image Process(this Image source, Rectangle sourceRectangle, IImageSampler processor) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return PerformAction(source, true, (sourceImage, targetImage) => processor.Apply(targetImage, sourceImage, sourceRectangle)); @@ -97,7 +97,7 @@ namespace ImageProcessorCore /// The processor to apply to the image. /// The . internal static Image Process(this Image source, int width, int height, IImageSampler sampler) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Process(source, width, height, source.Bounds, default(Rectangle), sampler); @@ -124,7 +124,7 @@ namespace ImageProcessorCore /// The processor to apply to the image. /// The . internal static Image Process(this Image source, int width, int height, Rectangle sourceRectangle, Rectangle targetRectangle, IImageSampler sampler) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return PerformAction(source, false, (sourceImage, targetImage) => sampler.Apply(targetImage, sourceImage, width, height, targetRectangle, sourceRectangle)); @@ -139,7 +139,7 @@ namespace ImageProcessorCore /// The to perform against the image. /// The . private static Image PerformAction(Image source, Action> action) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { action(source); @@ -162,7 +162,7 @@ namespace ImageProcessorCore /// The to perform against the image. /// The . private static Image PerformAction(Image source, bool clone, Action, ImageBase> action) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { Image transformedImage = clone diff --git a/src/ImageProcessorCore/Image/PixelAccessor.cs b/src/ImageProcessorCore/Image/PixelAccessor.cs index 7561150a56..42989d0440 100644 --- a/src/ImageProcessorCore/Image/PixelAccessor.cs +++ b/src/ImageProcessorCore/Image/PixelAccessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore /// The pixel format. /// The packed format. uint, long, float. public unsafe class PixelAccessor : IDisposable - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/ImageProcessor.cs b/src/ImageProcessorCore/ImageProcessor.cs index ffe9ea3089..93fdee2e2b 100644 --- a/src/ImageProcessorCore/ImageProcessor.cs +++ b/src/ImageProcessorCore/ImageProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public abstract class ImageProcessor : IImageProcessor - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Profiles/Exif/ExifProfile.cs b/src/ImageProcessorCore/Profiles/Exif/ExifProfile.cs index 2c1509fd0e..4d3e3362a0 100644 --- a/src/ImageProcessorCore/Profiles/Exif/ExifProfile.cs +++ b/src/ImageProcessorCore/Profiles/Exif/ExifProfile.cs @@ -118,7 +118,7 @@ namespace ImageProcessorCore /// The pixel format. /// The packed format. uint, long, float. public Image CreateThumbnail() - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { this.InitializeValues(); diff --git a/src/ImageProcessorCore/Quantizers/IQuantizer.cs b/src/ImageProcessorCore/Quantizers/IQuantizer.cs index 1ad7ad9c38..da196bfcf6 100644 --- a/src/ImageProcessorCore/Quantizers/IQuantizer.cs +++ b/src/ImageProcessorCore/Quantizers/IQuantizer.cs @@ -11,7 +11,7 @@ namespace ImageProcessorCore.Quantizers /// The pixel format. /// The packed format. uint, long, float. public interface IQuantizer : IQuantizer - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Quantizers/Octree/OctreeQuantizer.cs b/src/ImageProcessorCore/Quantizers/Octree/OctreeQuantizer.cs index d6eeb535ff..202492e715 100644 --- a/src/ImageProcessorCore/Quantizers/Octree/OctreeQuantizer.cs +++ b/src/ImageProcessorCore/Quantizers/Octree/OctreeQuantizer.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Quantizers /// The pixel format. /// The packed format. uint, long, float. public sealed class OctreeQuantizer : Quantizer - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Quantizers/Octree/Quantizer.cs b/src/ImageProcessorCore/Quantizers/Octree/Quantizer.cs index 1354808798..375193b913 100644 --- a/src/ImageProcessorCore/Quantizers/Octree/Quantizer.cs +++ b/src/ImageProcessorCore/Quantizers/Octree/Quantizer.cs @@ -14,7 +14,7 @@ namespace ImageProcessorCore.Quantizers /// The pixel format. /// The packed format. uint, long, float. public abstract class Quantizer : IQuantizer - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Quantizers/Palette/PaletteQuantizer.cs b/src/ImageProcessorCore/Quantizers/Palette/PaletteQuantizer.cs index 07a4098463..f448702315 100644 --- a/src/ImageProcessorCore/Quantizers/Palette/PaletteQuantizer.cs +++ b/src/ImageProcessorCore/Quantizers/Palette/PaletteQuantizer.cs @@ -17,7 +17,7 @@ namespace ImageProcessorCore.Quantizers /// The pixel format. /// The packed format. uint, long, float. public class PaletteQuantizer : Quantizer - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Quantizers/Quantize.cs b/src/ImageProcessorCore/Quantizers/Quantize.cs index c6b72430c5..7116b7d0a8 100644 --- a/src/ImageProcessorCore/Quantizers/Quantize.cs +++ b/src/ImageProcessorCore/Quantizers/Quantize.cs @@ -22,7 +22,7 @@ namespace ImageProcessorCore /// The maximum number of colors to return. Defaults to 256. /// The . public static Image Quantize(this Image source, Quantization mode = Quantization.Octree, int maxColors = 256) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { IQuantizer quantizer; @@ -54,7 +54,7 @@ namespace ImageProcessorCore /// The maximum number of colors to return. /// The . public static Image Quantize(this Image source, IQuantizer quantizer, int maxColors) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { QuantizedImage quantizedImage = quantizer.Quantize(source, maxColors); diff --git a/src/ImageProcessorCore/Quantizers/QuantizedImage.cs b/src/ImageProcessorCore/Quantizers/QuantizedImage.cs index 79b618a964..7bb5c6f5b1 100644 --- a/src/ImageProcessorCore/Quantizers/QuantizedImage.cs +++ b/src/ImageProcessorCore/Quantizers/QuantizedImage.cs @@ -14,7 +14,7 @@ namespace ImageProcessorCore.Quantizers /// The pixel format. /// The packed format. uint, long, float. public class QuantizedImage - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Quantizers/Wu/WuQuantizer.cs b/src/ImageProcessorCore/Quantizers/Wu/WuQuantizer.cs index 15e9cc5056..b3365803d8 100644 --- a/src/ImageProcessorCore/Quantizers/Wu/WuQuantizer.cs +++ b/src/ImageProcessorCore/Quantizers/Wu/WuQuantizer.cs @@ -35,7 +35,7 @@ namespace ImageProcessorCore.Quantizers /// The pixel format. /// The packed format. uint, long, float. public sealed class WuQuantizer : IQuantizer - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/AutoOrient.cs b/src/ImageProcessorCore/Samplers/AutoOrient.cs index 26fe192d8c..63c3669f19 100644 --- a/src/ImageProcessorCore/Samplers/AutoOrient.cs +++ b/src/ImageProcessorCore/Samplers/AutoOrient.cs @@ -18,7 +18,7 @@ namespace ImageProcessorCore /// The image to auto rotate. /// The public static Image AutoOrient(this Image source) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { Orientation orientation = GetExifOrientation(source); @@ -63,7 +63,7 @@ namespace ImageProcessorCore /// The image to auto rotate. /// The private static Orientation GetExifOrientation(Image source) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { if (source.ExifProfile == null) diff --git a/src/ImageProcessorCore/Samplers/BoxBlur.cs b/src/ImageProcessorCore/Samplers/BoxBlur.cs index 53442d841e..679ad374be 100644 --- a/src/ImageProcessorCore/Samplers/BoxBlur.cs +++ b/src/ImageProcessorCore/Samplers/BoxBlur.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The 'radius' value representing the size of the area to sample. /// The . public static Image BoxBlur(this Image source, int radius = 7) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return BoxBlur(source, radius, source.Bounds); @@ -39,7 +39,7 @@ namespace ImageProcessorCore /// /// The . public static Image BoxBlur(this Image source, int radius, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new BoxBlurProcessor(radius)); diff --git a/src/ImageProcessorCore/Samplers/Crop.cs b/src/ImageProcessorCore/Samplers/Crop.cs index ccb07ee5c0..87f66c9f7b 100644 --- a/src/ImageProcessorCore/Samplers/Crop.cs +++ b/src/ImageProcessorCore/Samplers/Crop.cs @@ -22,7 +22,7 @@ namespace ImageProcessorCore /// The target image height. /// The public static Image Crop(this Image source, int width, int height) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Crop(source, width, height, source.Bounds); @@ -45,7 +45,7 @@ namespace ImageProcessorCore /// /// The public static Image Crop(this Image source, int width, int height, Rectangle sourceRectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { Guard.MustBeGreaterThan(width, 0, nameof(width)); diff --git a/src/ImageProcessorCore/Samplers/DetectEdges.cs b/src/ImageProcessorCore/Samplers/DetectEdges.cs index 3282b0bb3d..3bf1af93f5 100644 --- a/src/ImageProcessorCore/Samplers/DetectEdges.cs +++ b/src/ImageProcessorCore/Samplers/DetectEdges.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The image this method extends. /// The . public static Image DetectEdges(this Image source) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return DetectEdges(source, source.Bounds, new SobelProcessor { Grayscale = true }); @@ -39,7 +39,7 @@ namespace ImageProcessorCore /// /// The . public static Image DetectEdges(this Image source, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return DetectEdges(source, rectangle, new SobelProcessor { Grayscale = true }); @@ -55,7 +55,7 @@ namespace ImageProcessorCore /// Whether to convert the image to Grayscale first. Defaults to true. /// The . public static Image DetectEdges(this Image source, EdgeDetection filter, bool grayscale = true) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return DetectEdges(source, filter, source.Bounds, grayscale); @@ -74,7 +74,7 @@ namespace ImageProcessorCore /// Whether to convert the image to Grayscale first. Defaults to true. /// The . public static Image DetectEdges(this Image source, EdgeDetection filter, Rectangle rectangle, bool grayscale = true) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { IEdgeDetectorFilter processor; @@ -134,7 +134,7 @@ namespace ImageProcessorCore /// The filter for detecting edges. /// The . public static Image DetectEdges(this Image source, IEdgeDetectorFilter filter) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return DetectEdges(source, source.Bounds, filter); @@ -152,7 +152,7 @@ namespace ImageProcessorCore /// The filter for detecting edges. /// The . public static Image DetectEdges(this Image source, Rectangle rectangle, IEdgeDetectorFilter filter) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, filter); diff --git a/src/ImageProcessorCore/Samplers/EntropyCrop.cs b/src/ImageProcessorCore/Samplers/EntropyCrop.cs index 04e84cfafb..665ee5a6bf 100644 --- a/src/ImageProcessorCore/Samplers/EntropyCrop.cs +++ b/src/ImageProcessorCore/Samplers/EntropyCrop.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The threshold for entropic density. /// The public static Image EntropyCrop(this Image source, float threshold = .5f) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { EntropyCropProcessor processor = new EntropyCropProcessor(threshold); diff --git a/src/ImageProcessorCore/Samplers/Flip.cs b/src/ImageProcessorCore/Samplers/Flip.cs index ebf880f2b3..f74199c691 100644 --- a/src/ImageProcessorCore/Samplers/Flip.cs +++ b/src/ImageProcessorCore/Samplers/Flip.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The to perform the flip. /// The public static Image Flip(this Image source, FlipType flipType) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { FlipProcessor processor = new FlipProcessor(flipType); diff --git a/src/ImageProcessorCore/Samplers/GuassianBlur.cs b/src/ImageProcessorCore/Samplers/GuassianBlur.cs index 18ff96e479..712640c030 100644 --- a/src/ImageProcessorCore/Samplers/GuassianBlur.cs +++ b/src/ImageProcessorCore/Samplers/GuassianBlur.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The 'sigma' value representing the weight of the blur. /// The . public static Image GuassianBlur(this Image source, float sigma = 3f) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return GuassianBlur(source, sigma, source.Bounds); @@ -39,7 +39,7 @@ namespace ImageProcessorCore /// /// The . public static Image GuassianBlur(this Image source, float sigma, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new GuassianBlurProcessor(sigma)); diff --git a/src/ImageProcessorCore/Samplers/GuassianSharpen.cs b/src/ImageProcessorCore/Samplers/GuassianSharpen.cs index 219c19ecc5..72ba8b2a83 100644 --- a/src/ImageProcessorCore/Samplers/GuassianSharpen.cs +++ b/src/ImageProcessorCore/Samplers/GuassianSharpen.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The 'sigma' value representing the weight of the blur. /// The . public static Image GuassianSharpen(this Image source, float sigma = 3f) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return GuassianSharpen(source, sigma, source.Bounds); @@ -39,7 +39,7 @@ namespace ImageProcessorCore /// /// The . public static Image GuassianSharpen(this Image source, float sigma, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Process(rectangle, new GuassianSharpenProcessor(sigma)); diff --git a/src/ImageProcessorCore/Samplers/OilPainting.cs b/src/ImageProcessorCore/Samplers/OilPainting.cs index 07b4144f4c..55ba447733 100644 --- a/src/ImageProcessorCore/Samplers/OilPainting.cs +++ b/src/ImageProcessorCore/Samplers/OilPainting.cs @@ -24,7 +24,7 @@ namespace ImageProcessorCore /// The number of neighbouring pixels used in calculating each individual pixel value. /// The . public static Image OilPaint(this Image source, int levels = 10, int brushSize = 15) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return OilPaint(source, levels, brushSize, source.Bounds); @@ -43,7 +43,7 @@ namespace ImageProcessorCore /// /// The . public static Image OilPaint(this Image source, int levels, int brushSize, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { Guard.MustBeGreaterThan(levels, 0, nameof(levels)); diff --git a/src/ImageProcessorCore/Samplers/Options/ResizeHelper.cs b/src/ImageProcessorCore/Samplers/Options/ResizeHelper.cs index 82a98c3c37..209ebf05e4 100644 --- a/src/ImageProcessorCore/Samplers/Options/ResizeHelper.cs +++ b/src/ImageProcessorCore/Samplers/Options/ResizeHelper.cs @@ -25,7 +25,7 @@ namespace ImageProcessorCore /// The . /// public static Rectangle CalculateTargetLocationAndBounds(ImageBase source, ResizeOptions options) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { switch (options.Mode) @@ -58,7 +58,7 @@ namespace ImageProcessorCore /// The . /// private static Rectangle CalculateCropRectangle(ImageBase source, ResizeOptions options) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { int width = options.Size.Width; @@ -179,7 +179,7 @@ namespace ImageProcessorCore /// The . /// private static Rectangle CalculatePadRectangle(ImageBase source, ResizeOptions options) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { int width = options.Size.Width; @@ -262,7 +262,7 @@ namespace ImageProcessorCore /// The . /// private static Rectangle CalculateBoxPadRectangle(ImageBase source, ResizeOptions options) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { int width = options.Size.Width; @@ -351,7 +351,7 @@ namespace ImageProcessorCore /// The . /// private static Rectangle CalculateMaxRectangle(ImageBase source, ResizeOptions options) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { int width = options.Size.Width; @@ -394,7 +394,7 @@ namespace ImageProcessorCore /// The . /// private static Rectangle CalculateMinRectangle(ImageBase source, ResizeOptions options) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { int width = options.Size.Width; diff --git a/src/ImageProcessorCore/Samplers/Pad.cs b/src/ImageProcessorCore/Samplers/Pad.cs index 3c91a2f89d..dfed97133d 100644 --- a/src/ImageProcessorCore/Samplers/Pad.cs +++ b/src/ImageProcessorCore/Samplers/Pad.cs @@ -20,7 +20,7 @@ namespace ImageProcessorCore /// The new height. /// The . public static Image Pad(this Image source, int width, int height) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { ResizeOptions options = new ResizeOptions diff --git a/src/ImageProcessorCore/Samplers/Pixelate.cs b/src/ImageProcessorCore/Samplers/Pixelate.cs index 5d39728b3c..69fda7d25b 100644 --- a/src/ImageProcessorCore/Samplers/Pixelate.cs +++ b/src/ImageProcessorCore/Samplers/Pixelate.cs @@ -23,7 +23,7 @@ namespace ImageProcessorCore /// The size of the pixels. /// The . public static Image Pixelate(this Image source, int size = 4) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Pixelate(source, size, source.Bounds); @@ -41,7 +41,7 @@ namespace ImageProcessorCore /// /// The . public static Image Pixelate(this Image source, int size, Rectangle rectangle) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { if (size <= 0 || size > source.Height || size > source.Width) diff --git a/src/ImageProcessorCore/Samplers/Processors/CompandingResizeProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/CompandingResizeProcessor.cs index a6c07cffbc..84342107c7 100644 --- a/src/ImageProcessorCore/Samplers/Processors/CompandingResizeProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/CompandingResizeProcessor.cs @@ -16,7 +16,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class CompandingResizeProcessor : ResamplingWeightedProcessor - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/BoxBlurProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/BoxBlurProcessor.cs index a67dbe647a..e76fa2a684 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/BoxBlurProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/BoxBlurProcessor.cs @@ -11,7 +11,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class BoxBlurProcessor : ImageSampler - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/Convolution2DFilter.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/Convolution2DFilter.cs index b58c7a885b..e2a9087eb8 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/Convolution2DFilter.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/Convolution2DFilter.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class Convolution2DFilter : ImageSampler - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/Convolution2PassFilter.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/Convolution2PassFilter.cs index 48a5927fe4..3510a4acef 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/Convolution2PassFilter.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/Convolution2PassFilter.cs @@ -14,7 +14,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class Convolution2PassFilter : ImageSampler - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/ConvolutionFilter.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/ConvolutionFilter.cs index d14a548583..6c39e36b19 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/ConvolutionFilter.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/ConvolutionFilter.cs @@ -14,7 +14,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class ConvolutionFilter : ImageSampler - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DFilter.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DFilter.cs index b228322329..0e8883c9aa 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DFilter.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DFilter.cs @@ -12,7 +12,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public abstract class EdgeDetector2DFilter : ImageSampler, IEdgeDetectorFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassFilter.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassFilter.cs index 2e3aeb365a..2eaa4487ef 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassFilter.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassFilter.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public abstract class EdgeDetectorCompassFilter : ImageSampler, IEdgeDetectorFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorFilter.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorFilter.cs index e300cbb9ae..4b9c9f8d6b 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorFilter.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorFilter.cs @@ -11,7 +11,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public abstract class EdgeDetectorFilter : ImageSampler, IEdgeDetectorFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorFilter.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorFilter.cs index d040743e8f..b17f131af1 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorFilter.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorFilter.cs @@ -11,7 +11,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public interface IEdgeDetectorFilter : IImageSampler, IEdgeDetectorFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { } diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs index b16372fd8f..6600e7c6e6 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The packed format. uint, long, float. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class KayyaliProcessor : EdgeDetector2DFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/KirschProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/KirschProcessor.cs index 529592a012..a82218b6f6 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/KirschProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/KirschProcessor.cs @@ -14,7 +14,7 @@ namespace ImageProcessorCore.Processors /// The packed format. uint, long, float. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class KirschProcessor : EdgeDetectorCompassFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs index 1393b7d149..cb982986d2 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The packed format. uint, long, float. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class Laplacian3X3Processor : EdgeDetectorFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs index 5a8c0125f3..ecc3073af7 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The packed format. uint, long, float. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class Laplacian5X5Processor : EdgeDetectorFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs index 6185bd17d5..b49484fca0 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The packed format. uint, long, float. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class LaplacianOfGaussianProcessor : EdgeDetectorFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/PrewittProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/PrewittProcessor.cs index 25cf9983f3..ba1910f022 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/PrewittProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/PrewittProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The packed format. uint, long, float. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class PrewittProcessor : EdgeDetector2DFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs index d132a7fc4f..5422f71e9e 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The packed format. uint, long, float. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class RobertsCrossProcessor : EdgeDetector2DFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs index 2bb8044991..40dec5c697 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs @@ -14,7 +14,7 @@ namespace ImageProcessorCore.Processors /// The packed format. uint, long, float. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class RobinsonProcessor : EdgeDetectorCompassFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/ScharrProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/ScharrProcessor.cs index 47b8651c9a..d25f447a47 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/ScharrProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/ScharrProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The packed format. uint, long, float. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class ScharrProcessor : EdgeDetector2DFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/SobelProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/SobelProcessor.cs index 0a6f9b7259..1b1ab3f35a 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/SobelProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/EdgeDetection/SobelProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The packed format. uint, long, float. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] public class SobelProcessor : EdgeDetector2DFilter - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/GuassianBlurProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/GuassianBlurProcessor.cs index d8a1b0907b..c336298eed 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/GuassianBlurProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/GuassianBlurProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class GuassianBlurProcessor : ImageSampler - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/GuassianSharpenProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/GuassianSharpenProcessor.cs index 6d0382ee9d..a8f200c419 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Convolution/GuassianSharpenProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Convolution/GuassianSharpenProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class GuassianSharpenProcessor : ImageSampler - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/CropProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/CropProcessor.cs index 0aaab83950..71d08e4d75 100644 --- a/src/ImageProcessorCore/Samplers/Processors/CropProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/CropProcessor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class CropProcessor : ImageSampler - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/EntropyCropProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/EntropyCropProcessor.cs index 88a31e9e18..3b257ef996 100644 --- a/src/ImageProcessorCore/Samplers/Processors/EntropyCropProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/EntropyCropProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class EntropyCropProcessor : ImageSampler - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/FlipProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/FlipProcessor.cs index 4c4df43e67..c68ee66823 100644 --- a/src/ImageProcessorCore/Samplers/Processors/FlipProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/FlipProcessor.cs @@ -14,7 +14,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class FlipProcessor : ImageSampler - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/IImageSampler.cs b/src/ImageProcessorCore/Samplers/Processors/IImageSampler.cs index 4484356d0b..292904bded 100644 --- a/src/ImageProcessorCore/Samplers/Processors/IImageSampler.cs +++ b/src/ImageProcessorCore/Samplers/Processors/IImageSampler.cs @@ -11,7 +11,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public interface IImageSampler : IImageProcessor - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/ImageSampler.cs b/src/ImageProcessorCore/Samplers/Processors/ImageSampler.cs index 110ff28bd1..72c235800a 100644 --- a/src/ImageProcessorCore/Samplers/Processors/ImageSampler.cs +++ b/src/ImageProcessorCore/Samplers/Processors/ImageSampler.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public abstract class ImageSampler : ImageProcessor, IImageSampler - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Matrix3x2Processor.cs b/src/ImageProcessorCore/Samplers/Processors/Matrix3x2Processor.cs index 86b086b29e..d428ecdb97 100644 --- a/src/ImageProcessorCore/Samplers/Processors/Matrix3x2Processor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/Matrix3x2Processor.cs @@ -13,7 +13,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public abstract class Matrix3x2Processor : ImageSampler - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/OilPaintingProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/OilPaintingProcessor.cs index 2709d13a03..bce83aaaaa 100644 --- a/src/ImageProcessorCore/Samplers/Processors/OilPaintingProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/OilPaintingProcessor.cs @@ -16,7 +16,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class OilPaintingProcessor : ImageSampler - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/PixelateProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/PixelateProcessor.cs index fe21e7fd6e..1236681ffc 100644 --- a/src/ImageProcessorCore/Samplers/Processors/PixelateProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/PixelateProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class PixelateProcessor : ImageSampler - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/ResamplingWeightedProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/ResamplingWeightedProcessor.cs index 338b52906a..d6ca2bb5c5 100644 --- a/src/ImageProcessorCore/Samplers/Processors/ResamplingWeightedProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/ResamplingWeightedProcessor.cs @@ -14,7 +14,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public abstract class ResamplingWeightedProcessor : ImageSampler - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/ResizeProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/ResizeProcessor.cs index 74d61983fd..de75a0312e 100644 --- a/src/ImageProcessorCore/Samplers/Processors/ResizeProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/ResizeProcessor.cs @@ -18,7 +18,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class ResizeProcessor : ResamplingWeightedProcessor - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/RotateProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/RotateProcessor.cs index 5b6cee4cc0..880644c45f 100644 --- a/src/ImageProcessorCore/Samplers/Processors/RotateProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/RotateProcessor.cs @@ -16,7 +16,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class RotateProcessor : Matrix3x2Processor - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/SkewProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/SkewProcessor.cs index 47bbabcf1f..588a35df7b 100644 --- a/src/ImageProcessorCore/Samplers/Processors/SkewProcessor.cs +++ b/src/ImageProcessorCore/Samplers/Processors/SkewProcessor.cs @@ -15,7 +15,7 @@ namespace ImageProcessorCore.Processors /// The pixel format. /// The packed format. uint, long, float. public class SkewProcessor : Matrix3x2Processor - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Resize.cs b/src/ImageProcessorCore/Samplers/Resize.cs index 6fd2a7b099..1dd00b0825 100644 --- a/src/ImageProcessorCore/Samplers/Resize.cs +++ b/src/ImageProcessorCore/Samplers/Resize.cs @@ -22,7 +22,7 @@ namespace ImageProcessorCore /// The /// Passing zero for one of height or width within the resize options will automatically preserve the aspect ratio of the original image public static Image Resize(this Image source, ResizeOptions options) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { // Ensure size is populated across both dimensions. @@ -52,7 +52,7 @@ namespace ImageProcessorCore /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image public static Image Resize(this Image source, int width, int height) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Resize(source, width, height, new BicubicResampler(), false); @@ -70,7 +70,7 @@ namespace ImageProcessorCore /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image public static Image Resize(this Image source, int width, int height, bool compand) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Resize(source, width, height, new BicubicResampler(), compand); @@ -88,7 +88,7 @@ namespace ImageProcessorCore /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image public static Image Resize(this Image source, int width, int height, IResampler sampler) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Resize(source, width, height, sampler, false); @@ -107,7 +107,7 @@ namespace ImageProcessorCore /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image public static Image Resize(this Image source, int width, int height, IResampler sampler, bool compand) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Resize(source, width, height, sampler, source.Bounds, new Rectangle(0, 0, width, height), compand); @@ -133,7 +133,7 @@ namespace ImageProcessorCore /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image public static Image Resize(this Image source, int width, int height, IResampler sampler, Rectangle sourceRectangle, Rectangle targetRectangle, bool compand = false) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { if (width == 0 && height > 0) diff --git a/src/ImageProcessorCore/Samplers/Rotate.cs b/src/ImageProcessorCore/Samplers/Rotate.cs index 2b0f4dbcec..cc79ecac23 100644 --- a/src/ImageProcessorCore/Samplers/Rotate.cs +++ b/src/ImageProcessorCore/Samplers/Rotate.cs @@ -21,7 +21,7 @@ namespace ImageProcessorCore /// The angle in degrees to perform the rotation. /// The public static Image Rotate(this Image source, float degrees) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Rotate(source, degrees, true); @@ -36,7 +36,7 @@ namespace ImageProcessorCore /// The to perform the rotation. /// The public static Image Rotate(this Image source, RotateType rotateType) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Rotate(source, (float)rotateType, false); @@ -52,7 +52,7 @@ namespace ImageProcessorCore /// Whether to expand the image to fit the rotated result. /// The public static Image Rotate(this Image source, float degrees, bool expand) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { RotateProcessor processor = new RotateProcessor { Angle = degrees, Expand = expand }; diff --git a/src/ImageProcessorCore/Samplers/RotateFlip.cs b/src/ImageProcessorCore/Samplers/RotateFlip.cs index 34af54a98e..0331dd4930 100644 --- a/src/ImageProcessorCore/Samplers/RotateFlip.cs +++ b/src/ImageProcessorCore/Samplers/RotateFlip.cs @@ -19,7 +19,7 @@ namespace ImageProcessorCore /// The to perform the flip. /// The public static Image RotateFlip(this Image source, RotateType rotateType, FlipType flipType) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return source.Rotate(rotateType).Flip(flipType); diff --git a/src/ImageProcessorCore/Samplers/Skew.cs b/src/ImageProcessorCore/Samplers/Skew.cs index 0a76f07dde..a597b560bb 100644 --- a/src/ImageProcessorCore/Samplers/Skew.cs +++ b/src/ImageProcessorCore/Samplers/Skew.cs @@ -22,7 +22,7 @@ namespace ImageProcessorCore /// The angle in degrees to perform the rotation along the y-axis. /// The public static Image Skew(this Image source, float degreesX, float degreesY) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { return Skew(source, degreesX, degreesY, true); @@ -39,7 +39,7 @@ namespace ImageProcessorCore /// Whether to expand the image to fit the skewed result. /// The public static Image Skew(this Image source, float degreesX, float degreesY, bool expand) - where TColor : IPackedVector + where TColor : struct, IPackedVector where TPacked : struct { SkewProcessor processor = new SkewProcessor { AngleX = degreesX, AngleY = degreesY, Expand = expand };