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 2591fc10ae..37b387acb9 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 b3a64473ed..c36197815a 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 5d90eccc9d..3984d7d14f 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 606a4c6561..0f6e629931 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { return source.Process(rectangle, new BlackWhiteProcessor()); diff --git a/src/ImageProcessorCore/Filters/Blend.cs b/src/ImageProcessorCore/Filters/Blend.cs index ac9501f3f4..a088642963 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 6bfe6448a8..3d4a7ba795 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 9f5bc47a5e..2b169a1ee2 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { IImageFilter processor; diff --git a/src/ImageProcessorCore/Filters/Contrast.cs b/src/ImageProcessorCore/Filters/Contrast.cs index 92e1dbe28e..1532f5ec99 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 383fc0b5df..d1abfedd3c 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { GlowProcessor processor = new GlowProcessor { Radius = radius, }; diff --git a/src/ImageProcessorCore/Filters/Grayscale.cs b/src/ImageProcessorCore/Filters/Grayscale.cs index d054386031..a48b2a895b 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { IImageFilter processor = mode == GrayscaleMode.Bt709 diff --git a/src/ImageProcessorCore/Filters/Hue.cs b/src/ImageProcessorCore/Filters/Hue.cs index 3bc331d248..a0f5d0ec06 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 764d127f3e..c33745ed7c 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { return source.Process(rectangle, new InvertProcessor()); diff --git a/src/ImageProcessorCore/Filters/Kodachrome.cs b/src/ImageProcessorCore/Filters/Kodachrome.cs index 2bd061fed4..3e09a1ea27 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { return source.Process(rectangle, new KodachromeProcessor()); diff --git a/src/ImageProcessorCore/Filters/Lomograph.cs b/src/ImageProcessorCore/Filters/Lomograph.cs index 2c12d88002..f0fd21a8c9 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { return source.Process(rectangle, new LomographProcessor()); diff --git a/src/ImageProcessorCore/Filters/Polaroid.cs b/src/ImageProcessorCore/Filters/Polaroid.cs index 840b7812cb..f19c4578cd 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 e6934b1a2f..bf75cf8e8d 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 06d83e3631..e8004c2a23 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { return source.Process(rectangle, new SepiaProcessor()); diff --git a/src/ImageProcessorCore/Filters/Vignette.cs b/src/ImageProcessorCore/Filters/Vignette.cs index 37a56cee46..d231126c2e 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 d6b1ea3e6c..475643c1d0 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { Guard.NotNull(image, "image"); diff --git a/src/ImageProcessorCore/Formats/Bmp/BmpDecoderCore.cs b/src/ImageProcessorCore/Formats/Bmp/BmpDecoderCore.cs index 31c3317aba..6218da2da1 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 5ab6e6f169..42627626d2 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 f74f79625b..81c388930e 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 69cf8924f2..665a7fbd93 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Formats/Gif/GifEncoder.cs b/src/ImageProcessorCore/Formats/Gif/GifEncoder.cs index 46b09de827..5c59d8cc95 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { GifEncoderCore encoder = new GifEncoderCore diff --git a/src/ImageProcessorCore/Formats/Gif/GifEncoderCore.cs b/src/ImageProcessorCore/Formats/Gif/GifEncoderCore.cs index e37ca3a1b3..c23140c7b5 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { Guard.NotNull(image, nameof(image)); @@ -116,7 +116,7 @@ namespace ImageProcessorCore.Formats /// The . /// private static int GetTransparentIndex(QuantizedImage quantized) - where TColor : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { byte[] indexedPixels = image.Pixels; diff --git a/src/ImageProcessorCore/Formats/IImageDecoder.cs b/src/ImageProcessorCore/Formats/IImageDecoder.cs index c3bc5325c5..051053c2ac 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct; } } diff --git a/src/ImageProcessorCore/Formats/IImageEncoder.cs b/src/ImageProcessorCore/Formats/IImageEncoder.cs index 35ae38c2b3..8fe036ccf6 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct; } } diff --git a/src/ImageProcessorCore/Formats/Jpg/JpegDecoder.cs b/src/ImageProcessorCore/Formats/Jpg/JpegDecoder.cs index 6e6db9b9c4..2c7a07ed06 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 d835bfb6d7..e736cb248e 100644 --- a/src/ImageProcessorCore/Formats/Jpg/JpegDecoderCore.cs.REMOVED.git-id +++ b/src/ImageProcessorCore/Formats/Jpg/JpegDecoderCore.cs.REMOVED.git-id @@ -1 +1 @@ -8dbd88f93229d332f2ca8e61d85d4ac6a66773ef \ No newline at end of file +cee4b682b4cfc0f0cef3cafb5b089c780d1cb4d1 \ No newline at end of file diff --git a/src/ImageProcessorCore/Formats/Jpg/JpegEncoder.cs b/src/ImageProcessorCore/Formats/Jpg/JpegEncoder.cs index 32fa38d832..2b9b9c2561 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { JpegEncoderCore encode = new JpegEncoderCore(); diff --git a/src/ImageProcessorCore/Formats/Jpg/JpegEncoderCore.cs b/src/ImageProcessorCore/Formats/Jpg/JpegEncoderCore.cs index d61c0ee9d9..d85d2ad9f2 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { Guard.NotNull(image, nameof(image)); @@ -571,7 +571,7 @@ namespace ImageProcessorCore.Formats } private void WriteProfiles(Image image) - where TColor : IPackedPixel + where TColor : struct, IPackedPixel 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 dbb872c182..9c1f729fd7 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 68037f9470..e448ffc156 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { int zeroIndex = 0; diff --git a/src/ImageProcessorCore/Formats/Png/PngEncoder.cs b/src/ImageProcessorCore/Formats/Png/PngEncoder.cs index 8da7f5f325..b3a4285152 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { PngEncoderCore encoder = new PngEncoderCore diff --git a/src/ImageProcessorCore/Formats/Png/PngEncoderCore.cs b/src/ImageProcessorCore/Formats/Png/PngEncoderCore.cs index 04ee5c3aef..69ea26a866 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 c3edeb264e..c084db86a1 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 0124a7c24d..95ef077557 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct => source.Save(stream, new PngEncoder { Quality = quality }); @@ -62,7 +62,7 @@ namespace ImageProcessorCore /// The . /// public static Image SaveAsJpeg(this Image source, Stream stream, int quality = 75) - where TColor : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct => source.Save(stream, new JpegEncoder { Quality = quality }); @@ -79,7 +79,7 @@ namespace ImageProcessorCore /// The . /// public static Image SaveAsGif(this Image source, Stream stream, int quality = 256) - where TColor : IPackedPixel + where TColor : struct, IPackedPixel 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 93993a12c0..69efc72b63 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 d4f3fa56f6..cf2aaf7448 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { this.InitializeValues(); diff --git a/src/ImageProcessorCore/Quantizers/IQuantizer.cs b/src/ImageProcessorCore/Quantizers/IQuantizer.cs index 85d1172ae3..b0fd01b285 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Quantizers/Octree/OctreeQuantizer.cs b/src/ImageProcessorCore/Quantizers/Octree/OctreeQuantizer.cs index 7f4713b656..3c07b1b83e 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Quantizers/Octree/Quantizer.cs b/src/ImageProcessorCore/Quantizers/Octree/Quantizer.cs index fc87811596..d0cf5d73e4 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Quantizers/Palette/PaletteQuantizer.cs b/src/ImageProcessorCore/Quantizers/Palette/PaletteQuantizer.cs index 7382cd9b4a..b60ef51dc1 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Quantizers/Quantize.cs b/src/ImageProcessorCore/Quantizers/Quantize.cs index 908dc7c04b..aadac231be 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { QuantizedImage quantizedImage = quantizer.Quantize(source, maxColors); diff --git a/src/ImageProcessorCore/Quantizers/QuantizedImage.cs b/src/ImageProcessorCore/Quantizers/QuantizedImage.cs index c68bdce72b..c3e73bc377 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Quantizers/Wu/WuQuantizer.cs b/src/ImageProcessorCore/Quantizers/Wu/WuQuantizer.cs index ad5201aa18..a72e398e63 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/AutoOrient.cs b/src/ImageProcessorCore/Samplers/AutoOrient.cs index 97e41f577b..321946cea6 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { if (source.ExifProfile == null) diff --git a/src/ImageProcessorCore/Samplers/BoxBlur.cs b/src/ImageProcessorCore/Samplers/BoxBlur.cs index cbe444b9e9..9afef2dae4 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 b014fe7bca..6b74b7981a 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { Guard.MustBeGreaterThan(width, 0, nameof(width)); diff --git a/src/ImageProcessorCore/Samplers/DetectEdges.cs b/src/ImageProcessorCore/Samplers/DetectEdges.cs index b933f32429..f7cc0ba541 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { return source.Process(rectangle, filter); diff --git a/src/ImageProcessorCore/Samplers/EntropyCrop.cs b/src/ImageProcessorCore/Samplers/EntropyCrop.cs index 463052c720..5dc69574ae 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { EntropyCropProcessor processor = new EntropyCropProcessor(threshold); diff --git a/src/ImageProcessorCore/Samplers/Flip.cs b/src/ImageProcessorCore/Samplers/Flip.cs index 133cc07f43..72554690c7 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { FlipProcessor processor = new FlipProcessor(flipType); diff --git a/src/ImageProcessorCore/Samplers/GuassianBlur.cs b/src/ImageProcessorCore/Samplers/GuassianBlur.cs index 52c8b08aa0..f0ee928d6b 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 23ad813fc0..0dac73bf74 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 54ec595199..94e7ceb4ad 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 ebbb5bbb76..c62316de53 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { ResizeOptions options = new ResizeOptions diff --git a/src/ImageProcessorCore/Samplers/Pixelate.cs b/src/ImageProcessorCore/Samplers/Pixelate.cs index b19940e7fc..4ad1616f96 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 7172d5f46b..52fac0c306 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/BoxBlurProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/BoxBlurProcessor.cs index 495d5968ad..414bb10b2f 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 5ab7805fe9..f5e1405756 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 f1a7060961..9b0af064be 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 1402747aa3..481c6c79af 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 779387998d..3204024627 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 0fb41cc54f..1d8b2cc165 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/Convolution/GuassianSharpenProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/Convolution/GuassianSharpenProcessor.cs index a85a0bdc9a..194e481efe 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 cb2b88eb9c..d8d8fb7ab1 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/FlipProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/FlipProcessor.cs index ae322db417..a6f0678f67 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 575d85229a..181d438a65 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { /// diff --git a/src/ImageProcessorCore/Samplers/Processors/RotateProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/RotateProcessor.cs index afb2c23f56..d65161038c 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 2273c80189..877a689f21 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { if (width == 0 && height > 0) diff --git a/src/ImageProcessorCore/Samplers/Rotate.cs b/src/ImageProcessorCore/Samplers/Rotate.cs index 51b81cbd4b..d66e67438c 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 a20cea5289..7c2b642a45 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { return source.Rotate(rotateType).Flip(flipType); diff --git a/src/ImageProcessorCore/Samplers/Skew.cs b/src/ImageProcessorCore/Samplers/Skew.cs index 7692cbcd22..2751350cd3 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 : IPackedPixel + where TColor : struct, IPackedPixel 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 : IPackedPixel + where TColor : struct, IPackedPixel where TPacked : struct { SkewProcessor processor = new SkewProcessor { AngleX = degreesX, AngleY = degreesY, Expand = expand };