From 18b8b662e9c959f685bec92bfbae4c8b5daddb9e Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Wed, 25 Jun 2025 20:46:20 +0200 Subject: [PATCH] Use Target Type new only when apparent --- .editorconfig | 3 + .../Advanced/ParallelExecutionSettings.cs | 4 +- .../Advanced/ParallelRowIterator.Wrappers.cs | 4 +- src/ImageSharp/Color/Color.WernerPalette.cs | 2 +- src/ImageSharp/Color/Color.cs | 6 +- src/ImageSharp/ColorProfiles/CieLab.cs | 8 +- src/ImageSharp/ColorProfiles/CieLch.cs | 10 +- src/ImageSharp/ColorProfiles/CieLchuv.cs | 8 +- src/ImageSharp/ColorProfiles/CieLuv.cs | 4 +- src/ImageSharp/ColorProfiles/CieXyy.cs | 8 +- src/ImageSharp/ColorProfiles/CieXyz.cs | 8 +- src/ImageSharp/ColorProfiles/Cmyk.cs | 6 +- .../ColorProfiles/ColorProfileConverter.cs | 2 +- .../ColorProfileConverterExtensionsIcc.cs | 16 +-- src/ImageSharp/ColorProfiles/Hsl.cs | 8 +- src/ImageSharp/ColorProfiles/Hsv.cs | 10 +- src/ImageSharp/ColorProfiles/HunterLab.cs | 8 +- .../Icc/Calculators/ColorTrcCalculator.cs | 6 +- .../Icc/Calculators/CurveCalculator.cs | 2 +- .../Icc/Calculators/GrayTrcCalculator.cs | 2 +- .../Icc/Calculators/LutABCalculator.cs | 10 +- .../Icc/Calculators/LutEntryCalculator.cs | 4 +- .../Icc/Calculators/MatrixCalculator.cs | 2 +- .../ColorProfiles/Icc/CompactSrgbV4Profile.cs | 2 +- .../Icc/IccConverterbase.Conversions.cs | 4 +- .../KnownChromaticAdaptationMatrices.cs | 12 +- .../ColorProfiles/KnownRgbWorkingSpaces.cs | 38 +++--- .../ColorProfiles/KnownYCbCrMatrices.cs | 18 +-- src/ImageSharp/ColorProfiles/Lms.cs | 4 +- src/ImageSharp/ColorProfiles/Rgb.cs | 6 +- .../VonKriesChromaticAdaptation.cs | 6 +- src/ImageSharp/ColorProfiles/Y.cs | 2 +- src/ImageSharp/ColorProfiles/YCbCr.cs | 6 +- src/ImageSharp/ColorProfiles/YccK.cs | 6 +- .../Extensions/ConfigurationExtensions.cs | 2 +- src/ImageSharp/Common/Helpers/Numerics.cs | 2 +- .../Common/Helpers/SimdUtils.Pack.cs | 2 +- src/ImageSharp/Common/Helpers/SimdUtils.cs | 2 +- src/ImageSharp/Common/Helpers/TolerantMath.cs | 2 +- .../Common/Helpers/UnitConverter.cs | 4 +- src/ImageSharp/Compression/Zlib/Deflater.cs | 2 +- .../Compression/Zlib/DeflaterEngine.cs | 2 +- .../Compression/Zlib/DeflaterHuffman.cs | 8 +- .../Compression/Zlib/DeflaterOutputStream.cs | 2 +- .../Compression/Zlib/ZlibDeflateStream.cs | 2 +- .../Compression/Zlib/ZlibInflateStream.cs | 2 +- src/ImageSharp/Configuration.cs | 2 +- src/ImageSharp/Formats/Bmp/BmpDecoder.cs | 2 +- src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs | 16 +-- src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs | 6 +- src/ImageSharp/Formats/Bmp/BmpFormat.cs | 2 +- src/ImageSharp/Formats/Bmp/BmpMetadata.cs | 16 +-- .../Formats/Cur/CurFrameMetadata.cs | 8 +- src/ImageSharp/Formats/Cur/CurMetadata.cs | 4 +- src/ImageSharp/Formats/DecoderOptions.cs | 2 +- src/ImageSharp/Formats/Gif/GifDecoderCore.cs | 12 +- src/ImageSharp/Formats/Gif/GifEncoderCore.cs | 2 +- .../Formats/Gif/GifFrameMetadata.cs | 2 +- src/ImageSharp/Formats/Gif/GifMetadata.cs | 2 +- .../GifNetscapeLoopingApplicationExtension.cs | 2 +- .../Sections/GifXmpApplicationExtension.cs | 2 +- .../Formats/Ico/IcoFrameMetadata.cs | 8 +- src/ImageSharp/Formats/Ico/IcoMetadata.cs | 4 +- .../Formats/Icon/IconDecoderCore.cs | 12 +- .../Formats/Icon/IconEncoderCore.cs | 6 +- src/ImageSharp/Formats/ImageFormatManager.cs | 2 +- .../Formats/Jpeg/Components/Block8x8.cs | 2 +- .../Jpeg/Components/Block8x8F.ScaledCopy.cs | 8 +- .../JpegColorConverter.TiffYccKScalar.cs | 4 +- .../JpegColorConverter.YCbCrScalar.cs | 2 +- .../JpegColorConverter.YccKScalar.cs | 2 +- .../ColorConverters/JpegColorConverterBase.cs | 2 +- .../Jpeg/Components/Decoder/AdobeMarker.cs | 2 +- .../Decoder/ArithmeticScanDecoder.cs | 2 +- .../Components/Decoder/HuffmanScanDecoder.cs | 4 +- .../Jpeg/Components/Decoder/JFifMarker.cs | 2 +- .../Jpeg/Components/Decoder/JpegComponent.cs | 4 +- .../Components/Decoder/SpectralConverter.cs | 2 +- .../Jpeg/Components/Encoder/Component.cs | 4 +- .../Components/Encoder/ComponentProcessor.cs | 2 +- .../Components/Encoder/HuffmanScanEncoder.cs | 2 +- .../Jpeg/Components/Encoder/JpegFrame.cs | 2 +- .../Encoder/SpectralConverter{TPixel}.cs | 2 +- .../Formats/Jpeg/Components/SizeExtensions.cs | 2 +- src/ImageSharp/Formats/Jpeg/JpegDecoder.cs | 2 +- .../Formats/Jpeg/JpegDecoderCore.cs | 34 +++--- .../Jpeg/JpegEncoderCore.FrameConfig.cs | 84 +++++++------- src/ImageSharp/Formats/Jpeg/JpegFormat.cs | 2 +- src/ImageSharp/Formats/Jpeg/JpegMetadata.cs | 4 +- src/ImageSharp/Formats/Pbm/PbmDecoderCore.cs | 8 +- src/ImageSharp/Formats/Pbm/PbmMetadata.cs | 4 +- src/ImageSharp/Formats/Pbm/PlainDecoder.cs | 8 +- .../Formats/Png/Chunks/PngPhysical.cs | 4 +- src/ImageSharp/Formats/Png/PngDecoder.cs | 2 +- src/ImageSharp/Formats/Png/PngDecoderCore.cs | 34 +++--- .../Formats/Png/PngDecoderOptions.cs | 2 +- src/ImageSharp/Formats/Png/PngEncoderCore.cs | 2 +- src/ImageSharp/Formats/Png/PngFormat.cs | 2 +- .../Formats/Png/PngFrameMetadata.cs | 6 +- src/ImageSharp/Formats/Png/PngMetadata.cs | 4 +- .../Formats/Png/PngScanlineProcessor.cs | 12 +- src/ImageSharp/Formats/Qoi/QoiDecoderCore.cs | 4 +- src/ImageSharp/Formats/Qoi/QoiFormat.cs | 2 +- src/ImageSharp/Formats/Qoi/QoiMetadata.cs | 6 +- src/ImageSharp/Formats/Tga/TgaDecoderCore.cs | 12 +- src/ImageSharp/Formats/Tga/TgaFormat.cs | 2 +- src/ImageSharp/Formats/Tga/TgaMetadata.cs | 10 +- .../Compressors/DeflateCompressor.cs | 4 +- .../Compression/Compressors/LzwCompressor.cs | 2 +- .../Compressors/TiffJpegCompressor.cs | 2 +- .../Decompressors/DeflateTiffCompression.cs | 2 +- .../Compression/Decompressors/LzwString.cs | 4 +- .../Decompressors/LzwTiffCompression.cs | 2 +- .../ModifiedHuffmanTiffCompression.cs | 2 +- .../Decompressors/T4TiffCompression.cs | 2 +- .../Decompressors/T6TiffCompression.cs | 2 +- .../Decompressors/TiffLzwDecoder.cs | 2 +- .../Decompressors/WebpTiffCompression.cs | 2 +- .../Tiff/Compression/HorizontalPredictor.cs | 6 +- .../Compression/TiffDecompressorsFactory.cs | 5 +- .../BlackIsZero16TiffColor{TPixel}.cs | 2 +- .../BlackIsZero32FloatTiffColor{TPixel}.cs | 4 +- .../BlackIsZero4TiffColor{TPixel}.cs | 6 +- .../BlackIsZeroTiffColor{TPixel}.cs | 3 +- .../CieLabPlanarTiffColor{TPixel}.cs | 3 +- .../CieLabTiffColor{TPixel}.cs | 3 +- .../CmykTiffColor{TPixel}.cs | 4 +- .../PaletteTiffColor{TPixel}.cs | 3 +- .../Rgb161616TiffColor{TPixel}.cs | 2 +- .../Rgb16PlanarTiffColor{TPixel}.cs | 4 +- .../RgbFloat323232TiffColor{TPixel}.cs | 5 +- .../RgbPlanarTiffColor{TPixel}.cs | 3 +- .../RgbTiffColor{TPixel}.cs | 2 +- .../Rgba16161616TiffColor{TPixel}.cs | 2 +- .../Rgba16PlanarTiffColor{TPixel}.cs | 4 +- .../RgbaFloat32323232TiffColor{TPixel}.cs | 5 +- .../WhiteIsZero16TiffColor{TPixel}.cs | 4 +- .../WhiteIsZero32FloatTiffColor{TPixel}.cs | 4 +- .../WhiteIsZero4TiffColor{TPixel}.cs | 6 +- .../WhiteIsZero8TiffColor{TPixel}.cs | 2 +- .../WhiteIsZeroTiffColor{TPixel}.cs | 2 +- .../YCbCrConverter.cs | 8 +- .../YCbCrPlanarTiffColor{TPixel}.cs | 2 +- .../YCbCrTiffColor{TPixel}.cs | 2 +- .../Formats/Tiff/TiffBitsPerSample.cs | 2 +- .../Formats/Tiff/TiffDecoderCore.cs | 6 +- .../Tiff/TiffDecoderMetadataCreator.cs | 4 +- .../Formats/Tiff/TiffDecoderOptionsParser.cs | 6 +- .../Tiff/TiffEncoderEntriesCollector.cs | 4 +- src/ImageSharp/Formats/Tiff/TiffFormat.cs | 6 +- src/ImageSharp/Formats/Tiff/TiffMetadata.cs | 14 +-- .../Formats/Tiff/Utils/TiffUtilities.cs | 2 +- .../Tiff/Writers/TiffBiColorWriter{TPixel}.cs | 2 +- .../Tiff/Writers/TiffPaletteWriter{TPixel}.cs | 4 +- src/ImageSharp/Formats/Webp/AlphaDecoder.cs | 4 +- src/ImageSharp/Formats/Webp/AlphaEncoder.cs | 2 +- .../Formats/Webp/BitWriter/Vp8BitWriter.cs | 4 +- .../Formats/Webp/BitWriter/Vp8LBitWriter.cs | 2 +- .../Formats/Webp/Chunks/WebpFrameData.cs | 2 +- .../Webp/Lossless/BackwardReferenceEncoder.cs | 12 +- .../Formats/Webp/Lossless/CostManager.cs | 10 +- .../Formats/Webp/Lossless/CrunchConfig.cs | 2 +- .../Formats/Webp/Lossless/HTreeGroup.cs | 2 +- .../Formats/Webp/Lossless/HuffmanUtils.cs | 2 +- .../Formats/Webp/Lossless/Vp8LDecoder.cs | 2 +- .../Formats/Webp/Lossless/Vp8LEncoder.cs | 18 +-- .../Formats/Webp/Lossless/Vp8LHistogram.cs | 2 +- .../Formats/Webp/Lossless/Vp8LHistogramSet.cs | 8 +- .../Webp/Lossless/WebpLosslessDecoder.cs | 8 +- src/ImageSharp/Formats/Webp/Lossy/QuantEnc.cs | 18 +-- .../Formats/Webp/Lossy/Vp8BandProbas.cs | 2 +- src/ImageSharp/Formats/Webp/Lossy/Vp8Costs.cs | 2 +- .../Formats/Webp/Lossy/Vp8Decoder.cs | 18 +-- .../Formats/Webp/Lossy/Vp8EncIterator.cs | 2 +- .../Formats/Webp/Lossy/Vp8EncProba.cs | 8 +- .../Formats/Webp/Lossy/Vp8Encoder.cs | 12 +- src/ImageSharp/Formats/Webp/Lossy/Vp8Proba.cs | 2 +- src/ImageSharp/Formats/Webp/Lossy/Vp8Stats.cs | 2 +- .../Formats/Webp/Lossy/WebpLossyDecoder.cs | 6 +- .../Formats/Webp/WebpAnimationDecoder.cs | 4 +- .../Formats/Webp/WebpChunkParsingUtils.cs | 10 +- src/ImageSharp/Formats/Webp/WebpDecoder.cs | 2 +- .../Formats/Webp/WebpDecoderCore.cs | 10 +- .../Formats/Webp/WebpDecoderOptions.cs | 2 +- src/ImageSharp/Formats/Webp/WebpFormat.cs | 6 +- src/ImageSharp/Formats/Webp/WebpMetadata.cs | 4 +- .../GraphicOptionsDefaultsExtensions.cs | 2 +- src/ImageSharp/GraphicsOptions.cs | 2 +- src/ImageSharp/IO/ChunkedMemoryStream.cs | 2 +- src/ImageSharp/Image.Decode.cs | 2 +- src/ImageSharp/Image.WrapMemory.cs | 20 ++-- src/ImageSharp/Image.cs | 2 +- src/ImageSharp/ImageFrame.LoadPixelData.cs | 2 +- src/ImageSharp/ImageFrame.cs | 2 +- .../ImageFrameCollection{TPixel}.cs | 8 +- src/ImageSharp/ImageFrame{TPixel}.cs | 6 +- src/ImageSharp/Image{TPixel}.cs | 20 ++-- .../Allocators/Internals/ManagedBufferBase.cs | 2 +- .../Internals/SharedArrayPoolBuffer{T}.cs | 2 +- ...iformUnmanagedMemoryPool.LifetimeGuards.cs | 2 +- .../Internals/UniformUnmanagedMemoryPool.cs | 4 +- .../Internals/UnmanagedBuffer{T}.cs | 4 +- .../Internals/UnmanagedMemoryHandle.cs | 4 +- ...iformUnmanagedMemoryPoolMemoryAllocator.cs | 4 +- src/ImageSharp/Memory/Buffer2DExtensions.cs | 2 +- src/ImageSharp/Memory/Buffer2DRegion{T}.cs | 4 +- src/ImageSharp/Memory/ByteMemoryOwner{T}.cs | 2 +- .../MemoryGroupExtensions.cs | 12 +- .../MemoryGroupView{T}.cs | 4 +- .../MemoryGroup{T}.Consumed.cs | 4 +- .../MemoryGroup{T}.Owned.cs | 6 +- .../DiscontiguousBuffers/MemoryGroup{T}.cs | 4 +- .../Memory/MemoryAllocatorExtensions.cs | 4 +- src/ImageSharp/Memory/RowInterval.cs | 4 +- .../Memory/UnmanagedMemoryManager{T}.cs | 4 +- .../Profiles/Exif/ExifEncodedStringHelpers.cs | 6 +- .../Metadata/Profiles/Exif/ExifProfile.cs | 2 +- .../Metadata/Profiles/Exif/ExifReader.cs | 4 +- .../Profiles/Exif/Tags/ExifTag.Byte.cs | 6 +- .../Profiles/Exif/Tags/ExifTag.ByteArray.cs | 16 +-- .../Profiles/Exif/Tags/ExifTag.DoubleArray.cs | 8 +- .../Exif/Tags/ExifTag.EncodedString.cs | 6 +- .../Profiles/Exif/Tags/ExifTag.Long.cs | 42 +++---- .../Profiles/Exif/Tags/ExifTag.LongArray.cs | 22 ++-- .../Profiles/Exif/Tags/ExifTag.Number.cs | 18 +-- .../Profiles/Exif/Tags/ExifTag.NumberArray.cs | 10 +- .../Profiles/Exif/Tags/ExifTag.Rational.cs | 66 +++++------ .../Exif/Tags/ExifTag.RationalArray.cs | 20 ++-- .../Profiles/Exif/Tags/ExifTag.Short.cs | 94 +++++++-------- .../Profiles/Exif/Tags/ExifTag.ShortArray.cs | 40 +++---- .../Exif/Tags/ExifTag.SignedRational.cs | 12 +- .../Exif/Tags/ExifTag.SignedRationalArray.cs | 2 +- .../Exif/Tags/ExifTag.SignedShortArray.cs | 2 +- .../Profiles/Exif/Tags/ExifTag.String.cs | 108 +++++++++--------- .../Profiles/Exif/Tags/ExifTag.Ucs2String.cs | 10 +- .../Profiles/Exif/Tags/ExifTag.Undefined.cs | 28 ++--- .../Profiles/Exif/Values/ExifEncodedString.cs | 2 +- .../Profiles/Exif/Values/ExifRational.cs | 2 +- .../Profiles/Exif/Values/ExifRationalArray.cs | 4 +- .../ICC/DataReader/IccDataReader.Curves.cs | 18 +-- .../ICC/DataReader/IccDataReader.Lut.cs | 8 +- .../IccDataReader.MultiProcessElement.cs | 6 +- .../DataReader/IccDataReader.NonPrimitives.cs | 20 ++-- .../DataReader/IccDataReader.TagDataEntry.cs | 68 +++++------ .../DataWriter/IccDataWriter.NonPrimitives.cs | 4 +- .../DataWriter/IccDataWriter.TagDataEntry.cs | 6 +- .../Profiles/ICC/DataWriter/IccDataWriter.cs | 2 +- .../Metadata/Profiles/ICC/IccProfile.cs | 2 +- .../Metadata/Profiles/ICC/IccReader.cs | 6 +- .../Metadata/Profiles/ICC/IccWriter.cs | 2 +- .../TagDataEntries/IccLut16TagDataEntry.cs | 2 +- .../IccTextDescriptionTagDataEntry.cs | 12 +- .../Metadata/Profiles/IPTC/IptcProfile.cs | 4 +- .../Metadata/Profiles/IPTC/IptcValue.cs | 2 +- .../PixelBlenders/PorterDuffFunctions.cs | 4 +- .../PixelFormats/PixelComponentInfo.cs | 2 +- .../PixelImplementations/Abgr32.cs | 6 +- .../PixelImplementations/Argb32.cs | 6 +- .../PixelImplementations/Bgr24.cs | 6 +- .../PixelImplementations/Bgr565.cs | 4 +- .../PixelImplementations/Bgra32.cs | 6 +- .../PixelImplementations/Bgra4444.cs | 2 +- .../PixelImplementations/Bgra5551.cs | 2 +- .../PixelImplementations/Byte4.cs | 2 +- .../PixelImplementations/HalfSingle.cs | 4 +- .../PixelImplementations/HalfVector2.cs | 6 +- .../PixelImplementations/HalfVector4.cs | 2 +- .../PixelFormats/PixelImplementations/L16.cs | 4 +- .../PixelFormats/PixelImplementations/L8.cs | 4 +- .../PixelFormats/PixelImplementations/La16.cs | 4 +- .../PixelFormats/PixelImplementations/La32.cs | 18 +-- .../PixelImplementations/NormalizedByte2.cs | 8 +- .../PixelImplementations/NormalizedByte4.cs | 2 +- .../PixelImplementations/NormalizedShort2.cs | 8 +- .../PixelImplementations/NormalizedShort4.cs | 2 +- .../PixelFormats/PixelImplementations/Rg32.cs | 4 +- .../PixelImplementations/Rgb24.cs | 8 +- .../PixelImplementations/Rgb48.cs | 6 +- .../PixelImplementations/Rgba1010102.cs | 2 +- .../PixelImplementations/Rgba32.cs | 10 +- .../PixelImplementations/Rgba64.cs | 4 +- .../PixelImplementations/RgbaVector.cs | 2 +- .../PixelImplementations/Short2.cs | 8 +- .../PixelImplementations/Short4.cs | 2 +- src/ImageSharp/Primitives/ColorMatrix.Impl.cs | 10 +- src/ImageSharp/Primitives/Complex64.cs | 4 +- src/ImageSharp/Primitives/DenseMatrix{T}.cs | 6 +- src/ImageSharp/Primitives/LongRational.cs | 12 +- src/ImageSharp/Primitives/Number.cs | 6 +- src/ImageSharp/Primitives/Point.cs | 2 +- src/ImageSharp/Primitives/Rectangle.cs | 14 +-- src/ImageSharp/Primitives/RectangleF.cs | 8 +- src/ImageSharp/Primitives/SignedRational.cs | 4 +- src/ImageSharp/Primitives/Size.cs | 4 +- src/ImageSharp/Primitives/SizeF.cs | 4 +- src/ImageSharp/Primitives/ValueSize.cs | 6 +- .../HistogramEqualizationExtensions.cs | 2 +- .../Extensions/Transforms/CropExtensions.cs | 2 +- .../Extensions/Transforms/PadExtensions.cs | 2 +- .../Extensions/Transforms/ResizeExtensions.cs | 8 +- .../Transforms/TransformExtensions.cs | 4 +- .../Processing/KnownFilterMatrices.cs | 14 +-- .../CloningImageProcessor{TPixel}.cs | 4 +- .../Convolution/BoxBlurProcessor{TPixel}.cs | 2 +- .../Convolution2DRowOperation{TPixel}.cs | 4 +- .../Convolution/Convolution2DState.cs | 4 +- .../Convolution/ConvolutionState.cs | 2 +- .../EdgeDetector2DProcessor{TPixel}.cs | 2 +- .../Implementation/LaplacianKernelFactory.cs | 2 +- .../Convolution/MedianConvolutionState.cs | 2 +- .../Convolution/MedianRowOperation{TPixel}.cs | 4 +- .../Parameters/BokehBlurKernelDataProvider.cs | 4 +- .../Dithering/ErrorDither.KnownTypes.cs | 18 +-- .../Processors/Dithering/OrderedDither.cs | 2 +- .../Dithering/OrderedDitherFactory.cs | 2 +- .../PaletteDitherProcessor{TPixel}.cs | 2 +- .../DrawImageProcessor{TPixelBg,TPixelFg}.cs | 4 +- .../Effects/OilPaintingProcessor{TPixel}.cs | 2 +- .../Effects/PixelRowDelegateProcessor.cs | 2 +- ...lRowDelegateProcessor{TPixel,TDelegate}.cs | 2 +- .../PositionAwarePixelRowDelegateProcessor.cs | 2 +- ...eHistogramEqualizationProcessor{TPixel}.cs | 12 +- ...alizationSlidingWindowProcessor{TPixel}.cs | 2 +- .../AutoLevelProcessor{TPixel}.cs | 4 +- ...lHistogramEqualizationProcessor{TPixel}.cs | 2 +- .../Overlays/GlowProcessor{TPixel}.cs | 2 +- .../Overlays/VignetteProcessor{TPixel}.cs | 2 +- .../Quantization/OctreeQuantizer.cs | 2 +- .../Quantization/OctreeQuantizer{TPixel}.cs | 6 +- .../Quantization/PaletteQuantizer.cs | 2 +- .../Quantization/WebSafePaletteQuantizer.cs | 2 +- .../Quantization/WernerPaletteQuantizer.cs | 2 +- .../Processors/Quantization/WuQuantizer.cs | 2 +- .../Quantization/WuQuantizer{TPixel}.cs | 2 +- .../Transforms/CropProcessor{TPixel}.cs | 4 +- .../AffineTransformProcessor{TPixel}.cs | 4 +- .../Transforms/Resize/ResizeHelper.cs | 16 +-- .../Transforms/Resize/ResizeKernelMap.cs | 2 +- .../Resize/ResizeProcessor{TPixel}.cs | 6 +- .../Transforms/Resize/ResizeWorker.cs | 4 +- .../Processors/Transforms/TransformUtils.cs | 18 +-- .../Processing/ProjectiveTransformBuilder.cs | 26 ++--- .../Bulk/FromRgba32Bytes.cs | 2 +- .../Codecs/Bmp/DecodeBmp.cs | 2 +- .../Codecs/Gif/DecodeEncodeGif.cs | 4 +- .../Codecs/Gif/DecodeGif.cs | 2 +- .../Codecs/Gif/EncodeGif.cs | 4 +- .../Codecs/Gif/EncodeGifMultiple.cs | 2 +- .../BlockOperations/Block8x8F_CopyTo2x2.cs | 56 ++++----- .../BlockOperations/Block8x8F_DivideRound.cs | 4 +- .../ColorConversionBenchmark.cs | 2 +- .../Codecs/Jpeg/DecodeJpeg.cs | 2 +- .../Codecs/Jpeg/DecodeJpegParseStreamOnly.cs | 3 +- .../Codecs/Jpeg/DecodeJpeg_ImageSpecific.cs | 4 +- .../Codecs/Jpeg/EncodeJpegComparison.cs | 6 +- .../Codecs/Jpeg/EncodeJpegFeatures.cs | 4 +- .../Codecs/MultiImageBenchmarkBase.cs | 2 +- .../Codecs/Png/EncodeIndexedPng.cs | 6 +- .../Codecs/Tga/EncodeTga.cs | 2 +- .../Codecs/Tiff/EncodeTiff.cs | 2 +- .../Codecs/Webp/EncodeWebp.cs | 2 +- .../Color/ColorEquality.cs | 2 +- .../Color/RgbWorkingSpaceAdapt.cs | 2 +- .../ImageSharp.Benchmarks/Color/YcbCrToRgb.cs | 4 +- .../General/Adler32Benchmark.cs | 2 +- .../ImageSharp.Benchmarks/General/Array2D.cs | 2 +- .../General/BasicMath/ClampSpan.cs | 2 +- .../General/BasicMath/ClampVector4.cs | 4 +- .../General/CopyBuffers.cs | 4 +- .../General/IO/BufferedStreams.cs | 32 +++--- .../PixelConversion_ConvertFromRgba32.cs | 6 +- .../PixelConversion_ConvertFromVector4.cs | 4 +- .../PixelConversion_ConvertToRgba32.cs | 4 +- ...vertToRgba32_AsPartOfCompositeOperation.cs | 4 +- .../PixelConversion_ConvertToVector4.cs | 2 +- ...ertToVector4_AsPartOfCompositeOperation.cs | 2 +- .../PixelConversion_Rgba32_To_Bgra32.cs | 4 +- .../General/PixelConversion/TestArgb.cs | 2 +- .../General/PixelConversion/TestRgba.cs | 2 +- .../General/Vector4Constants.cs | 8 +- .../General/Vectorization/BitwiseOrUint32.cs | 4 +- .../General/Vectorization/DivFloat.cs | 4 +- .../General/Vectorization/DivUInt32.cs | 4 +- .../General/Vectorization/Divide.cs | 2 +- .../General/Vectorization/MulFloat.cs | 6 +- .../General/Vectorization/MulUInt32.cs | 4 +- .../General/Vectorization/Multiply.cs | 2 +- .../General/Vectorization/Premultiply.cs | 6 +- .../Vectorization/ReinterpretUInt32AsFloat.cs | 2 +- .../General/Vectorization/UInt32ToSingle.cs | 14 +-- .../General/Vectorization/VectorFetching.cs | 12 +- .../LoadResizeSaveStressBenchmarks.cs | 2 +- .../LoadResizeSaveStressRunner.cs | 6 +- .../PixelBlenders/PorterDuffBulkVsPixel.cs | 4 +- .../ImageSharp.Benchmarks/Processing/Crop.cs | 4 +- .../Processing/HistogramEqualization.cs | 4 +- .../Processing/OilPaint.cs | 2 +- .../Processing/Resize.cs | 4 +- .../LoadResizeSaveParallelMemoryStress.cs | 4 +- .../Program.cs | 4 +- .../Color/ColorTests.CastTo.cs | 8 +- tests/ImageSharp.Tests/Color/ColorTests.cs | 16 +-- .../Color/ReferencePalette.cs | 2 +- tests/ImageSharp.Tests/Color/RgbaDouble.cs | 2 +- .../ColorProfiles/CieLabTests.cs | 4 +- .../ColorProfiles/CieLchTests.cs | 4 +- .../ColorProfiles/CieLchuvTests.cs | 4 +- .../ColorProfiles/CieLuvTests.cs | 4 +- .../CieXyChromaticityCoordinatesTests.cs | 4 +- .../ColorProfiles/CieXyyTests.cs | 4 +- .../ColorProfiles/CieXyzTests.cs | 4 +- .../ColorProfiles/CmykTests.cs | 4 +- .../ColorProfiles/CompandingTests.cs | 2 +- .../ColorProfiles/HslTests.cs | 4 +- .../ColorProfiles/HsvTests.cs | 4 +- .../ColorProfiles/HunterLabTests.cs | 4 +- .../Icc/ColorProfileConverterTests.Icc.cs | 16 +-- .../ColorProfiles/Icc/TestIccProfiles.cs | 5 +- .../ColorProfiles/LmsTests.cs | 4 +- .../ColorProfiles/RgbTests.cs | 4 +- .../StringRepresentationTests.cs | 2 +- .../ColorProfiles/YCbCrTests.cs | 4 +- .../ImageSharp.Tests/ColorProfiles/YTests.cs | 4 +- .../ColorProfiles/YccKTests.cs | 4 +- .../Common/EncoderExtensionsTests.cs | 2 +- .../ImageSharp.Tests/Common/NumericsTests.cs | 2 +- .../ImageSharp.Tests/Common/SimdUtilsTests.cs | 6 +- .../Common/StreamExtensionsTests.cs | 10 +- tests/ImageSharp.Tests/ConfigurationTests.cs | 2 +- .../Drawing/DrawImageTests.cs | 24 ++-- .../Formats/Bmp/BmpEncoderTests.cs | 2 +- .../Formats/Bmp/BmpFileHeaderTests.cs | 2 +- .../Formats/Bmp/ImageExtensionsTest.cs | 4 +- .../Formats/Gif/GifDecoderTests.cs | 10 +- .../Formats/Gif/GifEncoderTests.cs | 10 +- .../Formats/Gif/GifMetadataTests.cs | 4 +- .../Formats/Gif/ImageExtensionsTest.cs | 4 +- .../Formats/Icon/Ico/IcoDecoderTests.cs | 5 +- .../Formats/ImageFormatManagerTests.cs | 2 +- .../Formats/Jpg/Block8x8Tests.cs | 6 +- .../Formats/Jpg/HuffmanScanEncoderTests.cs | 2 +- .../Formats/Jpg/ImageExtensionsTest.cs | 4 +- .../Formats/Jpg/JpegColorConverterTests.cs | 24 ++-- .../Formats/Jpg/JpegDecoderTests.Metadata.cs | 12 +- .../Formats/Jpg/JpegDecoderTests.cs | 16 +-- .../Formats/Jpg/JpegEncoderTests.Metadata.cs | 4 +- .../Formats/Jpg/JpegFileMarkerTests.cs | 2 +- .../Formats/Jpg/JpegMetadataTests.cs | 16 +-- .../Formats/Jpg/ParseStreamTests.cs | 6 +- .../Formats/Jpg/SpectralJpegTests.cs | 6 +- .../Jpg/SpectralToPixelConversionTests.cs | 2 +- .../Formats/Jpg/Utils/JpegFixture.cs | 12 +- .../Formats/Jpg/Utils/LibJpegTools.cs | 6 +- ...ceImplementations.LLM_FloatingPoint_DCT.cs | 10 +- .../Formats/Jpg/Utils/VerifyJpeg.cs | 2 +- .../Formats/Pbm/ImageExtensionsTest.cs | 4 +- .../Formats/Pbm/PbmDecoderTests.cs | 6 +- .../Formats/Pbm/PbmEncoderTests.cs | 12 +- .../Formats/Pbm/PbmRoundTripTests.cs | 6 +- .../Formats/Png/Adler32Tests.cs | 2 +- .../Formats/Png/ImageExtensionsTest.cs | 4 +- .../Formats/Png/PngDecoderTests.Chunks.cs | 2 +- .../Formats/Png/PngDecoderTests.cs | 10 +- .../Formats/Png/PngEncoderFilterTests.cs | 28 ++--- .../Formats/Png/PngEncoderTests.cs | 6 +- .../Formats/Png/PngFrameMetadataTests.cs | 4 +- .../Formats/Png/PngMetadataTests.cs | 4 +- .../Formats/Png/PngTextDataTests.cs | 2 +- .../Formats/Qoi/ImageExtensionsTest.cs | 4 +- .../Formats/Tga/ImageExtensionsTest.cs | 4 +- .../Formats/Tga/TgaDecoderTests.cs | 2 +- .../Formats/Tiff/BigTiffMetadataTests.cs | 2 +- .../DeflateTiffCompressionTests.cs | 2 +- .../Compression/LzwTiffCompressionTests.cs | 2 +- .../Compression/NoneTiffCompressionTests.cs | 6 +- .../PackBitsTiffCompressionTests.cs | 6 +- .../Formats/Tiff/ImageExtensionsTest.cs | 4 +- .../BlackIsZeroTiffColorTests.cs | 2 +- .../PaletteTiffColorTests.cs | 4 +- .../PhotometricInterpretationTestBase.cs | 4 +- .../RgbPlanarTiffColorTests.cs | 78 ++++++------- .../RgbTiffColorTests.cs | 78 ++++++------- .../WhiteIsZeroTiffColorTests.cs | 2 +- .../Formats/Tiff/TiffDecoderTests.cs | 2 +- .../Formats/Tiff/TiffEncoderBaseTester.cs | 6 +- .../Tiff/TiffEncoderMultiframeTests.cs | 20 ++-- .../Formats/Tiff/TiffEncoderTests.cs | 2 +- .../Formats/Tiff/Utils/TiffWriterTests.cs | 32 +++--- .../Formats/WebP/ImageExtensionsTests.cs | 4 +- .../Formats/WebP/LosslessUtilsTests.cs | 4 +- .../Formats/WebP/PredictorEncoderTests.cs | 2 +- .../Formats/WebP/Vp8HistogramTests.cs | 12 +- .../Formats/WebP/Vp8ModeScoreTests.cs | 10 +- .../Formats/WebP/Vp8ResidualTests.cs | 6 +- .../Formats/WebP/WebpDecoderTests.cs | 6 +- .../Formats/WebP/WebpEncoderTests.cs | 4 +- .../Formats/WebP/WebpMetaDataTests.cs | 12 +- .../GraphicOptionsDefaultsExtensionsTests.cs | 46 ++++---- .../ImageSharp.Tests/GraphicsOptionsTests.cs | 8 +- .../Helpers/ColorNumericsTests.cs | 2 +- .../ImageSharp.Tests/Helpers/NumericsTests.cs | 8 +- .../Helpers/ParallelExecutionSettingsTests.cs | 2 +- .../Helpers/ParallelRowIteratorTests.cs | 2 +- .../Helpers/RowIntervalTests.cs | 14 +-- .../Helpers/TolerantMathTests.cs | 2 +- .../IO/ChunkedMemoryStreamTests.cs | 4 +- .../ImageSharp.Tests/Image/ImageCloneTests.cs | 4 +- .../Image/ImageFrameCollectionTests.cs | 7 +- .../ImageSharp.Tests/Image/ImageFrameTests.cs | 18 +-- .../Image/ImageRotationTests.cs | 6 +- .../ImageSharp.Tests/Image/ImageSaveTests.cs | 10 +- .../Image/ImageTests.DetectFormat.cs | 4 +- .../Image/ImageTests.EncodeCancellation.cs | 28 ++--- .../Image/ImageTests.Identify.cs | 4 +- .../Image/ImageTests.ImageLoadTestBase.cs | 16 +-- ..._FileSystemPath_UseDefaultConfiguration.cs | 2 +- ...s.Load_FromBytes_UseGlobalConfiguration.cs | 2 +- ...ts.Load_FromStream_ThrowsRightException.cs | 2 +- ...Load_FromStream_UseDefaultConfiguration.cs | 6 +- .../Image/ImageTests.WrapMemory.cs | 4 +- .../Image/LargeImageIntegrationTests.cs | 2 +- .../Image/ProcessPixelRowsTestBase.cs | 6 +- tests/ImageSharp.Tests/Issues/Issue594.cs | 2 +- .../Memory/Allocators/BufferTestSuite.cs | 2 +- .../RefCountedLifetimeGuardTests.cs | 10 +- .../Allocators/SharedArrayPoolBufferTests.cs | 4 +- .../SimpleGcMemoryAllocatorTests.cs | 2 +- .../UniformUnmanagedMemoryPoolTests.Trim.cs | 18 +-- .../UniformUnmanagedMemoryPoolTests.cs | 54 ++++----- ...niformUnmanagedPoolMemoryAllocatorTests.cs | 8 +- .../Memory/Allocators/UnmanagedBufferTests.cs | 2 +- .../Allocators/UnmanagedMemoryHandleTests.cs | 2 +- .../Memory/Buffer2DTests.SwapOrCopyContent.cs | 4 +- .../ImageSharp.Tests/Memory/Buffer2DTests.cs | 12 +- .../Memory/BufferAreaTests.cs | 12 +- .../DiscontiguousBuffers/MemoryGroupIndex.cs | 6 +- .../MemoryGroupIndexTests.cs | 6 +- .../MemoryGroupTests.Allocate.cs | 6 +- .../DiscontiguousBuffers/MemoryGroupTests.cs | 10 +- .../MemoryGroupTestsBase.cs | 2 +- tests/ImageSharp.Tests/Memory/TestStructs.cs | 4 +- .../MemoryAllocatorValidator.cs | 2 +- .../Metadata/ImageFrameMetadataTests.cs | 2 +- .../Metadata/ImageMetadataTests.cs | 6 +- .../Profiles/CICP/CicpProfileTests.cs | 8 +- .../Profiles/Exif/ExifProfileTests.cs | 38 +++--- .../Metadata/Profiles/Exif/ExifReaderTests.cs | 4 +- .../Exif/ExifTagDescriptionAttributeTests.cs | 2 +- .../Profiles/Exif/Values/ExifValuesTests.cs | 44 +++---- .../DataReader/IccDataReaderCurvesTests.cs | 2 +- .../ICC/DataReader/IccDataReaderLutTests.cs | 2 +- .../IccDataReaderMultiProcessElementTests.cs | 2 +- .../IccDataReaderNonPrimitivesTests.cs | 2 +- .../IccDataReaderPrimitivesTests.cs | 2 +- .../IccDataReaderTagDataEntryTests.cs | 2 +- .../DataWriter/IccDataWriterCurvesTests.cs | 2 +- .../ICC/DataWriter/IccDataWriterLutTests.cs | 2 +- .../Metadata/Profiles/ICC/IccProfileTests.cs | 2 +- .../Metadata/Profiles/ICC/IccWriterTests.cs | 2 +- .../Profiles/ICC/Various/IccProfileIdTests.cs | 2 +- .../Profiles/IPTC/IptcProfileTests.cs | 6 +- .../Metadata/Profiles/XMP/XmpProfileTests.cs | 26 ++--- .../Numerics/RationalTests.cs | 20 ++-- .../Numerics/SignedRationalTests.cs | 24 ++-- .../ImageSharp.Tests/PixelFormats/A8Tests.cs | 2 +- .../PixelFormats/Abgr32Tests.cs | 4 +- .../PixelFormats/Argb32Tests.cs | 2 +- .../PixelFormats/Bgr24Tests.cs | 4 +- .../PixelFormats/Bgr565Tests.cs | 30 ++--- .../PixelFormats/Bgra32Tests.cs | 4 +- .../PixelFormats/Bgra4444Tests.cs | 28 ++--- .../PixelFormats/Bgra5551Tests.cs | 30 ++--- .../PixelFormats/Byte4Tests.cs | 26 ++--- .../PixelFormats/HalfVector2Tests.cs | 2 +- .../PixelFormats/HalfVector4Tests.cs | 2 +- .../ImageSharp.Tests/PixelFormats/L16Tests.cs | 4 +- .../ImageSharp.Tests/PixelFormats/L8Tests.cs | 4 +- .../PixelFormats/La16Tests.cs | 4 +- .../PixelFormats/La32Tests.cs | 4 +- .../PixelFormats/NormalizedByte2Tests.cs | 6 +- .../PixelFormats/NormalizedByte4Tests.cs | 26 ++--- .../PixelFormats/NormalizedShort2Tests.cs | 6 +- .../PixelFormats/NormalizedShort4Tests.cs | 26 ++--- .../PixelFormats/PixelBlenderTests.cs | 24 ++-- .../PixelBlenders/PorterDuffFunctionsTests.cs | 52 ++++----- .../PorterDuffFunctionsTestsTPixel.cs | 2 +- .../PixelOperations/PixelOperationsTests.cs | 14 +-- .../PixelFormats/Rg32Tests.cs | 2 +- .../PixelFormats/Rgb24Tests.cs | 4 +- .../PixelFormats/Rgb48Tests.cs | 2 +- .../PixelFormats/Rgba1010102Tests.cs | 28 ++--- .../PixelFormats/Rgba32Tests.cs | 2 +- .../PixelFormats/Rgba64Tests.cs | 2 +- .../PixelFormats/RgbaVectorTests.cs | 6 +- .../PixelFormats/Short2Tests.cs | 8 +- .../PixelFormats/Short4Tests.cs | 2 +- .../Primitives/DenseMatrixTests.cs | 2 +- .../Primitives/PointFTests.cs | 2 +- .../ImageSharp.Tests/Primitives/PointTests.cs | 18 +-- .../Primitives/RectangleFTests.cs | 72 ++++++------ .../Primitives/RectangleTests.cs | 16 +-- .../ImageSharp.Tests/Primitives/SizeFTests.cs | 10 +- .../ImageSharp.Tests/Primitives/SizeTests.cs | 30 ++--- .../BaseImageOperationsExtensionTest.cs | 8 +- .../Binarization/OrderedDitherFactoryTests.cs | 8 +- .../Convolution/KernelSamplingMapTest.cs | 82 ++++++------- .../Processors/LaplacianKernelFactoryTests.cs | 6 +- .../Processing/FakeImageOperationsProvider.cs | 4 +- .../Processing/Filters/BrightnessTest.cs | 12 +- .../Processing/ImageOperationTests.cs | 6 +- .../Processing/ImageProcessingContextTests.cs | 8 +- .../HistogramEqualizationTests.cs | 4 +- .../Normalization/MagickCompareTests.cs | 2 +- .../Processing/Overlays/GlowTest.cs | 2 +- .../Processing/Overlays/VignetteTest.cs | 2 +- .../Binarization/BinaryDitherTests.cs | 8 +- .../Binarization/BinaryThresholdTest.cs | 10 +- .../Basic1ParameterConvolutionTests.cs | 2 +- .../Processors/Convolution/BokehBlurTest.cs | 6 +- .../Convolution/ConvolutionTests.cs | 2 +- .../Processors/Convolution/DetectEdgesTest.cs | 16 +-- .../Processors/Dithering/DitherTests.cs | 8 +- .../Processors/Effects/OilPaintTest.cs | 2 +- .../Processors/Effects/PixelShaderTest.cs | 4 +- .../Processors/Effects/PixelateTest.cs | 2 +- .../Processors/Filters/BrightnessTest.cs | 2 +- .../Processors/Filters/ColorBlindnessTest.cs | 2 +- .../Processors/Filters/ContrastTest.cs | 2 +- .../Processors/Filters/GrayscaleTest.cs | 2 +- .../Processing/Processors/Filters/HueTest.cs | 2 +- .../Processors/Filters/LightnessTest.cs | 2 +- .../Processors/Filters/OpacityTest.cs | 2 +- .../Processors/Filters/SaturateTest.cs | 2 +- .../Quantization/OctreeQuantizerTests.cs | 16 +-- .../Quantization/PaletteQuantizerTests.cs | 16 +-- .../Quantization/WuQuantizerTests.cs | 16 +-- .../Transforms/AffineTransformTests.cs | 10 +- .../Processors/Transforms/AutoOrientTests.cs | 4 +- .../Processors/Transforms/CropTest.cs | 2 +- .../Processors/Transforms/EntropyCropTest.cs | 2 +- .../Processors/Transforms/FlipTests.cs | 4 +- .../Transforms/ResizeHelperTests.cs | 14 +-- ...ResizeKernelMapTests.ReferenceKernelMap.cs | 6 +- .../Transforms/ResizeKernelMapTests.cs | 10 +- .../Processors/Transforms/ResizeTests.cs | 18 +-- .../Processors/Transforms/RotateFlipTests.cs | 4 +- .../Processors/Transforms/RotateTests.cs | 8 +- .../Processors/Transforms/SkewTests.cs | 4 +- .../Processors/Transforms/SwizzleTests.cs | 6 +- .../Transforms/AffineTransformBuilderTests.cs | 3 +- .../Processing/Transforms/CropTest.cs | 2 +- .../ProjectiveTransformBuilderTests.cs | 3 +- .../Transforms/ProjectiveTransformTests.cs | 18 +-- .../Processing/Transforms/ResizeTests.cs | 2 +- .../Processing/Transforms/SwizzleTests.cs | 4 +- .../Transforms/TransformBuilderTestBase.cs | 52 ++++----- .../LoadResizeSaveProfilingBenchmarks.cs | 2 +- .../ResizeProfilingBenchmarks.cs | 2 +- .../Quantization/QuantizedImageTests.cs | 2 +- .../Quantization/WuQuantizerTests.cs | 22 ++-- .../Conversion/IccConversionDataLutEntry.cs | 2 +- .../IccConversionDataMultiProcessElement.cs | 4 +- .../Conversion/IccConversionDataTrc.cs | 10 +- .../TestDataIcc/IccTestDataLut.cs | 2 +- .../TestDataIcc/IccTestDataProfiles.cs | 8 +- .../TestDataIcc/IccTestDataTagDataEntry.cs | 6 +- tests/ImageSharp.Tests/TestFile.cs | 4 +- tests/ImageSharp.Tests/TestFontUtilities.cs | 2 +- tests/ImageSharp.Tests/TestFormat.cs | 8 +- .../TestUtilities/ByteBuffer.cs | 2 +- .../TestUtilities/EofHitCounter.cs | 4 +- .../FeatureTesting/FeatureTestRunner.cs | 16 +-- .../ImageComparison/ExactImageComparer.cs | 4 +- .../ImageComparison/ImageComparer.cs | 2 +- .../ImageComparison/ImageComparingUtils.cs | 2 +- .../ImageComparison/ImageSimilarityReport.cs | 4 +- .../ImageComparison/TolerantImageComparer.cs | 4 +- .../BasicTestPatternProvider.cs | 2 +- .../ImageProviders/BlankProvider.cs | 2 +- .../ImageProviders/FileProvider.cs | 2 +- .../ImageProviders/TestImageProvider.cs | 6 +- .../TestUtilities/MeasureFixture.cs | 2 +- .../TestUtilities/PausedMemoryStream.cs | 4 +- .../TestUtilities/PausedStream.cs | 4 +- .../ReferenceCodecs/MagickReferenceDecoder.cs | 14 +-- .../ReferenceCodecs/SystemDrawingBridge.cs | 12 +- .../SystemDrawingReferenceDecoder.cs | 6 +- .../SystemDrawingReferenceEncoder.cs | 4 +- .../SixLaborsXunitTestFramework.cs | 2 +- .../TestUtilities/TestEnvironment.cs | 4 +- .../TestUtilities/TestImageExtensions.cs | 2 +- .../TestUtilities/TestMemoryAllocator.cs | 10 +- .../TestUtilities/TestMemoryManager.cs | 2 +- .../TestUtilities/TestPixel.cs | 2 +- .../TestUtilities/TestUtils.cs | 4 +- .../TestUtilities/TestVector4.cs | 2 +- .../Tests/BasicSerializerTests.cs | 2 +- .../TestUtilities/Tests/ImageComparerTests.cs | 4 +- .../Tests/ReferenceDecoderBenchmarks.cs | 2 +- .../Tests/SemaphoreReadMemoryStreamTests.cs | 4 +- .../Tests/SystemDrawingReferenceCodecTests.cs | 8 +- .../Tests/TestImageProviderTests.cs | 4 +- .../Tests/TestUtilityExtensionsTests.cs | 2 +- 703 files changed, 2574 insertions(+), 2561 deletions(-) diff --git a/.editorconfig b/.editorconfig index af1e5b44c..74a363eef 100644 --- a/.editorconfig +++ b/.editorconfig @@ -161,6 +161,9 @@ csharp_style_deconstructed_variable_declaration = true:warning csharp_style_prefer_index_operator = true:warning csharp_style_prefer_range_operator = true:warning csharp_style_implicit_object_creation_when_type_is_apparent = true:error +# ReSharper inspection severities +resharper_arrange_object_creation_when_type_evident_highlighting = error +resharper_arrange_object_creation_when_type_not_evident_highlighting = error # "Null" checking preferences csharp_style_throw_expression = true:warning csharp_style_conditional_delegate_call = true:warning diff --git a/src/ImageSharp/Advanced/ParallelExecutionSettings.cs b/src/ImageSharp/Advanced/ParallelExecutionSettings.cs index f295ddb1b..fd9692f9a 100644 --- a/src/ImageSharp/Advanced/ParallelExecutionSettings.cs +++ b/src/ImageSharp/Advanced/ParallelExecutionSettings.cs @@ -79,7 +79,7 @@ public readonly struct ParallelExecutionSettings { Guard.MustBeGreaterThan(multiplier, 0, nameof(multiplier)); - return new( + return new ParallelExecutionSettings( this.MaxDegreeOfParallelism, this.MinimumPixelsProcessedPerTask * multiplier, this.MemoryAllocator); @@ -92,6 +92,6 @@ public readonly struct ParallelExecutionSettings /// The . public static ParallelExecutionSettings FromConfiguration(Configuration configuration) { - return new(configuration.MaxDegreeOfParallelism, configuration.MemoryAllocator); + return new ParallelExecutionSettings(configuration.MaxDegreeOfParallelism, configuration.MemoryAllocator); } } diff --git a/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs b/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs index b76f2948f..cbcd12aec 100644 --- a/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs +++ b/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs @@ -139,7 +139,7 @@ public static partial class ParallelRowIterator } int yMax = Math.Min(yMin + this.stepY, this.maxY); - RowInterval rows = new RowInterval(yMin, yMax); + RowInterval rows = new(yMin, yMax); // Skip the safety copy when invoking a potentially impure method on a readonly field Unsafe.AsRef(in this.operation).Invoke(in rows); @@ -185,7 +185,7 @@ public static partial class ParallelRowIterator } int yMax = Math.Min(yMin + this.stepY, this.maxY); - RowInterval rows = new RowInterval(yMin, yMax); + RowInterval rows = new(yMin, yMax); using IMemoryOwner buffer = this.allocator.Allocate(this.bufferLength); diff --git a/src/ImageSharp/Color/Color.WernerPalette.cs b/src/ImageSharp/Color/Color.WernerPalette.cs index 1058da654..6f0e3744f 100644 --- a/src/ImageSharp/Color/Color.WernerPalette.cs +++ b/src/ImageSharp/Color/Color.WernerPalette.cs @@ -8,7 +8,7 @@ namespace SixLabors.ImageSharp; /// public partial struct Color { - private static readonly Lazy WernerPaletteLazy = new Lazy(CreateWernerPalette, true); + private static readonly Lazy WernerPaletteLazy = new(CreateWernerPalette, true); /// /// Gets a collection of colors as defined in the original second edition of Werner’s Nomenclature of Colours 1821. diff --git a/src/ImageSharp/Color/Color.cs b/src/ImageSharp/Color/Color.cs index 8f54680ec..1dfbf0a24 100644 --- a/src/ImageSharp/Color/Color.cs +++ b/src/ImageSharp/Color/Color.cs @@ -81,10 +81,10 @@ public readonly partial struct Color : IEquatable PixelTypeInfo info = TPixel.GetPixelTypeInfo(); if (info.ComponentInfo.HasValue && info.ComponentInfo.Value.GetMaximumComponentPrecision() <= (int)PixelComponentBitDepth.Bit32) { - return new(source.ToScaledVector4()); + return new Color(source.ToScaledVector4()); } - return new(source); + return new Color(source); } /// @@ -120,7 +120,7 @@ public readonly partial struct Color : IEquatable { for (int i = 0; i < destination.Length; i++) { - destination[i] = new(source[i]); + destination[i] = new Color(source[i]); } } } diff --git a/src/ImageSharp/ColorProfiles/CieLab.cs b/src/ImageSharp/ColorProfiles/CieLab.cs index c1f53c162..ebe163102 100644 --- a/src/ImageSharp/ColorProfiles/CieLab.cs +++ b/src/ImageSharp/ColorProfiles/CieLab.cs @@ -88,7 +88,7 @@ public readonly struct CieLab : IProfileConnectingSpace v3 += this.AsVector3Unsafe(); v3 += new Vector3(0, 128F, 128F); v3 /= new Vector3(100F, 255F, 255F); - return new(v3, 1F); + return new Vector4(v3, 1F); } /// @@ -97,7 +97,7 @@ public readonly struct CieLab : IProfileConnectingSpace Vector3 v3 = source.AsVector3(); v3 *= new Vector3(100F, 255, 255); v3 -= new Vector3(0, 128F, 128F); - return new(v3); + return new CieLab(v3); } /// @@ -145,7 +145,7 @@ public readonly struct CieLab : IProfileConnectingSpace float a = 500F * (fx - fy); float b = 200F * (fy - fz); - return new(l, a, b); + return new CieLab(l, a, b); } /// @@ -182,7 +182,7 @@ public readonly struct CieLab : IProfileConnectingSpace Vector3 wxyz = new(whitePoint.X, whitePoint.Y, whitePoint.Z); Vector3 xyzr = new(xr, yr, zr); - return new(xyzr * wxyz); + return new CieXyz(xyzr * wxyz); } /// diff --git a/src/ImageSharp/ColorProfiles/CieLch.cs b/src/ImageSharp/ColorProfiles/CieLch.cs index 53afc0053..e62aa2ba2 100644 --- a/src/ImageSharp/ColorProfiles/CieLch.cs +++ b/src/ImageSharp/ColorProfiles/CieLch.cs @@ -25,7 +25,7 @@ public readonly struct CieLch : IColorProfile /// The hue in degrees. [MethodImpl(MethodImplOptions.AggressiveInlining)] public CieLch(float l, float c, float h) - : this(new(l, c, h)) + : this(new Vector3(l, c, h)) { } @@ -100,7 +100,7 @@ public readonly struct CieLch : IColorProfile v3 += this.AsVector3Unsafe(); v3 += new Vector3(0, 200, 0); v3 /= new Vector3(100, 400, 360); - return new(v3, 1F); + return new Vector4(v3, 1F); } /// @@ -109,7 +109,7 @@ public readonly struct CieLch : IColorProfile Vector3 v3 = source.AsVector3(); v3 *= new Vector3(100, 400, 360); v3 -= new Vector3(0, 200, 0); - return new(v3, true); + return new CieLch(v3, true); } /// @@ -155,7 +155,7 @@ public readonly struct CieLch : IColorProfile hDegrees += 360; } - return new(l, c, hDegrees); + return new CieLch(l, c, hDegrees); } /// @@ -181,7 +181,7 @@ public readonly struct CieLch : IColorProfile float a = c * MathF.Cos(hRadians); float b = c * MathF.Sin(hRadians); - return new(l, a, b); + return new CieLab(l, a, b); } /// diff --git a/src/ImageSharp/ColorProfiles/CieLchuv.cs b/src/ImageSharp/ColorProfiles/CieLchuv.cs index c08d6cc40..5478752dd 100644 --- a/src/ImageSharp/ColorProfiles/CieLchuv.cs +++ b/src/ImageSharp/ColorProfiles/CieLchuv.cs @@ -25,7 +25,7 @@ public readonly struct CieLchuv : IColorProfile /// The hue in degrees. [MethodImpl(MethodImplOptions.AggressiveInlining)] public CieLchuv(float l, float c, float h) - : this(new(l, c, h)) + : this(new Vector3(l, c, h)) { } @@ -97,7 +97,7 @@ public readonly struct CieLchuv : IColorProfile v3 += this.AsVector3Unsafe(); v3 += new Vector3(0, 200, 0); v3 /= new Vector3(100, 400, 360); - return new(v3, 1F); + return new Vector4(v3, 1F); } /// @@ -106,7 +106,7 @@ public readonly struct CieLchuv : IColorProfile Vector3 v3 = source.AsVector3(); v3 *= new Vector3(100, 400, 360); v3 -= new Vector3(0, 200, 0); - return new(v3, true); + return new CieLchuv(v3, true); } /// @@ -154,7 +154,7 @@ public readonly struct CieLchuv : IColorProfile hDegrees += 360; } - return new(l, c, hDegrees); + return new CieLchuv(l, c, hDegrees); } /// diff --git a/src/ImageSharp/ColorProfiles/CieLuv.cs b/src/ImageSharp/ColorProfiles/CieLuv.cs index 58ec9048c..b17c43331 100644 --- a/src/ImageSharp/ColorProfiles/CieLuv.cs +++ b/src/ImageSharp/ColorProfiles/CieLuv.cs @@ -134,7 +134,7 @@ public readonly struct CieLuv : IColorProfile v = 0; } - return new((float)l, (float)u, (float)v); + return new CieLuv((float)l, (float)u, (float)v); } /// @@ -188,7 +188,7 @@ public readonly struct CieLuv : IColorProfile z = 0; } - return new((float)x, (float)y, (float)z); + return new CieXyz((float)x, (float)y, (float)z); } /// diff --git a/src/ImageSharp/ColorProfiles/CieXyy.cs b/src/ImageSharp/ColorProfiles/CieXyy.cs index ef45f352d..744b6195e 100644 --- a/src/ImageSharp/ColorProfiles/CieXyy.cs +++ b/src/ImageSharp/ColorProfiles/CieXyy.cs @@ -122,10 +122,10 @@ public readonly struct CieXyy : IColorProfile if (float.IsNaN(x) || float.IsNaN(y)) { - return new(0, 0, source.Y); + return new CieXyy(0, 0, source.Y); } - return new(x, y, source.Y); + return new CieXyy(x, y, source.Y); } /// @@ -144,14 +144,14 @@ public readonly struct CieXyy : IColorProfile { if (MathF.Abs(this.Y) < Constants.Epsilon) { - return new(0, 0, this.Yl); + return new CieXyz(0, 0, this.Yl); } float x = (this.X * this.Yl) / this.Y; float y = this.Yl; float z = ((1 - this.X - this.Y) * y) / this.Y; - return new(x, y, z); + return new CieXyz(x, y, z); } /// diff --git a/src/ImageSharp/ColorProfiles/CieXyz.cs b/src/ImageSharp/ColorProfiles/CieXyz.cs index b14f01469..94fcfb21b 100644 --- a/src/ImageSharp/ColorProfiles/CieXyz.cs +++ b/src/ImageSharp/ColorProfiles/CieXyz.cs @@ -88,7 +88,7 @@ public readonly struct CieXyz : IProfileConnectingSpace { Vector3 v3 = default; v3 += this.AsVector3Unsafe(); - return new(v3, 1F); + return new Vector4(v3, 1F); } /// @@ -97,13 +97,13 @@ public readonly struct CieXyz : IProfileConnectingSpace Vector3 v3 = default; v3 += this.AsVector3Unsafe(); v3 *= 32768F / 65535; - return new(v3, 1F); + return new Vector4(v3, 1F); } internal static CieXyz FromVector4(Vector4 source) { Vector3 v3 = source.AsVector3(); - return new(v3); + return new CieXyz(v3); } /// @@ -111,7 +111,7 @@ public readonly struct CieXyz : IProfileConnectingSpace { Vector3 v3 = source.AsVector3(); v3 *= 65535 / 32768F; - return new(v3); + return new CieXyz(v3); } /// diff --git a/src/ImageSharp/ColorProfiles/Cmyk.cs b/src/ImageSharp/ColorProfiles/Cmyk.cs index 3a2ffd6fb..ee81ff9f7 100644 --- a/src/ImageSharp/ColorProfiles/Cmyk.cs +++ b/src/ImageSharp/ColorProfiles/Cmyk.cs @@ -26,7 +26,7 @@ public readonly struct Cmyk : IColorProfile /// The keyline black component. [MethodImpl(MethodImplOptions.AggressiveInlining)] public Cmyk(float c, float m, float y, float k) - : this(new(c, m, y, k)) + : this(new Vector4(c, m, y, k)) { } @@ -138,12 +138,12 @@ public readonly struct Cmyk : IColorProfile if (k.X >= 1F - Constants.Epsilon) { - return new(0, 0, 0, 1F); + return new Cmyk(0, 0, 0, 1F); } cmy = (cmy - k) / (Vector3.One - k); - return new(cmy.X, cmy.Y, cmy.Z, k.X); + return new Cmyk(cmy.X, cmy.Y, cmy.Z, k.X); } /// diff --git a/src/ImageSharp/ColorProfiles/ColorProfileConverter.cs b/src/ImageSharp/ColorProfiles/ColorProfileConverter.cs index d0afec4ab..7072537a4 100644 --- a/src/ImageSharp/ColorProfiles/ColorProfileConverter.cs +++ b/src/ImageSharp/ColorProfiles/ColorProfileConverter.cs @@ -12,7 +12,7 @@ public class ColorProfileConverter /// Initializes a new instance of the class. /// public ColorProfileConverter() - : this(new()) + : this(new ColorConversionOptions()) { } diff --git a/src/ImageSharp/ColorProfiles/ColorProfileConverterExtensionsIcc.cs b/src/ImageSharp/ColorProfiles/ColorProfileConverterExtensionsIcc.cs index b00ff8200..c33f40001 100644 --- a/src/ImageSharp/ColorProfiles/ColorProfileConverterExtensionsIcc.cs +++ b/src/ImageSharp/ColorProfiles/ColorProfileConverterExtensionsIcc.cs @@ -57,11 +57,11 @@ internal static class ColorProfileConverterExtensionsIcc ConversionParams sourceParams = new(converter.Options.SourceIccProfile, toPcs: true); ConversionParams targetParams = new(converter.Options.TargetIccProfile, toPcs: false); - ColorProfileConverter pcsConverter = new(new() + ColorProfileConverter pcsConverter = new(new ColorConversionOptions { MemoryAllocator = converter.Options.MemoryAllocator, - SourceWhitePoint = new(converter.Options.SourceIccProfile.Header.PcsIlluminant), - TargetWhitePoint = new(converter.Options.TargetIccProfile.Header.PcsIlluminant), + SourceWhitePoint = new CieXyz(converter.Options.SourceIccProfile.Header.PcsIlluminant), + TargetWhitePoint = new CieXyz(converter.Options.TargetIccProfile.Header.PcsIlluminant), }); // Normalize the source, then convert to the PCS space. @@ -101,11 +101,11 @@ internal static class ColorProfileConverterExtensionsIcc ConversionParams sourceParams = new(converter.Options.SourceIccProfile, toPcs: true); ConversionParams targetParams = new(converter.Options.TargetIccProfile, toPcs: false); - ColorProfileConverter pcsConverter = new(new() + ColorProfileConverter pcsConverter = new(new ColorConversionOptions { MemoryAllocator = converter.Options.MemoryAllocator, - SourceWhitePoint = new(converter.Options.SourceIccProfile.Header.PcsIlluminant), - TargetWhitePoint = new(converter.Options.TargetIccProfile.Header.PcsIlluminant), + SourceWhitePoint = new CieXyz(converter.Options.SourceIccProfile.Header.PcsIlluminant), + TargetWhitePoint = new CieXyz(converter.Options.TargetIccProfile.Header.PcsIlluminant), }); using IMemoryOwner pcsBuffer = converter.Options.MemoryAllocator.Allocate(source.Length); @@ -355,7 +355,7 @@ internal static class ColorProfileConverterExtensionsIcc vector = Vector3.Max(vector, Vector3.Zero); } - xyz = new(AdjustPcsFromV2BlackPoint(vector)); + xyz = new CieXyz(AdjustPcsFromV2BlackPoint(vector)); } // when converting from PCS to device with v2 perceptual intent @@ -371,7 +371,7 @@ internal static class ColorProfileConverterExtensionsIcc vector = Vector3.Max(vector, Vector3.Zero); } - xyz = new(vector); + xyz = new CieXyz(vector); } switch (targetParams.PcsType) diff --git a/src/ImageSharp/ColorProfiles/Hsl.cs b/src/ImageSharp/ColorProfiles/Hsl.cs index 2735b5513..7a9365fb7 100644 --- a/src/ImageSharp/ColorProfiles/Hsl.cs +++ b/src/ImageSharp/ColorProfiles/Hsl.cs @@ -24,7 +24,7 @@ public readonly struct Hsl : IColorProfile /// The l value (lightness) component. [MethodImpl(MethodImplOptions.AggressiveInlining)] public Hsl(float h, float s, float l) - : this(new(h, s, l)) + : this(new Vector3(h, s, l)) { } @@ -141,7 +141,7 @@ public readonly struct Hsl : IColorProfile if (MathF.Abs(chroma) < Constants.Epsilon) { - return new(0F, s, l); + return new Hsl(0F, s, l); } if (MathF.Abs(r - max) < Constants.Epsilon) @@ -172,7 +172,7 @@ public readonly struct Hsl : IColorProfile s = chroma / (2F - max - min); } - return new(h, s, l); + return new Hsl(h, s, l); } /// @@ -213,7 +213,7 @@ public readonly struct Hsl : IColorProfile } } - return new(r, g, b); + return new Rgb(r, g, b); } /// diff --git a/src/ImageSharp/ColorProfiles/Hsv.cs b/src/ImageSharp/ColorProfiles/Hsv.cs index d29b3023e..1e013fe1f 100644 --- a/src/ImageSharp/ColorProfiles/Hsv.cs +++ b/src/ImageSharp/ColorProfiles/Hsv.cs @@ -24,7 +24,7 @@ public readonly struct Hsv : IColorProfile /// The v value (brightness) component. [MethodImpl(MethodImplOptions.AggressiveInlining)] public Hsv(float h, float s, float v) - : this(new(h, s, v)) + : this(new Vector3(h, s, v)) { } @@ -139,7 +139,7 @@ public readonly struct Hsv : IColorProfile if (MathF.Abs(chroma) < Constants.Epsilon) { - return new(0, s, v); + return new Hsv(0, s, v); } if (MathF.Abs(r - max) < Constants.Epsilon) @@ -163,7 +163,7 @@ public readonly struct Hsv : IColorProfile s = chroma / v; - return new(h, s, v); + return new Hsv(h, s, v); } /// @@ -185,7 +185,7 @@ public readonly struct Hsv : IColorProfile if (MathF.Abs(s) < Constants.Epsilon) { - return new(v, v, v); + return new Rgb(v, v, v); } float h = (MathF.Abs(this.H - 360) < Constants.Epsilon) ? 0 : this.H / 60; @@ -236,7 +236,7 @@ public readonly struct Hsv : IColorProfile break; } - return new(r, g, b); + return new Rgb(r, g, b); } /// diff --git a/src/ImageSharp/ColorProfiles/HunterLab.cs b/src/ImageSharp/ColorProfiles/HunterLab.cs index 341360b12..e978c6de2 100644 --- a/src/ImageSharp/ColorProfiles/HunterLab.cs +++ b/src/ImageSharp/ColorProfiles/HunterLab.cs @@ -87,7 +87,7 @@ public readonly struct HunterLab : IColorProfile v3 += this.AsVector3Unsafe(); v3 += new Vector3(0, 128F, 128F); v3 /= new Vector3(100F, 255F, 255F); - return new(v3, 1F); + return new Vector4(v3, 1F); } /// @@ -96,7 +96,7 @@ public readonly struct HunterLab : IColorProfile Vector3 v3 = source.AsVector3(); v3 *= new Vector3(100F, 255, 255); v3 -= new Vector3(0, 128F, 128F); - return new(v3); + return new HunterLab(v3); } /// @@ -151,7 +151,7 @@ public readonly struct HunterLab : IColorProfile b = 0; } - return new(l, a, b); + return new HunterLab(l, a, b); } /// @@ -184,7 +184,7 @@ public readonly struct HunterLab : IColorProfile float x = (((a / ka) * sqrtPow) + pow) * xn; float z = (((b / kb) * sqrtPow) - pow) * (-zn); - return new(x, y, z); + return new CieXyz(x, y, z); } /// diff --git a/src/ImageSharp/ColorProfiles/Icc/Calculators/ColorTrcCalculator.cs b/src/ImageSharp/ColorProfiles/Icc/Calculators/ColorTrcCalculator.cs index e5d95d513..01c66881a 100644 --- a/src/ImageSharp/ColorProfiles/Icc/Calculators/ColorTrcCalculator.cs +++ b/src/ImageSharp/ColorProfiles/Icc/Calculators/ColorTrcCalculator.cs @@ -23,12 +23,12 @@ internal class ColorTrcCalculator : IVector4Calculator bool toPcs) { this.toPcs = toPcs; - this.curveCalculator = new([redTrc, greenTrc, blueTrc], !toPcs); + this.curveCalculator = new TrcCalculator([redTrc, greenTrc, blueTrc], !toPcs); Vector3 mr = redMatrixColumn.Data[0]; Vector3 mg = greenMatrixColumn.Data[0]; Vector3 mb = blueMatrixColumn.Data[0]; - this.matrix = new(mr.X, mr.Y, mr.Z, 0, mg.X, mg.Y, mg.Z, 0, mb.X, mb.Y, mb.Z, 0, 0, 0, 0, 1); + this.matrix = new Matrix4x4(mr.X, mr.Y, mr.Z, 0, mg.X, mg.Y, mg.Z, 0, mb.X, mb.Y, mb.Z, 0, 0, 0, 0, 1); if (!toPcs) { @@ -58,7 +58,7 @@ internal class ColorTrcCalculator : IVector4Calculator // when data to PCS, upstream process provides scaled XYZ // but input to calculator is descaled XYZ // (see DemoMaxICC IccCmm.cpp : CIccXformMatrixTRC::Apply) - xyz = new(CieXyz.FromScaledVector4(xyz).AsVector3Unsafe(), 1); + xyz = new Vector4(CieXyz.FromScaledVector4(xyz).AsVector3Unsafe(), 1); return this.curveCalculator.Calculate(xyz); } } diff --git a/src/ImageSharp/ColorProfiles/Icc/Calculators/CurveCalculator.cs b/src/ImageSharp/ColorProfiles/Icc/Calculators/CurveCalculator.cs index 9c7a18ae8..c39eaf958 100644 --- a/src/ImageSharp/ColorProfiles/Icc/Calculators/CurveCalculator.cs +++ b/src/ImageSharp/ColorProfiles/Icc/Calculators/CurveCalculator.cs @@ -31,7 +31,7 @@ internal partial class CurveCalculator : ISingleCalculator } else { - this.lutCalculator = new(entry.CurveData, inverted); + this.lutCalculator = new LutCalculator(entry.CurveData, inverted); this.type = CalculationType.Lut; } } diff --git a/src/ImageSharp/ColorProfiles/Icc/Calculators/GrayTrcCalculator.cs b/src/ImageSharp/ColorProfiles/Icc/Calculators/GrayTrcCalculator.cs index f39f4da52..8d823c1e9 100644 --- a/src/ImageSharp/ColorProfiles/Icc/Calculators/GrayTrcCalculator.cs +++ b/src/ImageSharp/ColorProfiles/Icc/Calculators/GrayTrcCalculator.cs @@ -12,7 +12,7 @@ internal class GrayTrcCalculator : IVector4Calculator private readonly TrcCalculator calculator; public GrayTrcCalculator(IccTagDataEntry grayTrc, bool toPcs) - => this.calculator = new(new IccTagDataEntry[] { grayTrc }, !toPcs); + => this.calculator = new TrcCalculator(new IccTagDataEntry[] { grayTrc }, !toPcs); [MethodImpl(MethodImplOptions.AggressiveInlining)] public Vector4 Calculate(Vector4 value) => this.calculator.Calculate(value); diff --git a/src/ImageSharp/ColorProfiles/Icc/Calculators/LutABCalculator.cs b/src/ImageSharp/ColorProfiles/Icc/Calculators/LutABCalculator.cs index e0d1ad8d4..172d80639 100644 --- a/src/ImageSharp/ColorProfiles/Icc/Calculators/LutABCalculator.cs +++ b/src/ImageSharp/ColorProfiles/Icc/Calculators/LutABCalculator.cs @@ -109,27 +109,27 @@ internal partial class LutABCalculator : IVector4Calculator if (hasACurve) { - this.curveACalculator = new(curveA, false); + this.curveACalculator = new TrcCalculator(curveA, false); } if (hasBCurve) { - this.curveBCalculator = new(curveB, false); + this.curveBCalculator = new TrcCalculator(curveB, false); } if (hasMCurve) { - this.curveMCalculator = new(curveM, false); + this.curveMCalculator = new TrcCalculator(curveM, false); } if (hasMatrix) { - this.matrixCalculator = new(matrix3x3.Value, matrix3x1.Value); + this.matrixCalculator = new MatrixCalculator(matrix3x3.Value, matrix3x1.Value); } if (hasClut) { - this.clutCalculator = new(clut); + this.clutCalculator = new ClutCalculator(clut); } } } diff --git a/src/ImageSharp/ColorProfiles/Icc/Calculators/LutEntryCalculator.cs b/src/ImageSharp/ColorProfiles/Icc/Calculators/LutEntryCalculator.cs index fbeae88f8..c97578ee3 100644 --- a/src/ImageSharp/ColorProfiles/Icc/Calculators/LutEntryCalculator.cs +++ b/src/ImageSharp/ColorProfiles/Icc/Calculators/LutEntryCalculator.cs @@ -61,7 +61,7 @@ internal class LutEntryCalculator : IVector4Calculator { this.inputCurve = InitLut(inputCurve); this.outputCurve = InitLut(outputCurve); - this.clutCalculator = new(clut); + this.clutCalculator = new ClutCalculator(clut); this.matrix = matrix; this.doTransform = !matrix.IsIdentity && inputCurve.Length == 3; @@ -72,7 +72,7 @@ internal class LutEntryCalculator : IVector4Calculator LutCalculator[] calculators = new LutCalculator[curves.Length]; for (int i = 0; i < curves.Length; i++) { - calculators[i] = new(curves[i].Values, false); + calculators[i] = new LutCalculator(curves[i].Values, false); } return calculators; diff --git a/src/ImageSharp/ColorProfiles/Icc/Calculators/MatrixCalculator.cs b/src/ImageSharp/ColorProfiles/Icc/Calculators/MatrixCalculator.cs index 5eade1fc8..6be1fdbf9 100644 --- a/src/ImageSharp/ColorProfiles/Icc/Calculators/MatrixCalculator.cs +++ b/src/ImageSharp/ColorProfiles/Icc/Calculators/MatrixCalculator.cs @@ -14,7 +14,7 @@ internal class MatrixCalculator : IVector4Calculator public MatrixCalculator(Matrix4x4 matrix3x3, Vector3 matrix3x1) { this.matrix2D = matrix3x3; - this.matrix1D = new(matrix3x1, 0); + this.matrix1D = new Vector4(matrix3x1, 0); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp/ColorProfiles/Icc/CompactSrgbV4Profile.cs b/src/ImageSharp/ColorProfiles/Icc/CompactSrgbV4Profile.cs index f0ee4ba58..29e30b53e 100644 --- a/src/ImageSharp/ColorProfiles/Icc/CompactSrgbV4Profile.cs +++ b/src/ImageSharp/ColorProfiles/Icc/CompactSrgbV4Profile.cs @@ -37,6 +37,6 @@ internal static class CompactSrgbV4Profile { byte[] buffer = new byte[Data.Length]; Data.CopyTo(buffer); - return new(buffer); + return new IccProfile(buffer); } } diff --git a/src/ImageSharp/ColorProfiles/Icc/IccConverterbase.Conversions.cs b/src/ImageSharp/ColorProfiles/Icc/IccConverterbase.Conversions.cs index 917be020b..20df08e37 100644 --- a/src/ImageSharp/ColorProfiles/Icc/IccConverterbase.Conversions.cs +++ b/src/ImageSharp/ColorProfiles/Icc/IccConverterbase.Conversions.cs @@ -91,7 +91,7 @@ internal abstract partial class IccConverterBase throw new InvalidIccProfileException("Missing matrix column or channel."); } - return new( + return new ColorTrcCalculator( redMatrixColumn, greenMatrixColumn, blueMatrixColumn, @@ -104,6 +104,6 @@ internal abstract partial class IccConverterBase private static GrayTrcCalculator InitGrayTrc(IccProfile profile, bool toPcs) { IccTagDataEntry entry = GetTag(profile, IccProfileTag.GrayTrc); - return new(entry, toPcs); + return new GrayTrcCalculator(entry, toPcs); } } diff --git a/src/ImageSharp/ColorProfiles/KnownChromaticAdaptationMatrices.cs b/src/ImageSharp/ColorProfiles/KnownChromaticAdaptationMatrices.cs index a5486580f..71d565f87 100644 --- a/src/ImageSharp/ColorProfiles/KnownChromaticAdaptationMatrices.cs +++ b/src/ImageSharp/ColorProfiles/KnownChromaticAdaptationMatrices.cs @@ -24,7 +24,7 @@ public static class KnownChromaticAdaptationMatrices /// von Kries chromatic adaptation transform matrix (Hunt-Pointer-Estevez adjusted for D65) /// public static readonly Matrix4x4 VonKriesHPEAdjusted - = Matrix4x4.Transpose(new() + = Matrix4x4.Transpose(new Matrix4x4 { M11 = 0.40024F, M12 = 0.7076F, @@ -42,7 +42,7 @@ public static class KnownChromaticAdaptationMatrices /// von Kries chromatic adaptation transform matrix (Hunt-Pointer-Estevez for equal energy) /// public static readonly Matrix4x4 VonKriesHPE - = Matrix4x4.Transpose(new() + = Matrix4x4.Transpose(new Matrix4x4 { M11 = 0.3897F, M12 = 0.6890F, @@ -65,7 +65,7 @@ public static class KnownChromaticAdaptationMatrices /// Bradford chromatic adaptation transform matrix (used in CMCCAT97) /// public static readonly Matrix4x4 Bradford - = Matrix4x4.Transpose(new() + = Matrix4x4.Transpose(new Matrix4x4 { M11 = 0.8951F, M12 = 0.2664F, @@ -83,7 +83,7 @@ public static class KnownChromaticAdaptationMatrices /// Spectral sharpening and the Bradford transform /// public static readonly Matrix4x4 BradfordSharp - = Matrix4x4.Transpose(new() + = Matrix4x4.Transpose(new Matrix4x4 { M11 = 1.2694F, M12 = -0.0988F, @@ -101,7 +101,7 @@ public static class KnownChromaticAdaptationMatrices /// CMCCAT2000 (fitted from all available color data sets) /// public static readonly Matrix4x4 CMCCAT2000 - = Matrix4x4.Transpose(new() + = Matrix4x4.Transpose(new Matrix4x4 { M11 = 0.7982F, M12 = 0.3389F, @@ -119,7 +119,7 @@ public static class KnownChromaticAdaptationMatrices /// CAT02 (optimized for minimizing CIELAB differences) /// public static readonly Matrix4x4 CAT02 - = Matrix4x4.Transpose(new() + = Matrix4x4.Transpose(new Matrix4x4 { M11 = 0.7328F, M12 = 0.4296F, diff --git a/src/ImageSharp/ColorProfiles/KnownRgbWorkingSpaces.cs b/src/ImageSharp/ColorProfiles/KnownRgbWorkingSpaces.cs index 1c5f1664c..916383936 100644 --- a/src/ImageSharp/ColorProfiles/KnownRgbWorkingSpaces.cs +++ b/src/ImageSharp/ColorProfiles/KnownRgbWorkingSpaces.cs @@ -18,96 +18,96 @@ public static class KnownRgbWorkingSpaces /// Uses proper companding function, according to: /// /// - public static readonly RgbWorkingSpace SRgb = new SRgbWorkingSpace(KnownIlluminants.D65, new(new(0.6400F, 0.3300F), new(0.3000F, 0.6000F), new(0.1500F, 0.0600F))); + public static readonly RgbWorkingSpace SRgb = new SRgbWorkingSpace(KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6400F, 0.3300F), new CieXyChromaticityCoordinates(0.3000F, 0.6000F), new CieXyChromaticityCoordinates(0.1500F, 0.0600F))); /// /// Simplified sRgb working space (uses gamma companding instead of ). /// See also . /// - public static readonly RgbWorkingSpace SRgbSimplified = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new(new(0.6400F, 0.3300F), new(0.3000F, 0.6000F), new(0.1500F, 0.0600F))); + public static readonly RgbWorkingSpace SRgbSimplified = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6400F, 0.3300F), new CieXyChromaticityCoordinates(0.3000F, 0.6000F), new CieXyChromaticityCoordinates(0.1500F, 0.0600F))); /// /// Rec. 709 (ITU-R Recommendation BT.709) working space. /// - public static readonly RgbWorkingSpace Rec709 = new Rec709WorkingSpace(KnownIlluminants.D65, new(new(0.64F, 0.33F), new(0.30F, 0.60F), new(0.15F, 0.06F))); + public static readonly RgbWorkingSpace Rec709 = new Rec709WorkingSpace(KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.64F, 0.33F), new CieXyChromaticityCoordinates(0.30F, 0.60F), new CieXyChromaticityCoordinates(0.15F, 0.06F))); /// /// Rec. 2020 (ITU-R Recommendation BT.2020F) working space. /// - public static readonly RgbWorkingSpace Rec2020 = new Rec2020WorkingSpace(KnownIlluminants.D65, new(new(0.708F, 0.292F), new(0.170F, 0.797F), new(0.131F, 0.046F))); + public static readonly RgbWorkingSpace Rec2020 = new Rec2020WorkingSpace(KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.708F, 0.292F), new CieXyChromaticityCoordinates(0.170F, 0.797F), new CieXyChromaticityCoordinates(0.131F, 0.046F))); /// /// ECI Rgb v2 working space. /// - public static readonly RgbWorkingSpace ECIRgbv2 = new LWorkingSpace(KnownIlluminants.D50, new(new(0.6700F, 0.3300F), new(0.2100F, 0.7100F), new(0.1400F, 0.0800F))); + public static readonly RgbWorkingSpace ECIRgbv2 = new LWorkingSpace(KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6700F, 0.3300F), new CieXyChromaticityCoordinates(0.2100F, 0.7100F), new CieXyChromaticityCoordinates(0.1400F, 0.0800F))); /// /// Adobe Rgb (1998) working space. /// - public static readonly RgbWorkingSpace AdobeRgb1998 = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new(new(0.6400F, 0.3300F), new(0.2100F, 0.7100F), new(0.1500F, 0.0600F))); + public static readonly RgbWorkingSpace AdobeRgb1998 = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6400F, 0.3300F), new CieXyChromaticityCoordinates(0.2100F, 0.7100F), new CieXyChromaticityCoordinates(0.1500F, 0.0600F))); /// /// Apple sRgb working space. /// - public static readonly RgbWorkingSpace ApplesRgb = new GammaWorkingSpace(1.8F, KnownIlluminants.D65, new(new(0.6250F, 0.3400F), new(0.2800F, 0.5950F), new(0.1550F, 0.0700F))); + public static readonly RgbWorkingSpace ApplesRgb = new GammaWorkingSpace(1.8F, KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6250F, 0.3400F), new CieXyChromaticityCoordinates(0.2800F, 0.5950F), new CieXyChromaticityCoordinates(0.1550F, 0.0700F))); /// /// Best Rgb working space. /// - public static readonly RgbWorkingSpace BestRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new(new(0.7347F, 0.2653F), new(0.2150F, 0.7750F), new(0.1300F, 0.0350F))); + public static readonly RgbWorkingSpace BestRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.7347F, 0.2653F), new CieXyChromaticityCoordinates(0.2150F, 0.7750F), new CieXyChromaticityCoordinates(0.1300F, 0.0350F))); /// /// Beta Rgb working space. /// - public static readonly RgbWorkingSpace BetaRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new(new(0.6888F, 0.3112F), new(0.1986F, 0.7551F), new(0.1265F, 0.0352F))); + public static readonly RgbWorkingSpace BetaRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6888F, 0.3112F), new CieXyChromaticityCoordinates(0.1986F, 0.7551F), new CieXyChromaticityCoordinates(0.1265F, 0.0352F))); /// /// Bruce Rgb working space. /// - public static readonly RgbWorkingSpace BruceRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new(new(0.6400F, 0.3300F), new(0.2800F, 0.6500F), new(0.1500F, 0.0600F))); + public static readonly RgbWorkingSpace BruceRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6400F, 0.3300F), new CieXyChromaticityCoordinates(0.2800F, 0.6500F), new CieXyChromaticityCoordinates(0.1500F, 0.0600F))); /// /// CIE Rgb working space. /// - public static readonly RgbWorkingSpace CIERgb = new GammaWorkingSpace(2.2F, KnownIlluminants.E, new(new(0.7350F, 0.2650F), new(0.2740F, 0.7170F), new(0.1670F, 0.0090F))); + public static readonly RgbWorkingSpace CIERgb = new GammaWorkingSpace(2.2F, KnownIlluminants.E, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.7350F, 0.2650F), new CieXyChromaticityCoordinates(0.2740F, 0.7170F), new CieXyChromaticityCoordinates(0.1670F, 0.0090F))); /// /// ColorMatch Rgb working space. /// - public static readonly RgbWorkingSpace ColorMatchRgb = new GammaWorkingSpace(1.8F, KnownIlluminants.D50, new(new(0.6300F, 0.3400F), new(0.2950F, 0.6050F), new(0.1500F, 0.0750F))); + public static readonly RgbWorkingSpace ColorMatchRgb = new GammaWorkingSpace(1.8F, KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6300F, 0.3400F), new CieXyChromaticityCoordinates(0.2950F, 0.6050F), new CieXyChromaticityCoordinates(0.1500F, 0.0750F))); /// /// Don Rgb 4 working space. /// - public static readonly RgbWorkingSpace DonRgb4 = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new(new(0.6960F, 0.3000F), new(0.2150F, 0.7650F), new(0.1300F, 0.0350F))); + public static readonly RgbWorkingSpace DonRgb4 = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6960F, 0.3000F), new CieXyChromaticityCoordinates(0.2150F, 0.7650F), new CieXyChromaticityCoordinates(0.1300F, 0.0350F))); /// /// Ekta Space PS5 working space. /// - public static readonly RgbWorkingSpace EktaSpacePS5 = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new(new(0.6950F, 0.3050F), new(0.2600F, 0.7000F), new(0.1100F, 0.0050F))); + public static readonly RgbWorkingSpace EktaSpacePS5 = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6950F, 0.3050F), new CieXyChromaticityCoordinates(0.2600F, 0.7000F), new CieXyChromaticityCoordinates(0.1100F, 0.0050F))); /// /// NTSC Rgb working space. /// - public static readonly RgbWorkingSpace NTSCRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.C, new(new(0.6700F, 0.3300F), new(0.2100F, 0.7100F), new(0.1400F, 0.0800F))); + public static readonly RgbWorkingSpace NTSCRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.C, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6700F, 0.3300F), new CieXyChromaticityCoordinates(0.2100F, 0.7100F), new CieXyChromaticityCoordinates(0.1400F, 0.0800F))); /// /// PAL/SECAM Rgb working space. /// - public static readonly RgbWorkingSpace PALSECAMRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new(new(0.6400F, 0.3300F), new(0.2900F, 0.6000F), new(0.1500F, 0.0600F))); + public static readonly RgbWorkingSpace PALSECAMRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6400F, 0.3300F), new CieXyChromaticityCoordinates(0.2900F, 0.6000F), new CieXyChromaticityCoordinates(0.1500F, 0.0600F))); /// /// ProPhoto Rgb working space. /// - public static readonly RgbWorkingSpace ProPhotoRgb = new GammaWorkingSpace(1.8F, KnownIlluminants.D50, new(new(0.7347F, 0.2653F), new(0.1596F, 0.8404F), new(0.0366F, 0.0001F))); + public static readonly RgbWorkingSpace ProPhotoRgb = new GammaWorkingSpace(1.8F, KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.7347F, 0.2653F), new CieXyChromaticityCoordinates(0.1596F, 0.8404F), new CieXyChromaticityCoordinates(0.0366F, 0.0001F))); /// /// SMPTE-C Rgb working space. /// - public static readonly RgbWorkingSpace SMPTECRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new(new(0.6300F, 0.3400F), new(0.3100F, 0.5950F), new(0.1550F, 0.0700F))); + public static readonly RgbWorkingSpace SMPTECRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6300F, 0.3400F), new CieXyChromaticityCoordinates(0.3100F, 0.5950F), new CieXyChromaticityCoordinates(0.1550F, 0.0700F))); /// /// Wide Gamut Rgb working space. /// - public static readonly RgbWorkingSpace WideGamutRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new(new(0.7350F, 0.2650F), new(0.1150F, 0.8260F), new(0.1570F, 0.0180F))); + public static readonly RgbWorkingSpace WideGamutRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.7350F, 0.2650F), new CieXyChromaticityCoordinates(0.1150F, 0.8260F), new CieXyChromaticityCoordinates(0.1570F, 0.0180F))); } diff --git a/src/ImageSharp/ColorProfiles/KnownYCbCrMatrices.cs b/src/ImageSharp/ColorProfiles/KnownYCbCrMatrices.cs index b838f9ddc..d32833a38 100644 --- a/src/ImageSharp/ColorProfiles/KnownYCbCrMatrices.cs +++ b/src/ImageSharp/ColorProfiles/KnownYCbCrMatrices.cs @@ -16,47 +16,47 @@ public static class KnownYCbCrMatrices /// ITU-R BT.601 (SD video standard). /// public static readonly YCbCrTransform BT601 = new( - new( + new Matrix4x4( 0.299000F, 0.587000F, 0.114000F, 0F, -0.168736F, -0.331264F, 0.500000F, 0F, 0.500000F, -0.418688F, -0.081312F, 0F, 0F, 0F, 0F, 1F), - new( + new Matrix4x4( 1.000000F, 0.000000F, 1.402000F, 0F, 1.000000F, -0.344136F, -0.714136F, 0F, 1.000000F, 1.772000F, 0.000000F, 0F, 0F, 0F, 0F, 1F), - new(0F, 0.5F, 0.5F)); + new Vector3(0F, 0.5F, 0.5F)); /// /// ITU-R BT.709 (HD video, sRGB standard). /// public static readonly YCbCrTransform BT709 = new( - new( + new Matrix4x4( 0.212600F, 0.715200F, 0.072200F, 0F, -0.114572F, -0.385428F, 0.500000F, 0F, 0.500000F, -0.454153F, -0.045847F, 0F, 0F, 0F, 0F, 1F), - new( + new Matrix4x4( 1.000000F, 0.000000F, 1.574800F, 0F, 1.000000F, -0.187324F, -0.468124F, 0F, 1.000000F, 1.855600F, 0.000000F, 0F, 0F, 0F, 0F, 1F), - new(0F, 0.5F, 0.5F)); + new Vector3(0F, 0.5F, 0.5F)); /// /// ITU-R BT.2020 (UHD/4K video standard). /// public static readonly YCbCrTransform BT2020 = new( - new( + new Matrix4x4( 0.262700F, 0.678000F, 0.059300F, 0F, -0.139630F, -0.360370F, 0.500000F, 0F, 0.500000F, -0.459786F, -0.040214F, 0F, 0F, 0F, 0F, 1F), - new( + new Matrix4x4( 1.000000F, 0.000000F, 1.474600F, 0F, 1.000000F, -0.164553F, -0.571353F, 0F, 1.000000F, 1.881400F, 0.000000F, 0F, 0F, 0F, 0F, 1F), - new(0F, 0.5F, 0.5F)); + new Vector3(0F, 0.5F, 0.5F)); } diff --git a/src/ImageSharp/ColorProfiles/Lms.cs b/src/ImageSharp/ColorProfiles/Lms.cs index 86cb7956b..3aa3d7255 100644 --- a/src/ImageSharp/ColorProfiles/Lms.cs +++ b/src/ImageSharp/ColorProfiles/Lms.cs @@ -89,7 +89,7 @@ public readonly struct Lms : IColorProfile v3 += this.AsVector3Unsafe(); v3 += new Vector3(1F); v3 /= 2F; - return new(v3, 1F); + return new Vector4(v3, 1F); } /// @@ -98,7 +98,7 @@ public readonly struct Lms : IColorProfile Vector3 v3 = source.AsVector3(); v3 *= 2F; v3 -= new Vector3(1F); - return new(v3); + return new Lms(v3); } /// diff --git a/src/ImageSharp/ColorProfiles/Rgb.cs b/src/ImageSharp/ColorProfiles/Rgb.cs index 4d7788fcf..42e502592 100644 --- a/src/ImageSharp/ColorProfiles/Rgb.cs +++ b/src/ImageSharp/ColorProfiles/Rgb.cs @@ -154,7 +154,7 @@ public readonly struct Rgb : IProfileConnectingSpace Rgb linear = FromScaledVector4(options.SourceRgbWorkingSpace.Expand(this.ToScaledVector4())); // Then convert to xyz - return new(Vector3.Transform(linear.AsVector3Unsafe(), GetRgbToCieXyzMatrix(options.SourceRgbWorkingSpace))); + return new CieXyz(Vector3.Transform(linear.AsVector3Unsafe(), GetRgbToCieXyzMatrix(options.SourceRgbWorkingSpace))); } /// @@ -171,7 +171,7 @@ public readonly struct Rgb : IProfileConnectingSpace Rgb linear = FromScaledVector4(options.SourceRgbWorkingSpace.Expand(rgb.ToScaledVector4())); // Then convert to xyz - destination[i] = new(Vector3.Transform(linear.AsVector3Unsafe(), matrix)); + destination[i] = new CieXyz(Vector3.Transform(linear.AsVector3Unsafe(), matrix)); } } @@ -274,7 +274,7 @@ public readonly struct Rgb : IProfileConnectingSpace Vector3 vector = Vector3.Transform(workingSpace.WhitePoint.AsVector3Unsafe(), inverseXyzMatrix); // Use transposed Rows/Columns - return new() + return new Matrix4x4 { M11 = vector.X * mXr, M21 = vector.Y * mXg, diff --git a/src/ImageSharp/ColorProfiles/VonKriesChromaticAdaptation.cs b/src/ImageSharp/ColorProfiles/VonKriesChromaticAdaptation.cs index 6f06ccf27..25604001f 100644 --- a/src/ImageSharp/ColorProfiles/VonKriesChromaticAdaptation.cs +++ b/src/ImageSharp/ColorProfiles/VonKriesChromaticAdaptation.cs @@ -31,7 +31,7 @@ public static class VonKriesChromaticAdaptation if (from.Equals(to)) { - return new(source.X, source.Y, source.Z); + return new CieXyz(source.X, source.Y, source.Z); } Vector3 sourceColorLms = Vector3.Transform(source.AsVector3Unsafe(), matrix); @@ -42,7 +42,7 @@ public static class VonKriesChromaticAdaptation Vector3 targetColorLms = Vector3.Multiply(vector, sourceColorLms); Matrix4x4.Invert(matrix, out Matrix4x4 inverseMatrix); - return new(Vector3.Transform(targetColorLms, inverseMatrix)); + return new CieXyz(Vector3.Transform(targetColorLms, inverseMatrix)); } /// @@ -89,7 +89,7 @@ public static class VonKriesChromaticAdaptation Vector3 sourceColorLms = Vector3.Transform(sp.AsVector3Unsafe(), matrix); Vector3 targetColorLms = Vector3.Multiply(vector, sourceColorLms); - dp = new(Vector3.Transform(targetColorLms, inverseMatrix)); + dp = new CieXyz(Vector3.Transform(targetColorLms, inverseMatrix)); } } } diff --git a/src/ImageSharp/ColorProfiles/Y.cs b/src/ImageSharp/ColorProfiles/Y.cs index 62cef7814..2be34fc31 100644 --- a/src/ImageSharp/ColorProfiles/Y.cs +++ b/src/ImageSharp/ColorProfiles/Y.cs @@ -92,7 +92,7 @@ public readonly struct Y : IColorProfile { Matrix4x4 m = options.YCbCrTransform.Forward; float offset = options.YCbCrTransform.Offset.X; - return new(Vector3.Dot(source.AsVector3Unsafe(), new(m.M11, m.M12, m.M13)) + offset); + return new Y(Vector3.Dot(source.AsVector3Unsafe(), new Vector3(m.M11, m.M12, m.M13)) + offset); } /// diff --git a/src/ImageSharp/ColorProfiles/YCbCr.cs b/src/ImageSharp/ColorProfiles/YCbCr.cs index e112ef799..22d629373 100644 --- a/src/ImageSharp/ColorProfiles/YCbCr.cs +++ b/src/ImageSharp/ColorProfiles/YCbCr.cs @@ -24,7 +24,7 @@ public readonly struct YCbCr : IColorProfile /// The cr chroma component. [MethodImpl(MethodImplOptions.AggressiveInlining)] public YCbCr(float y, float cb, float cr) - : this(new(y, cb, cr)) + : this(new Vector3(y, cb, cr)) { } @@ -95,7 +95,7 @@ public readonly struct YCbCr : IColorProfile { Vector3 v3 = default; v3 += this.AsVector3Unsafe(); - return new(v3, 1F); + return new Vector4(v3, 1F); } /// @@ -133,7 +133,7 @@ public readonly struct YCbCr : IColorProfile Matrix4x4 m = options.TransposedYCbCrTransform.Forward; Vector3 offset = options.TransposedYCbCrTransform.Offset; - return new(Vector3.Transform(rgb, m) + offset, true); + return new YCbCr(Vector3.Transform(rgb, m) + offset, true); } /// diff --git a/src/ImageSharp/ColorProfiles/YccK.cs b/src/ImageSharp/ColorProfiles/YccK.cs index d0966a6d1..df5eb4894 100644 --- a/src/ImageSharp/ColorProfiles/YccK.cs +++ b/src/ImageSharp/ColorProfiles/YccK.cs @@ -27,7 +27,7 @@ public readonly struct YccK : IColorProfile /// The keyline black component. [MethodImpl(MethodImplOptions.AggressiveInlining)] public YccK(float y, float cb, float cr, float k) - : this(new(y, cb, cr, k)) + : this(new Vector4(y, cb, cr, k)) { } @@ -149,11 +149,11 @@ public readonly struct YccK : IColorProfile if (k >= 1F - Constants.Epsilon) { - return new(new(0F, 0.5F, 0.5F, 1F), true); + return new YccK(new Vector4(0F, 0.5F, 0.5F, 1F), true); } rgb /= 1F - k; - return new(new Vector4(Vector3.Transform(rgb, m), k) + new Vector4(offset, 0F)); + return new YccK(new Vector4(Vector3.Transform(rgb, m), k) + new Vector4(offset, 0F)); } /// diff --git a/src/ImageSharp/Common/Extensions/ConfigurationExtensions.cs b/src/ImageSharp/Common/Extensions/ConfigurationExtensions.cs index c20c6e9c9..6ed83a0d8 100644 --- a/src/ImageSharp/Common/Extensions/ConfigurationExtensions.cs +++ b/src/ImageSharp/Common/Extensions/ConfigurationExtensions.cs @@ -14,6 +14,6 @@ internal static class ConfigurationExtensions /// public static ParallelOptions GetParallelOptions(this Configuration configuration) { - return new() { MaxDegreeOfParallelism = configuration.MaxDegreeOfParallelism }; + return new ParallelOptions { MaxDegreeOfParallelism = configuration.MaxDegreeOfParallelism }; } } diff --git a/src/ImageSharp/Common/Helpers/Numerics.cs b/src/ImageSharp/Common/Helpers/Numerics.cs index 0aa8e4a41..ff28063f0 100644 --- a/src/ImageSharp/Common/Helpers/Numerics.cs +++ b/src/ImageSharp/Common/Helpers/Numerics.cs @@ -656,7 +656,7 @@ internal static class Numerics return Sse.Shuffle(value.AsVector128(), value.AsVector128(), ShuffleAlphaControl).AsVector4(); } - return new(value.W); + return new Vector4(value.W); } /// diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs b/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs index 80bfa29ca..f471d0231 100644 --- a/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs +++ b/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs @@ -134,7 +134,7 @@ internal static partial class SimdUtils ref Rgba32 rgb = ref MemoryMarshal.GetReference(destination); nuint count = (uint)redChannel.Length / 4; - destination.Fill(new(0, 0, 0, 255)); + destination.Fill(new Rgba32(0, 0, 0, 255)); for (nuint i = 0; i < count; i++) { ref Rgba32 d0 = ref Unsafe.Add(ref rgb, i * 4); diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.cs b/src/ImageSharp/Common/Helpers/SimdUtils.cs index 883e18ae7..7f98c8375 100644 --- a/src/ImageSharp/Common/Helpers/SimdUtils.cs +++ b/src/ImageSharp/Common/Helpers/SimdUtils.cs @@ -29,7 +29,7 @@ internal static partial class SimdUtils [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static Vector4 PseudoRound(this Vector4 v) { - Vector4 sign = Numerics.Clamp(v, new(-1), new(1)); + Vector4 sign = Numerics.Clamp(v, new Vector4(-1), new Vector4(1)); return v + (sign * 0.5f); } diff --git a/src/ImageSharp/Common/Helpers/TolerantMath.cs b/src/ImageSharp/Common/Helpers/TolerantMath.cs index b4ed9ee2f..2c622d167 100644 --- a/src/ImageSharp/Common/Helpers/TolerantMath.cs +++ b/src/ImageSharp/Common/Helpers/TolerantMath.cs @@ -20,7 +20,7 @@ internal readonly struct TolerantMath /// It is a field so it can be passed as an 'in' parameter. /// Does not necessarily fit all use cases! /// - public static readonly TolerantMath Default = new TolerantMath(1e-8); + public static readonly TolerantMath Default = new(1e-8); public TolerantMath(double epsilon) { diff --git a/src/ImageSharp/Common/Helpers/UnitConverter.cs b/src/ImageSharp/Common/Helpers/UnitConverter.cs index c50766ec2..45dbe41cb 100644 --- a/src/ImageSharp/Common/Helpers/UnitConverter.cs +++ b/src/ImageSharp/Common/Helpers/UnitConverter.cs @@ -131,9 +131,9 @@ internal static class UnitConverter ushort exifUnit = (ushort)(unit + 1); if (unit == PixelResolutionUnit.AspectRatio) { - return new(exifUnit, null, null); + return new ExifResolutionValues(exifUnit, null, null); } - return new(exifUnit, horizontal, vertical); + return new ExifResolutionValues(exifUnit, horizontal, vertical); } } diff --git a/src/ImageSharp/Compression/Zlib/Deflater.cs b/src/ImageSharp/Compression/Zlib/Deflater.cs index 2e39d435d..f642ec85a 100644 --- a/src/ImageSharp/Compression/Zlib/Deflater.cs +++ b/src/ImageSharp/Compression/Zlib/Deflater.cs @@ -79,7 +79,7 @@ internal sealed class Deflater : IDisposable } // TODO: Possibly provide DeflateStrategy as an option. - this.engine = new(memoryAllocator, DeflateStrategy.Default); + this.engine = new DeflaterEngine(memoryAllocator, DeflateStrategy.Default); this.SetLevel(level); this.Reset(); diff --git a/src/ImageSharp/Compression/Zlib/DeflaterEngine.cs b/src/ImageSharp/Compression/Zlib/DeflaterEngine.cs index c9613610d..6009fdfbc 100644 --- a/src/ImageSharp/Compression/Zlib/DeflaterEngine.cs +++ b/src/ImageSharp/Compression/Zlib/DeflaterEngine.cs @@ -147,7 +147,7 @@ internal sealed unsafe class DeflaterEngine : IDisposable /// The deflate strategy to use. public DeflaterEngine(MemoryAllocator memoryAllocator, DeflateStrategy strategy) { - this.huffman = new(memoryAllocator); + this.huffman = new DeflaterHuffman(memoryAllocator); this.Pending = this.huffman.Pending; this.strategy = strategy; diff --git a/src/ImageSharp/Compression/Zlib/DeflaterHuffman.cs b/src/ImageSharp/Compression/Zlib/DeflaterHuffman.cs index a05320a09..e4dc1945a 100644 --- a/src/ImageSharp/Compression/Zlib/DeflaterHuffman.cs +++ b/src/ImageSharp/Compression/Zlib/DeflaterHuffman.cs @@ -58,11 +58,11 @@ internal sealed unsafe class DeflaterHuffman : IDisposable /// The memory allocator to use for buffer allocations. public DeflaterHuffman(MemoryAllocator memoryAllocator) { - this.Pending = new(memoryAllocator); + this.Pending = new DeflaterPendingBuffer(memoryAllocator); - this.literalTree = new(memoryAllocator, LiteralNumber, 257, 15); - this.distTree = new(memoryAllocator, DistanceNumber, 1, 15); - this.blTree = new(memoryAllocator, BitLengthNumber, 4, 7); + this.literalTree = new Tree(memoryAllocator, LiteralNumber, 257, 15); + this.distTree = new Tree(memoryAllocator, DistanceNumber, 1, 15); + this.blTree = new Tree(memoryAllocator, BitLengthNumber, 4, 7); this.distanceMemoryOwner = memoryAllocator.Allocate(BufferSize); this.distanceBufferHandle = this.distanceMemoryOwner.Memory.Pin(); diff --git a/src/ImageSharp/Compression/Zlib/DeflaterOutputStream.cs b/src/ImageSharp/Compression/Zlib/DeflaterOutputStream.cs index 76a5a045e..de818fd8f 100644 --- a/src/ImageSharp/Compression/Zlib/DeflaterOutputStream.cs +++ b/src/ImageSharp/Compression/Zlib/DeflaterOutputStream.cs @@ -30,7 +30,7 @@ internal sealed class DeflaterOutputStream : Stream this.rawStream = rawStream; this.memoryOwner = memoryAllocator.Allocate(BufferLength); this.buffer = this.memoryOwner.Memory; - this.deflater = new(memoryAllocator, compressionLevel); + this.deflater = new Deflater(memoryAllocator, compressionLevel); } /// diff --git a/src/ImageSharp/Compression/Zlib/ZlibDeflateStream.cs b/src/ImageSharp/Compression/Zlib/ZlibDeflateStream.cs index 936444406..2e52f84d7 100644 --- a/src/ImageSharp/Compression/Zlib/ZlibDeflateStream.cs +++ b/src/ImageSharp/Compression/Zlib/ZlibDeflateStream.cs @@ -101,7 +101,7 @@ internal sealed class ZlibDeflateStream : Stream this.rawStream.WriteByte(Cmf); this.rawStream.WriteByte((byte)flg); - this.deflateStream = new(memoryAllocator, this.rawStream, compressionLevel); + this.deflateStream = new DeflaterOutputStream(memoryAllocator, this.rawStream, compressionLevel); } /// diff --git a/src/ImageSharp/Compression/Zlib/ZlibInflateStream.cs b/src/ImageSharp/Compression/Zlib/ZlibInflateStream.cs index aa4beba18..1d743bf3a 100644 --- a/src/ImageSharp/Compression/Zlib/ZlibInflateStream.cs +++ b/src/ImageSharp/Compression/Zlib/ZlibInflateStream.cs @@ -270,7 +270,7 @@ internal sealed class ZlibInflateStream : Stream } // Initialize the deflate BufferedReadStream. - this.CompressedStream = new(this, CompressionMode.Decompress, true); + this.CompressedStream = new DeflateStream(this, CompressionMode.Decompress, true); return true; } diff --git a/src/ImageSharp/Configuration.cs b/src/ImageSharp/Configuration.cs index 1d9f3bb85..c2b02dedd 100644 --- a/src/ImageSharp/Configuration.cs +++ b/src/ImageSharp/Configuration.cs @@ -122,7 +122,7 @@ public sealed class Configuration /// /// Gets or the that is currently in use. /// - public ImageFormatManager ImageFormatsManager { get; private set; } = new ImageFormatManager(); + public ImageFormatManager ImageFormatsManager { get; private set; } = new(); /// /// Gets or sets the that is currently in use. diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoder.cs b/src/ImageSharp/Formats/Bmp/BmpDecoder.cs index da6556b36..d98f7bccb 100644 --- a/src/ImageSharp/Formats/Bmp/BmpDecoder.cs +++ b/src/ImageSharp/Formats/Bmp/BmpDecoder.cs @@ -25,7 +25,7 @@ public sealed class BmpDecoder : SpecializedImageDecoder Guard.NotNull(options, nameof(options)); Guard.NotNull(stream, nameof(stream)); - return new BmpDecoderCore(new() { GeneralOptions = options }).Identify(options.Configuration, stream, cancellationToken); + return new BmpDecoderCore(new BmpDecoderOptions { GeneralOptions = options }).Identify(options.Configuration, stream, cancellationToken); } /// diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs index acf69529a..17c1f545b 100644 --- a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs +++ b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs @@ -132,7 +132,7 @@ internal sealed class BmpDecoderCore : ImageDecoderCore { int bytesPerColorMapEntry = this.ReadImageHeaders(stream, out bool inverted, out byte[] palette); - image = new(this.configuration, this.infoHeader.Width, this.infoHeader.Height, this.metadata); + image = new Image(this.configuration, this.infoHeader.Width, this.infoHeader.Height, this.metadata); Buffer2D pixels = image.GetRootFramePixelBuffer(); @@ -220,7 +220,7 @@ internal sealed class BmpDecoderCore : ImageDecoderCore protected override ImageInfo Identify(BufferedReadStream stream, CancellationToken cancellationToken) { this.ReadImageHeaders(stream, out _, out _); - return new(new(this.infoHeader.Width, this.infoHeader.Height), this.metadata); + return new ImageInfo(new Size(this.infoHeader.Width, this.infoHeader.Height), this.metadata); } /// @@ -343,7 +343,7 @@ internal sealed class BmpDecoderCore : ImageDecoderCore RleSkippedPixelHandling.Transparent => TPixel.FromScaledVector4(Vector4.Zero), // Default handling for skipped pixels is black (which is what System.Drawing is also doing). - _ => TPixel.FromScaledVector4(new(0.0f, 0.0f, 0.0f, 1.0f)), + _ => TPixel.FromScaledVector4(new Vector4(0.0f, 0.0f, 0.0f, 1.0f)), }; } else @@ -404,7 +404,7 @@ internal sealed class BmpDecoderCore : ImageDecoderCore RleSkippedPixelHandling.Transparent => TPixel.FromScaledVector4(Vector4.Zero), // Default handling for skipped pixels is black (which is what System.Drawing is also doing). - _ => TPixel.FromScaledVector4(new(0.0f, 0.0f, 0.0f, 1.0f)), + _ => TPixel.FromScaledVector4(new Vector4(0.0f, 0.0f, 0.0f, 1.0f)), }; } else @@ -1270,7 +1270,7 @@ internal sealed class BmpDecoderCore : ImageDecoderCore byte g = (byte)((temp & greenMask) >> rightShiftGreenMask); byte b = (byte)((temp & blueMask) >> rightShiftBlueMask); byte a = alphaMask != 0 ? (byte)((temp & alphaMask) >> rightShiftAlphaMask) : byte.MaxValue; - pixelRow[x] = TPixel.FromRgba32(new(r, g, b, a)); + pixelRow[x] = TPixel.FromRgba32(new Rgba32(r, g, b, a)); } offset += 4; @@ -1332,7 +1332,7 @@ internal sealed class BmpDecoderCore : ImageDecoderCore long infoHeaderStart = stream.Position; // Resolution is stored in PPM. - this.metadata = new() + this.metadata = new ImageMetadata { ResolutionUnits = PixelResolutionUnit.PixelsPerMeter }; @@ -1426,7 +1426,7 @@ internal sealed class BmpDecoderCore : ImageDecoderCore byte[] iccProfileData = new byte[this.infoHeader.ProfileSize]; stream.Position = infoHeaderStart + this.infoHeader.ProfileData; stream.Read(iccProfileData); - this.metadata.IccProfile = new(iccProfileData); + this.metadata.IccProfile = new IccProfile(iccProfileData); stream.Position = streamPosition; } } @@ -1457,7 +1457,7 @@ internal sealed class BmpDecoderCore : ImageDecoderCore this.bmpMetadata.InfoHeaderType = infoHeaderType; this.bmpMetadata.BitsPerPixel = (BmpBitsPerPixel)bitsPerPixel; - this.Dimensions = new(this.infoHeader.Width, this.infoHeader.Height); + this.Dimensions = new Size(this.infoHeader.Width, this.infoHeader.Height); } /// diff --git a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs index ba9a0dc23..ccc620d6c 100644 --- a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs +++ b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs @@ -655,7 +655,7 @@ internal sealed class BmpEncoderCore CancellationToken cancellationToken) where TPixel : unmanaged, IPixel { - using IQuantizer frameQuantizer = this.quantizer.CreatePixelSpecificQuantizer(configuration, new() + using IQuantizer frameQuantizer = this.quantizer.CreatePixelSpecificQuantizer(configuration, new QuantizerOptions { MaxColors = 16, Dither = this.quantizer.Options.Dither, @@ -712,7 +712,7 @@ internal sealed class BmpEncoderCore CancellationToken cancellationToken) where TPixel : unmanaged, IPixel { - using IQuantizer frameQuantizer = this.quantizer.CreatePixelSpecificQuantizer(configuration, new() + using IQuantizer frameQuantizer = this.quantizer.CreatePixelSpecificQuantizer(configuration, new QuantizerOptions { MaxColors = 4, Dither = this.quantizer.Options.Dither, @@ -778,7 +778,7 @@ internal sealed class BmpEncoderCore CancellationToken cancellationToken) where TPixel : unmanaged, IPixel { - using IQuantizer frameQuantizer = this.quantizer.CreatePixelSpecificQuantizer(configuration, new() + using IQuantizer frameQuantizer = this.quantizer.CreatePixelSpecificQuantizer(configuration, new QuantizerOptions { MaxColors = 2, Dither = this.quantizer.Options.Dither, diff --git a/src/ImageSharp/Formats/Bmp/BmpFormat.cs b/src/ImageSharp/Formats/Bmp/BmpFormat.cs index a67b06cb8..5dec4a674 100644 --- a/src/ImageSharp/Formats/Bmp/BmpFormat.cs +++ b/src/ImageSharp/Formats/Bmp/BmpFormat.cs @@ -15,7 +15,7 @@ public sealed class BmpFormat : IImageFormat /// /// Gets the shared instance. /// - public static BmpFormat Instance { get; } = new BmpFormat(); + public static BmpFormat Instance { get; } = new(); /// public string Name => "BMP"; diff --git a/src/ImageSharp/Formats/Bmp/BmpMetadata.cs b/src/ImageSharp/Formats/Bmp/BmpMetadata.cs index 3514a7ed5..1dac74ba3 100644 --- a/src/ImageSharp/Formats/Bmp/BmpMetadata.cs +++ b/src/ImageSharp/Formats/Bmp/BmpMetadata.cs @@ -54,21 +54,21 @@ public class BmpMetadata : IFormatMetadata int bpp = metadata.PixelTypeInfo.BitsPerPixel; return bpp switch { - 1 => new() { BitsPerPixel = BmpBitsPerPixel.Bit1 }, - 2 => new() { BitsPerPixel = BmpBitsPerPixel.Bit2 }, - <= 4 => new() { BitsPerPixel = BmpBitsPerPixel.Bit4 }, - <= 8 => new() { BitsPerPixel = BmpBitsPerPixel.Bit8 }, - <= 16 => new() + 1 => new BmpMetadata { BitsPerPixel = BmpBitsPerPixel.Bit1 }, + 2 => new BmpMetadata { BitsPerPixel = BmpBitsPerPixel.Bit2 }, + <= 4 => new BmpMetadata { BitsPerPixel = BmpBitsPerPixel.Bit4 }, + <= 8 => new BmpMetadata { BitsPerPixel = BmpBitsPerPixel.Bit8 }, + <= 16 => new BmpMetadata { BitsPerPixel = BmpBitsPerPixel.Bit16, InfoHeaderType = BmpInfoHeaderType.WinVersion3 }, - <= 24 => new() + <= 24 => new BmpMetadata { BitsPerPixel = BmpBitsPerPixel.Bit24, InfoHeaderType = BmpInfoHeaderType.WinVersion4 }, - _ => new() + _ => new BmpMetadata { BitsPerPixel = BmpBitsPerPixel.Bit32, InfoHeaderType = BmpInfoHeaderType.WinVersion5 @@ -131,7 +131,7 @@ public class BmpMetadata : IFormatMetadata break; } - return new(bpp) + return new PixelTypeInfo(bpp) { AlphaRepresentation = alpha, ComponentInfo = info, diff --git a/src/ImageSharp/Formats/Cur/CurFrameMetadata.cs b/src/ImageSharp/Formats/Cur/CurFrameMetadata.cs index 454f15b86..b4f017253 100644 --- a/src/ImageSharp/Formats/Cur/CurFrameMetadata.cs +++ b/src/ImageSharp/Formats/Cur/CurFrameMetadata.cs @@ -73,7 +73,7 @@ public class CurFrameMetadata : IFormatFrameMetadata { if (!metadata.PixelTypeInfo.HasValue) { - return new() + return new CurFrameMetadata { BmpBitsPerPixel = BmpBitsPerPixel.Bit32, Compression = IconFrameCompression.Png @@ -98,7 +98,7 @@ public class CurFrameMetadata : IFormatFrameMetadata compression = IconFrameCompression.Png; } - return new() + return new CurFrameMetadata { BmpBitsPerPixel = bbpp, Compression = compression, @@ -147,7 +147,7 @@ public class CurFrameMetadata : IFormatFrameMetadata ? (byte)0 : (byte)ColorNumerics.GetColorCountForBitDepth((int)this.BmpBitsPerPixel); - return new() + return new IconDirEntry { Width = ClampEncodingDimension(this.EncodingWidth ?? size.Width), Height = ClampEncodingDimension(this.EncodingHeight ?? size.Height), @@ -210,7 +210,7 @@ public class CurFrameMetadata : IFormatFrameMetadata } } - return new(bpp) + return new PixelTypeInfo(bpp) { AlphaRepresentation = alpha, ComponentInfo = info, diff --git a/src/ImageSharp/Formats/Cur/CurMetadata.cs b/src/ImageSharp/Formats/Cur/CurMetadata.cs index 6499c5b42..d8fdb3290 100644 --- a/src/ImageSharp/Formats/Cur/CurMetadata.cs +++ b/src/ImageSharp/Formats/Cur/CurMetadata.cs @@ -68,7 +68,7 @@ public class CurMetadata : IFormatMetadata compression = IconFrameCompression.Png; } - return new() + return new CurMetadata { BmpBitsPerPixel = bbpp, Compression = compression @@ -129,7 +129,7 @@ public class CurMetadata : IFormatMetadata } } - return new(bpp) + return new PixelTypeInfo(bpp) { AlphaRepresentation = alpha, ComponentInfo = info, diff --git a/src/ImageSharp/Formats/DecoderOptions.cs b/src/ImageSharp/Formats/DecoderOptions.cs index 8a365682a..2511cffdb 100644 --- a/src/ImageSharp/Formats/DecoderOptions.cs +++ b/src/ImageSharp/Formats/DecoderOptions.cs @@ -13,7 +13,7 @@ namespace SixLabors.ImageSharp.Formats; /// public sealed class DecoderOptions { - private static readonly Lazy LazyOptions = new(() => new()); + private static readonly Lazy LazyOptions = new(() => new DecoderOptions()); private uint maxFrames = int.MaxValue; diff --git a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs index 4817edcf7..ca28bc771 100644 --- a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs @@ -266,8 +266,8 @@ internal sealed class GifDecoderCore : ImageDecoderCore GifThrowHelper.ThrowNoHeader(); } - return new( - new(this.logicalScreenDescriptor.Width, this.logicalScreenDescriptor.Height), + return new ImageInfo( + new Size(this.logicalScreenDescriptor.Width, this.logicalScreenDescriptor.Height), this.metadata, framesMetadata); } @@ -305,7 +305,7 @@ internal sealed class GifDecoderCore : ImageDecoderCore GifThrowHelper.ThrowInvalidImageContentException("Width or height should not be 0"); } - this.Dimensions = new(this.imageDescriptor.Width, this.imageDescriptor.Height); + this.Dimensions = new Size(this.imageDescriptor.Width, this.imageDescriptor.Height); } /// @@ -344,7 +344,7 @@ internal sealed class GifDecoderCore : ImageDecoderCore GifXmpApplicationExtension extension = GifXmpApplicationExtension.Read(stream, this.memoryAllocator); if (extension.Data.Length > 0) { - this.metadata!.XmpProfile = new(extension.Data); + this.metadata!.XmpProfile = new XmpProfile(extension.Data); } else { @@ -554,7 +554,7 @@ internal sealed class GifDecoderCore : ImageDecoderCore if (previousFrame is null && previousDisposalMode is null) { image = transFlag - ? new(this.configuration, imageWidth, imageHeight, this.metadata) + ? new Image(this.configuration, imageWidth, imageHeight, this.metadata) : new Image(this.configuration, imageWidth, imageHeight, backgroundPixel, this.metadata); this.SetFrameMetadata(image.Frames.RootFrame.Metadata); @@ -597,7 +597,7 @@ internal sealed class GifDecoderCore : ImageDecoderCore if (disposalMethod == FrameDisposalMode.RestoreToBackground) { - this.restoreArea = Rectangle.Intersect(image.Bounds, new(descriptor.Left, descriptor.Top, descriptor.Width, descriptor.Height)); + this.restoreArea = Rectangle.Intersect(image.Bounds, new Rectangle(descriptor.Left, descriptor.Top, descriptor.Width, descriptor.Height)); } if (colorTable.Length == 0) diff --git a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs index 43af476f2..ffe318063 100644 --- a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs @@ -113,7 +113,7 @@ internal sealed class GifEncoderCore TransparentColorMode mode = this.transparentColorMode; // Create a new quantizer options instance augmenting the transparent color mode to match the encoder. - QuantizerOptions options = (this.encoder.Quantizer?.Options ?? new()).DeepClone(o => o.TransparentColorMode = mode); + QuantizerOptions options = (this.encoder.Quantizer?.Options ?? new QuantizerOptions()).DeepClone(o => o.TransparentColorMode = mode); if (globalQuantizer is null) { diff --git a/src/ImageSharp/Formats/Gif/GifFrameMetadata.cs b/src/ImageSharp/Formats/Gif/GifFrameMetadata.cs index e1b3354ad..8ea607df6 100644 --- a/src/ImageSharp/Formats/Gif/GifFrameMetadata.cs +++ b/src/ImageSharp/Formats/Gif/GifFrameMetadata.cs @@ -93,7 +93,7 @@ public class GifFrameMetadata : IFormatFrameMetadata // If the color table is global and frame has no transparency. Consider it 'Source' also. blendSource |= this.ColorTableMode == FrameColorTableMode.Global && !this.HasTransparency; - return new() + return new FormatConnectingFrameMetadata { ColorTableMode = this.ColorTableMode, Duration = TimeSpan.FromMilliseconds(this.FrameDelay * 10), diff --git a/src/ImageSharp/Formats/Gif/GifMetadata.cs b/src/ImageSharp/Formats/Gif/GifMetadata.cs index d6e9c780b..77f600633 100644 --- a/src/ImageSharp/Formats/Gif/GifMetadata.cs +++ b/src/ImageSharp/Formats/Gif/GifMetadata.cs @@ -87,7 +87,7 @@ public class GifMetadata : IFormatMetadata ? Numerics.Clamp(ColorNumerics.GetBitsNeededForColorDepth(this.GlobalColorTable.Value.Length), 1, 8) : 8; - return new(bpp) + return new PixelTypeInfo(bpp) { ColorType = PixelColorType.Indexed, ComponentInfo = PixelComponentInfo.Create(1, bpp, bpp), diff --git a/src/ImageSharp/Formats/Gif/Sections/GifNetscapeLoopingApplicationExtension.cs b/src/ImageSharp/Formats/Gif/Sections/GifNetscapeLoopingApplicationExtension.cs index 4c2ffbe4d..e41389675 100644 --- a/src/ImageSharp/Formats/Gif/Sections/GifNetscapeLoopingApplicationExtension.cs +++ b/src/ImageSharp/Formats/Gif/Sections/GifNetscapeLoopingApplicationExtension.cs @@ -22,7 +22,7 @@ internal readonly struct GifNetscapeLoopingApplicationExtension : IGifExtension public static GifNetscapeLoopingApplicationExtension Parse(ReadOnlySpan buffer) { ushort repeatCount = BinaryPrimitives.ReadUInt16LittleEndian(buffer[..2]); - return new(repeatCount); + return new GifNetscapeLoopingApplicationExtension(repeatCount); } public int WriteTo(Span buffer) diff --git a/src/ImageSharp/Formats/Gif/Sections/GifXmpApplicationExtension.cs b/src/ImageSharp/Formats/Gif/Sections/GifXmpApplicationExtension.cs index b32f91205..1c1127c3b 100644 --- a/src/ImageSharp/Formats/Gif/Sections/GifXmpApplicationExtension.cs +++ b/src/ImageSharp/Formats/Gif/Sections/GifXmpApplicationExtension.cs @@ -42,7 +42,7 @@ internal readonly struct GifXmpApplicationExtension : IGifExtension stream.Skip(1); // Skip the terminator. } - return new(buffer); + return new GifXmpApplicationExtension(buffer); } public int WriteTo(Span buffer) diff --git a/src/ImageSharp/Formats/Ico/IcoFrameMetadata.cs b/src/ImageSharp/Formats/Ico/IcoFrameMetadata.cs index 3afb02456..266a3457a 100644 --- a/src/ImageSharp/Formats/Ico/IcoFrameMetadata.cs +++ b/src/ImageSharp/Formats/Ico/IcoFrameMetadata.cs @@ -66,7 +66,7 @@ public class IcoFrameMetadata : IFormatFrameMetadata { if (!metadata.PixelTypeInfo.HasValue) { - return new() + return new IcoFrameMetadata { BmpBitsPerPixel = BmpBitsPerPixel.Bit32, Compression = IconFrameCompression.Png @@ -91,7 +91,7 @@ public class IcoFrameMetadata : IFormatFrameMetadata compression = IconFrameCompression.Png; } - return new() + return new IcoFrameMetadata { BmpBitsPerPixel = bbpp, Compression = compression, @@ -138,7 +138,7 @@ public class IcoFrameMetadata : IFormatFrameMetadata ? (byte)0 : (byte)ColorNumerics.GetColorCountForBitDepth((int)this.BmpBitsPerPixel); - return new() + return new IconDirEntry { Width = ClampEncodingDimension(this.EncodingWidth ?? size.Width), Height = ClampEncodingDimension(this.EncodingHeight ?? size.Height), @@ -205,7 +205,7 @@ public class IcoFrameMetadata : IFormatFrameMetadata } } - return new(bpp) + return new PixelTypeInfo(bpp) { AlphaRepresentation = alpha, ComponentInfo = info, diff --git a/src/ImageSharp/Formats/Ico/IcoMetadata.cs b/src/ImageSharp/Formats/Ico/IcoMetadata.cs index 4436dce85..f8c2ff40f 100644 --- a/src/ImageSharp/Formats/Ico/IcoMetadata.cs +++ b/src/ImageSharp/Formats/Ico/IcoMetadata.cs @@ -68,7 +68,7 @@ public class IcoMetadata : IFormatMetadata compression = IconFrameCompression.Png; } - return new() + return new IcoMetadata { BmpBitsPerPixel = bbpp, Compression = compression @@ -129,7 +129,7 @@ public class IcoMetadata : IFormatMetadata } } - return new(bpp) + return new PixelTypeInfo(bpp) { AlphaRepresentation = alpha, ComponentInfo = info, diff --git a/src/ImageSharp/Formats/Icon/IconDecoderCore.cs b/src/ImageSharp/Formats/Icon/IconDecoderCore.cs index caed2dd90..bc3258e6b 100644 --- a/src/ImageSharp/Formats/Icon/IconDecoderCore.cs +++ b/src/ImageSharp/Formats/Icon/IconDecoderCore.cs @@ -63,7 +63,7 @@ internal abstract class IconDecoderCore : ImageDecoderCore // Since Windows Vista, the size of an image is determined from the BITMAPINFOHEADER structure or PNG image data // which technically allows storing icons with larger than 256 pixels, but such larger sizes are not recommended by Microsoft. - this.Dimensions = new(Math.Max(this.Dimensions.Width, temp.Size.Width), Math.Max(this.Dimensions.Height, temp.Size.Height)); + this.Dimensions = new Size(Math.Max(this.Dimensions.Width, temp.Size.Width), Math.Max(this.Dimensions.Height, temp.Size.Height)); } ImageMetadata metadata = new(); @@ -208,7 +208,7 @@ internal abstract class IconDecoderCore : ImageDecoderCore // Since Windows Vista, the size of an image is determined from the BITMAPINFOHEADER structure or PNG image data // which technically allows storing icons with larger than 256 pixels, but such larger sizes are not recommended by Microsoft. - this.Dimensions = new(Math.Max(this.Dimensions.Width, frameInfo.Size.Width), Math.Max(this.Dimensions.Height, frameInfo.Size.Height)); + this.Dimensions = new Size(Math.Max(this.Dimensions.Width, frameInfo.Size.Width), Math.Max(this.Dimensions.Height, frameInfo.Size.Height)); } // Copy the format specific metadata to the image. @@ -222,7 +222,7 @@ internal abstract class IconDecoderCore : ImageDecoderCore metadata.SetFormatMetadata(PngFormat.Instance, pngMetadata); } - return new(this.Dimensions, metadata, frames); + return new ImageInfo(this.Dimensions, metadata, frames); } protected abstract void SetFrameMetadata( @@ -276,20 +276,20 @@ internal abstract class IconDecoderCore : ImageDecoderCore height = Math.Max(height, entry.Height); } - this.Dimensions = new(width, height); + this.Dimensions = new Size(width, height); } private ImageDecoderCore GetDecoder(bool isPng) { if (isPng) { - return new PngDecoderCore(new() + return new PngDecoderCore(new PngDecoderOptions { GeneralOptions = this.Options, }); } - return new BmpDecoderCore(new() + return new BmpDecoderCore(new BmpDecoderOptions { GeneralOptions = this.Options, ProcessedAlphaMask = true, diff --git a/src/ImageSharp/Formats/Icon/IconEncoderCore.cs b/src/ImageSharp/Formats/Icon/IconEncoderCore.cs index 76b14832a..479cf9f1b 100644 --- a/src/ImageSharp/Formats/Icon/IconEncoderCore.cs +++ b/src/ImageSharp/Formats/Icon/IconEncoderCore.cs @@ -116,7 +116,7 @@ internal abstract class IconEncoderCore [MemberNotNull(nameof(entries))] private void InitHeader(Image image) { - this.fileHeader = new(this.iconFileType, (ushort)image.Frames.Count); + this.fileHeader = new IconDir(this.iconFileType, (ushort)image.Frames.Count); this.entries = this.iconFileType switch { IconFileType.ICO => @@ -155,14 +155,14 @@ internal abstract class IconEncoderCore count = 256; } - return new WuQuantizer(new() + return new WuQuantizer(new QuantizerOptions { MaxColors = count }); } // Don't dither if we have a palette. We want to preserve as much information as possible. - return new PaletteQuantizer(metadata.ColorTable.Value, new() { Dither = null }); + return new PaletteQuantizer(metadata.ColorTable.Value, new QuantizerOptions { Dither = null }); } internal sealed class EncodingFrameMetadata diff --git a/src/ImageSharp/Formats/ImageFormatManager.cs b/src/ImageSharp/Formats/ImageFormatManager.cs index b6b5f8779..ecf96855e 100644 --- a/src/ImageSharp/Formats/ImageFormatManager.cs +++ b/src/ImageSharp/Formats/ImageFormatManager.cs @@ -161,7 +161,7 @@ public class ImageFormatManager /// /// Removes all the registered image format detectors. /// - public void ClearImageFormatDetectors() => this.imageFormatDetectors = new(); + public void ClearImageFormatDetectors() => this.imageFormatDetectors = new ConcurrentBag(); /// /// Adds a new detector for detecting mime types. diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs index 754f1f8b4..d2c383132 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs @@ -140,7 +140,7 @@ internal partial struct Block8x8 /// public override string ToString() { - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new(); sb.Append('['); for (int i = 0; i < Size; i++) { diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs index 1c0615ef5..179f9aa28 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs @@ -57,19 +57,19 @@ internal partial struct Block8x8F ref Vector4 dTopLeft = ref Unsafe.As(ref Unsafe.Add(ref destBase, offset)); ref Vector4 dBottomLeft = ref Unsafe.As(ref Unsafe.Add(ref destBase, offset + destStride)); - Vector4 xyLeft = new Vector4(sLeft.X); + Vector4 xyLeft = new(sLeft.X); xyLeft.Z = sLeft.Y; xyLeft.W = sLeft.Y; - Vector4 zwLeft = new Vector4(sLeft.Z); + Vector4 zwLeft = new(sLeft.Z); zwLeft.Z = sLeft.W; zwLeft.W = sLeft.W; - Vector4 xyRight = new Vector4(sRight.X); + Vector4 xyRight = new(sRight.X); xyRight.Z = sRight.Y; xyRight.W = sRight.Y; - Vector4 zwRight = new Vector4(sRight.Z); + Vector4 zwRight = new(sRight.Z); zwRight.Z = sRight.W; zwRight.W = sRight.W; diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.TiffYccKScalar.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.TiffYccKScalar.cs index 495a20831..01bfc0875 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.TiffYccKScalar.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.TiffYccKScalar.cs @@ -128,7 +128,7 @@ internal abstract partial class JpegColorConverterBase ColorProfileConverter converter = new(); Span source = MemoryMarshal.Cast(packed); - // YccK is not a defined ICC color space — it's a JPEG-specific encoding used in Adobe-style CMYK JPEGs. + // YccK is not a defined ICC color space � it's a JPEG-specific encoding used in Adobe-style CMYK JPEGs. // ICC profiles expect colorimetric CMYK values, so we must first convert YccK to CMYK using a hardcoded inverse transform. // This transform assumes Rec.601 YCbCr coefficients and an inverted K channel. // @@ -144,7 +144,7 @@ internal abstract partial class JpegColorConverterBase SourceIccProfile = profile, TargetIccProfile = CompactSrgbV4Profile.Profile, }; - converter = new(options); + converter = new ColorProfileConverter(options); converter.Convert(source, destination); UnpackDeinterleave3(MemoryMarshal.Cast(packed)[..source.Length], c0, c1, c2); diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrScalar.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrScalar.cs index 4fa18b88a..2b1c1dca3 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrScalar.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrScalar.cs @@ -91,7 +91,7 @@ internal abstract partial class JpegColorConverterBase SourceIccProfile = profile, TargetIccProfile = CompactSrgbV4Profile.Profile, }; - converter = new(options); + converter = new ColorProfileConverter(options); converter.Convert(destination, destination); UnpackDeinterleave3(MemoryMarshal.Cast(packed)[..source.Length], c0, c1, c2); diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKScalar.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKScalar.cs index 8cd715eb3..3368e52bf 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKScalar.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKScalar.cs @@ -116,7 +116,7 @@ internal abstract partial class JpegColorConverterBase SourceIccProfile = profile, TargetIccProfile = CompactSrgbV4Profile.Profile, }; - converter = new(options); + converter = new ColorProfileConverter(options); converter.Convert(source, destination); UnpackDeinterleave3(MemoryMarshal.Cast(packed)[..source.Length], c0, c1, c2); diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverterBase.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverterBase.cs index 7d236eeae..74227c7a6 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverterBase.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverterBase.cs @@ -514,7 +514,7 @@ internal abstract partial class JpegColorConverterBase Span c2 = this.Component2.Length > 0 ? this.Component2.Slice(start, length) : []; Span c3 = this.Component3.Length > 0 ? this.Component3.Slice(start, length) : []; - return new(this.ComponentCount, c0, c1, c2, c3); + return new ComponentValues(this.ComponentCount, c0, c1, c2, c3); } } } diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs index 5109b1862..cf2369b2c 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs @@ -71,7 +71,7 @@ internal readonly struct AdobeMarker : IEquatable short app14Flags1 = (short)((bytes[9] << 8) | bytes[10]); byte colorTransform = bytes[11]; - marker = new(dctEncodeVersion, app14Flags0, app14Flags1, colorTransform); + marker = new AdobeMarker(dctEncodeVersion, app14Flags0, app14Flags1, colorTransform); return true; } diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs index ba6276a5c..6e83f5b2b 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs @@ -242,7 +242,7 @@ internal class ArithmeticScanDecoder : IJpegScanDecoder this.scanComponentCount = scanComponentCount; - this.scanBuffer = new(this.stream); + this.scanBuffer = new JpegBitReader(this.stream); this.frame.AllocateComponents(); diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs index b43df4d97..9ee43a2c8 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs @@ -116,7 +116,7 @@ internal class HuffmanScanDecoder : IJpegScanDecoder this.scanComponentCount = scanComponentCount; - this.scanBuffer = new(this.stream); + this.scanBuffer = new JpegBitReader(this.stream); this.frame.AllocateComponents(); @@ -784,6 +784,6 @@ internal class HuffmanScanDecoder : IJpegScanDecoder public void BuildHuffmanTable(int type, int index, ReadOnlySpan codeLengths, ReadOnlySpan values, Span workspace) { HuffmanTable[] tables = type == 0 ? this.dcHuffmanTables : this.acHuffmanTables; - tables[index] = new(codeLengths, values, workspace); + tables[index] = new HuffmanTable(codeLengths, values, workspace); } } diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JFifMarker.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JFifMarker.cs index b31376992..7e25e945a 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JFifMarker.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JFifMarker.cs @@ -80,7 +80,7 @@ internal readonly struct JFifMarker : IEquatable byte densityUnits = bytes[7]; short xDensity = (short)((bytes[8] << 8) | bytes[9]); short yDensity = (short)((bytes[10] << 8) | bytes[11]); - marker = new(majorVersion, minorVersion, densityUnits, xDensity, yDensity); + marker = new JFifMarker(majorVersion, minorVersion, densityUnits, xDensity, yDensity); return true; } diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponent.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponent.cs index 7e4a06d41..b2debf393 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponent.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponent.cs @@ -21,7 +21,7 @@ internal class JpegComponent : IDisposable, IJpegComponent this.HorizontalSamplingFactor = horizontalFactor; this.VerticalSamplingFactor = verticalFactor; - this.SamplingFactors = new(this.HorizontalSamplingFactor, this.VerticalSamplingFactor); + this.SamplingFactors = new Size(this.HorizontalSamplingFactor, this.VerticalSamplingFactor); this.QuantizationTableIndex = quantizationTableIndex; this.Index = index; @@ -109,7 +109,7 @@ internal class JpegComponent : IDisposable, IJpegComponent int blocksPerLineForMcu = this.Frame.McusPerLine * this.HorizontalSamplingFactor; int blocksPerColumnForMcu = this.Frame.McusPerColumn * this.VerticalSamplingFactor; - this.SizeInBlocks = new(blocksPerLineForMcu, blocksPerColumnForMcu); + this.SizeInBlocks = new Size(blocksPerLineForMcu, blocksPerColumnForMcu); this.SubSamplingDivisors = new Size(maxSubFactorH, maxSubFactorV).DivideBy(this.SamplingFactors); diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter.cs index 5b77ab153..0703e4d9e 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter.cs @@ -121,7 +121,7 @@ internal abstract class SpectralConverter if (scaledWidth >= tSize.Width && scaledHeight >= tSize.Height) { blockPixelSize = blockSize; - return new(scaledWidth, scaledHeight); + return new Size(scaledWidth, scaledHeight); } } } diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/Component.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/Component.cs index 7398e97a0..cc565c4d8 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/Component.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/Component.cs @@ -19,7 +19,7 @@ internal class Component : IDisposable this.HorizontalSamplingFactor = horizontalFactor; this.VerticalSamplingFactor = verticalFactor; - this.SamplingFactors = new(horizontalFactor, verticalFactor); + this.SamplingFactors = new Size(horizontalFactor, verticalFactor); this.QuantizationTableIndex = quantizationTableIndex; } @@ -95,7 +95,7 @@ internal class Component : IDisposable int blocksPerLineForMcu = frame.McusPerLine * this.HorizontalSamplingFactor; int blocksPerColumnForMcu = frame.McusPerColumn * this.VerticalSamplingFactor; - this.SizeInBlocks = new(blocksPerLineForMcu, blocksPerColumnForMcu); + this.SizeInBlocks = new Size(blocksPerLineForMcu, blocksPerColumnForMcu); this.SubSamplingDivisors = new Size(maxSubFactorH, maxSubFactorV).DivideBy(this.SamplingFactors); diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs index 1704ae1e7..1b0a17704 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs @@ -241,7 +241,7 @@ internal class ComponentProcessor : IDisposable ref Vector targetVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(target)); nuint count = target.VectorCount(); - Vector multiplierVector = new Vector(multiplier); + Vector multiplierVector = new(multiplier); for (nuint i = 0; i < count; i++) { Unsafe.Add(ref targetVectorRef, i) *= multiplierVector; diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs index 857f2a1fe..4815fce0c 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs @@ -134,7 +134,7 @@ internal class HuffmanScanEncoder public void BuildHuffmanTable(JpegHuffmanTableConfig tableConfig) { HuffmanLut[] tables = tableConfig.Class == 0 ? this.dcHuffmanTables : this.acHuffmanTables; - tables[tableConfig.DestinationIndex] = new(tableConfig.Table); + tables[tableConfig.DestinationIndex] = new HuffmanLut(tableConfig.Table); } /// diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/JpegFrame.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/JpegFrame.cs index f8a3d6dd2..6ba0b8272 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/JpegFrame.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/JpegFrame.cs @@ -27,7 +27,7 @@ internal sealed class JpegFrame : IDisposable for (int i = 0; i < this.Components.Length; i++) { JpegComponentConfig componentConfig = componentConfigs[i]; - this.Components[i] = new(allocator, componentConfig.HorizontalSampleFactor, componentConfig.VerticalSampleFactor, componentConfig.QuantizatioTableIndex) + this.Components[i] = new Component(allocator, componentConfig.HorizontalSampleFactor, componentConfig.VerticalSampleFactor, componentConfig.QuantizatioTableIndex) { DcTableId = componentConfig.DcTableSelector, AcTableId = componentConfig.AcTableSelector, diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/SpectralConverter{TPixel}.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/SpectralConverter{TPixel}.cs index e97c57cd9..b60ef68f1 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/SpectralConverter{TPixel}.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/SpectralConverter{TPixel}.cs @@ -51,7 +51,7 @@ internal class SpectralConverter : SpectralConverter, IDisposable for (int i = 0; i < this.componentProcessors.Length; i++) { Component component = frame.Components[i]; - this.componentProcessors[i] = new( + this.componentProcessors[i] = new ComponentProcessor( allocator, component, postProcessorBufferSize, diff --git a/src/ImageSharp/Formats/Jpeg/Components/SizeExtensions.cs b/src/ImageSharp/Formats/Jpeg/Components/SizeExtensions.cs index c92c2e7bd..b5d01fa5c 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/SizeExtensions.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/SizeExtensions.cs @@ -32,7 +32,7 @@ internal static class SizeExtensions sizeVect.X = MathF.Ceiling(sizeVect.X); sizeVect.Y = MathF.Ceiling(sizeVect.Y); - return new((int)sizeVect.X, (int)sizeVect.Y); + return new Size((int)sizeVect.X, (int)sizeVect.Y); } /// diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs index 026c542dd..c013cdc9c 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs @@ -25,7 +25,7 @@ public sealed class JpegDecoder : SpecializedImageDecoder Guard.NotNull(options, nameof(options)); Guard.NotNull(stream, nameof(stream)); - using JpegDecoderCore decoder = new(new() { GeneralOptions = options }); + using JpegDecoderCore decoder = new(new JpegDecoderOptions { GeneralOptions = options }); return decoder.Identify(options.Configuration, stream, cancellationToken); } diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs index c9ac1e6bb..0ad78b903 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs @@ -167,7 +167,7 @@ internal sealed class JpegDecoderCore : ImageDecoderCore, IRawJpegData int b = stream.ReadByte(); if (b == -1) { - return new(JpegConstants.Markers.EOI, stream.Length - 2); + return new JpegFileMarker(JpegConstants.Markers.EOI, stream.Length - 2); } // Found a marker. @@ -179,14 +179,14 @@ internal sealed class JpegDecoderCore : ImageDecoderCore, IRawJpegData b = stream.ReadByte(); if (b == -1) { - return new(JpegConstants.Markers.EOI, stream.Length - 2); + return new JpegFileMarker(JpegConstants.Markers.EOI, stream.Length - 2); } } // Found a valid marker. Exit loop if (b is not 0 and (< JpegConstants.Markers.RST0 or > JpegConstants.Markers.RST7)) { - return new((byte)(uint)b, stream.Position - 2); + return new JpegFileMarker((byte)(uint)b, stream.Position - 2); } } } @@ -205,7 +205,7 @@ internal sealed class JpegDecoderCore : ImageDecoderCore, IRawJpegData _ = this.Options.TryGetIccProfileForColorConversion(this.Metadata.IccProfile, out IccProfile profile); - return new( + return new Image( this.configuration, spectralConverter.GetPixelBuffer(profile, cancellationToken), this.Metadata); @@ -222,7 +222,7 @@ internal sealed class JpegDecoderCore : ImageDecoderCore, IRawJpegData this.InitDerivedMetadataProperties(); Size pixelSize = this.Frame.PixelSize; - return new(new(pixelSize.Width, pixelSize.Height), this.Metadata); + return new ImageInfo(new Size(pixelSize.Width, pixelSize.Height), this.Metadata); } /// @@ -233,7 +233,7 @@ internal sealed class JpegDecoderCore : ImageDecoderCore, IRawJpegData /// The scan decoder. public void LoadTables(byte[] tableBytes, IJpegScanDecoder scanDecoder) { - this.Metadata ??= new(); + this.Metadata ??= new ImageMetadata(); this.QuantizationTables = new Block8x8F[4]; this.scanDecoder = scanDecoder; if (tableBytes.Length < 4) @@ -256,7 +256,7 @@ internal sealed class JpegDecoderCore : ImageDecoderCore, IRawJpegData // Read next marker. bytesRead = stream.Read(markerBuffer); - fileMarker = new(markerBuffer[1], (int)stream.Position - 2); + fileMarker = new JpegFileMarker(markerBuffer[1], (int)stream.Position - 2); while (fileMarker.Marker != JpegConstants.Markers.EOI || (fileMarker.Marker == JpegConstants.Markers.EOI && fileMarker.Invalid)) { @@ -300,7 +300,7 @@ internal sealed class JpegDecoderCore : ImageDecoderCore, IRawJpegData JpegThrowHelper.ThrowInvalidImageContentException("Not enough data to read marker"); } - fileMarker = new(markerBuffer[1], 0); + fileMarker = new JpegFileMarker(markerBuffer[1], 0); } } @@ -316,7 +316,7 @@ internal sealed class JpegDecoderCore : ImageDecoderCore, IRawJpegData this.scanDecoder ??= new HuffmanScanDecoder(stream, spectralConverter, cancellationToken); - this.Metadata ??= new(); + this.Metadata ??= new ImageMetadata(); Span markerBuffer = stackalloc byte[2]; @@ -529,7 +529,7 @@ internal sealed class JpegDecoderCore : ImageDecoderCore, IRawJpegData chars[i] = (char)read; } - metadata.Comments.Add(new(chars)); + metadata.Comments.Add(new JpegComData(chars)); } /// @@ -661,7 +661,7 @@ internal sealed class JpegDecoderCore : ImageDecoderCore, IRawJpegData { if (this.hasExif) { - this.Metadata.ExifProfile = new(this.exifData); + this.Metadata.ExifProfile = new ExifProfile(this.exifData); } } @@ -685,7 +685,7 @@ internal sealed class JpegDecoderCore : ImageDecoderCore, IRawJpegData if (!this.skipMetadata && profile?.CheckIsValid() == true) { this.hasIcc = true; - this.Metadata ??= new(); + this.Metadata ??= new ImageMetadata(); this.Metadata.IccProfile = profile; } } @@ -697,7 +697,7 @@ internal sealed class JpegDecoderCore : ImageDecoderCore, IRawJpegData { if (this.hasIptc) { - this.Metadata.IptcProfile = new(this.iptcData); + this.Metadata.IptcProfile = new IptcProfile(this.iptcData); } } @@ -708,7 +708,7 @@ internal sealed class JpegDecoderCore : ImageDecoderCore, IRawJpegData { if (this.hasXmp) { - this.Metadata.XmpProfile = new(this.xmpData); + this.Metadata.XmpProfile = new XmpProfile(this.xmpData); } } @@ -992,7 +992,7 @@ internal sealed class JpegDecoderCore : ImageDecoderCore, IRawJpegData /// The remaining bytes in the segment block. private void ProcessArithmeticTable(BufferedReadStream stream, int remaining) { - this.arithmeticDecodingTables ??= new(4); + this.arithmeticDecodingTables ??= new List(4); while (remaining > 0) { @@ -1242,8 +1242,8 @@ internal sealed class JpegDecoderCore : ImageDecoderCore, IRawJpegData JpegThrowHelper.ThrowNotSupportedComponentCount(componentCount); } - this.Frame = new(frameMarker, precision, frameWidth, frameHeight, componentCount); - this.Dimensions = new(frameWidth, frameHeight); + this.Frame = new JpegFrame(frameMarker, precision, frameWidth, frameHeight, componentCount); + this.Dimensions = new Size(frameWidth, frameHeight); this.Metadata.GetJpegMetadata().Progressive = this.Frame.Progressive; remaining -= length; diff --git a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.FrameConfig.cs b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.FrameConfig.cs index 9a89eced2..98b6dd30a 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.FrameConfig.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.FrameConfig.cs @@ -13,13 +13,13 @@ internal sealed unsafe partial class JpegEncoderCore { private static JpegFrameConfig[] CreateFrameConfigs() { - JpegHuffmanTableConfig defaultLuminanceHuffmanDC = new JpegHuffmanTableConfig(@class: 0, destIndex: 0, HuffmanSpec.LuminanceDC); - JpegHuffmanTableConfig defaultLuminanceHuffmanAC = new JpegHuffmanTableConfig(@class: 1, destIndex: 0, HuffmanSpec.LuminanceAC); - JpegHuffmanTableConfig defaultChrominanceHuffmanDC = new JpegHuffmanTableConfig(@class: 0, destIndex: 1, HuffmanSpec.ChrominanceDC); - JpegHuffmanTableConfig defaultChrominanceHuffmanAC = new JpegHuffmanTableConfig(@class: 1, destIndex: 1, HuffmanSpec.ChrominanceAC); + JpegHuffmanTableConfig defaultLuminanceHuffmanDC = new(@class: 0, destIndex: 0, HuffmanSpec.LuminanceDC); + JpegHuffmanTableConfig defaultLuminanceHuffmanAC = new(@class: 1, destIndex: 0, HuffmanSpec.LuminanceAC); + JpegHuffmanTableConfig defaultChrominanceHuffmanDC = new(@class: 0, destIndex: 1, HuffmanSpec.ChrominanceDC); + JpegHuffmanTableConfig defaultChrominanceHuffmanAC = new(@class: 1, destIndex: 1, HuffmanSpec.ChrominanceAC); - JpegQuantizationTableConfig defaultLuminanceQuantTable = new JpegQuantizationTableConfig(0, Quantization.LuminanceTable); - JpegQuantizationTableConfig defaultChrominanceQuantTable = new JpegQuantizationTableConfig(1, Quantization.ChrominanceTable); + JpegQuantizationTableConfig defaultLuminanceQuantTable = new(0, Quantization.LuminanceTable); + JpegQuantizationTableConfig defaultChrominanceQuantTable = new(1, Quantization.ChrominanceTable); JpegHuffmanTableConfig[] yCbCrHuffmanConfigs = new JpegHuffmanTableConfig[] { @@ -38,77 +38,77 @@ internal sealed unsafe partial class JpegEncoderCore return new JpegFrameConfig[] { // YCbCr 4:4:4 - new JpegFrameConfig( + new( JpegColorSpace.YCbCr, JpegColorType.YCbCrRatio444, new JpegComponentConfig[] { - new JpegComponentConfig(id: 1, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), - new JpegComponentConfig(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), - new JpegComponentConfig(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), + new(id: 1, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), + new(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), }, yCbCrHuffmanConfigs, yCbCrQuantTableConfigs), // YCbCr 4:2:2 - new JpegFrameConfig( + new( JpegColorSpace.YCbCr, JpegColorType.YCbCrRatio422, new JpegComponentConfig[] { - new JpegComponentConfig(id: 1, hsf: 2, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), - new JpegComponentConfig(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), - new JpegComponentConfig(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), + new(id: 1, hsf: 2, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), + new(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), }, yCbCrHuffmanConfigs, yCbCrQuantTableConfigs), // YCbCr 4:2:0 - new JpegFrameConfig( + new( JpegColorSpace.YCbCr, JpegColorType.YCbCrRatio420, new JpegComponentConfig[] { - new JpegComponentConfig(id: 1, hsf: 2, vsf: 2, quantIndex: 0, dcIndex: 0, acIndex: 0), - new JpegComponentConfig(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), - new JpegComponentConfig(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), + new(id: 1, hsf: 2, vsf: 2, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), + new(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), }, yCbCrHuffmanConfigs, yCbCrQuantTableConfigs), // YCbCr 4:1:1 - new JpegFrameConfig( + new( JpegColorSpace.YCbCr, JpegColorType.YCbCrRatio411, new JpegComponentConfig[] { - new JpegComponentConfig(id: 1, hsf: 4, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), - new JpegComponentConfig(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), - new JpegComponentConfig(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), + new(id: 1, hsf: 4, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), + new(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), }, yCbCrHuffmanConfigs, yCbCrQuantTableConfigs), // YCbCr 4:1:0 - new JpegFrameConfig( + new( JpegColorSpace.YCbCr, JpegColorType.YCbCrRatio410, new JpegComponentConfig[] { - new JpegComponentConfig(id: 1, hsf: 4, vsf: 2, quantIndex: 0, dcIndex: 0, acIndex: 0), - new JpegComponentConfig(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), - new JpegComponentConfig(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), + new(id: 1, hsf: 4, vsf: 2, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), + new(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1), }, yCbCrHuffmanConfigs, yCbCrQuantTableConfigs), // Luminance - new JpegFrameConfig( + new( JpegColorSpace.Grayscale, JpegColorType.Luminance, new JpegComponentConfig[] { - new JpegComponentConfig(id: 0, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 0, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), }, new JpegHuffmanTableConfig[] { @@ -121,14 +121,14 @@ internal sealed unsafe partial class JpegEncoderCore }), // Rgb - new JpegFrameConfig( + new( JpegColorSpace.RGB, JpegColorType.Rgb, new JpegComponentConfig[] { - new JpegComponentConfig(id: 82, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), - new JpegComponentConfig(id: 71, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), - new JpegComponentConfig(id: 66, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 82, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 71, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 66, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), }, new JpegHuffmanTableConfig[] { @@ -144,15 +144,15 @@ internal sealed unsafe partial class JpegEncoderCore }, // Cmyk - new JpegFrameConfig( + new( JpegColorSpace.Cmyk, JpegColorType.Cmyk, new JpegComponentConfig[] { - new JpegComponentConfig(id: 1, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), - new JpegComponentConfig(id: 2, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), - new JpegComponentConfig(id: 3, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), - new JpegComponentConfig(id: 4, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 1, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 2, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 3, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 4, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), }, new JpegHuffmanTableConfig[] { @@ -168,15 +168,15 @@ internal sealed unsafe partial class JpegEncoderCore }, // YccK - new JpegFrameConfig( + new( JpegColorSpace.Ycck, JpegColorType.Ycck, new JpegComponentConfig[] { - new JpegComponentConfig(id: 1, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), - new JpegComponentConfig(id: 2, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), - new JpegComponentConfig(id: 3, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), - new JpegComponentConfig(id: 4, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 1, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 2, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 3, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), + new(id: 4, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0), }, new JpegHuffmanTableConfig[] { diff --git a/src/ImageSharp/Formats/Jpeg/JpegFormat.cs b/src/ImageSharp/Formats/Jpeg/JpegFormat.cs index a07be33fc..9d5a29981 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegFormat.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegFormat.cs @@ -15,7 +15,7 @@ public sealed class JpegFormat : IImageFormat /// /// Gets the shared instance. /// - public static JpegFormat Instance { get; } = new JpegFormat(); + public static JpegFormat Instance { get; } = new(); /// public string Name => "JPEG"; diff --git a/src/ImageSharp/Formats/Jpeg/JpegMetadata.cs b/src/ImageSharp/Formats/Jpeg/JpegMetadata.cs index 88bea3dc9..fe4855dc7 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegMetadata.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegMetadata.cs @@ -139,7 +139,7 @@ public class JpegMetadata : IFormatMetadata break; } - return new() + return new JpegMetadata { ColorType = color, ChrominanceQuality = metadata.Quality, @@ -182,7 +182,7 @@ public class JpegMetadata : IFormatMetadata break; } - return new(bpp) + return new PixelTypeInfo(bpp) { AlphaRepresentation = PixelAlphaRepresentation.None, ColorType = colorType, diff --git a/src/ImageSharp/Formats/Pbm/PbmDecoderCore.cs b/src/ImageSharp/Formats/Pbm/PbmDecoderCore.cs index d2a2f661f..989eadda7 100644 --- a/src/ImageSharp/Formats/Pbm/PbmDecoderCore.cs +++ b/src/ImageSharp/Formats/Pbm/PbmDecoderCore.cs @@ -79,8 +79,8 @@ internal sealed class PbmDecoderCore : ImageDecoderCore protected override ImageInfo Identify(BufferedReadStream stream, CancellationToken cancellationToken) { this.ProcessHeader(stream); - return new( - new(this.pixelSize.Width, this.pixelSize.Height), + return new ImageInfo( + new Size(this.pixelSize.Width, this.pixelSize.Height), this.metadata); } @@ -171,9 +171,9 @@ internal sealed class PbmDecoderCore : ImageDecoderCore this.componentType = PbmComponentType.Bit; } - this.pixelSize = new(width, height); + this.pixelSize = new Size(width, height); this.Dimensions = this.pixelSize; - this.metadata = new(); + this.metadata = new ImageMetadata(); PbmMetadata meta = this.metadata.GetPbmMetadata(); meta.Encoding = this.encoding; meta.ColorType = this.colorType; diff --git a/src/ImageSharp/Formats/Pbm/PbmMetadata.cs b/src/ImageSharp/Formats/Pbm/PbmMetadata.cs index 9045671fb..d852f3c8e 100644 --- a/src/ImageSharp/Formats/Pbm/PbmMetadata.cs +++ b/src/ImageSharp/Formats/Pbm/PbmMetadata.cs @@ -77,7 +77,7 @@ public class PbmMetadata : IFormatMetadata _ => PbmComponentType.Short }; - return new() + return new PbmMetadata { ColorType = color, ComponentType = componentType @@ -114,7 +114,7 @@ public class PbmMetadata : IFormatMetadata break; } - return new(bpp) + return new PixelTypeInfo(bpp) { AlphaRepresentation = PixelAlphaRepresentation.None, ColorType = colorType, diff --git a/src/ImageSharp/Formats/Pbm/PlainDecoder.cs b/src/ImageSharp/Formats/Pbm/PlainDecoder.cs index 4ffd824c5..8748d90fa 100644 --- a/src/ImageSharp/Formats/Pbm/PlainDecoder.cs +++ b/src/ImageSharp/Formats/Pbm/PlainDecoder.cs @@ -71,7 +71,7 @@ internal class PlainDecoder for (int x = 0; x < width; x++) { stream.ReadDecimal(out int value); - rowSpan[x] = new((byte)value); + rowSpan[x] = new L8((byte)value); eofReached = !stream.SkipWhitespaceAndComments(); if (eofReached) { @@ -107,7 +107,7 @@ internal class PlainDecoder for (int x = 0; x < width; x++) { stream.ReadDecimal(out int value); - rowSpan[x] = new((ushort)value); + rowSpan[x] = new L16((ushort)value); eofReached = !stream.SkipWhitespaceAndComments(); if (eofReached) { @@ -154,7 +154,7 @@ internal class PlainDecoder stream.ReadDecimal(out int blue); - rowSpan[x] = new((byte)red, (byte)green, (byte)blue); + rowSpan[x] = new Rgb24((byte)red, (byte)green, (byte)blue); eofReached = !stream.SkipWhitespaceAndComments(); if (eofReached) { @@ -201,7 +201,7 @@ internal class PlainDecoder stream.ReadDecimal(out int blue); - rowSpan[x] = new((ushort)red, (ushort)green, (ushort)blue); + rowSpan[x] = new Rgb48((ushort)red, (ushort)green, (ushort)blue); eofReached = !stream.SkipWhitespaceAndComments(); if (eofReached) { diff --git a/src/ImageSharp/Formats/Png/Chunks/PngPhysical.cs b/src/ImageSharp/Formats/Png/Chunks/PngPhysical.cs index a68b1cab4..8af0ac8ca 100644 --- a/src/ImageSharp/Formats/Png/Chunks/PngPhysical.cs +++ b/src/ImageSharp/Formats/Png/Chunks/PngPhysical.cs @@ -50,7 +50,7 @@ internal readonly struct PngPhysical uint vResolution = BinaryPrimitives.ReadUInt32BigEndian(data.Slice(4, 4)); byte unit = data[8]; - return new(hResolution, vResolution, unit); + return new PngPhysical(hResolution, vResolution, unit); } /// @@ -92,7 +92,7 @@ internal readonly struct PngPhysical break; } - return new(x, y, unitSpecifier); + return new PngPhysical(x, y, unitSpecifier); } /// diff --git a/src/ImageSharp/Formats/Png/PngDecoder.cs b/src/ImageSharp/Formats/Png/PngDecoder.cs index b0adbe6c5..df3995294 100644 --- a/src/ImageSharp/Formats/Png/PngDecoder.cs +++ b/src/ImageSharp/Formats/Png/PngDecoder.cs @@ -25,7 +25,7 @@ public sealed class PngDecoder : SpecializedImageDecoder Guard.NotNull(options, nameof(options)); Guard.NotNull(stream, nameof(stream)); - return new PngDecoderCore(new() { GeneralOptions = options }).Identify(options.Configuration, stream, cancellationToken); + return new PngDecoderCore(new PngDecoderOptions { GeneralOptions = options }).Identify(options.Configuration, stream, cancellationToken); } /// diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs index 577c15272..38f964d37 100644 --- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs @@ -248,7 +248,7 @@ internal sealed class PngDecoderCore : ImageDecoderCore break; case PngChunkType.Data: pngMetadata.AnimateRootFrame = currentFrameControl != null; - currentFrameControl ??= new((uint)this.header.Width, (uint)this.header.Height); + currentFrameControl ??= new FrameControl((uint)this.header.Width, (uint)this.header.Height); if (image is null) { this.InitializeImage(metadata, currentFrameControl.Value, out image); @@ -297,7 +297,7 @@ internal sealed class PngDecoderCore : ImageDecoderCore { byte[] exifData = new byte[chunk.Length]; chunk.Data.GetSpan().CopyTo(exifData); - MergeOrSetExifProfile(metadata, new(exifData), replaceExistingKeys: true); + MergeOrSetExifProfile(metadata, new ExifProfile(exifData), replaceExistingKeys: true); } break; @@ -433,7 +433,7 @@ internal sealed class PngDecoderCore : ImageDecoderCore } pngMetadata.AnimateRootFrame = currentFrameControl != null; - currentFrameControl ??= new((uint)this.header.Width, (uint)this.header.Height); + currentFrameControl ??= new FrameControl((uint)this.header.Width, (uint)this.header.Height); if (framesMetadata.Count == 0) { InitializeFrameMetadata(framesMetadata, currentFrameControl.Value); @@ -497,7 +497,7 @@ internal sealed class PngDecoderCore : ImageDecoderCore { byte[] exifData = new byte[chunk.Length]; chunk.Data.GetSpan().CopyTo(exifData); - MergeOrSetExifProfile(metadata, new(exifData), replaceExistingKeys: true); + MergeOrSetExifProfile(metadata, new ExifProfile(exifData), replaceExistingKeys: true); } break; @@ -525,7 +525,7 @@ internal sealed class PngDecoderCore : ImageDecoderCore PngThrowHelper.ThrowInvalidHeader(); } - return new(new(this.header.Width, this.header.Height), metadata, framesMetadata); + return new ImageInfo(new Size(this.header.Width, this.header.Height), metadata, framesMetadata); } finally { @@ -626,7 +626,7 @@ internal sealed class PngDecoderCore : ImageDecoderCore private void InitializeImage(ImageMetadata metadata, FrameControl frameControl, out Image image) where TPixel : unmanaged, IPixel { - image = new(this.configuration, this.header.Width, this.header.Height, metadata); + image = new Image(this.configuration, this.header.Width, this.header.Height, metadata); PngFrameMetadata frameMetadata = image.Frames.RootFrame.Metadata.GetPngMetadata(); frameMetadata.FromChunk(in frameControl); @@ -1343,7 +1343,7 @@ internal sealed class PngDecoderCore : ImageDecoderCore pngMetadata.InterlaceMethod = this.header.InterlaceMethod; this.pngColorType = this.header.ColorType; - this.Dimensions = new(this.header.Width, this.header.Height); + this.Dimensions = new Size(this.header.Width, this.header.Height); } /// @@ -1377,7 +1377,7 @@ internal sealed class PngDecoderCore : ImageDecoderCore if (!TryReadTextChunkMetadata(baseMetadata, name, value)) { - metadata.TextData.Add(new(name, value, string.Empty, string.Empty)); + metadata.TextData.Add(new PngTextData(name, value, string.Empty, string.Empty)); } } @@ -1418,7 +1418,7 @@ internal sealed class PngDecoderCore : ImageDecoderCore if (this.TryDecompressTextData(compressedData, PngConstants.Encoding, out string? uncompressed) && !TryReadTextChunkMetadata(baseMetadata, name, uncompressed)) { - metadata.TextData.Add(new(name, uncompressed, string.Empty, string.Empty)); + metadata.TextData.Add(new PngTextData(name, uncompressed, string.Empty, string.Empty)); } } @@ -1476,7 +1476,7 @@ internal sealed class PngDecoderCore : ImageDecoderCore fullRange = null; } - metadata.CicpProfile = new(colorPrimaries, transferFunction, matrixCoefficients, fullRange); + metadata.CicpProfile = new CicpProfile(colorPrimaries, transferFunction, matrixCoefficients, fullRange); } /// @@ -1560,7 +1560,7 @@ internal sealed class PngDecoderCore : ImageDecoderCore return false; } - MergeOrSetExifProfile(metadata, new(exifBlob), replaceExistingKeys: false); + MergeOrSetExifProfile(metadata, new ExifProfile(exifBlob), replaceExistingKeys: false); return true; } @@ -1594,7 +1594,7 @@ internal sealed class PngDecoderCore : ImageDecoderCore if (this.TryDecompressZlibData(compressedData, this.maxUncompressedLength, out byte[] iccpProfileBytes)) { - metadata.IccProfile = new(iccpProfileBytes); + metadata.IccProfile = new IccProfile(iccpProfileBytes); } } @@ -1750,17 +1750,17 @@ internal sealed class PngDecoderCore : ImageDecoderCore if (this.TryDecompressTextData(compressedData, PngConstants.TranslatedEncoding, out string? uncompressed)) { - pngMetadata.TextData.Add(new(keyword, uncompressed, language, translatedKeyword)); + pngMetadata.TextData.Add(new PngTextData(keyword, uncompressed, language, translatedKeyword)); } } else if (IsXmpTextData(keywordBytes)) { - metadata.XmpProfile = new(data[dataStartIdx..].ToArray()); + metadata.XmpProfile = new XmpProfile(data[dataStartIdx..].ToArray()); } else { string value = PngConstants.TranslatedEncoding.GetString(data[dataStartIdx..]); - pngMetadata.TextData.Add(new(keyword, value, language, translatedKeyword)); + pngMetadata.TextData.Add(new PngTextData(keyword, value, language, translatedKeyword)); } } @@ -1950,14 +1950,14 @@ internal sealed class PngDecoderCore : ImageDecoderCore type != PngChunkType.AnimationControl && type != PngChunkType.FrameControl) { - chunk = new(length, type); + chunk = new PngChunk(length, type); return true; } // A chunk might report a length that exceeds the length of the stream. // Take the minimum of the two values to ensure we don't read past the end of the stream. position = this.currentStream.Position; - chunk = new( + chunk = new PngChunk( length: (int)Math.Min(length, this.currentStream.Length - position), type: type, data: this.ReadChunkData(length)); diff --git a/src/ImageSharp/Formats/Png/PngDecoderOptions.cs b/src/ImageSharp/Formats/Png/PngDecoderOptions.cs index a73db8777..e4aeded15 100644 --- a/src/ImageSharp/Formats/Png/PngDecoderOptions.cs +++ b/src/ImageSharp/Formats/Png/PngDecoderOptions.cs @@ -9,7 +9,7 @@ namespace SixLabors.ImageSharp.Formats.Png; public sealed class PngDecoderOptions : ISpecializedDecoderOptions { /// - public DecoderOptions GeneralOptions { get; init; } = new DecoderOptions(); + public DecoderOptions GeneralOptions { get; init; } = new(); /// /// Gets the maximum memory in bytes that a zTXt, sPLT, iTXt, iCCP, or unknown chunk can occupy when decompressed. diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs index e9b76522c..2b01affea 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs @@ -265,7 +265,7 @@ internal sealed class PngEncoderCore : IDisposable { // Use the previously derived global palette and a shared quantizer to // quantize the subsequent frames. This allows us to cache the color matching resolution. - paletteQuantizer ??= new( + paletteQuantizer ??= new PaletteQuantizer( this.configuration, this.quantizer!.Options, previousPalette); diff --git a/src/ImageSharp/Formats/Png/PngFormat.cs b/src/ImageSharp/Formats/Png/PngFormat.cs index e5852affa..e49b89631 100644 --- a/src/ImageSharp/Formats/Png/PngFormat.cs +++ b/src/ImageSharp/Formats/Png/PngFormat.cs @@ -15,7 +15,7 @@ public sealed class PngFormat : IImageFormat /// /// Gets the shared instance. /// - public static PngFormat Instance { get; } = new PngFormat(); + public static PngFormat Instance { get; } = new(); /// public string Name => "PNG"; diff --git a/src/ImageSharp/Formats/Png/PngFrameMetadata.cs b/src/ImageSharp/Formats/Png/PngFrameMetadata.cs index dd642cf6d..b2f993da4 100644 --- a/src/ImageSharp/Formats/Png/PngFrameMetadata.cs +++ b/src/ImageSharp/Formats/Png/PngFrameMetadata.cs @@ -53,7 +53,7 @@ public class PngFrameMetadata : IFormatFrameMetadata /// The chunk to create an instance from. internal void FromChunk(in FrameControl frameControl) { - this.FrameDelay = new(frameControl.DelayNumerator, frameControl.DelayDenominator); + this.FrameDelay = new Rational(frameControl.DelayNumerator, frameControl.DelayDenominator); this.DisposalMode = frameControl.DisposalMode; this.BlendMode = frameControl.BlendMode; } @@ -62,7 +62,7 @@ public class PngFrameMetadata : IFormatFrameMetadata public static PngFrameMetadata FromFormatConnectingFrameMetadata(FormatConnectingFrameMetadata metadata) => new() { - FrameDelay = new(metadata.Duration.TotalMilliseconds / 1000), + FrameDelay = new Rational(metadata.Duration.TotalMilliseconds / 1000), DisposalMode = GetMode(metadata.DisposalMode), BlendMode = metadata.BlendMode, }; @@ -76,7 +76,7 @@ public class PngFrameMetadata : IFormatFrameMetadata delay = 0; } - return new() + return new FormatConnectingFrameMetadata { ColorTableMode = FrameColorTableMode.Global, Duration = TimeSpan.FromMilliseconds(delay * 1000), diff --git a/src/ImageSharp/Formats/Png/PngMetadata.cs b/src/ImageSharp/Formats/Png/PngMetadata.cs index fcbb93bf0..3bdbf00ad 100644 --- a/src/ImageSharp/Formats/Png/PngMetadata.cs +++ b/src/ImageSharp/Formats/Png/PngMetadata.cs @@ -129,7 +129,7 @@ public class PngMetadata : IFormatMetadata 4 => PngBitDepth.Bit4, _ => (bpc <= 8) ? PngBitDepth.Bit8 : PngBitDepth.Bit16, }; - return new() + return new PngMetadata { ColorType = color, BitDepth = bitDepth, @@ -209,7 +209,7 @@ public class PngMetadata : IFormatMetadata break; } - return new(bpp) + return new PixelTypeInfo(bpp) { AlphaRepresentation = alpha, ColorType = colorType, diff --git a/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs b/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs index 820fc0b5c..33ba58f54 100644 --- a/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs +++ b/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs @@ -133,7 +133,7 @@ internal static class PngScanlineProcessor ushort l = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o, 2)); ushort a = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + 2, 2)); - Unsafe.Add(ref rowSpanRef, (uint)x) = TPixel.FromLa32(new(l, a)); + Unsafe.Add(ref rowSpanRef, (uint)x) = TPixel.FromLa32(new La32(l, a)); } } else @@ -143,7 +143,7 @@ internal static class PngScanlineProcessor { byte l = Unsafe.Add(ref scanlineSpanRef, offset2); byte a = Unsafe.Add(ref scanlineSpanRef, offset2 + bytesPerSample); - Unsafe.Add(ref rowSpanRef, x) = TPixel.FromLa16(new(l, a)); + Unsafe.Add(ref rowSpanRef, x) = TPixel.FromLa16(new La16(l, a)); offset2 += bytesPerPixel; } } @@ -239,7 +239,7 @@ internal static class PngScanlineProcessor ushort r = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o, bytesPerSample)); ushort g = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + bytesPerSample, bytesPerSample)); ushort b = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + (2 * bytesPerSample), bytesPerSample)); - Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgb48(new(r, g, b)); + Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgb48(new Rgb48(r, g, b)); } } else if (pixelOffset == 0 && increment == 1) @@ -258,7 +258,7 @@ internal static class PngScanlineProcessor byte r = Unsafe.Add(ref scanlineSpanRef, (uint)o); byte g = Unsafe.Add(ref scanlineSpanRef, (uint)(o + bytesPerSample)); byte b = Unsafe.Add(ref scanlineSpanRef, (uint)(o + (2 * bytesPerSample))); - Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgb24(new(r, g, b)); + Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgb24(new Rgb24(r, g, b)); } } @@ -339,7 +339,7 @@ internal static class PngScanlineProcessor ushort g = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + bytesPerSample, bytesPerSample)); ushort b = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + (2 * bytesPerSample), bytesPerSample)); ushort a = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + (3 * bytesPerSample), bytesPerSample)); - Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgba64(new(r, g, b, a)); + Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgba64(new Rgba64(r, g, b, a)); } } else if (pixelOffset == 0 && increment == 1) @@ -360,7 +360,7 @@ internal static class PngScanlineProcessor byte g = Unsafe.Add(ref scanlineSpanRef, (uint)(o + bytesPerSample)); byte b = Unsafe.Add(ref scanlineSpanRef, (uint)(o + (2 * bytesPerSample))); byte a = Unsafe.Add(ref scanlineSpanRef, (uint)(o + (3 * bytesPerSample))); - Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgba32(new(r, g, b, a)); + Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgba32(new Rgba32(r, g, b, a)); } } } diff --git a/src/ImageSharp/Formats/Qoi/QoiDecoderCore.cs b/src/ImageSharp/Formats/Qoi/QoiDecoderCore.cs index 45f79c040..85fac7ea2 100644 --- a/src/ImageSharp/Formats/Qoi/QoiDecoderCore.cs +++ b/src/ImageSharp/Formats/Qoi/QoiDecoderCore.cs @@ -68,7 +68,7 @@ internal class QoiDecoderCore : ImageDecoderCore qoiMetadata.Channels = this.header.Channels; qoiMetadata.ColorSpace = this.header.ColorSpace; - return new(size, metadata); + return new ImageInfo(size, metadata); } /// @@ -124,7 +124,7 @@ internal class QoiDecoderCore : ImageDecoderCore ThrowInvalidImageContentException(); } - this.header = new(width, height, (QoiChannels)channels, (QoiColorSpace)colorSpace); + this.header = new QoiHeader(width, height, (QoiChannels)channels, (QoiColorSpace)colorSpace); } [DoesNotReturn] diff --git a/src/ImageSharp/Formats/Qoi/QoiFormat.cs b/src/ImageSharp/Formats/Qoi/QoiFormat.cs index ca2d7ae45..fbee2bc3f 100644 --- a/src/ImageSharp/Formats/Qoi/QoiFormat.cs +++ b/src/ImageSharp/Formats/Qoi/QoiFormat.cs @@ -15,7 +15,7 @@ public sealed class QoiFormat : IImageFormat /// /// Gets the shared instance. /// - public static QoiFormat Instance { get; } = new QoiFormat(); + public static QoiFormat Instance { get; } = new(); /// public string DefaultMimeType => "image/qoi"; diff --git a/src/ImageSharp/Formats/Qoi/QoiMetadata.cs b/src/ImageSharp/Formats/Qoi/QoiMetadata.cs index 8f71ebeee..e463d511d 100644 --- a/src/ImageSharp/Formats/Qoi/QoiMetadata.cs +++ b/src/ImageSharp/Formats/Qoi/QoiMetadata.cs @@ -44,10 +44,10 @@ public class QoiMetadata : IFormatMetadata if (color.HasFlag(PixelColorType.Alpha)) { - return new() { Channels = QoiChannels.Rgba }; + return new QoiMetadata { Channels = QoiChannels.Rgba }; } - return new() { Channels = QoiChannels.Rgb }; + return new QoiMetadata { Channels = QoiChannels.Rgb }; } /// @@ -73,7 +73,7 @@ public class QoiMetadata : IFormatMetadata break; } - return new(bpp) + return new PixelTypeInfo(bpp) { AlphaRepresentation = alpha, ColorType = colorType, diff --git a/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs b/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs index 59977ecbc..ead157986 100644 --- a/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs +++ b/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs @@ -622,7 +622,7 @@ internal sealed class TgaDecoderCore : ImageDecoderCore else { byte alpha = alphaBits == 0 ? byte.MaxValue : bufferSpan[idx + 3]; - color = TPixel.FromBgra32(new(bufferSpan[idx + 2], bufferSpan[idx + 1], bufferSpan[idx], alpha)); + color = TPixel.FromBgra32(new Bgra32(bufferSpan[idx + 2], bufferSpan[idx + 1], bufferSpan[idx], alpha)); } break; @@ -638,8 +638,8 @@ internal sealed class TgaDecoderCore : ImageDecoderCore protected override ImageInfo Identify(BufferedReadStream stream, CancellationToken cancellationToken) { this.ReadFileHeader(stream); - return new( - new(this.fileHeader.Width, this.fileHeader.Height), + return new ImageInfo( + new Size(this.fileHeader.Width, this.fileHeader.Height), this.metadata); } @@ -705,7 +705,7 @@ internal sealed class TgaDecoderCore : ImageDecoderCore Guard.NotNull(this.tgaMetadata); byte alpha = this.tgaMetadata.AlphaChannelBits == 0 ? byte.MaxValue : scratchBuffer[3]; - pixelRow[x] = TPixel.FromBgra32(new(scratchBuffer[2], scratchBuffer[1], scratchBuffer[0], alpha)); + pixelRow[x] = TPixel.FromBgra32(new Bgra32(scratchBuffer[2], scratchBuffer[1], scratchBuffer[0], alpha)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -907,9 +907,9 @@ internal sealed class TgaDecoderCore : ImageDecoderCore stream.Read(buffer, 0, TgaFileHeader.Size); this.fileHeader = TgaFileHeader.Parse(buffer); - this.Dimensions = new(this.fileHeader.Width, this.fileHeader.Height); + this.Dimensions = new Size(this.fileHeader.Width, this.fileHeader.Height); - this.metadata = new(); + this.metadata = new ImageMetadata(); this.tgaMetadata = this.metadata.GetTgaMetadata(); this.tgaMetadata.BitsPerPixel = (TgaBitsPerPixel)this.fileHeader.PixelDepth; diff --git a/src/ImageSharp/Formats/Tga/TgaFormat.cs b/src/ImageSharp/Formats/Tga/TgaFormat.cs index e024dfc62..f5bf76fb4 100644 --- a/src/ImageSharp/Formats/Tga/TgaFormat.cs +++ b/src/ImageSharp/Formats/Tga/TgaFormat.cs @@ -11,7 +11,7 @@ public sealed class TgaFormat : IImageFormat /// /// Gets the shared instance. /// - public static TgaFormat Instance { get; } = new TgaFormat(); + public static TgaFormat Instance { get; } = new(); /// public string Name => "TGA"; diff --git a/src/ImageSharp/Formats/Tga/TgaMetadata.cs b/src/ImageSharp/Formats/Tga/TgaMetadata.cs index a7be538ec..8d40f8646 100644 --- a/src/ImageSharp/Formats/Tga/TgaMetadata.cs +++ b/src/ImageSharp/Formats/Tga/TgaMetadata.cs @@ -41,10 +41,10 @@ public class TgaMetadata : IFormatMetadata int bpp = metadata.PixelTypeInfo.BitsPerPixel; return bpp switch { - <= 8 => new() { BitsPerPixel = TgaBitsPerPixel.Bit8 }, - <= 16 => new() { BitsPerPixel = TgaBitsPerPixel.Bit16 }, - <= 24 => new() { BitsPerPixel = TgaBitsPerPixel.Bit24 }, - _ => new() { BitsPerPixel = TgaBitsPerPixel.Bit32 } + <= 8 => new TgaMetadata { BitsPerPixel = TgaBitsPerPixel.Bit8 }, + <= 16 => new TgaMetadata { BitsPerPixel = TgaBitsPerPixel.Bit16 }, + <= 24 => new TgaMetadata { BitsPerPixel = TgaBitsPerPixel.Bit24 }, + _ => new TgaMetadata { BitsPerPixel = TgaBitsPerPixel.Bit32 } }; } @@ -79,7 +79,7 @@ public class TgaMetadata : IFormatMetadata break; } - return new(bpp) + return new PixelTypeInfo(bpp) { AlphaRepresentation = alpha, ComponentInfo = info, diff --git a/src/ImageSharp/Formats/Tiff/Compression/Compressors/DeflateCompressor.cs b/src/ImageSharp/Formats/Tiff/Compression/Compressors/DeflateCompressor.cs index 1d7de583f..3debd373c 100644 --- a/src/ImageSharp/Formats/Tiff/Compression/Compressors/DeflateCompressor.cs +++ b/src/ImageSharp/Formats/Tiff/Compression/Compressors/DeflateCompressor.cs @@ -11,7 +11,7 @@ internal sealed class DeflateCompressor : TiffBaseCompressor { private readonly DeflateCompressionLevel compressionLevel; - private readonly MemoryStream memoryStream = new MemoryStream(); + private readonly MemoryStream memoryStream = new(); public DeflateCompressor(Stream output, MemoryAllocator allocator, int width, int bitsPerPixel, TiffPredictor predictor, DeflateCompressionLevel compressionLevel) : base(output, allocator, width, bitsPerPixel, predictor) @@ -29,7 +29,7 @@ internal sealed class DeflateCompressor : TiffBaseCompressor public override void CompressStrip(Span rows, int height) { this.memoryStream.Seek(0, SeekOrigin.Begin); - using (ZlibDeflateStream stream = new ZlibDeflateStream(this.Allocator, this.memoryStream, this.compressionLevel)) + using (ZlibDeflateStream stream = new(this.Allocator, this.memoryStream, this.compressionLevel)) { if (this.Predictor == TiffPredictor.Horizontal) { diff --git a/src/ImageSharp/Formats/Tiff/Compression/Compressors/LzwCompressor.cs b/src/ImageSharp/Formats/Tiff/Compression/Compressors/LzwCompressor.cs index 7dfb60bad..a6242114e 100644 --- a/src/ImageSharp/Formats/Tiff/Compression/Compressors/LzwCompressor.cs +++ b/src/ImageSharp/Formats/Tiff/Compression/Compressors/LzwCompressor.cs @@ -20,7 +20,7 @@ internal sealed class LzwCompressor : TiffBaseCompressor public override TiffCompression Method => TiffCompression.Lzw; /// - public override void Initialize(int rowsPerStrip) => this.lzwEncoder = new(this.Allocator); + public override void Initialize(int rowsPerStrip) => this.lzwEncoder = new TiffLzwEncoder(this.Allocator); /// public override void CompressStrip(Span rows, int height) diff --git a/src/ImageSharp/Formats/Tiff/Compression/Compressors/TiffJpegCompressor.cs b/src/ImageSharp/Formats/Tiff/Compression/Compressors/TiffJpegCompressor.cs index a2a83be0a..1ad69b2c8 100644 --- a/src/ImageSharp/Formats/Tiff/Compression/Compressors/TiffJpegCompressor.cs +++ b/src/ImageSharp/Formats/Tiff/Compression/Compressors/TiffJpegCompressor.cs @@ -29,7 +29,7 @@ internal class TiffJpegCompressor : TiffBaseCompressor int pixelCount = rows.Length / 3; int width = pixelCount / height; - using MemoryStream memoryStream = new MemoryStream(); + using MemoryStream memoryStream = new(); Image image = Image.LoadPixelData(rows, width, height); image.Save(memoryStream, new JpegEncoder() { diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/DeflateTiffCompression.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/DeflateTiffCompression.cs index 39c392815..4e176f28d 100644 --- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/DeflateTiffCompression.cs +++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/DeflateTiffCompression.cs @@ -54,7 +54,7 @@ internal sealed class DeflateTiffCompression : TiffBaseDecompressor protected override void Decompress(BufferedReadStream stream, int byteCount, int stripHeight, Span buffer, CancellationToken cancellationToken) { long pos = stream.Position; - using (ZlibInflateStream deframeStream = new ZlibInflateStream( + using (ZlibInflateStream deframeStream = new( stream, () => { diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwString.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwString.cs index cad46e987..e6895d67c 100644 --- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwString.cs +++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwString.cs @@ -50,10 +50,10 @@ public class LzwString { if (this == Empty) { - return new(other); + return new LzwString(other); } - return new(other, this.FirstChar, this.Length + 1, this); + return new LzwString(other, this.FirstChar, this.Length + 1, this); } /// diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwTiffCompression.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwTiffCompression.cs index beb22a2bb..f00c5aa81 100644 --- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwTiffCompression.cs +++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwTiffCompression.cs @@ -48,7 +48,7 @@ internal sealed class LzwTiffCompression : TiffBaseDecompressor /// protected override void Decompress(BufferedReadStream stream, int byteCount, int stripHeight, Span buffer, CancellationToken cancellationToken) { - TiffLzwDecoder decoder = new TiffLzwDecoder(stream); + TiffLzwDecoder decoder = new(stream); decoder.DecodePixels(buffer); if (this.Predictor == TiffPredictor.Horizontal) diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/ModifiedHuffmanTiffCompression.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/ModifiedHuffmanTiffCompression.cs index f0ed12c41..ccdf9b0b7 100644 --- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/ModifiedHuffmanTiffCompression.cs +++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/ModifiedHuffmanTiffCompression.cs @@ -41,7 +41,7 @@ internal sealed class ModifiedHuffmanTiffCompression : TiffBaseDecompressor /// protected override void Decompress(BufferedReadStream stream, int byteCount, int stripHeight, Span buffer, CancellationToken cancellationToken) { - ModifiedHuffmanBitReader bitReader = new ModifiedHuffmanBitReader(stream, this.FillOrder, byteCount); + ModifiedHuffmanBitReader bitReader = new(stream, this.FillOrder, byteCount); buffer.Clear(); nint bitsWritten = 0; diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T4TiffCompression.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T4TiffCompression.cs index 4d09f7b4e..d9e49aa75 100644 --- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T4TiffCompression.cs +++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T4TiffCompression.cs @@ -60,7 +60,7 @@ internal sealed class T4TiffCompression : TiffBaseDecompressor } bool eolPadding = this.faxCompressionOptions.HasFlag(FaxCompressionOptions.EolPadding); - T4BitReader bitReader = new T4BitReader(stream, this.FillOrder, byteCount, eolPadding); + T4BitReader bitReader = new(stream, this.FillOrder, byteCount, eolPadding); buffer.Clear(); nint bitsWritten = 0; diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6TiffCompression.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6TiffCompression.cs index c0ec49d8e..2020dce47 100644 --- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6TiffCompression.cs +++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6TiffCompression.cs @@ -69,7 +69,7 @@ internal sealed class T6TiffCompression : TiffBaseDecompressor bitsWritten = this.WriteScanLine(buffer, scanLine, bitsWritten); scanLine.CopyTo(referenceScanLineSpan); - referenceScanLine = new(this.isWhiteZero, referenceScanLineSpan); + referenceScanLine = new CcittReferenceScanline(this.isWhiteZero, referenceScanLineSpan); } } diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/TiffLzwDecoder.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/TiffLzwDecoder.cs index 40278dca2..a53e1bc74 100644 --- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/TiffLzwDecoder.cs +++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/TiffLzwDecoder.cs @@ -103,7 +103,7 @@ internal sealed class TiffLzwDecoder this.table = new LzwString[TableSize]; for (int i = 0; i < 256; i++) { - this.table[i] = new((byte)i); + this.table[i] = new LzwString((byte)i); } this.Init(); diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/WebpTiffCompression.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/WebpTiffCompression.cs index 5f4ca12bd..c0affc50a 100644 --- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/WebpTiffCompression.cs +++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/WebpTiffCompression.cs @@ -32,7 +32,7 @@ internal class WebpTiffCompression : TiffBaseDecompressor /// protected override void Decompress(BufferedReadStream stream, int byteCount, int stripHeight, Span buffer, CancellationToken cancellationToken) { - using WebpDecoderCore decoder = new(new() { GeneralOptions = this.options }); + using WebpDecoderCore decoder = new(new WebpDecoderOptions { GeneralOptions = this.options }); using Image image = decoder.Decode(this.options.Configuration, stream, cancellationToken); CopyImageBytesToBuffer(buffer, image.Frames.RootFrame.PixelBuffer); } diff --git a/src/ImageSharp/Formats/Tiff/Compression/HorizontalPredictor.cs b/src/ImageSharp/Formats/Tiff/Compression/HorizontalPredictor.cs index ebf4042e2..706e6a38c 100644 --- a/src/ImageSharp/Formats/Tiff/Compression/HorizontalPredictor.cs +++ b/src/ImageSharp/Formats/Tiff/Compression/HorizontalPredictor.cs @@ -222,7 +222,7 @@ internal static class HorizontalPredictor byte r = (byte)(rowRgb[x].R - rowRgb[x - 1].R); byte g = (byte)(rowRgb[x].G - rowRgb[x - 1].G); byte b = (byte)(rowRgb[x].B - rowRgb[x - 1].B); - rowRgb[x] = new(r, g, b); + rowRgb[x] = new Rgb24(r, g, b); } } } @@ -429,7 +429,7 @@ internal static class HorizontalPredictor r += pixel.R; g += pixel.G; b += pixel.B; - pixel = new(r, g, b); + pixel = new Rgb24(r, g, b); } } @@ -462,7 +462,7 @@ internal static class HorizontalPredictor g += pixel.G; b += pixel.B; a += pixel.A; - pixel = new(r, g, b, a); + pixel = new Rgba32(r, g, b, a); } } diff --git a/src/ImageSharp/Formats/Tiff/Compression/TiffDecompressorsFactory.cs b/src/ImageSharp/Formats/Tiff/Compression/TiffDecompressorsFactory.cs index 0bc2e7343..aa207e2b6 100644 --- a/src/ImageSharp/Formats/Tiff/Compression/TiffDecompressorsFactory.cs +++ b/src/ImageSharp/Formats/Tiff/Compression/TiffDecompressorsFactory.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using SixLabors.ImageSharp.Formats.Jpeg; using SixLabors.ImageSharp.Formats.Tiff.Compression.Decompressors; using SixLabors.ImageSharp.Formats.Tiff.Constants; using SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation; @@ -64,11 +65,11 @@ internal static class TiffDecompressorsFactory case TiffDecoderCompressionType.Jpeg: DebugGuard.IsTrue(predictor == TiffPredictor.None, "Predictor should only be used with lzw or deflate compression"); - return new JpegTiffCompression(new() { GeneralOptions = options }, allocator, width, bitsPerPixel, metadata, jpegTables, photometricInterpretation); + return new JpegTiffCompression(new JpegDecoderOptions { GeneralOptions = options }, allocator, width, bitsPerPixel, metadata, jpegTables, photometricInterpretation); case TiffDecoderCompressionType.OldJpeg: DebugGuard.IsTrue(predictor == TiffPredictor.None, "Predictor should only be used with lzw or deflate compression"); - return new OldJpegTiffCompression(new() { GeneralOptions = options }, allocator, width, bitsPerPixel, metadata, oldJpegStartOfImageMarker, photometricInterpretation); + return new OldJpegTiffCompression(new JpegDecoderOptions { GeneralOptions = options }, allocator, width, bitsPerPixel, metadata, oldJpegStartOfImageMarker, photometricInterpretation); case TiffDecoderCompressionType.Webp: DebugGuard.IsTrue(predictor == TiffPredictor.None, "Predictor should only be used with lzw or deflate compression"); diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero16TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero16TiffColor{TPixel}.cs index 2ef261811..d818aef1b 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero16TiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero16TiffColor{TPixel}.cs @@ -47,7 +47,7 @@ internal class BlackIsZero16TiffColor : TiffBaseColorDecoder ushort intensity = TiffUtilities.ConvertToUShortBigEndian(data.Slice(offset, 2)); offset += 2; - pixelRow[x] = TPixel.FromL16(new(intensity)); + pixelRow[x] = TPixel.FromL16(new L16(intensity)); } } else diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero32FloatTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero32FloatTiffColor{TPixel}.cs index b30700adb..ac316459d 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero32FloatTiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero32FloatTiffColor{TPixel}.cs @@ -40,7 +40,7 @@ internal class BlackIsZero32FloatTiffColor : TiffBaseColorDecoder : TiffBaseColorDecoder : TiffBaseColorDecoder for (int x = left; x < left + width - 1;) { byte byteData = data[offset++]; - pixelRowSpan[x++] = TPixel.FromL8(new((byte)(((byteData & 0xF0) >> 4) * 17))); - pixelRowSpan[x++] = TPixel.FromL8(new((byte)((byteData & 0x0F) * 17))); + pixelRowSpan[x++] = TPixel.FromL8(new L8((byte)(((byteData & 0xF0) >> 4) * 17))); + pixelRowSpan[x++] = TPixel.FromL8(new L8((byte)((byteData & 0x0F) * 17))); } if (isOddWidth) { byte byteData = data[offset++]; - pixelRowSpan[left + width - 1] = TPixel.FromL8(new((byte)(((byteData & 0xF0) >> 4) * 17))); + pixelRowSpan[left + width - 1] = TPixel.FromL8(new L8((byte)(((byteData & 0xF0) >> 4) * 17))); } } } diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColor{TPixel}.cs index 709c2bf64..7428ef057 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColor{TPixel}.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Numerics; using SixLabors.ImageSharp.Formats.Tiff.Utils; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; @@ -35,7 +36,7 @@ internal class BlackIsZeroTiffColor : TiffBaseColorDecoder { int value = bitReader.ReadBits(this.bitsPerSample0); float intensity = value / this.factor; - pixelRow[x] = TPixel.FromScaledVector4(new(intensity, intensity, intensity, 1f)); + pixelRow[x] = TPixel.FromScaledVector4(new Vector4(intensity, intensity, intensity, 1f)); } bitReader.NextRow(); diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabPlanarTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabPlanarTiffColor{TPixel}.cs index d6fc7c487..d23d1e290 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabPlanarTiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabPlanarTiffColor{TPixel}.cs @@ -2,6 +2,7 @@ // Licensed under the Six Labors Split License. using System.Buffers; +using System.Numerics; using SixLabors.ImageSharp.ColorProfiles; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; @@ -34,7 +35,7 @@ internal class CieLabPlanarTiffColor : TiffBasePlanarColorDecoder(in lab); - pixelRow[x] = TPixel.FromScaledVector4(new(rgb.R, rgb.G, rgb.B, 1.0f)); + pixelRow[x] = TPixel.FromScaledVector4(new Vector4(rgb.R, rgb.G, rgb.B, 1.0f)); offset++; } diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabTiffColor{TPixel}.cs index b0236022b..b10d27ccd 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabTiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabTiffColor{TPixel}.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Numerics; using SixLabors.ImageSharp.ColorProfiles; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; @@ -30,7 +31,7 @@ internal class CieLabTiffColor : TiffBaseColorDecoder float l = (data[offset] & 0xFF) * 100f * Inv255; CieLab lab = new(l, (sbyte)data[offset + 1], (sbyte)data[offset + 2]); Rgb rgb = ColorProfileConverter.Convert(in lab); - pixelRow[x] = TPixel.FromScaledVector4(new(rgb.R, rgb.G, rgb.B, 1f)); + pixelRow[x] = TPixel.FromScaledVector4(new Vector4(rgb.R, rgb.G, rgb.B, 1f)); offset += 3; } diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CmykTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CmykTiffColor{TPixel}.cs index 86e584193..2e22fcde0 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CmykTiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CmykTiffColor{TPixel}.cs @@ -31,7 +31,7 @@ internal class CmykTiffColor : TiffBaseColorDecoder Span pixelRow = pixels.DangerousGetRowSpan(y).Slice(left, width); for (int x = 0; x < pixelRow.Length; x++) { - pixelRow[x] = TPixel.FromVector4(new(data[offset] * Inv255, data[offset + 1] * Inv255, data[offset + 2] * Inv255, 1.0f)); + pixelRow[x] = TPixel.FromVector4(new Vector4(data[offset] * Inv255, data[offset + 1] * Inv255, data[offset + 2] * Inv255, 1.0f)); offset += 3; } @@ -47,7 +47,7 @@ internal class CmykTiffColor : TiffBaseColorDecoder { Cmyk cmyk = new(data[offset] * Inv255, data[offset + 1] * Inv255, data[offset + 2] * Inv255, data[offset + 3] * Inv255); Rgb rgb = ColorProfileConverter.Convert(in cmyk); - pixelRow[x] = TPixel.FromScaledVector4(new(rgb.R, rgb.G, rgb.B, 1.0f)); + pixelRow[x] = TPixel.FromScaledVector4(new Vector4(rgb.R, rgb.G, rgb.B, 1.0f)); offset += 4; } diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/PaletteTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/PaletteTiffColor{TPixel}.cs index 745e5846a..69113cf93 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/PaletteTiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/PaletteTiffColor{TPixel}.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Numerics; using SixLabors.ImageSharp.Formats.Tiff.Utils; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; @@ -63,7 +64,7 @@ internal class PaletteTiffColor : TiffBaseColorDecoder float r = colorMap[rOffset + i] * InvMax; float g = colorMap[gOffset + i] * InvMax; float b = colorMap[bOffset + i] * InvMax; - palette[i] = TPixel.FromScaledVector4(new(r, g, b, 1f)); + palette[i] = TPixel.FromScaledVector4(new Vector4(r, g, b, 1f)); } return palette; diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb161616TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb161616TiffColor{TPixel}.cs index d8520e307..c1420b4f4 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb161616TiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb161616TiffColor{TPixel}.cs @@ -48,7 +48,7 @@ internal class Rgb161616TiffColor : TiffBaseColorDecoder ushort b = TiffUtilities.ConvertToUShortBigEndian(data.Slice(offset, 2)); offset += 2; - pixelRow[x] = TPixel.FromRgb48(new(r, g, b)); + pixelRow[x] = TPixel.FromRgb48(new Rgb48(r, g, b)); } } else diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb16PlanarTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb16PlanarTiffColor{TPixel}.cs index f55d7225e..84efb9021 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb16PlanarTiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb16PlanarTiffColor{TPixel}.cs @@ -44,7 +44,7 @@ internal class Rgb16PlanarTiffColor : TiffBasePlanarColorDecoder offset += 2; - pixelRow[x] = TPixel.FromRgb48(new(r, g, b)); + pixelRow[x] = TPixel.FromRgb48(new Rgb48(r, g, b)); } } else @@ -57,7 +57,7 @@ internal class Rgb16PlanarTiffColor : TiffBasePlanarColorDecoder offset += 2; - pixelRow[x] = TPixel.FromRgb48(new(r, g, b)); + pixelRow[x] = TPixel.FromRgb48(new Rgb48(r, g, b)); } } } diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbFloat323232TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbFloat323232TiffColor{TPixel}.cs index 37605ef80..f9c17eb2f 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbFloat323232TiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbFloat323232TiffColor{TPixel}.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Numerics; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; @@ -50,7 +51,7 @@ internal class RgbFloat323232TiffColor : TiffBaseColorDecoder float b = BitConverter.ToSingle(buffer); offset += 4; - pixelRow[x] = TPixel.FromScaledVector4(new(r, g, b, 1f)); + pixelRow[x] = TPixel.FromScaledVector4(new Vector4(r, g, b, 1f)); } } else @@ -66,7 +67,7 @@ internal class RgbFloat323232TiffColor : TiffBaseColorDecoder float b = BitConverter.ToSingle(data.Slice(offset, 4)); offset += 4; - pixelRow[x] = TPixel.FromScaledVector4(new(r, g, b, 1f)); + pixelRow[x] = TPixel.FromScaledVector4(new Vector4(r, g, b, 1f)); } } } diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColor{TPixel}.cs index 844b08d3c..a013abfbd 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColor{TPixel}.cs @@ -2,6 +2,7 @@ // Licensed under the Six Labors Split License. using System.Buffers; +using System.Numerics; using SixLabors.ImageSharp.Formats.Tiff.Utils; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; @@ -62,7 +63,7 @@ internal class RgbPlanarTiffColor : TiffBasePlanarColorDecoder float g = gBitReader.ReadBits(this.bitsPerSampleG) / this.gFactor; float b = bBitReader.ReadBits(this.bitsPerSampleB) / this.bFactor; - pixelRow[x] = TPixel.FromScaledVector4(new(r, g, b, 1f)); + pixelRow[x] = TPixel.FromScaledVector4(new Vector4(r, g, b, 1f)); } rBitReader.NextRow(); diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbTiffColor{TPixel}.cs index 2b85c2fd6..3c205d147 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbTiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbTiffColor{TPixel}.cs @@ -52,7 +52,7 @@ internal class RgbTiffColor : TiffBaseColorDecoder float g = bitReader.ReadBits(this.bitsPerSampleG) / this.gFactor; float b = bitReader.ReadBits(this.bitsPerSampleB) / this.bFactor; - pixelRow[x] = TPixel.FromScaledVector4(new(r, g, b, 1f)); + pixelRow[x] = TPixel.FromScaledVector4(new Vector4(r, g, b, 1f)); } bitReader.NextRow(); diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16161616TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16161616TiffColor{TPixel}.cs index e4965887d..9847f45b5 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16161616TiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16161616TiffColor{TPixel}.cs @@ -67,7 +67,7 @@ internal class Rgba16161616TiffColor : TiffBaseColorDecoder pixelRow[x] = hasAssociatedAlpha ? TiffUtilities.ColorFromRgba64Premultiplied(r, g, b, a) - : TPixel.FromRgba64(new(r, g, b, a)); + : TPixel.FromRgba64(new Rgba64(r, g, b, a)); } } else diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16PlanarTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16PlanarTiffColor{TPixel}.cs index 3d36db17d..12357adc1 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16PlanarTiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16PlanarTiffColor{TPixel}.cs @@ -56,7 +56,7 @@ internal class Rgba16PlanarTiffColor : TiffBasePlanarColorDecoder(r, g, b, a) - : TPixel.FromRgba64(new(r, g, b, a)); + : TPixel.FromRgba64(new Rgba64(r, g, b, a)); } } else @@ -72,7 +72,7 @@ internal class Rgba16PlanarTiffColor : TiffBasePlanarColorDecoder(r, g, b, a) - : TPixel.FromRgba64(new(r, g, b, a)); + : TPixel.FromRgba64(new Rgba64(r, g, b, a)); } } } diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbaFloat32323232TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbaFloat32323232TiffColor{TPixel}.cs index 12f1b75b4..87a019641 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbaFloat32323232TiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbaFloat32323232TiffColor{TPixel}.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Numerics; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; @@ -55,7 +56,7 @@ internal class RgbaFloat32323232TiffColor : TiffBaseColorDecoder float a = BitConverter.ToSingle(buffer); offset += 4; - pixelRow[x] = TPixel.FromScaledVector4(new(r, g, b, a)); + pixelRow[x] = TPixel.FromScaledVector4(new Vector4(r, g, b, a)); } } else @@ -74,7 +75,7 @@ internal class RgbaFloat32323232TiffColor : TiffBaseColorDecoder float a = BitConverter.ToSingle(data.Slice(offset, 4)); offset += 4; - pixelRow[x] = TPixel.FromScaledVector4(new(r, g, b, a)); + pixelRow[x] = TPixel.FromScaledVector4(new Vector4(r, g, b, a)); } } } diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero16TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero16TiffColor{TPixel}.cs index 6f1672e1b..d70873634 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero16TiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero16TiffColor{TPixel}.cs @@ -36,7 +36,7 @@ internal class WhiteIsZero16TiffColor : TiffBaseColorDecoder ushort intensity = (ushort)(ushort.MaxValue - TiffUtilities.ConvertToUShortBigEndian(data.Slice(offset, 2))); offset += 2; - pixelRow[x] = TPixel.FromL16(new(intensity)); + pixelRow[x] = TPixel.FromL16(new L16(intensity)); } } else @@ -46,7 +46,7 @@ internal class WhiteIsZero16TiffColor : TiffBaseColorDecoder ushort intensity = (ushort)(ushort.MaxValue - TiffUtilities.ConvertToUShortLittleEndian(data.Slice(offset, 2))); offset += 2; - pixelRow[x] = TPixel.FromL16(new(intensity)); + pixelRow[x] = TPixel.FromL16(new L16(intensity)); } } } diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero32FloatTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero32FloatTiffColor{TPixel}.cs index 0db555cbb..6986f25eb 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero32FloatTiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero32FloatTiffColor{TPixel}.cs @@ -40,7 +40,7 @@ internal class WhiteIsZero32FloatTiffColor : TiffBaseColorDecoder : TiffBaseColorDecoder : TiffBaseColorDecoder for (int x = left; x < left + width - 1;) { byte byteData = data[offset++]; - pixelRowSpan[x++] = TPixel.FromL8(new((byte)((15 - ((byteData & 0xF0) >> 4)) * 17))); - pixelRowSpan[x++] = TPixel.FromL8(new((byte)((15 - (byteData & 0x0F)) * 17))); + pixelRowSpan[x++] = TPixel.FromL8(new L8((byte)((15 - ((byteData & 0xF0) >> 4)) * 17))); + pixelRowSpan[x++] = TPixel.FromL8(new L8((byte)((15 - (byteData & 0x0F)) * 17))); } if (isOddWidth) { byte byteData = data[offset++]; - pixelRowSpan[left + width - 1] = TPixel.FromL8(new((byte)((15 - ((byteData & 0xF0) >> 4)) * 17))); + pixelRowSpan[left + width - 1] = TPixel.FromL8(new L8((byte)((15 - ((byteData & 0xF0) >> 4)) * 17))); } } } diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero8TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero8TiffColor{TPixel}.cs index 5429dbd3b..ae0dcb753 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero8TiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero8TiffColor{TPixel}.cs @@ -23,7 +23,7 @@ internal class WhiteIsZero8TiffColor : TiffBaseColorDecoder for (int x = 0; x < pixelRow.Length; x++) { byte intensity = (byte)(byte.MaxValue - data[offset++]); - pixelRow[x] = TPixel.FromL8(new(intensity)); + pixelRow[x] = TPixel.FromL8(new L8(intensity)); } } } diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColor{TPixel}.cs index 06212eff3..0cd01a619 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColor{TPixel}.cs @@ -36,7 +36,7 @@ internal class WhiteIsZeroTiffColor : TiffBaseColorDecoder { int value = bitReader.ReadBits(this.bitsPerSample0); float intensity = 1f - (value / this.factor); - pixelRow[x] = TPixel.FromScaledVector4(new(intensity, intensity, intensity, 1f)); + pixelRow[x] = TPixel.FromScaledVector4(new Vector4(intensity, intensity, intensity, 1f)); } bitReader.NextRow(); diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrConverter.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrConverter.cs index 754cbd005..d41749be6 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrConverter.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrConverter.cs @@ -45,10 +45,10 @@ internal class YCbCrConverter TiffThrowHelper.ThrowImageFormatException("luma coefficients array should have 6 entry's"); } - this.yExpander = new(referenceBlackAndWhite[0], referenceBlackAndWhite[1], 255); - this.cbExpander = new(referenceBlackAndWhite[2], referenceBlackAndWhite[3], 127); - this.crExpander = new(referenceBlackAndWhite[4], referenceBlackAndWhite[5], 127); - this.converter = new(coefficients[0], coefficients[1], coefficients[2]); + this.yExpander = new CodingRangeExpander(referenceBlackAndWhite[0], referenceBlackAndWhite[1], 255); + this.cbExpander = new CodingRangeExpander(referenceBlackAndWhite[2], referenceBlackAndWhite[3], 127); + this.crExpander = new CodingRangeExpander(referenceBlackAndWhite[4], referenceBlackAndWhite[5], 127); + this.converter = new YCbCrToRgbConverter(coefficients[0], coefficients[1], coefficients[2]); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrPlanarTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrPlanarTiffColor{TPixel}.cs index ebae82430..768177bfc 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrPlanarTiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrPlanarTiffColor{TPixel}.cs @@ -20,7 +20,7 @@ internal class YCbCrPlanarTiffColor : TiffBasePlanarColorDecoder public YCbCrPlanarTiffColor(Rational[] referenceBlackAndWhite, Rational[] coefficients, ushort[] ycbcrSubSampling) { - this.converter = new(referenceBlackAndWhite, coefficients); + this.converter = new YCbCrConverter(referenceBlackAndWhite, coefficients); this.ycbcrSubSampling = ycbcrSubSampling; } diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrTiffColor{TPixel}.cs index 3bf550fe5..5a1389035 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrTiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrTiffColor{TPixel}.cs @@ -24,7 +24,7 @@ internal class YCbCrTiffColor : TiffBaseColorDecoder public YCbCrTiffColor(MemoryAllocator memoryAllocator, Rational[] referenceBlackAndWhite, Rational[] coefficients, ushort[] ycbcrSubSampling) { this.memoryAllocator = memoryAllocator; - this.converter = new(referenceBlackAndWhite, coefficients); + this.converter = new YCbCrConverter(referenceBlackAndWhite, coefficients); this.ycbcrSubSampling = ycbcrSubSampling; } diff --git a/src/ImageSharp/Formats/Tiff/TiffBitsPerSample.cs b/src/ImageSharp/Formats/Tiff/TiffBitsPerSample.cs index e9b620ea2..2bfd9a626 100644 --- a/src/ImageSharp/Formats/Tiff/TiffBitsPerSample.cs +++ b/src/ImageSharp/Formats/Tiff/TiffBitsPerSample.cs @@ -120,7 +120,7 @@ public readonly struct TiffBitsPerSample : IEquatable break; } - sample = new(c0, c1, c2, c3); + sample = new TiffBitsPerSample(c0, c1, c2, c3); return true; } diff --git a/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs b/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs index 73f66a062..fbff35297 100644 --- a/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs +++ b/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs @@ -191,7 +191,7 @@ internal class TiffDecoderCore : ImageDecoderCore this.Dimensions = frames[0].Size; ImageMetadata metadata = TiffDecoderMetadataCreator.Create(framesMetadata, this.skipMetadata, reader.ByteOrder, reader.IsBigTiff); - return new(this.configuration, metadata, frames); + return new Image(this.configuration, metadata, frames); } catch { @@ -228,7 +228,7 @@ internal class TiffDecoderCore : ImageDecoderCore ImageMetadata metadata = TiffDecoderMetadataCreator.Create(framesMetadata, this.skipMetadata, reader.ByteOrder, reader.IsBigTiff); - return new(new(width, height), metadata, framesMetadata); + return new ImageInfo(new Size(width, height), metadata, framesMetadata); } /// @@ -285,7 +285,7 @@ internal class TiffDecoderCore : ImageDecoderCore // We resolve the ICC profile early so that we can use it for color conversion if needed. if (tags.TryGetValue(ExifTag.IccProfile, out IExifValue iccProfileBytes)) { - imageFrameMetaData.IccProfile = new(iccProfileBytes.Value); + imageFrameMetaData.IccProfile = new IccProfile(iccProfileBytes.Value); } } diff --git a/src/ImageSharp/Formats/Tiff/TiffDecoderMetadataCreator.cs b/src/ImageSharp/Formats/Tiff/TiffDecoderMetadataCreator.cs index db27854a1..ebf407f9b 100644 --- a/src/ImageSharp/Formats/Tiff/TiffDecoderMetadataCreator.cs +++ b/src/ImageSharp/Formats/Tiff/TiffDecoderMetadataCreator.cs @@ -33,12 +33,12 @@ internal static class TiffDecoderMetadataCreator ImageFrameMetadata frameMetaData = frames[i]; if (TryGetIptc(frameMetaData.ExifProfile.Values, out byte[] iptcBytes)) { - frameMetaData.IptcProfile = new(iptcBytes); + frameMetaData.IptcProfile = new IptcProfile(iptcBytes); } if (frameMetaData.ExifProfile.TryGetValue(ExifTag.XMP, out IExifValue xmpProfileBytes)) { - frameMetaData.XmpProfile = new(xmpProfileBytes.Value); + frameMetaData.XmpProfile = new XmpProfile(xmpProfileBytes.Value); } } } diff --git a/src/ImageSharp/Formats/Tiff/TiffDecoderOptionsParser.cs b/src/ImageSharp/Formats/Tiff/TiffDecoderOptionsParser.cs index 958399454..7519871b7 100644 --- a/src/ImageSharp/Formats/Tiff/TiffDecoderOptionsParser.cs +++ b/src/ImageSharp/Formats/Tiff/TiffDecoderOptionsParser.cs @@ -531,7 +531,7 @@ internal static class TiffDecoderOptionsParser // Some encoders do not set the BitsPerSample correctly, so we set those values here to the required values: // https://github.com/SixLabors/ImageSharp/issues/2587 - options.BitsPerSample = new(1, 0, 0); + options.BitsPerSample = new TiffBitsPerSample(1, 0, 0); options.BitsPerPixel = 1; break; @@ -549,7 +549,7 @@ internal static class TiffDecoderOptionsParser options.FaxCompressionOptions = FaxCompressionOptions.None; } - options.BitsPerSample = new(1, 0, 0); + options.BitsPerSample = new TiffBitsPerSample(1, 0, 0); options.BitsPerPixel = 1; break; @@ -557,7 +557,7 @@ internal static class TiffDecoderOptionsParser case TiffCompression.Ccitt1D: options.CompressionType = TiffDecoderCompressionType.HuffmanRle; - options.BitsPerSample = new(1, 0, 0); + options.BitsPerSample = new TiffBitsPerSample(1, 0, 0); options.BitsPerPixel = 1; break; diff --git a/src/ImageSharp/Formats/Tiff/TiffEncoderEntriesCollector.cs b/src/ImageSharp/Formats/Tiff/TiffEncoderEntriesCollector.cs index 8890c61a5..eeb4afebf 100644 --- a/src/ImageSharp/Formats/Tiff/TiffEncoderEntriesCollector.cs +++ b/src/ImageSharp/Formats/Tiff/TiffEncoderEntriesCollector.cs @@ -298,12 +298,12 @@ internal class TiffEncoderEntriesCollector { this.Collector.AddOrReplace(new ExifRational(ExifTagValue.XResolution) { - Value = new(resolution.HorizontalResolution.Value) + Value = new Rational(resolution.HorizontalResolution.Value) }); this.Collector.AddOrReplace(new ExifRational(ExifTagValue.YResolution) { - Value = new(resolution.VerticalResolution.Value) + Value = new Rational(resolution.VerticalResolution.Value) }); } } diff --git a/src/ImageSharp/Formats/Tiff/TiffFormat.cs b/src/ImageSharp/Formats/Tiff/TiffFormat.cs index 76a06d013..eb052d1bf 100644 --- a/src/ImageSharp/Formats/Tiff/TiffFormat.cs +++ b/src/ImageSharp/Formats/Tiff/TiffFormat.cs @@ -17,7 +17,7 @@ public sealed class TiffFormat : IImageFormat /// /// Gets the shared instance. /// - public static TiffFormat Instance { get; } = new TiffFormat(); + public static TiffFormat Instance { get; } = new(); /// public string Name => "TIFF"; @@ -32,8 +32,8 @@ public sealed class TiffFormat : IImageFormat public IEnumerable FileExtensions => TiffConstants.FileExtensions; /// - public TiffMetadata CreateDefaultFormatMetadata() => new TiffMetadata(); + public TiffMetadata CreateDefaultFormatMetadata() => new(); /// - public TiffFrameMetadata CreateDefaultFormatFrameMetadata() => new TiffFrameMetadata(); + public TiffFrameMetadata CreateDefaultFormatFrameMetadata() => new(); } diff --git a/src/ImageSharp/Formats/Tiff/TiffMetadata.cs b/src/ImageSharp/Formats/Tiff/TiffMetadata.cs index 7d2056469..e965fcb4f 100644 --- a/src/ImageSharp/Formats/Tiff/TiffMetadata.cs +++ b/src/ImageSharp/Formats/Tiff/TiffMetadata.cs @@ -75,7 +75,7 @@ public class TiffMetadata : IFormatMetadata int bpp = metadata.PixelTypeInfo.BitsPerPixel; return bpp switch { - 1 => new() + 1 => new TiffMetadata { BitsPerPixel = TiffBitsPerPixel.Bit1, BitsPerSample = TiffConstants.BitsPerSample1Bit, @@ -83,7 +83,7 @@ public class TiffMetadata : IFormatMetadata Compression = TiffCompression.CcittGroup4Fax, Predictor = TiffPredictor.None }, - <= 4 => new() + <= 4 => new TiffMetadata { BitsPerPixel = TiffBitsPerPixel.Bit4, BitsPerSample = TiffConstants.BitsPerSample4Bit, @@ -91,7 +91,7 @@ public class TiffMetadata : IFormatMetadata Compression = TiffCompression.Deflate, Predictor = TiffPredictor.None // Best match for low bit depth }, - 8 => new() + 8 => new TiffMetadata { BitsPerPixel = TiffBitsPerPixel.Bit8, BitsPerSample = TiffConstants.BitsPerSample8Bit, @@ -99,7 +99,7 @@ public class TiffMetadata : IFormatMetadata Compression = TiffCompression.Deflate, Predictor = TiffPredictor.Horizontal }, - 16 => new() + 16 => new TiffMetadata { BitsPerPixel = TiffBitsPerPixel.Bit16, BitsPerSample = TiffConstants.BitsPerSample16Bit, @@ -107,7 +107,7 @@ public class TiffMetadata : IFormatMetadata Compression = TiffCompression.Deflate, Predictor = TiffPredictor.Horizontal }, - 32 or 64 => new() + 32 or 64 => new TiffMetadata { BitsPerPixel = TiffBitsPerPixel.Bit32, BitsPerSample = TiffConstants.BitsPerSampleRgb8Bit, @@ -115,7 +115,7 @@ public class TiffMetadata : IFormatMetadata Compression = TiffCompression.Deflate, Predictor = TiffPredictor.Horizontal }, - _ => new() + _ => new TiffMetadata { BitsPerPixel = TiffBitsPerPixel.Bit24, BitsPerSample = TiffConstants.BitsPerSampleRgb8Bit, @@ -165,7 +165,7 @@ public class TiffMetadata : IFormatMetadata break; } - return new(bpp) + return new PixelTypeInfo(bpp) { ColorType = colorType, ComponentInfo = info, diff --git a/src/ImageSharp/Formats/Tiff/Utils/TiffUtilities.cs b/src/ImageSharp/Formats/Tiff/Utils/TiffUtilities.cs index 8b5e04f27..e30765b1f 100644 --- a/src/ImageSharp/Formats/Tiff/Utils/TiffUtilities.cs +++ b/src/ImageSharp/Formats/Tiff/Utils/TiffUtilities.cs @@ -45,7 +45,7 @@ internal static class TiffUtilities return TPixel.FromRgba64(default); } - return TPixel.FromRgba64(new((ushort)(r / a), (ushort)(g / a), (ushort)(b / a), a)); + return TPixel.FromRgba64(new Rgba64((ushort)(r / a), (ushort)(g / a), (ushort)(b / a), a)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp/Formats/Tiff/Writers/TiffBiColorWriter{TPixel}.cs b/src/ImageSharp/Formats/Tiff/Writers/TiffBiColorWriter{TPixel}.cs index 8ede73279..647ff8a1a 100644 --- a/src/ImageSharp/Formats/Tiff/Writers/TiffBiColorWriter{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/Writers/TiffBiColorWriter{TPixel}.cs @@ -30,7 +30,7 @@ internal sealed class TiffBiColorWriter : TiffBaseColorWriter : base(image, encodingSize, memoryAllocator, configuration, entriesCollector) { // Convert image to black and white. - this.imageBlackWhite = new(configuration, new(), [image.Clone()]); + this.imageBlackWhite = new Image(configuration, new ImageMetadata(), [image.Clone()]); this.imageBlackWhite.Mutate(img => img.BinaryDither(KnownDitherings.FloydSteinberg)); } diff --git a/src/ImageSharp/Formats/Tiff/Writers/TiffPaletteWriter{TPixel}.cs b/src/ImageSharp/Formats/Tiff/Writers/TiffPaletteWriter{TPixel}.cs index a6106ae85..ebf75efe8 100644 --- a/src/ImageSharp/Formats/Tiff/Writers/TiffPaletteWriter{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/Writers/TiffPaletteWriter{TPixel}.cs @@ -44,13 +44,13 @@ internal sealed class TiffPaletteWriter : TiffBaseColorWriter this.colorPaletteBytes = this.colorPaletteSize * 2; using IQuantizer frameQuantizer = quantizer.CreatePixelSpecificQuantizer( this.Configuration, - new() + new QuantizerOptions { MaxColors = this.maxColors }); frameQuantizer.BuildPalette(pixelSamplingStrategy, frame); - this.quantizedFrame = frameQuantizer.QuantizeFrame(frame, new(Point.Empty, encodingSize)); + this.quantizedFrame = frameQuantizer.QuantizeFrame(frame, new Rectangle(Point.Empty, encodingSize)); this.AddColorMapTag(); } diff --git a/src/ImageSharp/Formats/Webp/AlphaDecoder.cs b/src/ImageSharp/Formats/Webp/AlphaDecoder.cs index f374daba4..accfea948 100644 --- a/src/ImageSharp/Formats/Webp/AlphaDecoder.cs +++ b/src/ImageSharp/Formats/Webp/AlphaDecoder.cs @@ -56,12 +56,12 @@ internal class AlphaDecoder : IDisposable this.Alpha = memoryAllocator.Allocate(totalPixels); this.AlphaFilterType = (WebpAlphaFilterType)filter; - this.Vp8LDec = new(width, height, memoryAllocator); + this.Vp8LDec = new Vp8LDecoder(width, height, memoryAllocator); if (this.Compressed) { Vp8LBitReader bitReader = new(data); - this.LosslessDecoder = new(bitReader, memoryAllocator, configuration); + this.LosslessDecoder = new WebpLosslessDecoder(bitReader, memoryAllocator, configuration); this.LosslessDecoder.DecodeImageStream(this.Vp8LDec, width, height, true); // Special case: if alpha data uses only the color indexing transform and diff --git a/src/ImageSharp/Formats/Webp/AlphaEncoder.cs b/src/ImageSharp/Formats/Webp/AlphaEncoder.cs index 56587da18..fd6f508e4 100644 --- a/src/ImageSharp/Formats/Webp/AlphaEncoder.cs +++ b/src/ImageSharp/Formats/Webp/AlphaEncoder.cs @@ -92,7 +92,7 @@ internal static class AlphaEncoder for (int x = 0; x < width; x++) { // Leave A/R/B channels zero'd. - pixelRow[x] = new(0, alphaRow[x], 0, 0); + pixelRow[x] = new Bgra32(0, alphaRow[x], 0, 0); } } diff --git a/src/ImageSharp/Formats/Webp/BitWriter/Vp8BitWriter.cs b/src/ImageSharp/Formats/Webp/BitWriter/Vp8BitWriter.cs index 505f54312..e9f50fb49 100644 --- a/src/ImageSharp/Formats/Webp/BitWriter/Vp8BitWriter.cs +++ b/src/ImageSharp/Formats/Webp/BitWriter/Vp8BitWriter.cs @@ -399,7 +399,7 @@ internal class Vp8BitWriter : BitWriterBase int mbSize = this.enc.Mbw * this.enc.Mbh; int expectedSize = (int)((uint)mbSize * 7 / 8); - Vp8BitWriter bitWriterPartZero = new Vp8BitWriter(expectedSize, this.enc); + Vp8BitWriter bitWriterPartZero = new(expectedSize, this.enc); // Partition #0 with header and partition sizes. uint size0 = bitWriterPartZero.GeneratePartition0(); @@ -545,7 +545,7 @@ internal class Vp8BitWriter : BitWriterBase // Writes the partition #0 modes (that is: all intra modes) private void CodeIntraModes() { - Vp8EncIterator it = new Vp8EncIterator(this.enc); + Vp8EncIterator it = new(this.enc); int predsWidth = this.enc.PredsWidth; do diff --git a/src/ImageSharp/Formats/Webp/BitWriter/Vp8LBitWriter.cs b/src/ImageSharp/Formats/Webp/BitWriter/Vp8LBitWriter.cs index 0b71a3ed0..dc867fa85 100644 --- a/src/ImageSharp/Formats/Webp/BitWriter/Vp8LBitWriter.cs +++ b/src/ImageSharp/Formats/Webp/BitWriter/Vp8LBitWriter.cs @@ -102,7 +102,7 @@ internal class Vp8LBitWriter : BitWriterBase { byte[] clonedBuffer = new byte[this.Buffer.Length]; System.Buffer.BlockCopy(this.Buffer, 0, clonedBuffer, 0, this.cur); - return new(clonedBuffer, this.bits, this.used, this.cur); + return new Vp8LBitWriter(clonedBuffer, this.bits, this.used, this.cur); } /// diff --git a/src/ImageSharp/Formats/Webp/Chunks/WebpFrameData.cs b/src/ImageSharp/Formats/Webp/Chunks/WebpFrameData.cs index 66662569c..7d22f7f2b 100644 --- a/src/ImageSharp/Formats/Webp/Chunks/WebpFrameData.cs +++ b/src/ImageSharp/Formats/Webp/Chunks/WebpFrameData.cs @@ -124,7 +124,7 @@ internal readonly struct WebpFrameData { Span buffer = stackalloc byte[4]; - return new( + return new WebpFrameData( dataSize: WebpChunkParsingUtils.ReadChunkSize(stream, buffer), x: WebpChunkParsingUtils.ReadUInt24LittleEndian(stream, buffer) * 2, y: WebpChunkParsingUtils.ReadUInt24LittleEndian(stream, buffer) * 2, diff --git a/src/ImageSharp/Formats/Webp/Lossless/BackwardReferenceEncoder.cs b/src/ImageSharp/Formats/Webp/Lossless/BackwardReferenceEncoder.cs index bac6d5167..274d4426f 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/BackwardReferenceEncoder.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/BackwardReferenceEncoder.cs @@ -72,7 +72,7 @@ internal static class BackwardReferenceEncoder BackwardReferencesLz77(width, height, bgra, 0, hashChain, worst); break; case Vp8LLz77Type.Lz77Box: - hashChainBox = new(memoryAllocator, width * height); + hashChainBox = new Vp8LHashChain(memoryAllocator, width * height); BackwardReferencesLz77Box(width, height, bgra, 0, hashChain, hashChainBox, worst); break; } @@ -145,7 +145,7 @@ internal static class BackwardReferenceEncoder for (int i = 0; i < colorCache.Length; i++) { histos[i].PaletteCodeBits = i; - colorCache[i] = new(i); + colorCache[i] = new ColorCache(i); } // Find the cacheBits giving the lowest entropy. @@ -281,7 +281,7 @@ internal static class BackwardReferenceEncoder if (useColorCache) { - colorCache = new(cacheBits); + colorCache = new ColorCache(cacheBits); } costModel.Build(xSize, cacheBits, refs); @@ -383,7 +383,7 @@ internal static class BackwardReferenceEncoder if (useColorCache) { - colorCache = new(cacheBits); + colorCache = new ColorCache(cacheBits); } backwardRefs.Clear(); @@ -475,7 +475,7 @@ internal static class BackwardReferenceEncoder ColorCache? colorCache = null; if (useColorCache) { - colorCache = new(cacheBits); + colorCache = new ColorCache(cacheBits); } refs.Clear(); @@ -730,7 +730,7 @@ internal static class BackwardReferenceEncoder if (useColorCache) { - colorCache = new(cacheBits); + colorCache = new ColorCache(cacheBits); } refs.Clear(); diff --git a/src/ImageSharp/Formats/Webp/Lossless/CostManager.cs b/src/ImageSharp/Formats/Webp/Lossless/CostManager.cs index 2b2286e04..4ab9d7b94 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/CostManager.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/CostManager.cs @@ -23,15 +23,15 @@ internal sealed class CostManager : IDisposable { int costCacheSize = pixCount > BackwardReferenceEncoder.MaxLength ? BackwardReferenceEncoder.MaxLength : pixCount; - this.CacheIntervals = new(); - this.CostCache = new(); + this.CacheIntervals = new List(); + this.CostCache = new List(); this.Costs = memoryAllocator.Allocate(pixCount); this.DistArray = distArray; this.Count = 0; for (int i = 0; i < FreeIntervalsStartCount; i++) { - this.freeIntervals.Push(new()); + this.freeIntervals.Push(new CostInterval()); } // Fill in the cost cache. @@ -62,7 +62,7 @@ internal sealed class CostManager : IDisposable double costVal = this.CostCache[i]; if (costVal != cur.Cost) { - cur = new() + cur = new CostCacheInterval { Start = i, Cost = costVal @@ -258,7 +258,7 @@ internal sealed class CostManager : IDisposable } else { - intervalNew = new() { Cost = cost, Start = start, End = end, Index = position }; + intervalNew = new CostInterval { Cost = cost, Start = start, End = end, Index = position }; } this.PositionOrphanInterval(intervalNew, intervalIn); diff --git a/src/ImageSharp/Formats/Webp/Lossless/CrunchConfig.cs b/src/ImageSharp/Formats/Webp/Lossless/CrunchConfig.cs index 7488f03ca..58394c212 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/CrunchConfig.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/CrunchConfig.cs @@ -7,5 +7,5 @@ internal class CrunchConfig { public EntropyIx EntropyIdx { get; set; } - public List SubConfigs { get; } = new List(); + public List SubConfigs { get; } = new(); } diff --git a/src/ImageSharp/Formats/Webp/Lossless/HTreeGroup.cs b/src/ImageSharp/Formats/Webp/Lossless/HTreeGroup.cs index 1375218da..5806ee5b5 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/HTreeGroup.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/HTreeGroup.cs @@ -15,7 +15,7 @@ internal struct HTreeGroup { public HTreeGroup(uint packedTableSize) { - this.HTrees = new(WebpConstants.HuffmanCodesPerMetaCode); + this.HTrees = new List(WebpConstants.HuffmanCodesPerMetaCode); this.PackedTable = new HuffmanCode[packedTableSize]; this.IsTrivialCode = false; this.IsTrivialLiteral = false; diff --git a/src/ImageSharp/Formats/Webp/Lossless/HuffmanUtils.cs b/src/ImageSharp/Formats/Webp/Lossless/HuffmanUtils.cs index fd5d1dd94..027d4f7ee 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/HuffmanUtils.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/HuffmanUtils.cs @@ -425,7 +425,7 @@ internal static class HuffmanUtils tableSize = 1 << tableBits; totalSize += tableSize; low = key & mask; - table[low] = new() + table[low] = new HuffmanCode { BitsUsed = tableBits + rootBits, Value = (uint)(tablePos - low) diff --git a/src/ImageSharp/Formats/Webp/Lossless/Vp8LDecoder.cs b/src/ImageSharp/Formats/Webp/Lossless/Vp8LDecoder.cs index c22abd83e..374465cf7 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/Vp8LDecoder.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/Vp8LDecoder.cs @@ -22,7 +22,7 @@ internal class Vp8LDecoder : IDisposable { this.Width = width; this.Height = height; - this.Metadata = new(); + this.Metadata = new Vp8LMetadata(); this.Pixels = memoryAllocator.Allocate(width * height, AllocationOptions.Clean); } diff --git a/src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs b/src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs index 2cbe4bbb6..b398554eb 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs @@ -124,16 +124,16 @@ internal class Vp8LEncoder : IDisposable this.transparentColorMode = transparentColorMode; this.nearLossless = nearLossless; this.nearLosslessQuality = Numerics.Clamp(nearLosslessQuality, 0, 100); - this.bitWriter = new(initialSize); + this.bitWriter = new Vp8LBitWriter(initialSize); this.Bgra = memoryAllocator.Allocate(pixelCount); this.EncodedData = memoryAllocator.Allocate(pixelCount); this.Palette = memoryAllocator.Allocate(WebpConstants.MaxPaletteSize); this.Refs = new Vp8LBackwardRefs[3]; - this.HashChain = new(memoryAllocator, pixelCount); + this.HashChain = new Vp8LHashChain(memoryAllocator, pixelCount); for (int i = 0; i < this.Refs.Length; i++) { - this.Refs[i] = new(memoryAllocator, pixelCount); + this.Refs[i] = new Vp8LBackwardRefs(memoryAllocator, pixelCount); } } @@ -549,14 +549,14 @@ internal class Vp8LEncoder : IDisposable // We can only apply kPalette or kPaletteAndSpatial if we can indeed use a palette. if ((entropyIx != EntropyIx.Palette && entropyIx != EntropyIx.PaletteAndSpatial) || usePalette) { - crunchConfigs.Add(new() { EntropyIdx = entropyIx }); + crunchConfigs.Add(new CrunchConfig { EntropyIdx = entropyIx }); } } } else { // Only choose the guessed best transform. - crunchConfigs.Add(new() { EntropyIdx = entropyIdx }); + crunchConfigs.Add(new CrunchConfig { EntropyIdx = entropyIdx }); if (this.quality >= 75 && this.method == WebpEncodingMethod.Level5) { // Test with and without color cache. @@ -565,7 +565,7 @@ internal class Vp8LEncoder : IDisposable // If we have a palette, also check in combination with spatial. if (entropyIdx == EntropyIx.Palette) { - crunchConfigs.Add(new() { EntropyIdx = EntropyIx.PaletteAndSpatial }); + crunchConfigs.Add(new CrunchConfig { EntropyIdx = EntropyIx.PaletteAndSpatial }); } } } @@ -575,7 +575,7 @@ internal class Vp8LEncoder : IDisposable { for (int j = 0; j < nlz77s; j++) { - crunchConfig.SubConfigs.Add(new() + crunchConfig.SubConfigs.Add(new CrunchSubConfig { Lz77 = j == 0 ? (int)Vp8LLz77Type.Lz77Standard | (int)Vp8LLz77Type.Lz77Rle : (int)Vp8LLz77Type.Lz77Box, DoNotCache = doNotCache @@ -712,7 +712,7 @@ internal class Vp8LEncoder : IDisposable HuffmanTreeToken[] tokens = new HuffmanTreeToken[maxTokens]; for (int i = 0; i < tokens.Length; i++) { - tokens[i] = new(); + tokens[i] = new HuffmanTreeToken(); } for (int i = 0; i < 5 * histogramImageSize; i++) @@ -858,7 +858,7 @@ internal class Vp8LEncoder : IDisposable HuffmanTreeToken[] tokens = new HuffmanTreeToken[maxTokens]; for (int i = 0; i < tokens.Length; i++) { - tokens[i] = new(); + tokens[i] = new HuffmanTreeToken(); } // Store Huffman codes. diff --git a/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogram.cs b/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogram.cs index 5b3ecc7f5..03bedfe67 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogram.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogram.cs @@ -613,7 +613,7 @@ internal sealed unsafe class OwnedVp8LHistogram : Vp8LHistogram, IDisposable { IMemoryOwner bufferOwner = memoryAllocator.Allocate(BufferSize, AllocationOptions.Clean); MemoryHandle bufferHandle = bufferOwner.Memory.Pin(); - return new(bufferOwner, ref bufferHandle, (uint*)bufferHandle.Pointer, paletteCodeBits); + return new OwnedVp8LHistogram(bufferOwner, ref bufferHandle, (uint*)bufferHandle.Pointer, paletteCodeBits); } /// diff --git a/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogramSet.cs b/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogramSet.cs index 68b52f22b..817641393 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogramSet.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogramSet.cs @@ -25,7 +25,7 @@ internal sealed class Vp8LHistogramSet : IEnumerable, IDisposable unsafe { uint* basePointer = (uint*)this.bufferHandle.Pointer; - this.items = new(capacity); + this.items = new List(capacity); for (int i = 0; i < capacity; i++) { this.items.Add(new MemberVp8LHistogram(basePointer + (Vp8LHistogram.BufferSize * i), cacheBits)); @@ -41,7 +41,7 @@ internal sealed class Vp8LHistogramSet : IEnumerable, IDisposable unsafe { uint* basePointer = (uint*)this.bufferHandle.Pointer; - this.items = new(capacity); + this.items = new List(capacity); for (int i = 0; i < capacity; i++) { this.items.Add(new MemberVp8LHistogram(basePointer + (Vp8LHistogram.BufferSize * i), refs, cacheBits)); @@ -49,9 +49,9 @@ internal sealed class Vp8LHistogramSet : IEnumerable, IDisposable } } - public Vp8LHistogramSet(int capacity) => this.items = new(capacity); + public Vp8LHistogramSet(int capacity) => this.items = new List(capacity); - public Vp8LHistogramSet() => this.items = new(); + public Vp8LHistogramSet() => this.items = new List(); public int Count => this.items.Count; diff --git a/src/ImageSharp/Formats/Webp/Lossless/WebpLosslessDecoder.cs b/src/ImageSharp/Formats/Webp/Lossless/WebpLosslessDecoder.cs index af26616cc..6de3ae749 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/WebpLosslessDecoder.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/WebpLosslessDecoder.cs @@ -108,7 +108,7 @@ internal sealed class WebpLosslessDecoder int numberOfTransformsPresent = 0; if (isLevel0) { - decoder.Transforms = new(WebpConstants.MaxNumberOfTransforms); + decoder.Transforms = new List(WebpConstants.MaxNumberOfTransforms); // Next bit indicates, if a transformation is present. while (this.bitReader.ReadBit()) @@ -129,7 +129,7 @@ internal sealed class WebpLosslessDecoder } else { - decoder.Metadata = new(); + decoder.Metadata = new Vp8LMetadata(); } // Color cache. @@ -156,7 +156,7 @@ internal sealed class WebpLosslessDecoder // Finish setting up the color-cache. if (isColorCachePresent) { - decoder.Metadata.ColorCache = new(colorCacheBits); + decoder.Metadata.ColorCache = new ColorCache(colorCacheBits); colorCacheSize = 1 << colorCacheBits; decoder.Metadata.ColorCacheSize = colorCacheSize; } @@ -416,7 +416,7 @@ internal sealed class WebpLosslessDecoder int[] codeLengths = new int[maxAlphabetSize]; for (int i = 0; i < numHTreeGroupsMax; i++) { - hTreeGroups[i] = new(HuffmanUtils.HuffmanPackedTableSize); + hTreeGroups[i] = new HTreeGroup(HuffmanUtils.HuffmanPackedTableSize); HTreeGroup hTreeGroup = hTreeGroups[i]; int totalSize = 0; bool isTrivialLiteral = true; diff --git a/src/ImageSharp/Formats/Webp/Lossy/QuantEnc.cs b/src/ImageSharp/Formats/Webp/Lossy/QuantEnc.cs index 31030adb0..ed1ed52ab 100644 --- a/src/ImageSharp/Formats/Webp/Lossy/QuantEnc.cs +++ b/src/ImageSharp/Formats/Webp/Lossy/QuantEnc.cs @@ -36,8 +36,8 @@ internal static unsafe class QuantEnc int tlambda = dqm.TLambda; Span src = it.YuvIn.AsSpan(Vp8EncIterator.YOffEnc); Span scratch = it.Scratch3; - Vp8ModeScore rdTmp = new Vp8ModeScore(); - Vp8Residual res = new Vp8Residual(); + Vp8ModeScore rdTmp = new(); + Vp8Residual res = new(); Vp8ModeScore rdCur = rdTmp; Vp8ModeScore rdBest = rd; int mode; @@ -107,7 +107,7 @@ internal static unsafe class QuantEnc Span bestBlocks = it.YuvOut2.AsSpan(Vp8EncIterator.YOffEnc); Span scratch = it.Scratch3; int totalHeaderBits = 0; - Vp8ModeScore rdBest = new Vp8ModeScore(); + Vp8ModeScore rdBest = new(); if (maxI4HeaderBits == 0) { @@ -118,9 +118,9 @@ internal static unsafe class QuantEnc rdBest.H = 211; // '211' is the value of VP8BitCost(0, 145) rdBest.SetRdScore(dqm.LambdaMode); it.StartI4(); - Vp8ModeScore rdi4 = new Vp8ModeScore(); - Vp8ModeScore rdTmp = new Vp8ModeScore(); - Vp8Residual res = new Vp8Residual(); + Vp8ModeScore rdi4 = new(); + Vp8ModeScore rdTmp = new(); + Vp8Residual res = new(); Span tmpLevels = stackalloc short[16]; do { @@ -220,9 +220,9 @@ internal static unsafe class QuantEnc Span tmpDst = it.YuvOut2.AsSpan(Vp8EncIterator.UOffEnc); Span dst0 = it.YuvOut.AsSpan(Vp8EncIterator.UOffEnc); Span dst = dst0; - Vp8ModeScore rdBest = new Vp8ModeScore(); - Vp8ModeScore rdUv = new Vp8ModeScore(); - Vp8Residual res = new Vp8Residual(); + Vp8ModeScore rdBest = new(); + Vp8ModeScore rdUv = new(); + Vp8Residual res = new(); int mode; rd.ModeUv = -1; diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8BandProbas.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8BandProbas.cs index 0c25fb4e4..90506efb8 100644 --- a/src/ImageSharp/Formats/Webp/Lossy/Vp8BandProbas.cs +++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8BandProbas.cs @@ -16,7 +16,7 @@ internal class Vp8BandProbas this.Probabilities = new Vp8ProbaArray[WebpConstants.NumCtx]; for (int i = 0; i < WebpConstants.NumCtx; i++) { - this.Probabilities[i] = new(); + this.Probabilities[i] = new Vp8ProbaArray(); } } diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8Costs.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8Costs.cs index a0fe03486..eee22159e 100644 --- a/src/ImageSharp/Formats/Webp/Lossy/Vp8Costs.cs +++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8Costs.cs @@ -13,7 +13,7 @@ internal class Vp8Costs this.Costs = new Vp8CostArray[WebpConstants.NumCtx]; for (int i = 0; i < WebpConstants.NumCtx; i++) { - this.Costs[i] = new(); + this.Costs[i] = new Vp8CostArray(); } } diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8Decoder.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8Decoder.cs index cd9a0dea2..3c8bafa1b 100644 --- a/src/ImageSharp/Formats/Webp/Lossy/Vp8Decoder.cs +++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8Decoder.cs @@ -25,7 +25,7 @@ internal class Vp8Decoder : IDisposable /// Used for allocating memory for the pixel data output and the temporary buffers. public Vp8Decoder(Vp8FrameHeader frameHeader, Vp8PictureHeader pictureHeader, Vp8SegmentHeader segmentHeader, Vp8Proba probabilities, MemoryAllocator memoryAllocator) { - this.FilterHeader = new(); + this.FilterHeader = new Vp8FilterHeader(); this.FrameHeader = frameHeader; this.PictureHeader = pictureHeader; this.SegmentHeader = segmentHeader; @@ -41,22 +41,22 @@ internal class Vp8Decoder : IDisposable this.FilterInfo = new Vp8FilterInfo[this.MbWidth]; for (int i = 0; i < this.MbWidth; i++) { - this.MacroBlockInfo[i] = new(); - this.MacroBlockData[i] = new(); - this.YuvTopSamples[i] = new(); - this.FilterInfo[i] = new(); + this.MacroBlockInfo[i] = new Vp8MacroBlock(); + this.MacroBlockData[i] = new Vp8MacroBlockData(); + this.YuvTopSamples[i] = new Vp8TopSamples(); + this.FilterInfo[i] = new Vp8FilterInfo(); } - this.MacroBlockInfo[this.MbWidth] = new(); + this.MacroBlockInfo[this.MbWidth] = new Vp8MacroBlock(); this.DeQuantMatrices = new Vp8QuantMatrix[WebpConstants.NumMbSegments]; this.FilterStrength = new Vp8FilterInfo[WebpConstants.NumMbSegments, 2]; for (int i = 0; i < WebpConstants.NumMbSegments; i++) { - this.DeQuantMatrices[i] = new(); + this.DeQuantMatrices[i] = new Vp8QuantMatrix(); for (int j = 0; j < 2; j++) { - this.FilterStrength[i, j] = new(); + this.FilterStrength[i, j] = new Vp8FilterInfo(); } } @@ -245,7 +245,7 @@ internal class Vp8Decoder : IDisposable public Vp8MacroBlock CurrentMacroBlock => this.MacroBlockInfo[this.MbX]; - public Vp8MacroBlock LeftMacroBlock => this.leftMacroBlock ??= new(); + public Vp8MacroBlock LeftMacroBlock => this.leftMacroBlock ??= new Vp8MacroBlock(); public Vp8MacroBlockData CurrentBlockData => this.MacroBlockData[this.MbX]; diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8EncIterator.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8EncIterator.cs index 7f57c81f8..a7c96edb7 100644 --- a/src/ImageSharp/Formats/Webp/Lossy/Vp8EncIterator.cs +++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8EncIterator.cs @@ -427,7 +427,7 @@ internal class Vp8EncIterator this.MakeIntra4Preds(); for (mode = 0; mode < maxMode; ++mode) { - histos[curHisto] = new(); + histos[curHisto] = new Vp8Histogram(); histos[curHisto].CollectHistogram(src, this.YuvP.AsSpan(Vp8Encoding.Vp8I4ModeOffsets[mode]), 0, 1); int alpha = histos[curHisto].GetAlpha(); diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8EncProba.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8EncProba.cs index a6faddc04..070e70574 100644 --- a/src/ImageSharp/Formats/Webp/Lossy/Vp8EncProba.cs +++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8EncProba.cs @@ -29,7 +29,7 @@ internal class Vp8EncProba this.Coeffs[i] = new Vp8BandProbas[WebpConstants.NumBands]; for (int j = 0; j < this.Coeffs[i].Length; j++) { - this.Coeffs[i][j] = new(); + this.Coeffs[i][j] = new Vp8BandProbas(); } } @@ -39,7 +39,7 @@ internal class Vp8EncProba this.Stats[i] = new Vp8Stats[WebpConstants.NumBands]; for (int j = 0; j < this.Stats[i].Length; j++) { - this.Stats[i][j] = new(); + this.Stats[i][j] = new Vp8Stats(); } } @@ -49,7 +49,7 @@ internal class Vp8EncProba this.LevelCost[i] = new Vp8Costs[WebpConstants.NumBands]; for (int j = 0; j < this.LevelCost[i].Length; j++) { - this.LevelCost[i][j] = new(); + this.LevelCost[i][j] = new Vp8Costs(); } } @@ -59,7 +59,7 @@ internal class Vp8EncProba this.RemappedCosts[i] = new Vp8Costs[16]; for (int j = 0; j < this.RemappedCosts[i].Length; j++) { - this.RemappedCosts[i][j] = new(); + this.RemappedCosts[i][j] = new Vp8Costs(); } } diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8Encoder.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8Encoder.cs index 608c5391b..e4ebe1473 100644 --- a/src/ImageSharp/Formats/Webp/Lossy/Vp8Encoder.cs +++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8Encoder.cs @@ -172,19 +172,19 @@ internal class Vp8Encoder : IDisposable this.MbInfo = new Vp8MacroBlockInfo[this.Mbw * this.Mbh]; for (int i = 0; i < this.MbInfo.Length; i++) { - this.MbInfo[i] = new(); + this.MbInfo[i] = new Vp8MacroBlockInfo(); } this.SegmentInfos = new Vp8SegmentInfo[4]; for (int i = 0; i < 4; i++) { - this.SegmentInfos[i] = new(); + this.SegmentInfos[i] = new Vp8SegmentInfo(); } - this.FilterHeader = new(); + this.FilterHeader = new Vp8FilterHeader(); int predSize = (((4 * this.Mbw) + 1) * ((4 * this.Mbh) + 1)) + this.PredsWidth + 1; this.PredsWidth = (4 * this.Mbw) + 1; - this.Proba = new(); + this.Proba = new Vp8EncProba(); this.Preds = new byte[predSize + this.PredsWidth + this.Mbw]; // Initialize with default values, which the reference c implementation uses, @@ -424,14 +424,14 @@ internal class Vp8Encoder : IDisposable this.uvAlpha /= totalMb; // Analysis is done, proceed to actual encoding. - this.SegmentHeader = new(4); + this.SegmentHeader = new Vp8EncSegmentHeader(4); this.AssignSegments(alphas); this.SetLoopParams(this.quality); // Initialize the bitwriter. int averageBytesPerMacroBlock = AverageBytesPerMb[this.BaseQuant >> 4]; int expectedSize = this.Mbw * this.Mbh * averageBytesPerMacroBlock; - this.bitWriter = new(expectedSize, this); + this.bitWriter = new Vp8BitWriter(expectedSize, this); // Stats-collection loop. this.StatLoop(width, height, yStride, uvStride); diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8Proba.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8Proba.cs index de03f3c93..0da6dfcad 100644 --- a/src/ImageSharp/Formats/Webp/Lossy/Vp8Proba.cs +++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8Proba.cs @@ -23,7 +23,7 @@ internal class Vp8Proba { for (int j = 0; j < WebpConstants.NumBands; j++) { - this.Bands[i, j] = new(); + this.Bands[i, j] = new Vp8BandProbas(); } } diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8Stats.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8Stats.cs index bd335f298..dda921a7c 100644 --- a/src/ImageSharp/Formats/Webp/Lossy/Vp8Stats.cs +++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8Stats.cs @@ -13,7 +13,7 @@ internal class Vp8Stats this.Stats = new Vp8StatsArray[WebpConstants.NumCtx]; for (int i = 0; i < WebpConstants.NumCtx; i++) { - this.Stats[i] = new(); + this.Stats[i] = new Vp8StatsArray(); } } diff --git a/src/ImageSharp/Formats/Webp/Lossy/WebpLossyDecoder.cs b/src/ImageSharp/Formats/Webp/Lossy/WebpLossyDecoder.cs index bd87b385c..f14df853c 100644 --- a/src/ImageSharp/Formats/Webp/Lossy/WebpLossyDecoder.cs +++ b/src/ImageSharp/Formats/Webp/Lossy/WebpLossyDecoder.cs @@ -150,7 +150,7 @@ internal sealed class WebpLossyDecoder { int offset = yMulWidth + x; Bgr24 bgr = pixelsBgr[offset]; - decodedPixelRow[x] = TPixel.FromBgra32(new(bgr.R, bgr.G, bgr.B, alphaSpan[offset])); + decodedPixelRow[x] = TPixel.FromBgra32(new Bgra32(bgr.R, bgr.G, bgr.B, alphaSpan[offset])); } } } @@ -1173,13 +1173,13 @@ internal sealed class WebpLossyDecoder pSize = sizeLeft; } - dec.Vp8BitReaders[p] = new(this.bitReader.Data, (uint)pSize, partStart); + dec.Vp8BitReaders[p] = new Vp8BitReader(this.bitReader.Data, (uint)pSize, partStart); partStart += pSize; sizeLeft -= pSize; sz = sz[3..]; } - dec.Vp8BitReaders[lastPart] = new(this.bitReader.Data, (uint)sizeLeft, partStart); + dec.Vp8BitReaders[lastPart] = new Vp8BitReader(this.bitReader.Data, (uint)sizeLeft, partStart); } private void ParseDequantizationIndices(Vp8Decoder decoder) diff --git a/src/ImageSharp/Formats/Webp/WebpAnimationDecoder.cs b/src/ImageSharp/Formats/Webp/WebpAnimationDecoder.cs index d19efec3b..173d9436d 100644 --- a/src/ImageSharp/Formats/Webp/WebpAnimationDecoder.cs +++ b/src/ImageSharp/Formats/Webp/WebpAnimationDecoder.cs @@ -93,7 +93,7 @@ internal class WebpAnimationDecoder : IDisposable ImageFrame? previousFrame = null; WebpFrameData? prevFrameData = null; - this.metadata = new(); + this.metadata = new ImageMetadata(); this.webpMetadata = this.metadata.GetWebpMetadata(); this.webpMetadata.RepeatCount = features.AnimationLoopCount; @@ -204,7 +204,7 @@ internal class WebpAnimationDecoder : IDisposable ImageFrame currentFrame; if (previousFrame is null) { - image = new(this.configuration, (int)width, (int)height, backgroundColor, this.metadata); + image = new Image(this.configuration, (int)width, (int)height, backgroundColor, this.metadata); currentFrame = image.Frames.RootFrame; SetFrameMetadata(currentFrame.Metadata, frameData); diff --git a/src/ImageSharp/Formats/Webp/WebpChunkParsingUtils.cs b/src/ImageSharp/Formats/Webp/WebpChunkParsingUtils.cs index a4e88e227..8df159dbf 100644 --- a/src/ImageSharp/Formats/Webp/WebpChunkParsingUtils.cs +++ b/src/ImageSharp/Formats/Webp/WebpChunkParsingUtils.cs @@ -118,7 +118,7 @@ internal static class WebpChunkParsingUtils Vp8BitReader bitReader = new(stream, remaining, memoryAllocator, partitionLength) { Remaining = remaining }; - return new() + return new WebpImageInfo { Width = width, Height = height, @@ -176,7 +176,7 @@ internal static class WebpChunkParsingUtils WebpThrowHelper.ThrowNotSupportedException($"Unexpected version number {version} found in VP8L header"); } - return new() + return new WebpImageInfo { Width = width, Height = height, @@ -239,7 +239,7 @@ internal static class WebpChunkParsingUtils uint height = ReadUInt24LittleEndian(stream, buffer) + 1; // Read all the chunks in the order they occur. - return new() + return new WebpImageInfo { Width = width, Height = height, @@ -358,7 +358,7 @@ internal static class WebpChunkParsingUtils if (metadata.ExifProfile != null) { - metadata.ExifProfile = new(exifData); + metadata.ExifProfile = new ExifProfile(exifData); } break; @@ -372,7 +372,7 @@ internal static class WebpChunkParsingUtils if (metadata.XmpProfile != null) { - metadata.XmpProfile = new(xmpData); + metadata.XmpProfile = new XmpProfile(xmpData); } break; diff --git a/src/ImageSharp/Formats/Webp/WebpDecoder.cs b/src/ImageSharp/Formats/Webp/WebpDecoder.cs index 41c5d60f7..48d725b26 100644 --- a/src/ImageSharp/Formats/Webp/WebpDecoder.cs +++ b/src/ImageSharp/Formats/Webp/WebpDecoder.cs @@ -25,7 +25,7 @@ public sealed class WebpDecoder : SpecializedImageDecoder Guard.NotNull(options, nameof(options)); Guard.NotNull(stream, nameof(stream)); - using WebpDecoderCore decoder = new(new() { GeneralOptions = options }); + using WebpDecoderCore decoder = new(new WebpDecoderOptions { GeneralOptions = options }); return decoder.Identify(options.Configuration, stream, cancellationToken); } diff --git a/src/ImageSharp/Formats/Webp/WebpDecoderCore.cs b/src/ImageSharp/Formats/Webp/WebpDecoderCore.cs index dfd80c838..51379a32a 100644 --- a/src/ImageSharp/Formats/Webp/WebpDecoderCore.cs +++ b/src/ImageSharp/Formats/Webp/WebpDecoderCore.cs @@ -93,7 +93,7 @@ internal sealed class WebpDecoderCore : ImageDecoderCore, IDisposable return animationDecoder.Decode(stream, this.webImageInfo.Features, this.webImageInfo.Width, this.webImageInfo.Height, fileSize); } - image = new(this.configuration, (int)this.webImageInfo.Width, (int)this.webImageInfo.Height, metadata); + image = new Image(this.configuration, (int)this.webImageInfo.Width, (int)this.webImageInfo.Height, metadata); Buffer2D pixels = image.GetRootFramePixelBuffer(); if (this.webImageInfo.IsLossless) { @@ -136,8 +136,8 @@ internal sealed class WebpDecoderCore : ImageDecoderCore, IDisposable ImageMetadata metadata = new(); using (this.webImageInfo = this.ReadVp8Info(stream, metadata, true)) { - return new( - new((int)this.webImageInfo.Width, (int)this.webImageInfo.Height), + return new ImageInfo( + new Size((int)this.webImageInfo.Width, (int)this.webImageInfo.Height), metadata); } } @@ -229,7 +229,7 @@ internal sealed class WebpDecoderCore : ImageDecoderCore, IDisposable default: WebpThrowHelper.ThrowImageFormatException("Unrecognized VP8 header"); return - new(); // this return will never be reached, because throw helper will throw an exception. + new WebpImageInfo(); // this return will never be reached, because throw helper will throw an exception. } } @@ -389,7 +389,7 @@ internal sealed class WebpDecoderCore : ImageDecoderCore, IDisposable return; } - metadata.XmpProfile = new(xmpData); + metadata.XmpProfile = new XmpProfile(xmpData); } } diff --git a/src/ImageSharp/Formats/Webp/WebpDecoderOptions.cs b/src/ImageSharp/Formats/Webp/WebpDecoderOptions.cs index 8840805b1..6fb15acbb 100644 --- a/src/ImageSharp/Formats/Webp/WebpDecoderOptions.cs +++ b/src/ImageSharp/Formats/Webp/WebpDecoderOptions.cs @@ -9,7 +9,7 @@ namespace SixLabors.ImageSharp.Formats.Webp; public sealed class WebpDecoderOptions : ISpecializedDecoderOptions { /// - public DecoderOptions GeneralOptions { get; init; } = new DecoderOptions(); + public DecoderOptions GeneralOptions { get; init; } = new(); /// /// Gets the flag to decide how to handle the background color Animation Chunk. diff --git a/src/ImageSharp/Formats/Webp/WebpFormat.cs b/src/ImageSharp/Formats/Webp/WebpFormat.cs index 1764182c5..9853ce7d7 100644 --- a/src/ImageSharp/Formats/Webp/WebpFormat.cs +++ b/src/ImageSharp/Formats/Webp/WebpFormat.cs @@ -15,7 +15,7 @@ public sealed class WebpFormat : IImageFormat /// /// Gets the shared instance. /// - public static WebpFormat Instance { get; } = new WebpFormat(); + public static WebpFormat Instance { get; } = new(); /// public string Name => "WEBP"; @@ -30,8 +30,8 @@ public sealed class WebpFormat : IImageFormat public IEnumerable FileExtensions => WebpConstants.FileExtensions; /// - public WebpMetadata CreateDefaultFormatMetadata() => new WebpMetadata(); + public WebpMetadata CreateDefaultFormatMetadata() => new(); /// - public WebpFrameMetadata CreateDefaultFormatFrameMetadata() => new WebpFrameMetadata(); + public WebpFrameMetadata CreateDefaultFormatFrameMetadata() => new(); } diff --git a/src/ImageSharp/Formats/Webp/WebpMetadata.cs b/src/ImageSharp/Formats/Webp/WebpMetadata.cs index 817addac5..1cdaeadb4 100644 --- a/src/ImageSharp/Formats/Webp/WebpMetadata.cs +++ b/src/ImageSharp/Formats/Webp/WebpMetadata.cs @@ -88,7 +88,7 @@ public class WebpMetadata : IFormatMetadata break; } - return new() + return new WebpMetadata { BitsPerPixel = bitsPerPixel, ColorType = color, @@ -126,7 +126,7 @@ public class WebpMetadata : IFormatMetadata break; } - return new(bpp) + return new PixelTypeInfo(bpp) { AlphaRepresentation = alpha, ColorType = colorType, diff --git a/src/ImageSharp/GraphicOptionsDefaultsExtensions.cs b/src/ImageSharp/GraphicOptionsDefaultsExtensions.cs index aa0590619..9412062cc 100644 --- a/src/ImageSharp/GraphicOptionsDefaultsExtensions.cs +++ b/src/ImageSharp/GraphicOptionsDefaultsExtensions.cs @@ -87,7 +87,7 @@ public static class GraphicOptionsDefaultsExtensions return go; } - GraphicsOptions configOptions = new GraphicsOptions(); + GraphicsOptions configOptions = new(); // capture the fallback so the same instance will always be returned in case its mutated configuration.Properties[typeof(GraphicsOptions)] = configOptions; diff --git a/src/ImageSharp/GraphicsOptions.cs b/src/ImageSharp/GraphicsOptions.cs index 4ac8585c3..dc3d17902 100644 --- a/src/ImageSharp/GraphicsOptions.cs +++ b/src/ImageSharp/GraphicsOptions.cs @@ -84,5 +84,5 @@ public class GraphicsOptions : IDeepCloneable public PixelAlphaCompositionMode AlphaCompositionMode { get; set; } = PixelAlphaCompositionMode.SrcOver; /// - public GraphicsOptions DeepClone() => new GraphicsOptions(this); + public GraphicsOptions DeepClone() => new(this); } diff --git a/src/ImageSharp/IO/ChunkedMemoryStream.cs b/src/ImageSharp/IO/ChunkedMemoryStream.cs index a5a401144..d62a64c23 100644 --- a/src/ImageSharp/IO/ChunkedMemoryStream.cs +++ b/src/ImageSharp/IO/ChunkedMemoryStream.cs @@ -27,7 +27,7 @@ internal sealed class ChunkedMemoryStream : Stream /// /// The memory allocator. public ChunkedMemoryStream(MemoryAllocator allocator) - => this.memoryChunkBuffer = new(allocator); + => this.memoryChunkBuffer = new MemoryChunkBuffer(allocator); /// public override bool CanRead => !this.isDisposed; diff --git a/src/ImageSharp/Image.Decode.cs b/src/ImageSharp/Image.Decode.cs index 7e61e5095..d2ee0f906 100644 --- a/src/ImageSharp/Image.Decode.cs +++ b/src/ImageSharp/Image.Decode.cs @@ -36,7 +36,7 @@ public abstract partial class Image width, height, configuration.PreferContiguousImageBuffers); - return new(configuration, uninitializedMemoryBuffer.FastMemoryGroup, width, height, metadata); + return new Image(configuration, uninitializedMemoryBuffer.FastMemoryGroup, width, height, metadata); } /// diff --git a/src/ImageSharp/Image.WrapMemory.cs b/src/ImageSharp/Image.WrapMemory.cs index ab2718f6c..03bec8bc6 100644 --- a/src/ImageSharp/Image.WrapMemory.cs +++ b/src/ImageSharp/Image.WrapMemory.cs @@ -53,7 +53,7 @@ public abstract partial class Image Guard.IsTrue(pixelMemory.Length >= (long)width * height, nameof(pixelMemory), "The length of the input memory is less than the specified image size"); MemoryGroup memorySource = MemoryGroup.Wrap(pixelMemory); - return new(configuration, memorySource, width, height, metadata); + return new Image(configuration, memorySource, width, height, metadata); } /// @@ -87,7 +87,7 @@ public abstract partial class Image int width, int height) where TPixel : unmanaged, IPixel - => WrapMemory(configuration, pixelMemory, width, height, new()); + => WrapMemory(configuration, pixelMemory, width, height, new ImageMetadata()); /// /// @@ -148,7 +148,7 @@ public abstract partial class Image Guard.IsTrue(pixelMemoryOwner.Memory.Length >= (long)width * height, nameof(pixelMemoryOwner), "The length of the input memory is less than the specified image size"); MemoryGroup memorySource = MemoryGroup.Wrap(pixelMemoryOwner); - return new(configuration, memorySource, width, height, metadata); + return new Image(configuration, memorySource, width, height, metadata); } /// @@ -171,7 +171,7 @@ public abstract partial class Image int width, int height) where TPixel : unmanaged, IPixel - => WrapMemory(configuration, pixelMemoryOwner, width, height, new()); + => WrapMemory(configuration, pixelMemoryOwner, width, height, new ImageMetadata()); /// /// Wraps an existing contiguous memory area of at least 'width' x 'height' pixels, @@ -235,7 +235,7 @@ public abstract partial class Image Guard.IsTrue(memoryManager.Memory.Length >= (long)width * height, nameof(byteMemory), "The length of the input memory is less than the specified image size"); MemoryGroup memorySource = MemoryGroup.Wrap(memoryManager.Memory); - return new(configuration, memorySource, width, height, metadata); + return new Image(configuration, memorySource, width, height, metadata); } /// @@ -269,7 +269,7 @@ public abstract partial class Image int width, int height) where TPixel : unmanaged, IPixel - => WrapMemory(configuration, byteMemory, width, height, new()); + => WrapMemory(configuration, byteMemory, width, height, new ImageMetadata()); /// /// @@ -333,7 +333,7 @@ public abstract partial class Image Guard.IsTrue(pixelMemoryOwner.Memory.Length >= (long)width * height, nameof(pixelMemoryOwner), "The length of the input memory is less than the specified image size"); MemoryGroup memorySource = MemoryGroup.Wrap(pixelMemoryOwner); - return new(configuration, memorySource, width, height, metadata); + return new Image(configuration, memorySource, width, height, metadata); } /// @@ -356,7 +356,7 @@ public abstract partial class Image int width, int height) where TPixel : unmanaged, IPixel - => WrapMemory(configuration, byteMemoryOwner, width, height, new()); + => WrapMemory(configuration, byteMemoryOwner, width, height, new ImageMetadata()); /// /// Wraps an existing contiguous memory area of at least 'width' x 'height' pixels, @@ -429,7 +429,7 @@ public abstract partial class Image Guard.MustBeGreaterThanOrEqualTo(bufferSizeInBytes / sizeof(TPixel), memoryManager.Memory.Span.Length, nameof(bufferSizeInBytes)); MemoryGroup memorySource = MemoryGroup.Wrap(memoryManager.Memory); - return new(configuration, memorySource, width, height, metadata); + return new Image(configuration, memorySource, width, height, metadata); } /// @@ -470,7 +470,7 @@ public abstract partial class Image int width, int height) where TPixel : unmanaged, IPixel - => WrapMemory(configuration, pointer, bufferSizeInBytes, width, height, new()); + => WrapMemory(configuration, pointer, bufferSizeInBytes, width, height, new ImageMetadata()); /// /// diff --git a/src/ImageSharp/Image.cs b/src/ImageSharp/Image.cs index 693b58db6..07b40a41a 100644 --- a/src/ImageSharp/Image.cs +++ b/src/ImageSharp/Image.cs @@ -47,7 +47,7 @@ public abstract partial class Image : IDisposable, IConfigurationProvider ImageMetadata metadata, int width, int height) - : this(configuration, pixelType, metadata, new(width, height)) + : this(configuration, pixelType, metadata, new Size(width, height)) { } diff --git a/src/ImageSharp/ImageFrame.LoadPixelData.cs b/src/ImageSharp/ImageFrame.LoadPixelData.cs index 90fe16bad..003a0349a 100644 --- a/src/ImageSharp/ImageFrame.LoadPixelData.cs +++ b/src/ImageSharp/ImageFrame.LoadPixelData.cs @@ -40,7 +40,7 @@ public partial class ImageFrame int count = width * height; Guard.MustBeGreaterThanOrEqualTo(data.Length, count, nameof(data)); - ImageFrame image = new ImageFrame(configuration, width, height); + ImageFrame image = new(configuration, width, height); data = data[..count]; data.CopyTo(image.PixelBuffer.FastMemoryGroup); diff --git a/src/ImageSharp/ImageFrame.cs b/src/ImageSharp/ImageFrame.cs index 686292bc7..3d4b63fad 100644 --- a/src/ImageSharp/ImageFrame.cs +++ b/src/ImageSharp/ImageFrame.cs @@ -25,7 +25,7 @@ public abstract partial class ImageFrame : IConfigurationProvider, IDisposable protected ImageFrame(Configuration configuration, int width, int height, ImageFrameMetadata metadata) { this.Configuration = configuration; - this.Size = new(width, height); + this.Size = new Size(width, height); this.Metadata = metadata; } diff --git a/src/ImageSharp/ImageFrameCollection{TPixel}.cs b/src/ImageSharp/ImageFrameCollection{TPixel}.cs index da76aa4ab..ad7d71974 100644 --- a/src/ImageSharp/ImageFrameCollection{TPixel}.cs +++ b/src/ImageSharp/ImageFrameCollection{TPixel}.cs @@ -23,7 +23,7 @@ public sealed class ImageFrameCollection : ImageFrameCollection, IEnumer this.parent = parent ?? throw new ArgumentNullException(nameof(parent)); // Frames are already cloned within the caller - this.frames.Add(new(parent.Configuration, width, height, backgroundColor)); + this.frames.Add(new ImageFrame(parent.Configuration, width, height, backgroundColor)); } internal ImageFrameCollection(Image parent, int width, int height, MemoryGroup memorySource) @@ -31,7 +31,7 @@ public sealed class ImageFrameCollection : ImageFrameCollection, IEnumer this.parent = parent ?? throw new ArgumentNullException(nameof(parent)); // Frames are already cloned within the caller - this.frames.Add(new(parent.Configuration, width, height, memorySource)); + this.frames.Add(new ImageFrame(parent.Configuration, width, height, memorySource)); } internal ImageFrameCollection(Image parent, IEnumerable> frames) @@ -269,7 +269,7 @@ public sealed class ImageFrameCollection : ImageFrameCollection, IEnumer this.frames.Remove(frame); - return new(this.parent.Configuration, this.parent.Metadata.DeepClone(), new[] { frame }); + return new Image(this.parent.Configuration, this.parent.Metadata.DeepClone(), new[] { frame }); } /// @@ -284,7 +284,7 @@ public sealed class ImageFrameCollection : ImageFrameCollection, IEnumer ImageFrame frame = this[index]; ImageFrame clonedFrame = frame.Clone(); - return new(this.parent.Configuration, this.parent.Metadata.DeepClone(), new[] { clonedFrame }); + return new Image(this.parent.Configuration, this.parent.Metadata.DeepClone(), new[] { clonedFrame }); } /// diff --git a/src/ImageSharp/ImageFrame{TPixel}.cs b/src/ImageSharp/ImageFrame{TPixel}.cs index ce673ba40..de71e77ca 100644 --- a/src/ImageSharp/ImageFrame{TPixel}.cs +++ b/src/ImageSharp/ImageFrame{TPixel}.cs @@ -81,7 +81,7 @@ public sealed class ImageFrame : ImageFrame, IPixelSource /// The height of the image in pixels. /// The color to clear the image with. internal ImageFrame(Configuration configuration, int width, int height, TPixel backgroundColor) - : this(configuration, width, height, backgroundColor, new()) + : this(configuration, width, height, backgroundColor, new ImageFrameMetadata()) { } @@ -114,7 +114,7 @@ public sealed class ImageFrame : ImageFrame, IPixelSource /// The height of the image in pixels. /// The memory source. internal ImageFrame(Configuration configuration, int width, int height, MemoryGroup memorySource) - : this(configuration, width, height, memorySource, new()) + : this(configuration, width, height, memorySource, new ImageFrameMetadata()) { } @@ -132,7 +132,7 @@ public sealed class ImageFrame : ImageFrame, IPixelSource Guard.MustBeGreaterThan(width, 0, nameof(width)); Guard.MustBeGreaterThan(height, 0, nameof(height)); - this.PixelBuffer = new(memorySource, width, height); + this.PixelBuffer = new Buffer2D(memorySource, width, height); } /// diff --git a/src/ImageSharp/Image{TPixel}.cs b/src/ImageSharp/Image{TPixel}.cs index 543d6ab43..dff8f577f 100644 --- a/src/ImageSharp/Image{TPixel}.cs +++ b/src/ImageSharp/Image{TPixel}.cs @@ -41,7 +41,7 @@ public sealed class Image : Image /// The height of the image in pixels. /// The color to initialize the pixels with. public Image(Configuration configuration, int width, int height, TPixel backgroundColor) - : this(configuration, width, height, backgroundColor, new()) + : this(configuration, width, height, backgroundColor, new ImageMetadata()) { } @@ -53,7 +53,7 @@ public sealed class Image : Image /// The height of the image in pixels. /// The color to initialize the pixels with. public Image(int width, int height, TPixel backgroundColor) - : this(Configuration.Default, width, height, backgroundColor, new()) + : this(Configuration.Default, width, height, backgroundColor, new ImageMetadata()) { } @@ -77,8 +77,8 @@ public sealed class Image : Image /// The height of the image in pixels. /// The images metadata. internal Image(Configuration configuration, int width, int height, ImageMetadata? metadata) - : base(configuration, TPixel.GetPixelTypeInfo(), metadata ?? new(), width, height) - => this.frames = new(this, width, height, default(TPixel)); + : base(configuration, TPixel.GetPixelTypeInfo(), metadata ?? new ImageMetadata(), width, height) + => this.frames = new ImageFrameCollection(this, width, height, default(TPixel)); /// /// Initializes a new instance of the class @@ -111,7 +111,7 @@ public sealed class Image : Image int height, ImageMetadata metadata) : base(configuration, TPixel.GetPixelTypeInfo(), metadata, width, height) - => this.frames = new(this, width, height, memoryGroup); + => this.frames = new ImageFrameCollection(this, width, height, memoryGroup); /// /// Initializes a new instance of the class @@ -128,8 +128,8 @@ public sealed class Image : Image int height, TPixel backgroundColor, ImageMetadata? metadata) - : base(configuration, TPixel.GetPixelTypeInfo(), metadata ?? new(), width, height) - => this.frames = new(this, width, height, backgroundColor); + : base(configuration, TPixel.GetPixelTypeInfo(), metadata ?? new ImageMetadata(), width, height) + => this.frames = new ImageFrameCollection(this, width, height, backgroundColor); /// /// Initializes a new instance of the class @@ -140,7 +140,7 @@ public sealed class Image : Image /// The frames that will be owned by this image instance. internal Image(Configuration configuration, ImageMetadata metadata, IEnumerable> frames) : base(configuration, TPixel.GetPixelTypeInfo(), metadata, ValidateFramesAndGetSize(frames)) - => this.frames = new(this, frames); + => this.frames = new ImageFrameCollection(this, frames); /// protected override ImageFrameCollection NonGenericFrameCollection => this.Frames; @@ -344,7 +344,7 @@ public sealed class Image : Image clonedFrames[i] = this.frames[i].Clone(configuration); } - return new(configuration, this.Metadata.DeepClone(), clonedFrames); + return new Image(configuration, this.Metadata.DeepClone(), clonedFrames); } /// @@ -363,7 +363,7 @@ public sealed class Image : Image clonedFrames[i] = this.frames[i].CloneAs(configuration); } - return new(configuration, this.Metadata.DeepClone(), clonedFrames); + return new Image(configuration, this.Metadata.DeepClone(), clonedFrames); } /// diff --git a/src/ImageSharp/Memory/Allocators/Internals/ManagedBufferBase.cs b/src/ImageSharp/Memory/Allocators/Internals/ManagedBufferBase.cs index cbf64e6a1..a6ed797d6 100644 --- a/src/ImageSharp/Memory/Allocators/Internals/ManagedBufferBase.cs +++ b/src/ImageSharp/Memory/Allocators/Internals/ManagedBufferBase.cs @@ -27,7 +27,7 @@ internal abstract class ManagedBufferBase : MemoryManager void* ptr = Unsafe.Add((void*)this.pinHandle.AddrOfPinnedObject(), elementIndex); // We should only pass pinnable:this, when GCHandle lifetime is managed by the MemoryManager instance. - return new(ptr, pinnable: this); + return new MemoryHandle(ptr, pinnable: this); } /// diff --git a/src/ImageSharp/Memory/Allocators/Internals/SharedArrayPoolBuffer{T}.cs b/src/ImageSharp/Memory/Allocators/Internals/SharedArrayPoolBuffer{T}.cs index 364aa05af..02bdf0f48 100644 --- a/src/ImageSharp/Memory/Allocators/Internals/SharedArrayPoolBuffer{T}.cs +++ b/src/ImageSharp/Memory/Allocators/Internals/SharedArrayPoolBuffer{T}.cs @@ -19,7 +19,7 @@ internal class SharedArrayPoolBuffer : ManagedBufferBase, IRefCounted { this.lengthInBytes = lengthInElements * Unsafe.SizeOf(); this.Array = ArrayPool.Shared.Rent(this.lengthInBytes); - this.lifetimeGuard = new(this.Array); + this.lifetimeGuard = new LifetimeGuard(this.Array); } public byte[]? Array { get; private set; } diff --git a/src/ImageSharp/Memory/Allocators/Internals/UniformUnmanagedMemoryPool.LifetimeGuards.cs b/src/ImageSharp/Memory/Allocators/Internals/UniformUnmanagedMemoryPool.LifetimeGuards.cs index a505548d2..e3b73204d 100644 --- a/src/ImageSharp/Memory/Allocators/Internals/UniformUnmanagedMemoryPool.LifetimeGuards.cs +++ b/src/ImageSharp/Memory/Allocators/Internals/UniformUnmanagedMemoryPool.LifetimeGuards.cs @@ -11,7 +11,7 @@ internal partial class UniformUnmanagedMemoryPool bool clear) where T : struct { - UnmanagedBuffer buffer = new UnmanagedBuffer(lengthInElements, new ReturnToPoolBufferLifetimeGuard(this, handle)); + UnmanagedBuffer buffer = new(lengthInElements, new ReturnToPoolBufferLifetimeGuard(this, handle)); if (clear) { buffer.Clear(); diff --git a/src/ImageSharp/Memory/Allocators/Internals/UniformUnmanagedMemoryPool.cs b/src/ImageSharp/Memory/Allocators/Internals/UniformUnmanagedMemoryPool.cs index d7212a41f..5e15e46e9 100644 --- a/src/ImageSharp/Memory/Allocators/Internals/UniformUnmanagedMemoryPool.cs +++ b/src/ImageSharp/Memory/Allocators/Internals/UniformUnmanagedMemoryPool.cs @@ -214,14 +214,14 @@ internal partial class UniformUnmanagedMemoryPool : System.Runtime.ConstrainedEx { lock (AllPools) { - AllPools.Add(new(pool)); + AllPools.Add(new WeakReference(pool)); // Invoke the timer callback more frequently, than trimSettings.TrimPeriodMilliseconds. // We are checking in the callback if enough time passed since the last trimming. If not, we do nothing. int period = settings.TrimPeriodMilliseconds / 4; if (trimTimer == null) { - trimTimer = new(_ => TimerCallback(), null, period, period); + trimTimer = new Timer(_ => TimerCallback(), null, period, period); } else if (settings.TrimPeriodMilliseconds < minTrimPeriodMilliseconds) { diff --git a/src/ImageSharp/Memory/Allocators/Internals/UnmanagedBuffer{T}.cs b/src/ImageSharp/Memory/Allocators/Internals/UnmanagedBuffer{T}.cs index 5e7f386fd..854b40e0c 100644 --- a/src/ImageSharp/Memory/Allocators/Internals/UnmanagedBuffer{T}.cs +++ b/src/ImageSharp/Memory/Allocators/Internals/UnmanagedBuffer{T}.cs @@ -35,7 +35,7 @@ internal sealed unsafe class UnmanagedBuffer : MemoryManager, IRefCounted { DebugGuard.NotDisposed(this.disposed == 1, this.GetType().Name); DebugGuard.NotDisposed(this.lifetimeGuard.IsDisposed, this.lifetimeGuard.GetType().Name); - return new(this.Pointer, this.lengthInElements); + return new Span(this.Pointer, this.lengthInElements); } /// @@ -48,7 +48,7 @@ internal sealed unsafe class UnmanagedBuffer : MemoryManager, IRefCounted this.lifetimeGuard.AddRef(); void* pbData = Unsafe.Add(this.Pointer, elementIndex); - return new(pbData, pinnable: this); + return new MemoryHandle(pbData, pinnable: this); } /// diff --git a/src/ImageSharp/Memory/Allocators/Internals/UnmanagedMemoryHandle.cs b/src/ImageSharp/Memory/Allocators/Internals/UnmanagedMemoryHandle.cs index 0fc5d2dea..6b31cadf4 100644 --- a/src/ImageSharp/Memory/Allocators/Internals/UnmanagedMemoryHandle.cs +++ b/src/ImageSharp/Memory/Allocators/Internals/UnmanagedMemoryHandle.cs @@ -64,7 +64,7 @@ internal struct UnmanagedMemoryHandle : IEquatable public static UnmanagedMemoryHandle Allocate(int lengthInBytes) { IntPtr handle = AllocateHandle(lengthInBytes); - return new(handle, lengthInBytes); + return new UnmanagedMemoryHandle(handle, lengthInBytes); } private static IntPtr AllocateHandle(int lengthInBytes) @@ -84,7 +84,7 @@ internal struct UnmanagedMemoryHandle : IEquatable counter++; Interlocked.Increment(ref totalOomRetries); - Interlocked.CompareExchange(ref lowMemoryMonitor, new(), null); + Interlocked.CompareExchange(ref lowMemoryMonitor, new object(), null); Monitor.Enter(lowMemoryMonitor); Monitor.Wait(lowMemoryMonitor, millisecondsTimeout: 1); Monitor.Exit(lowMemoryMonitor); diff --git a/src/ImageSharp/Memory/Allocators/UniformUnmanagedMemoryPoolMemoryAllocator.cs b/src/ImageSharp/Memory/Allocators/UniformUnmanagedMemoryPoolMemoryAllocator.cs index 203a5df69..10defe6cd 100644 --- a/src/ImageSharp/Memory/Allocators/UniformUnmanagedMemoryPoolMemoryAllocator.cs +++ b/src/ImageSharp/Memory/Allocators/UniformUnmanagedMemoryPoolMemoryAllocator.cs @@ -67,8 +67,8 @@ internal sealed class UniformUnmanagedMemoryPoolMemoryAllocator : MemoryAllocato this.poolBufferSizeInBytes = poolBufferSizeInBytes; this.poolCapacity = (int)(maxPoolSizeInBytes / poolBufferSizeInBytes); this.trimSettings = trimSettings; - this.pool = new(this.poolBufferSizeInBytes, this.poolCapacity, this.trimSettings); - this.nonPoolAllocator = new(unmanagedBufferSizeInBytes); + this.pool = new UniformUnmanagedMemoryPool(this.poolBufferSizeInBytes, this.poolCapacity, this.trimSettings); + this.nonPoolAllocator = new UnmanagedMemoryAllocator(unmanagedBufferSizeInBytes); } // This delegate allows overriding the method returning the available system memory, diff --git a/src/ImageSharp/Memory/Buffer2DExtensions.cs b/src/ImageSharp/Memory/Buffer2DExtensions.cs index b8ac5a584..f0fa1438d 100644 --- a/src/ImageSharp/Memory/Buffer2DExtensions.cs +++ b/src/ImageSharp/Memory/Buffer2DExtensions.cs @@ -126,7 +126,7 @@ public static class Buffer2DExtensions internal static Buffer2DRegion GetRegion(this Buffer2D buffer, int x, int y, int width, int height) where T : unmanaged => - new(buffer, new(x, y, width, height)); + new(buffer, new Rectangle(x, y, width, height)); /// /// Return a to the whole area of 'buffer' diff --git a/src/ImageSharp/Memory/Buffer2DRegion{T}.cs b/src/ImageSharp/Memory/Buffer2DRegion{T}.cs index c628bfd85..f4b257b58 100644 --- a/src/ImageSharp/Memory/Buffer2DRegion{T}.cs +++ b/src/ImageSharp/Memory/Buffer2DRegion{T}.cs @@ -124,8 +124,8 @@ public readonly struct Buffer2DRegion int x = this.Rectangle.X + rectangle.X; int y = this.Rectangle.Y + rectangle.Y; - rectangle = new(x, y, rectangle.Width, rectangle.Height); - return new(this.Buffer, rectangle); + rectangle = new Rectangle(x, y, rectangle.Width, rectangle.Height); + return new Buffer2DRegion(this.Buffer, rectangle); } /// diff --git a/src/ImageSharp/Memory/ByteMemoryOwner{T}.cs b/src/ImageSharp/Memory/ByteMemoryOwner{T}.cs index 91525e5ad..bc7175141 100644 --- a/src/ImageSharp/Memory/ByteMemoryOwner{T}.cs +++ b/src/ImageSharp/Memory/ByteMemoryOwner{T}.cs @@ -24,7 +24,7 @@ internal sealed class ByteMemoryOwner : IMemoryOwner public ByteMemoryOwner(IMemoryOwner memoryOwner) { this.memoryOwner = memoryOwner; - this.memoryManager = new(memoryOwner.Memory); + this.memoryManager = new ByteMemoryManager(memoryOwner.Memory); } /// diff --git a/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroupExtensions.cs b/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroupExtensions.cs index d2e4d00fb..148b5f6bf 100644 --- a/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroupExtensions.cs +++ b/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroupExtensions.cs @@ -77,7 +77,7 @@ internal static class MemoryGroupExtensions Guard.NotNull(source, nameof(source)); Guard.MustBeGreaterThanOrEqualTo(target.Length, source.TotalLength, nameof(target)); - MemoryGroupCursor cur = new MemoryGroupCursor(source); + MemoryGroupCursor cur = new(source); long position = 0; while (position < source.TotalLength) { @@ -100,7 +100,7 @@ internal static class MemoryGroupExtensions Guard.NotNull(target, nameof(target)); Guard.MustBeGreaterThanOrEqualTo(target.TotalLength, source.Length, nameof(target)); - MemoryGroupCursor cur = new MemoryGroupCursor(target); + MemoryGroupCursor cur = new(target); while (!source.IsEmpty) { @@ -126,8 +126,8 @@ internal static class MemoryGroupExtensions } long position = 0; - MemoryGroupCursor srcCur = new MemoryGroupCursor(source); - MemoryGroupCursor trgCur = new MemoryGroupCursor(target); + MemoryGroupCursor srcCur = new(source); + MemoryGroupCursor trgCur = new(target); while (position < source.TotalLength) { @@ -162,8 +162,8 @@ internal static class MemoryGroupExtensions } long position = 0; - MemoryGroupCursor srcCur = new MemoryGroupCursor(source); - MemoryGroupCursor trgCur = new MemoryGroupCursor(target); + MemoryGroupCursor srcCur = new(source); + MemoryGroupCursor trgCur = new(target); while (position < source.TotalLength) { diff --git a/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroupView{T}.cs b/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroupView{T}.cs index a3f45c8cf..76371e674 100644 --- a/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroupView{T}.cs +++ b/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroupView{T}.cs @@ -31,7 +31,7 @@ internal class MemoryGroupView : IMemoryGroup for (int i = 0; i < owner.Count; i++) { - this.memoryWrappers[i] = new(this, i); + this.memoryWrappers[i] = new MemoryOwnerWrapper(this, i); } } @@ -79,7 +79,7 @@ internal class MemoryGroupView : IMemoryGroup [MethodImpl(InliningOptions.ShortMethod)] public MemoryGroupEnumerator GetEnumerator() { - return new(this); + return new MemoryGroupEnumerator(this); } /// diff --git a/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.Consumed.cs b/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.Consumed.cs index 783ab53a5..950e2a019 100644 --- a/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.Consumed.cs +++ b/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.Consumed.cs @@ -18,7 +18,7 @@ internal abstract partial class MemoryGroup : base(bufferLength, totalLength) { this.source = source; - this.View = new(this); + this.View = new MemoryGroupView(this); } public override int Count @@ -33,7 +33,7 @@ internal abstract partial class MemoryGroup [MethodImpl(InliningOptions.ShortMethod)] public override MemoryGroupEnumerator GetEnumerator() { - return new(this); + return new MemoryGroupEnumerator(this); } /// diff --git a/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.Owned.cs b/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.Owned.cs index 937a1a32b..af896ee0e 100644 --- a/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.Owned.cs +++ b/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.Owned.cs @@ -23,7 +23,7 @@ internal abstract partial class MemoryGroup { this.memoryOwners = memoryOwners; this.Swappable = swappable; - this.View = new(this); + this.View = new MemoryGroupView(this); this.memoryGroupSpanCache = MemoryGroupSpanCache.Create(memoryOwners); } @@ -124,7 +124,7 @@ internal abstract partial class MemoryGroup public override void RecreateViewAfterSwap() { this.View.Invalidate(); - this.View = new(this); + this.View = new MemoryGroupView(this); } /// @@ -212,7 +212,7 @@ internal abstract partial class MemoryGroup public override unsafe MemoryHandle Pin(int elementIndex = 0) { void* pbData = Unsafe.Add(this.handle.Pointer, elementIndex); - return new(pbData); + return new MemoryHandle(pbData); } public override void Unpin() diff --git a/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.cs b/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.cs index 8e4c88104..d08bf248b 100644 --- a/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.cs +++ b/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.cs @@ -260,14 +260,14 @@ internal abstract partial class MemoryGroup : IMemoryGroup, IDisposable case SpanCacheMode.SinglePointer: { void* start = Unsafe.Add(this.memoryGroupSpanCache.SinglePointer, y * width); - return new(start, width); + return new Span(start, width); } case SpanCacheMode.MultiPointer: { this.GetMultiBufferPosition(y, width, out int bufferIdx, out int bufferStart); void* start = Unsafe.Add(this.memoryGroupSpanCache.MultiPointer[bufferIdx], bufferStart); - return new(start, width); + return new Span(start, width); } default: diff --git a/src/ImageSharp/Memory/MemoryAllocatorExtensions.cs b/src/ImageSharp/Memory/MemoryAllocatorExtensions.cs index 8178ca818..ff306e1e4 100644 --- a/src/ImageSharp/Memory/MemoryAllocatorExtensions.cs +++ b/src/ImageSharp/Memory/MemoryAllocatorExtensions.cs @@ -41,7 +41,7 @@ public static class MemoryAllocatorExtensions memoryGroup = memoryAllocator.AllocateGroup(groupLength, width, options); } - return new(memoryGroup, width, height); + return new Buffer2D(memoryGroup, width, height); } /// @@ -109,7 +109,7 @@ public static class MemoryAllocatorExtensions groupLength, width * alignmentMultiplier, options); - return new(memoryGroup, width, height); + return new Buffer2D(memoryGroup, width, height); } /// diff --git a/src/ImageSharp/Memory/RowInterval.cs b/src/ImageSharp/Memory/RowInterval.cs index 90a88d735..f27dc7441 100644 --- a/src/ImageSharp/Memory/RowInterval.cs +++ b/src/ImageSharp/Memory/RowInterval.cs @@ -79,7 +79,7 @@ public readonly struct RowInterval : IEquatable /// public override string ToString() => $"RowInterval [{this.Min}->{this.Max}]"; - internal RowInterval Slice(int start) => new RowInterval(this.Min + start, this.Max); + internal RowInterval Slice(int start) => new(this.Min + start, this.Max); - internal RowInterval Slice(int start, int length) => new RowInterval(this.Min + start, this.Min + start + length); + internal RowInterval Slice(int start, int length) => new(this.Min + start, this.Min + start + length); } diff --git a/src/ImageSharp/Memory/UnmanagedMemoryManager{T}.cs b/src/ImageSharp/Memory/UnmanagedMemoryManager{T}.cs index df845dd7a..7f3163af3 100644 --- a/src/ImageSharp/Memory/UnmanagedMemoryManager{T}.cs +++ b/src/ImageSharp/Memory/UnmanagedMemoryManager{T}.cs @@ -42,13 +42,13 @@ internal sealed unsafe class UnmanagedMemoryManager : MemoryManager /// public override Span GetSpan() { - return new(this.pointer, this.length); + return new Span(this.pointer, this.length); } /// public override MemoryHandle Pin(int elementIndex = 0) { - return new(((T*)this.pointer) + elementIndex, pinnable: this); + return new MemoryHandle(((T*)this.pointer) + elementIndex, pinnable: this); } /// diff --git a/src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs b/src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs index a58e22869..d2b88cbff 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs @@ -71,7 +71,7 @@ internal static class ExifEncodedStringHelpers { // Little-endian BOM string text = Encoding.Unicode.GetString(textBuffer[2..]); - encodedString = new(code, text); + encodedString = new EncodedString(code, text); return true; } @@ -79,14 +79,14 @@ internal static class ExifEncodedStringHelpers { // Big-endian BOM string text = Encoding.BigEndianUnicode.GetString(textBuffer[2..]); - encodedString = new(code, text); + encodedString = new EncodedString(code, text); return true; } } { string text = GetEncoding(code, order).GetString(textBuffer); - encodedString = new(code, text); + encodedString = new EncodedString(code, text); return true; } } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/ExifProfile.cs b/src/ImageSharp/Metadata/Profiles/Exif/ExifProfile.cs index f67395165..aa987bbe7 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/ExifProfile.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/ExifProfile.cs @@ -82,7 +82,7 @@ public sealed class ExifProfile : IDeepCloneable if (other.values != null) { - this.values = new(other.Values.Count); + this.values = new List(other.Values.Count); foreach (IExifValue value in other.Values) { diff --git a/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs b/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs index c04a6f78e..4cd4b4aac 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs @@ -669,7 +669,7 @@ internal abstract class BaseExifReader uint numerator = this.ConvertToUInt32(buffer[..4]); uint denominator = this.ConvertToUInt32(buffer.Slice(4, 4)); - return new(numerator, denominator, false); + return new Rational(numerator, denominator, false); } private sbyte ConvertToSignedByte(ReadOnlySpan buffer) => unchecked((sbyte)buffer[0]); @@ -696,7 +696,7 @@ internal abstract class BaseExifReader int numerator = this.ConvertToInt32(buffer[..4]); int denominator = this.ConvertToInt32(buffer.Slice(4, 4)); - return new(numerator, denominator, false); + return new SignedRational(numerator, denominator, false); } private short ConvertToSignedShort(ReadOnlySpan buffer) diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Byte.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Byte.cs index 9ee2cf2f4..ff74ecd19 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Byte.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Byte.cs @@ -9,15 +9,15 @@ public abstract partial class ExifTag /// /// Gets the FaxProfile exif tag. /// - public static ExifTag FaxProfile { get; } = new ExifTag(ExifTagValue.FaxProfile); + public static ExifTag FaxProfile { get; } = new(ExifTagValue.FaxProfile); /// /// Gets the ModeNumber exif tag. /// - public static ExifTag ModeNumber { get; } = new ExifTag(ExifTagValue.ModeNumber); + public static ExifTag ModeNumber { get; } = new(ExifTagValue.ModeNumber); /// /// Gets the GPSAltitudeRef exif tag. /// - public static ExifTag GPSAltitudeRef { get; } = new ExifTag(ExifTagValue.GPSAltitudeRef); + public static ExifTag GPSAltitudeRef { get; } = new(ExifTagValue.GPSAltitudeRef); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.ByteArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.ByteArray.cs index 00a9056d3..64d8e1437 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.ByteArray.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.ByteArray.cs @@ -9,40 +9,40 @@ public abstract partial class ExifTag /// /// Gets the ClipPath exif tag. /// - public static ExifTag ClipPath => new ExifTag(ExifTagValue.ClipPath); + public static ExifTag ClipPath => new(ExifTagValue.ClipPath); /// /// Gets the VersionYear exif tag. /// - public static ExifTag VersionYear => new ExifTag(ExifTagValue.VersionYear); + public static ExifTag VersionYear => new(ExifTagValue.VersionYear); /// /// Gets the XMP exif tag. /// - public static ExifTag XMP => new ExifTag(ExifTagValue.XMP); + public static ExifTag XMP => new(ExifTagValue.XMP); /// /// Gets the IPTC exif tag. /// - public static ExifTag IPTC => new ExifTag(ExifTagValue.IPTC); + public static ExifTag IPTC => new(ExifTagValue.IPTC); /// /// Gets the IccProfile exif tag. /// - public static ExifTag IccProfile => new ExifTag(ExifTagValue.IccProfile); + public static ExifTag IccProfile => new(ExifTagValue.IccProfile); /// /// Gets the CFAPattern2 exif tag. /// - public static ExifTag CFAPattern2 => new ExifTag(ExifTagValue.CFAPattern2); + public static ExifTag CFAPattern2 => new(ExifTagValue.CFAPattern2); /// /// Gets the TIFFEPStandardID exif tag. /// - public static ExifTag TIFFEPStandardID => new ExifTag(ExifTagValue.TIFFEPStandardID); + public static ExifTag TIFFEPStandardID => new(ExifTagValue.TIFFEPStandardID); /// /// Gets the GPSVersionID exif tag. /// - public static ExifTag GPSVersionID => new ExifTag(ExifTagValue.GPSVersionID); + public static ExifTag GPSVersionID => new(ExifTagValue.GPSVersionID); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.DoubleArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.DoubleArray.cs index 91d0c97b3..fded12261 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.DoubleArray.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.DoubleArray.cs @@ -9,20 +9,20 @@ public abstract partial class ExifTag /// /// Gets the PixelScale exif tag. /// - public static ExifTag PixelScale { get; } = new ExifTag(ExifTagValue.PixelScale); + public static ExifTag PixelScale { get; } = new(ExifTagValue.PixelScale); /// /// Gets the IntergraphMatrix exif tag. /// - public static ExifTag IntergraphMatrix { get; } = new ExifTag(ExifTagValue.IntergraphMatrix); + public static ExifTag IntergraphMatrix { get; } = new(ExifTagValue.IntergraphMatrix); /// /// Gets the ModelTiePoint exif tag. /// - public static ExifTag ModelTiePoint { get; } = new ExifTag(ExifTagValue.ModelTiePoint); + public static ExifTag ModelTiePoint { get; } = new(ExifTagValue.ModelTiePoint); /// /// Gets the ModelTransform exif tag. /// - public static ExifTag ModelTransform { get; } = new ExifTag(ExifTagValue.ModelTransform); + public static ExifTag ModelTransform { get; } = new(ExifTagValue.ModelTransform); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.EncodedString.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.EncodedString.cs index 4b53ba636..4cac0d0ca 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.EncodedString.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.EncodedString.cs @@ -9,15 +9,15 @@ public abstract partial class ExifTag /// /// Gets the UserComment exif tag. /// - public static ExifTag UserComment { get; } = new ExifTag(ExifTagValue.UserComment); + public static ExifTag UserComment { get; } = new(ExifTagValue.UserComment); /// /// Gets the GPSProcessingMethod exif tag. /// - public static ExifTag GPSProcessingMethod { get; } = new ExifTag(ExifTagValue.GPSProcessingMethod); + public static ExifTag GPSProcessingMethod { get; } = new(ExifTagValue.GPSProcessingMethod); /// /// Gets the GPSAreaInformation exif tag. /// - public static ExifTag GPSAreaInformation { get; } = new ExifTag(ExifTagValue.GPSAreaInformation); + public static ExifTag GPSAreaInformation { get; } = new(ExifTagValue.GPSAreaInformation); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Long.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Long.cs index f6c7c8ea7..5f9dfb4cd 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Long.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Long.cs @@ -9,105 +9,105 @@ public abstract partial class ExifTag /// /// Gets the SubfileType exif tag. /// - public static ExifTag SubfileType { get; } = new ExifTag(ExifTagValue.SubfileType); + public static ExifTag SubfileType { get; } = new(ExifTagValue.SubfileType); /// /// Gets the SubIFDOffset exif tag. /// - public static ExifTag SubIFDOffset { get; } = new ExifTag(ExifTagValue.SubIFDOffset); + public static ExifTag SubIFDOffset { get; } = new(ExifTagValue.SubIFDOffset); /// /// Gets the GPSIFDOffset exif tag. /// - public static ExifTag GPSIFDOffset { get; } = new ExifTag(ExifTagValue.GPSIFDOffset); + public static ExifTag GPSIFDOffset { get; } = new(ExifTagValue.GPSIFDOffset); /// /// Gets the T4Options exif tag. /// - public static ExifTag T4Options { get; } = new ExifTag(ExifTagValue.T4Options); + public static ExifTag T4Options { get; } = new(ExifTagValue.T4Options); /// /// Gets the T6Options exif tag. /// - public static ExifTag T6Options { get; } = new ExifTag(ExifTagValue.T6Options); + public static ExifTag T6Options { get; } = new(ExifTagValue.T6Options); /// /// Gets the XClipPathUnits exif tag. /// - public static ExifTag XClipPathUnits { get; } = new ExifTag(ExifTagValue.XClipPathUnits); + public static ExifTag XClipPathUnits { get; } = new(ExifTagValue.XClipPathUnits); /// /// Gets the YClipPathUnits exif tag. /// - public static ExifTag YClipPathUnits { get; } = new ExifTag(ExifTagValue.YClipPathUnits); + public static ExifTag YClipPathUnits { get; } = new(ExifTagValue.YClipPathUnits); /// /// Gets the ProfileType exif tag. /// - public static ExifTag ProfileType { get; } = new ExifTag(ExifTagValue.ProfileType); + public static ExifTag ProfileType { get; } = new(ExifTagValue.ProfileType); /// /// Gets the CodingMethods exif tag. /// - public static ExifTag CodingMethods { get; } = new ExifTag(ExifTagValue.CodingMethods); + public static ExifTag CodingMethods { get; } = new(ExifTagValue.CodingMethods); /// /// Gets the T82ptions exif tag. /// - public static ExifTag T82ptions { get; } = new ExifTag(ExifTagValue.T82ptions); + public static ExifTag T82ptions { get; } = new(ExifTagValue.T82ptions); /// /// Gets the JPEGInterchangeFormat exif tag. /// - public static ExifTag JPEGInterchangeFormat { get; } = new ExifTag(ExifTagValue.JPEGInterchangeFormat); + public static ExifTag JPEGInterchangeFormat { get; } = new(ExifTagValue.JPEGInterchangeFormat); /// /// Gets the JPEGInterchangeFormatLength exif tag. /// - public static ExifTag JPEGInterchangeFormatLength { get; } = new ExifTag(ExifTagValue.JPEGInterchangeFormatLength); + public static ExifTag JPEGInterchangeFormatLength { get; } = new(ExifTagValue.JPEGInterchangeFormatLength); /// /// Gets the MDFileTag exif tag. /// - public static ExifTag MDFileTag { get; } = new ExifTag(ExifTagValue.MDFileTag); + public static ExifTag MDFileTag { get; } = new(ExifTagValue.MDFileTag); /// /// Gets the StandardOutputSensitivity exif tag. /// - public static ExifTag StandardOutputSensitivity { get; } = new ExifTag(ExifTagValue.StandardOutputSensitivity); + public static ExifTag StandardOutputSensitivity { get; } = new(ExifTagValue.StandardOutputSensitivity); /// /// Gets the RecommendedExposureIndex exif tag. /// - public static ExifTag RecommendedExposureIndex { get; } = new ExifTag(ExifTagValue.RecommendedExposureIndex); + public static ExifTag RecommendedExposureIndex { get; } = new(ExifTagValue.RecommendedExposureIndex); /// /// Gets the ISOSpeed exif tag. /// - public static ExifTag ISOSpeed { get; } = new ExifTag(ExifTagValue.ISOSpeed); + public static ExifTag ISOSpeed { get; } = new(ExifTagValue.ISOSpeed); /// /// Gets the ISOSpeedLatitudeyyy exif tag. /// - public static ExifTag ISOSpeedLatitudeyyy { get; } = new ExifTag(ExifTagValue.ISOSpeedLatitudeyyy); + public static ExifTag ISOSpeedLatitudeyyy { get; } = new(ExifTagValue.ISOSpeedLatitudeyyy); /// /// Gets the ISOSpeedLatitudezzz exif tag. /// - public static ExifTag ISOSpeedLatitudezzz { get; } = new ExifTag(ExifTagValue.ISOSpeedLatitudezzz); + public static ExifTag ISOSpeedLatitudezzz { get; } = new(ExifTagValue.ISOSpeedLatitudezzz); /// /// Gets the FaxRecvParams exif tag. /// - public static ExifTag FaxRecvParams { get; } = new ExifTag(ExifTagValue.FaxRecvParams); + public static ExifTag FaxRecvParams { get; } = new(ExifTagValue.FaxRecvParams); /// /// Gets the FaxRecvTime exif tag. /// - public static ExifTag FaxRecvTime { get; } = new ExifTag(ExifTagValue.FaxRecvTime); + public static ExifTag FaxRecvTime { get; } = new(ExifTagValue.FaxRecvTime); /// /// Gets the ImageNumber exif tag. /// - public static ExifTag ImageNumber { get; } = new ExifTag(ExifTagValue.ImageNumber); + public static ExifTag ImageNumber { get; } = new(ExifTagValue.ImageNumber); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.LongArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.LongArray.cs index 4767ca852..e6821651a 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.LongArray.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.LongArray.cs @@ -9,55 +9,55 @@ public abstract partial class ExifTag /// /// Gets the FreeOffsets exif tag. /// - public static ExifTag FreeOffsets { get; } = new ExifTag(ExifTagValue.FreeOffsets); + public static ExifTag FreeOffsets { get; } = new(ExifTagValue.FreeOffsets); /// /// Gets the FreeByteCounts exif tag. /// - public static ExifTag FreeByteCounts { get; } = new ExifTag(ExifTagValue.FreeByteCounts); + public static ExifTag FreeByteCounts { get; } = new(ExifTagValue.FreeByteCounts); /// /// Gets the ColorResponseUnit exif tag. /// - public static ExifTag ColorResponseUnit { get; } = new ExifTag(ExifTagValue.ColorResponseUnit); + public static ExifTag ColorResponseUnit { get; } = new(ExifTagValue.ColorResponseUnit); /// /// Gets the SMinSampleValue exif tag. /// - public static ExifTag SMinSampleValue { get; } = new ExifTag(ExifTagValue.SMinSampleValue); + public static ExifTag SMinSampleValue { get; } = new(ExifTagValue.SMinSampleValue); /// /// Gets the SMaxSampleValue exif tag. /// - public static ExifTag SMaxSampleValue { get; } = new ExifTag(ExifTagValue.SMaxSampleValue); + public static ExifTag SMaxSampleValue { get; } = new(ExifTagValue.SMaxSampleValue); /// /// Gets the JPEGQTables exif tag. /// - public static ExifTag JPEGQTables { get; } = new ExifTag(ExifTagValue.JPEGQTables); + public static ExifTag JPEGQTables { get; } = new(ExifTagValue.JPEGQTables); /// /// Gets the JPEGDCTables exif tag. /// - public static ExifTag JPEGDCTables { get; } = new ExifTag(ExifTagValue.JPEGDCTables); + public static ExifTag JPEGDCTables { get; } = new(ExifTagValue.JPEGDCTables); /// /// Gets the JPEGACTables exif tag. /// - public static ExifTag JPEGACTables { get; } = new ExifTag(ExifTagValue.JPEGACTables); + public static ExifTag JPEGACTables { get; } = new(ExifTagValue.JPEGACTables); /// /// Gets the StripRowCounts exif tag. /// - public static ExifTag StripRowCounts { get; } = new ExifTag(ExifTagValue.StripRowCounts); + public static ExifTag StripRowCounts { get; } = new(ExifTagValue.StripRowCounts); /// /// Gets the IntergraphRegisters exif tag. /// - public static ExifTag IntergraphRegisters { get; } = new ExifTag(ExifTagValue.IntergraphRegisters); + public static ExifTag IntergraphRegisters { get; } = new(ExifTagValue.IntergraphRegisters); /// /// Gets the offset to child IFDs exif tag. /// - public static ExifTag SubIFDs { get; } = new ExifTag(ExifTagValue.SubIFDs); + public static ExifTag SubIFDs { get; } = new(ExifTagValue.SubIFDs); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Number.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Number.cs index 2018e4cea..e023beeb7 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Number.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Number.cs @@ -9,45 +9,45 @@ public abstract partial class ExifTag /// /// Gets the ImageWidth exif tag. /// - public static ExifTag ImageWidth { get; } = new ExifTag(ExifTagValue.ImageWidth); + public static ExifTag ImageWidth { get; } = new(ExifTagValue.ImageWidth); /// /// Gets the ImageLength exif tag. /// - public static ExifTag ImageLength { get; } = new ExifTag(ExifTagValue.ImageLength); + public static ExifTag ImageLength { get; } = new(ExifTagValue.ImageLength); /// /// Gets the RowsPerStrip exif tag. /// - public static ExifTag RowsPerStrip { get; } = new ExifTag(ExifTagValue.RowsPerStrip); + public static ExifTag RowsPerStrip { get; } = new(ExifTagValue.RowsPerStrip); /// /// Gets the TileWidth exif tag. /// - public static ExifTag TileWidth { get; } = new ExifTag(ExifTagValue.TileWidth); + public static ExifTag TileWidth { get; } = new(ExifTagValue.TileWidth); /// /// Gets the TileLength exif tag. /// - public static ExifTag TileLength { get; } = new ExifTag(ExifTagValue.TileLength); + public static ExifTag TileLength { get; } = new(ExifTagValue.TileLength); /// /// Gets the BadFaxLines exif tag. /// - public static ExifTag BadFaxLines { get; } = new ExifTag(ExifTagValue.BadFaxLines); + public static ExifTag BadFaxLines { get; } = new(ExifTagValue.BadFaxLines); /// /// Gets the ConsecutiveBadFaxLines exif tag. /// - public static ExifTag ConsecutiveBadFaxLines { get; } = new ExifTag(ExifTagValue.ConsecutiveBadFaxLines); + public static ExifTag ConsecutiveBadFaxLines { get; } = new(ExifTagValue.ConsecutiveBadFaxLines); /// /// Gets the PixelXDimension exif tag. /// - public static ExifTag PixelXDimension { get; } = new ExifTag(ExifTagValue.PixelXDimension); + public static ExifTag PixelXDimension { get; } = new(ExifTagValue.PixelXDimension); /// /// Gets the PixelYDimension exif tag. /// - public static ExifTag PixelYDimension { get; } = new ExifTag(ExifTagValue.PixelYDimension); + public static ExifTag PixelYDimension { get; } = new(ExifTagValue.PixelYDimension); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.NumberArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.NumberArray.cs index cd8968141..6a7438fc6 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.NumberArray.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.NumberArray.cs @@ -9,25 +9,25 @@ public abstract partial class ExifTag /// /// Gets the StripOffsets exif tag. /// - public static ExifTag StripOffsets { get; } = new ExifTag(ExifTagValue.StripOffsets); + public static ExifTag StripOffsets { get; } = new(ExifTagValue.StripOffsets); /// /// Gets the StripByteCounts exif tag. /// - public static ExifTag StripByteCounts { get; } = new ExifTag(ExifTagValue.StripByteCounts); + public static ExifTag StripByteCounts { get; } = new(ExifTagValue.StripByteCounts); /// /// Gets the TileByteCounts exif tag. /// - public static ExifTag TileByteCounts { get; } = new ExifTag(ExifTagValue.TileByteCounts); + public static ExifTag TileByteCounts { get; } = new(ExifTagValue.TileByteCounts); /// /// Gets the TileOffsets exif tag. /// - public static ExifTag TileOffsets { get; } = new ExifTag(ExifTagValue.TileOffsets); + public static ExifTag TileOffsets { get; } = new(ExifTagValue.TileOffsets); /// /// Gets the ImageLayer exif tag. /// - public static ExifTag ImageLayer { get; } = new ExifTag(ExifTagValue.ImageLayer); + public static ExifTag ImageLayer { get; } = new(ExifTagValue.ImageLayer); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Rational.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Rational.cs index e4fe13fe5..02526ac34 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Rational.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Rational.cs @@ -9,165 +9,165 @@ public abstract partial class ExifTag /// /// Gets the XPosition exif tag. /// - public static ExifTag XPosition { get; } = new ExifTag(ExifTagValue.XPosition); + public static ExifTag XPosition { get; } = new(ExifTagValue.XPosition); /// /// Gets the YPosition exif tag. /// - public static ExifTag YPosition { get; } = new ExifTag(ExifTagValue.YPosition); + public static ExifTag YPosition { get; } = new(ExifTagValue.YPosition); /// /// Gets the XResolution exif tag. /// - public static ExifTag XResolution { get; } = new ExifTag(ExifTagValue.XResolution); + public static ExifTag XResolution { get; } = new(ExifTagValue.XResolution); /// /// Gets the YResolution exif tag. /// - public static ExifTag YResolution { get; } = new ExifTag(ExifTagValue.YResolution); + public static ExifTag YResolution { get; } = new(ExifTagValue.YResolution); /// /// Gets the BatteryLevel exif tag. /// - public static ExifTag BatteryLevel { get; } = new ExifTag(ExifTagValue.BatteryLevel); + public static ExifTag BatteryLevel { get; } = new(ExifTagValue.BatteryLevel); /// /// Gets the ExposureTime exif tag. /// - public static ExifTag ExposureTime { get; } = new ExifTag(ExifTagValue.ExposureTime); + public static ExifTag ExposureTime { get; } = new(ExifTagValue.ExposureTime); /// /// Gets the FNumber exif tag. /// - public static ExifTag FNumber { get; } = new ExifTag(ExifTagValue.FNumber); + public static ExifTag FNumber { get; } = new(ExifTagValue.FNumber); /// /// Gets the MDScalePixel exif tag. /// - public static ExifTag MDScalePixel { get; } = new ExifTag(ExifTagValue.MDScalePixel); + public static ExifTag MDScalePixel { get; } = new(ExifTagValue.MDScalePixel); /// /// Gets the CompressedBitsPerPixel exif tag. /// - public static ExifTag CompressedBitsPerPixel { get; } = new ExifTag(ExifTagValue.CompressedBitsPerPixel); + public static ExifTag CompressedBitsPerPixel { get; } = new(ExifTagValue.CompressedBitsPerPixel); /// /// Gets the ApertureValue exif tag. /// - public static ExifTag ApertureValue { get; } = new ExifTag(ExifTagValue.ApertureValue); + public static ExifTag ApertureValue { get; } = new(ExifTagValue.ApertureValue); /// /// Gets the MaxApertureValue exif tag. /// - public static ExifTag MaxApertureValue { get; } = new ExifTag(ExifTagValue.MaxApertureValue); + public static ExifTag MaxApertureValue { get; } = new(ExifTagValue.MaxApertureValue); /// /// Gets the SubjectDistance exif tag. /// - public static ExifTag SubjectDistance { get; } = new ExifTag(ExifTagValue.SubjectDistance); + public static ExifTag SubjectDistance { get; } = new(ExifTagValue.SubjectDistance); /// /// Gets the FocalLength exif tag. /// - public static ExifTag FocalLength { get; } = new ExifTag(ExifTagValue.FocalLength); + public static ExifTag FocalLength { get; } = new(ExifTagValue.FocalLength); /// /// Gets the FlashEnergy2 exif tag. /// - public static ExifTag FlashEnergy2 { get; } = new ExifTag(ExifTagValue.FlashEnergy2); + public static ExifTag FlashEnergy2 { get; } = new(ExifTagValue.FlashEnergy2); /// /// Gets the FocalPlaneXResolution2 exif tag. /// - public static ExifTag FocalPlaneXResolution2 { get; } = new ExifTag(ExifTagValue.FocalPlaneXResolution2); + public static ExifTag FocalPlaneXResolution2 { get; } = new(ExifTagValue.FocalPlaneXResolution2); /// /// Gets the FocalPlaneYResolution2 exif tag. /// - public static ExifTag FocalPlaneYResolution2 { get; } = new ExifTag(ExifTagValue.FocalPlaneYResolution2); + public static ExifTag FocalPlaneYResolution2 { get; } = new(ExifTagValue.FocalPlaneYResolution2); /// /// Gets the ExposureIndex2 exif tag. /// - public static ExifTag ExposureIndex2 { get; } = new ExifTag(ExifTagValue.ExposureIndex2); + public static ExifTag ExposureIndex2 { get; } = new(ExifTagValue.ExposureIndex2); /// /// Gets the Humidity exif tag. /// - public static ExifTag Humidity { get; } = new ExifTag(ExifTagValue.Humidity); + public static ExifTag Humidity { get; } = new(ExifTagValue.Humidity); /// /// Gets the Pressure exif tag. /// - public static ExifTag Pressure { get; } = new ExifTag(ExifTagValue.Pressure); + public static ExifTag Pressure { get; } = new(ExifTagValue.Pressure); /// /// Gets the Acceleration exif tag. /// - public static ExifTag Acceleration { get; } = new ExifTag(ExifTagValue.Acceleration); + public static ExifTag Acceleration { get; } = new(ExifTagValue.Acceleration); /// /// Gets the FlashEnergy exif tag. /// - public static ExifTag FlashEnergy { get; } = new ExifTag(ExifTagValue.FlashEnergy); + public static ExifTag FlashEnergy { get; } = new(ExifTagValue.FlashEnergy); /// /// Gets the FocalPlaneXResolution exif tag. /// - public static ExifTag FocalPlaneXResolution { get; } = new ExifTag(ExifTagValue.FocalPlaneXResolution); + public static ExifTag FocalPlaneXResolution { get; } = new(ExifTagValue.FocalPlaneXResolution); /// /// Gets the FocalPlaneYResolution exif tag. /// - public static ExifTag FocalPlaneYResolution { get; } = new ExifTag(ExifTagValue.FocalPlaneYResolution); + public static ExifTag FocalPlaneYResolution { get; } = new(ExifTagValue.FocalPlaneYResolution); /// /// Gets the ExposureIndex exif tag. /// - public static ExifTag ExposureIndex { get; } = new ExifTag(ExifTagValue.ExposureIndex); + public static ExifTag ExposureIndex { get; } = new(ExifTagValue.ExposureIndex); /// /// Gets the DigitalZoomRatio exif tag. /// - public static ExifTag DigitalZoomRatio { get; } = new ExifTag(ExifTagValue.DigitalZoomRatio); + public static ExifTag DigitalZoomRatio { get; } = new(ExifTagValue.DigitalZoomRatio); /// /// Gets the GPSAltitude exif tag. /// - public static ExifTag GPSAltitude { get; } = new ExifTag(ExifTagValue.GPSAltitude); + public static ExifTag GPSAltitude { get; } = new(ExifTagValue.GPSAltitude); /// /// Gets the GPSDOP exif tag. /// - public static ExifTag GPSDOP { get; } = new ExifTag(ExifTagValue.GPSDOP); + public static ExifTag GPSDOP { get; } = new(ExifTagValue.GPSDOP); /// /// Gets the GPSSpeed exif tag. /// - public static ExifTag GPSSpeed { get; } = new ExifTag(ExifTagValue.GPSSpeed); + public static ExifTag GPSSpeed { get; } = new(ExifTagValue.GPSSpeed); /// /// Gets the GPSTrack exif tag. /// - public static ExifTag GPSTrack { get; } = new ExifTag(ExifTagValue.GPSTrack); + public static ExifTag GPSTrack { get; } = new(ExifTagValue.GPSTrack); /// /// Gets the GPSImgDirection exif tag. /// - public static ExifTag GPSImgDirection { get; } = new ExifTag(ExifTagValue.GPSImgDirection); + public static ExifTag GPSImgDirection { get; } = new(ExifTagValue.GPSImgDirection); /// /// Gets the GPSDestBearing exif tag. /// - public static ExifTag GPSDestBearing { get; } = new ExifTag(ExifTagValue.GPSDestBearing); + public static ExifTag GPSDestBearing { get; } = new(ExifTagValue.GPSDestBearing); /// /// Gets the GPSDestDistance exif tag. /// - public static ExifTag GPSDestDistance { get; } = new ExifTag(ExifTagValue.GPSDestDistance); + public static ExifTag GPSDestDistance { get; } = new(ExifTagValue.GPSDestDistance); /// /// Gets the GPSHPositioningError exif tag. /// - public static ExifTag GPSHPositioningError { get; } = new ExifTag(ExifTagValue.GPSHPositioningError); + public static ExifTag GPSHPositioningError { get; } = new(ExifTagValue.GPSHPositioningError); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.RationalArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.RationalArray.cs index 8b764c3f7..4ba140441 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.RationalArray.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.RationalArray.cs @@ -9,50 +9,50 @@ public abstract partial class ExifTag /// /// Gets the WhitePoint exif tag. /// - public static ExifTag WhitePoint { get; } = new ExifTag(ExifTagValue.WhitePoint); + public static ExifTag WhitePoint { get; } = new(ExifTagValue.WhitePoint); /// /// Gets the PrimaryChromaticities exif tag. /// - public static ExifTag PrimaryChromaticities { get; } = new ExifTag(ExifTagValue.PrimaryChromaticities); + public static ExifTag PrimaryChromaticities { get; } = new(ExifTagValue.PrimaryChromaticities); /// /// Gets the YCbCrCoefficients exif tag. /// - public static ExifTag YCbCrCoefficients { get; } = new ExifTag(ExifTagValue.YCbCrCoefficients); + public static ExifTag YCbCrCoefficients { get; } = new(ExifTagValue.YCbCrCoefficients); /// /// Gets the ReferenceBlackWhite exif tag. /// - public static ExifTag ReferenceBlackWhite { get; } = new ExifTag(ExifTagValue.ReferenceBlackWhite); + public static ExifTag ReferenceBlackWhite { get; } = new(ExifTagValue.ReferenceBlackWhite); /// /// Gets the GPSLatitude exif tag. /// - public static ExifTag GPSLatitude { get; } = new ExifTag(ExifTagValue.GPSLatitude); + public static ExifTag GPSLatitude { get; } = new(ExifTagValue.GPSLatitude); /// /// Gets the GPSLongitude exif tag. /// - public static ExifTag GPSLongitude { get; } = new ExifTag(ExifTagValue.GPSLongitude); + public static ExifTag GPSLongitude { get; } = new(ExifTagValue.GPSLongitude); /// /// Gets the GPSTimestamp exif tag. /// - public static ExifTag GPSTimestamp { get; } = new ExifTag(ExifTagValue.GPSTimestamp); + public static ExifTag GPSTimestamp { get; } = new(ExifTagValue.GPSTimestamp); /// /// Gets the GPSDestLatitude exif tag. /// - public static ExifTag GPSDestLatitude { get; } = new ExifTag(ExifTagValue.GPSDestLatitude); + public static ExifTag GPSDestLatitude { get; } = new(ExifTagValue.GPSDestLatitude); /// /// Gets the GPSDestLongitude exif tag. /// - public static ExifTag GPSDestLongitude { get; } = new ExifTag(ExifTagValue.GPSDestLongitude); + public static ExifTag GPSDestLongitude { get; } = new(ExifTagValue.GPSDestLongitude); /// /// Gets the LensSpecification exif tag. /// - public static ExifTag LensSpecification { get; } = new ExifTag(ExifTagValue.LensSpecification); + public static ExifTag LensSpecification { get; } = new(ExifTagValue.LensSpecification); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Short.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Short.cs index aeeda58bb..52972811e 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Short.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Short.cs @@ -9,235 +9,235 @@ public abstract partial class ExifTag /// /// Gets the OldSubfileType exif tag. /// - public static ExifTag OldSubfileType { get; } = new ExifTag(ExifTagValue.OldSubfileType); + public static ExifTag OldSubfileType { get; } = new(ExifTagValue.OldSubfileType); /// /// Gets the Compression exif tag. /// - public static ExifTag Compression { get; } = new ExifTag(ExifTagValue.Compression); + public static ExifTag Compression { get; } = new(ExifTagValue.Compression); /// /// Gets the PhotometricInterpretation exif tag. /// - public static ExifTag PhotometricInterpretation { get; } = new ExifTag(ExifTagValue.PhotometricInterpretation); + public static ExifTag PhotometricInterpretation { get; } = new(ExifTagValue.PhotometricInterpretation); /// /// Gets the Thresholding exif tag. /// - public static ExifTag Thresholding { get; } = new ExifTag(ExifTagValue.Thresholding); + public static ExifTag Thresholding { get; } = new(ExifTagValue.Thresholding); /// /// Gets the CellWidth exif tag. /// - public static ExifTag CellWidth { get; } = new ExifTag(ExifTagValue.CellWidth); + public static ExifTag CellWidth { get; } = new(ExifTagValue.CellWidth); /// /// Gets the CellLength exif tag. /// - public static ExifTag CellLength { get; } = new ExifTag(ExifTagValue.CellLength); + public static ExifTag CellLength { get; } = new(ExifTagValue.CellLength); /// /// Gets the FillOrder exif tag. /// - public static ExifTag FillOrder { get; } = new ExifTag(ExifTagValue.FillOrder); + public static ExifTag FillOrder { get; } = new(ExifTagValue.FillOrder); /// /// Gets the Orientation exif tag. /// - public static ExifTag Orientation { get; } = new ExifTag(ExifTagValue.Orientation); + public static ExifTag Orientation { get; } = new(ExifTagValue.Orientation); /// /// Gets the SamplesPerPixel exif tag. /// - public static ExifTag SamplesPerPixel { get; } = new ExifTag(ExifTagValue.SamplesPerPixel); + public static ExifTag SamplesPerPixel { get; } = new(ExifTagValue.SamplesPerPixel); /// /// Gets the PlanarConfiguration exif tag. /// - public static ExifTag PlanarConfiguration { get; } = new ExifTag(ExifTagValue.PlanarConfiguration); + public static ExifTag PlanarConfiguration { get; } = new(ExifTagValue.PlanarConfiguration); /// /// Gets the Predictor exif tag. /// - public static ExifTag Predictor { get; } = new ExifTag(ExifTagValue.Predictor); + public static ExifTag Predictor { get; } = new(ExifTagValue.Predictor); /// /// Gets the GrayResponseUnit exif tag. /// - public static ExifTag GrayResponseUnit { get; } = new ExifTag(ExifTagValue.GrayResponseUnit); + public static ExifTag GrayResponseUnit { get; } = new(ExifTagValue.GrayResponseUnit); /// /// Gets the ResolutionUnit exif tag. /// - public static ExifTag ResolutionUnit { get; } = new ExifTag(ExifTagValue.ResolutionUnit); + public static ExifTag ResolutionUnit { get; } = new(ExifTagValue.ResolutionUnit); /// /// Gets the CleanFaxData exif tag. /// - public static ExifTag CleanFaxData { get; } = new ExifTag(ExifTagValue.CleanFaxData); + public static ExifTag CleanFaxData { get; } = new(ExifTagValue.CleanFaxData); /// /// Gets the InkSet exif tag. /// - public static ExifTag InkSet { get; } = new ExifTag(ExifTagValue.InkSet); + public static ExifTag InkSet { get; } = new(ExifTagValue.InkSet); /// /// Gets the NumberOfInks exif tag. /// - public static ExifTag NumberOfInks { get; } = new ExifTag(ExifTagValue.NumberOfInks); + public static ExifTag NumberOfInks { get; } = new(ExifTagValue.NumberOfInks); /// /// Gets the DotRange exif tag. /// - public static ExifTag DotRange { get; } = new ExifTag(ExifTagValue.DotRange); + public static ExifTag DotRange { get; } = new(ExifTagValue.DotRange); /// /// Gets the Indexed exif tag. /// - public static ExifTag Indexed { get; } = new ExifTag(ExifTagValue.Indexed); + public static ExifTag Indexed { get; } = new(ExifTagValue.Indexed); /// /// Gets the OPIProxy exif tag. /// - public static ExifTag OPIProxy { get; } = new ExifTag(ExifTagValue.OPIProxy); + public static ExifTag OPIProxy { get; } = new(ExifTagValue.OPIProxy); /// /// Gets the JPEGProc exif tag. /// - public static ExifTag JPEGProc { get; } = new ExifTag(ExifTagValue.JPEGProc); + public static ExifTag JPEGProc { get; } = new(ExifTagValue.JPEGProc); /// /// Gets the JPEGRestartInterval exif tag. /// - public static ExifTag JPEGRestartInterval { get; } = new ExifTag(ExifTagValue.JPEGRestartInterval); + public static ExifTag JPEGRestartInterval { get; } = new(ExifTagValue.JPEGRestartInterval); /// /// Gets the YCbCrPositioning exif tag. /// - public static ExifTag YCbCrPositioning { get; } = new ExifTag(ExifTagValue.YCbCrPositioning); + public static ExifTag YCbCrPositioning { get; } = new(ExifTagValue.YCbCrPositioning); /// /// Gets the Rating exif tag. /// - public static ExifTag Rating { get; } = new ExifTag(ExifTagValue.Rating); + public static ExifTag Rating { get; } = new(ExifTagValue.Rating); /// /// Gets the RatingPercent exif tag. /// - public static ExifTag RatingPercent { get; } = new ExifTag(ExifTagValue.RatingPercent); + public static ExifTag RatingPercent { get; } = new(ExifTagValue.RatingPercent); /// /// Gets the ExposureProgram exif tag. /// - public static ExifTag ExposureProgram { get; } = new ExifTag(ExifTagValue.ExposureProgram); + public static ExifTag ExposureProgram { get; } = new(ExifTagValue.ExposureProgram); /// /// Gets the Interlace exif tag. /// - public static ExifTag Interlace { get; } = new ExifTag(ExifTagValue.Interlace); + public static ExifTag Interlace { get; } = new(ExifTagValue.Interlace); /// /// Gets the SelfTimerMode exif tag. /// - public static ExifTag SelfTimerMode { get; } = new ExifTag(ExifTagValue.SelfTimerMode); + public static ExifTag SelfTimerMode { get; } = new(ExifTagValue.SelfTimerMode); /// /// Gets the SensitivityType exif tag. /// - public static ExifTag SensitivityType { get; } = new ExifTag(ExifTagValue.SensitivityType); + public static ExifTag SensitivityType { get; } = new(ExifTagValue.SensitivityType); /// /// Gets the MeteringMode exif tag. /// - public static ExifTag MeteringMode { get; } = new ExifTag(ExifTagValue.MeteringMode); + public static ExifTag MeteringMode { get; } = new(ExifTagValue.MeteringMode); /// /// Gets the LightSource exif tag. /// - public static ExifTag LightSource { get; } = new ExifTag(ExifTagValue.LightSource); + public static ExifTag LightSource { get; } = new(ExifTagValue.LightSource); /// /// Gets the FocalPlaneResolutionUnit2 exif tag. /// - public static ExifTag FocalPlaneResolutionUnit2 { get; } = new ExifTag(ExifTagValue.FocalPlaneResolutionUnit2); + public static ExifTag FocalPlaneResolutionUnit2 { get; } = new(ExifTagValue.FocalPlaneResolutionUnit2); /// /// Gets the SensingMethod2 exif tag. /// - public static ExifTag SensingMethod2 { get; } = new ExifTag(ExifTagValue.SensingMethod2); + public static ExifTag SensingMethod2 { get; } = new(ExifTagValue.SensingMethod2); /// /// Gets the Flash exif tag. /// - public static ExifTag Flash { get; } = new ExifTag(ExifTagValue.Flash); + public static ExifTag Flash { get; } = new(ExifTagValue.Flash); /// /// Gets the ColorSpace exif tag. /// - public static ExifTag ColorSpace { get; } = new ExifTag(ExifTagValue.ColorSpace); + public static ExifTag ColorSpace { get; } = new(ExifTagValue.ColorSpace); /// /// Gets the FocalPlaneResolutionUnit exif tag. /// - public static ExifTag FocalPlaneResolutionUnit { get; } = new ExifTag(ExifTagValue.FocalPlaneResolutionUnit); + public static ExifTag FocalPlaneResolutionUnit { get; } = new(ExifTagValue.FocalPlaneResolutionUnit); /// /// Gets the SensingMethod exif tag. /// - public static ExifTag SensingMethod { get; } = new ExifTag(ExifTagValue.SensingMethod); + public static ExifTag SensingMethod { get; } = new(ExifTagValue.SensingMethod); /// /// Gets the CustomRendered exif tag. /// - public static ExifTag CustomRendered { get; } = new ExifTag(ExifTagValue.CustomRendered); + public static ExifTag CustomRendered { get; } = new(ExifTagValue.CustomRendered); /// /// Gets the ExposureMode exif tag. /// - public static ExifTag ExposureMode { get; } = new ExifTag(ExifTagValue.ExposureMode); + public static ExifTag ExposureMode { get; } = new(ExifTagValue.ExposureMode); /// /// Gets the WhiteBalance exif tag. /// - public static ExifTag WhiteBalance { get; } = new ExifTag(ExifTagValue.WhiteBalance); + public static ExifTag WhiteBalance { get; } = new(ExifTagValue.WhiteBalance); /// /// Gets the FocalLengthIn35mmFilm exif tag. /// - public static ExifTag FocalLengthIn35mmFilm { get; } = new ExifTag(ExifTagValue.FocalLengthIn35mmFilm); + public static ExifTag FocalLengthIn35mmFilm { get; } = new(ExifTagValue.FocalLengthIn35mmFilm); /// /// Gets the SceneCaptureType exif tag. /// - public static ExifTag SceneCaptureType { get; } = new ExifTag(ExifTagValue.SceneCaptureType); + public static ExifTag SceneCaptureType { get; } = new(ExifTagValue.SceneCaptureType); /// /// Gets the GainControl exif tag. /// - public static ExifTag GainControl { get; } = new ExifTag(ExifTagValue.GainControl); + public static ExifTag GainControl { get; } = new(ExifTagValue.GainControl); /// /// Gets the Contrast exif tag. /// - public static ExifTag Contrast { get; } = new ExifTag(ExifTagValue.Contrast); + public static ExifTag Contrast { get; } = new(ExifTagValue.Contrast); /// /// Gets the Saturation exif tag. /// - public static ExifTag Saturation { get; } = new ExifTag(ExifTagValue.Saturation); + public static ExifTag Saturation { get; } = new(ExifTagValue.Saturation); /// /// Gets the Sharpness exif tag. /// - public static ExifTag Sharpness { get; } = new ExifTag(ExifTagValue.Sharpness); + public static ExifTag Sharpness { get; } = new(ExifTagValue.Sharpness); /// /// Gets the SubjectDistanceRange exif tag. /// - public static ExifTag SubjectDistanceRange { get; } = new ExifTag(ExifTagValue.SubjectDistanceRange); + public static ExifTag SubjectDistanceRange { get; } = new(ExifTagValue.SubjectDistanceRange); /// /// Gets the GPSDifferential exif tag. /// - public static ExifTag GPSDifferential { get; } = new ExifTag(ExifTagValue.GPSDifferential); + public static ExifTag GPSDifferential { get; } = new(ExifTagValue.GPSDifferential); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.ShortArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.ShortArray.cs index dc708c50f..55e65517f 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.ShortArray.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.ShortArray.cs @@ -9,100 +9,100 @@ public abstract partial class ExifTag /// /// Gets the BitsPerSample exif tag. /// - public static ExifTag BitsPerSample { get; } = new ExifTag(ExifTagValue.BitsPerSample); + public static ExifTag BitsPerSample { get; } = new(ExifTagValue.BitsPerSample); /// /// Gets the MinSampleValue exif tag. /// - public static ExifTag MinSampleValue { get; } = new ExifTag(ExifTagValue.MinSampleValue); + public static ExifTag MinSampleValue { get; } = new(ExifTagValue.MinSampleValue); /// /// Gets the MaxSampleValue exif tag. /// - public static ExifTag MaxSampleValue { get; } = new ExifTag(ExifTagValue.MaxSampleValue); + public static ExifTag MaxSampleValue { get; } = new(ExifTagValue.MaxSampleValue); /// /// Gets the GrayResponseCurve exif tag. /// - public static ExifTag GrayResponseCurve { get; } = new ExifTag(ExifTagValue.GrayResponseCurve); + public static ExifTag GrayResponseCurve { get; } = new(ExifTagValue.GrayResponseCurve); /// /// Gets the ColorMap exif tag. /// - public static ExifTag ColorMap { get; } = new ExifTag(ExifTagValue.ColorMap); + public static ExifTag ColorMap { get; } = new(ExifTagValue.ColorMap); /// /// Gets the ExtraSamples exif tag. /// - public static ExifTag ExtraSamples { get; } = new ExifTag(ExifTagValue.ExtraSamples); + public static ExifTag ExtraSamples { get; } = new(ExifTagValue.ExtraSamples); /// /// Gets the PageNumber exif tag. /// - public static ExifTag PageNumber { get; } = new ExifTag(ExifTagValue.PageNumber); + public static ExifTag PageNumber { get; } = new(ExifTagValue.PageNumber); /// /// Gets the TransferFunction exif tag. /// - public static ExifTag TransferFunction { get; } = new ExifTag(ExifTagValue.TransferFunction); + public static ExifTag TransferFunction { get; } = new(ExifTagValue.TransferFunction); /// /// Gets the HalftoneHints exif tag. /// - public static ExifTag HalftoneHints { get; } = new ExifTag(ExifTagValue.HalftoneHints); + public static ExifTag HalftoneHints { get; } = new(ExifTagValue.HalftoneHints); /// /// Gets the SampleFormat exif tag. /// - public static ExifTag SampleFormat { get; } = new ExifTag(ExifTagValue.SampleFormat); + public static ExifTag SampleFormat { get; } = new(ExifTagValue.SampleFormat); /// /// Gets the TransferRange exif tag. /// - public static ExifTag TransferRange { get; } = new ExifTag(ExifTagValue.TransferRange); + public static ExifTag TransferRange { get; } = new(ExifTagValue.TransferRange); /// /// Gets the DefaultImageColor exif tag. /// - public static ExifTag DefaultImageColor { get; } = new ExifTag(ExifTagValue.DefaultImageColor); + public static ExifTag DefaultImageColor { get; } = new(ExifTagValue.DefaultImageColor); /// /// Gets the JPEGLosslessPredictors exif tag. /// - public static ExifTag JPEGLosslessPredictors { get; } = new ExifTag(ExifTagValue.JPEGLosslessPredictors); + public static ExifTag JPEGLosslessPredictors { get; } = new(ExifTagValue.JPEGLosslessPredictors); /// /// Gets the JPEGPointTransforms exif tag. /// - public static ExifTag JPEGPointTransforms { get; } = new ExifTag(ExifTagValue.JPEGPointTransforms); + public static ExifTag JPEGPointTransforms { get; } = new(ExifTagValue.JPEGPointTransforms); /// /// Gets the YCbCrSubsampling exif tag. /// - public static ExifTag YCbCrSubsampling { get; } = new ExifTag(ExifTagValue.YCbCrSubsampling); + public static ExifTag YCbCrSubsampling { get; } = new(ExifTagValue.YCbCrSubsampling); /// /// Gets the CFARepeatPatternDim exif tag. /// - public static ExifTag CFARepeatPatternDim { get; } = new ExifTag(ExifTagValue.CFARepeatPatternDim); + public static ExifTag CFARepeatPatternDim { get; } = new(ExifTagValue.CFARepeatPatternDim); /// /// Gets the IntergraphPacketData exif tag. /// - public static ExifTag IntergraphPacketData { get; } = new ExifTag(ExifTagValue.IntergraphPacketData); + public static ExifTag IntergraphPacketData { get; } = new(ExifTagValue.IntergraphPacketData); /// /// Gets the ISOSpeedRatings exif tag. /// - public static ExifTag ISOSpeedRatings { get; } = new ExifTag(ExifTagValue.ISOSpeedRatings); + public static ExifTag ISOSpeedRatings { get; } = new(ExifTagValue.ISOSpeedRatings); /// /// Gets the SubjectArea exif tag. /// - public static ExifTag SubjectArea { get; } = new ExifTag(ExifTagValue.SubjectArea); + public static ExifTag SubjectArea { get; } = new(ExifTagValue.SubjectArea); /// /// Gets the SubjectLocation exif tag. /// - public static ExifTag SubjectLocation { get; } = new ExifTag(ExifTagValue.SubjectLocation); + public static ExifTag SubjectLocation { get; } = new(ExifTagValue.SubjectLocation); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRational.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRational.cs index d645b5176..8fbbba217 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRational.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRational.cs @@ -9,30 +9,30 @@ public abstract partial class ExifTag /// /// Gets the ShutterSpeedValue exif tag. /// - public static ExifTag ShutterSpeedValue { get; } = new ExifTag(ExifTagValue.ShutterSpeedValue); + public static ExifTag ShutterSpeedValue { get; } = new(ExifTagValue.ShutterSpeedValue); /// /// Gets the BrightnessValue exif tag. /// - public static ExifTag BrightnessValue { get; } = new ExifTag(ExifTagValue.BrightnessValue); + public static ExifTag BrightnessValue { get; } = new(ExifTagValue.BrightnessValue); /// /// Gets the ExposureBiasValue exif tag. /// - public static ExifTag ExposureBiasValue { get; } = new ExifTag(ExifTagValue.ExposureBiasValue); + public static ExifTag ExposureBiasValue { get; } = new(ExifTagValue.ExposureBiasValue); /// /// Gets the AmbientTemperature exif tag. /// - public static ExifTag AmbientTemperature { get; } = new ExifTag(ExifTagValue.AmbientTemperature); + public static ExifTag AmbientTemperature { get; } = new(ExifTagValue.AmbientTemperature); /// /// Gets the WaterDepth exif tag. /// - public static ExifTag WaterDepth { get; } = new ExifTag(ExifTagValue.WaterDepth); + public static ExifTag WaterDepth { get; } = new(ExifTagValue.WaterDepth); /// /// Gets the CameraElevationAngle exif tag. /// - public static ExifTag CameraElevationAngle { get; } = new ExifTag(ExifTagValue.CameraElevationAngle); + public static ExifTag CameraElevationAngle { get; } = new(ExifTagValue.CameraElevationAngle); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRationalArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRationalArray.cs index ef1e8afea..a27108f8a 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRationalArray.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedRationalArray.cs @@ -9,5 +9,5 @@ public abstract partial class ExifTag /// /// Gets the Decode exif tag. /// - public static ExifTag Decode { get; } = new ExifTag(ExifTagValue.Decode); + public static ExifTag Decode { get; } = new(ExifTagValue.Decode); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedShortArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedShortArray.cs index d6a920514..086842698 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedShortArray.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedShortArray.cs @@ -9,5 +9,5 @@ public abstract partial class ExifTag /// /// Gets the TimeZoneOffset exif tag. /// - public static ExifTag TimeZoneOffset { get; } = new ExifTag(ExifTagValue.TimeZoneOffset); + public static ExifTag TimeZoneOffset { get; } = new(ExifTagValue.TimeZoneOffset); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.String.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.String.cs index 498dad3eb..688403a65 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.String.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.String.cs @@ -9,270 +9,270 @@ public abstract partial class ExifTag /// /// Gets the ImageDescription exif tag. /// - public static ExifTag ImageDescription { get; } = new ExifTag(ExifTagValue.ImageDescription); + public static ExifTag ImageDescription { get; } = new(ExifTagValue.ImageDescription); /// /// Gets the Make exif tag. /// - public static ExifTag Make { get; } = new ExifTag(ExifTagValue.Make); + public static ExifTag Make { get; } = new(ExifTagValue.Make); /// /// Gets the Model exif tag. /// - public static ExifTag Model { get; } = new ExifTag(ExifTagValue.Model); + public static ExifTag Model { get; } = new(ExifTagValue.Model); /// /// Gets the Software exif tag. /// - public static ExifTag Software { get; } = new ExifTag(ExifTagValue.Software); + public static ExifTag Software { get; } = new(ExifTagValue.Software); /// /// Gets the DateTime exif tag. /// - public static ExifTag DateTime { get; } = new ExifTag(ExifTagValue.DateTime); + public static ExifTag DateTime { get; } = new(ExifTagValue.DateTime); /// /// Gets the Artist exif tag. /// - public static ExifTag Artist { get; } = new ExifTag(ExifTagValue.Artist); + public static ExifTag Artist { get; } = new(ExifTagValue.Artist); /// /// Gets the HostComputer exif tag. /// - public static ExifTag HostComputer { get; } = new ExifTag(ExifTagValue.HostComputer); + public static ExifTag HostComputer { get; } = new(ExifTagValue.HostComputer); /// /// Gets the Copyright exif tag. /// - public static ExifTag Copyright { get; } = new ExifTag(ExifTagValue.Copyright); + public static ExifTag Copyright { get; } = new(ExifTagValue.Copyright); /// /// Gets the DocumentName exif tag. /// - public static ExifTag DocumentName { get; } = new ExifTag(ExifTagValue.DocumentName); + public static ExifTag DocumentName { get; } = new(ExifTagValue.DocumentName); /// /// Gets the PageName exif tag. /// - public static ExifTag PageName { get; } = new ExifTag(ExifTagValue.PageName); + public static ExifTag PageName { get; } = new(ExifTagValue.PageName); /// /// Gets the InkNames exif tag. /// - public static ExifTag InkNames { get; } = new ExifTag(ExifTagValue.InkNames); + public static ExifTag InkNames { get; } = new(ExifTagValue.InkNames); /// /// Gets the TargetPrinter exif tag. /// - public static ExifTag TargetPrinter { get; } = new ExifTag(ExifTagValue.TargetPrinter); + public static ExifTag TargetPrinter { get; } = new(ExifTagValue.TargetPrinter); /// /// Gets the ImageID exif tag. /// - public static ExifTag ImageID { get; } = new ExifTag(ExifTagValue.ImageID); + public static ExifTag ImageID { get; } = new(ExifTagValue.ImageID); /// /// Gets the MDLabName exif tag. /// - public static ExifTag MDLabName { get; } = new ExifTag(ExifTagValue.MDLabName); + public static ExifTag MDLabName { get; } = new(ExifTagValue.MDLabName); /// /// Gets the MDSampleInfo exif tag. /// - public static ExifTag MDSampleInfo { get; } = new ExifTag(ExifTagValue.MDSampleInfo); + public static ExifTag MDSampleInfo { get; } = new(ExifTagValue.MDSampleInfo); /// /// Gets the MDPrepDate exif tag. /// - public static ExifTag MDPrepDate { get; } = new ExifTag(ExifTagValue.MDPrepDate); + public static ExifTag MDPrepDate { get; } = new(ExifTagValue.MDPrepDate); /// /// Gets the MDPrepTime exif tag. /// - public static ExifTag MDPrepTime { get; } = new ExifTag(ExifTagValue.MDPrepTime); + public static ExifTag MDPrepTime { get; } = new(ExifTagValue.MDPrepTime); /// /// Gets the MDFileUnits exif tag. /// - public static ExifTag MDFileUnits { get; } = new ExifTag(ExifTagValue.MDFileUnits); + public static ExifTag MDFileUnits { get; } = new(ExifTagValue.MDFileUnits); /// /// Gets the SEMInfo exif tag. /// - public static ExifTag SEMInfo { get; } = new ExifTag(ExifTagValue.SEMInfo); + public static ExifTag SEMInfo { get; } = new(ExifTagValue.SEMInfo); /// /// Gets the SpectralSensitivity exif tag. /// - public static ExifTag SpectralSensitivity { get; } = new ExifTag(ExifTagValue.SpectralSensitivity); + public static ExifTag SpectralSensitivity { get; } = new(ExifTagValue.SpectralSensitivity); /// /// Gets the DateTimeOriginal exif tag. /// - public static ExifTag DateTimeOriginal { get; } = new ExifTag(ExifTagValue.DateTimeOriginal); + public static ExifTag DateTimeOriginal { get; } = new(ExifTagValue.DateTimeOriginal); /// /// Gets the DateTimeDigitized exif tag. /// - public static ExifTag DateTimeDigitized { get; } = new ExifTag(ExifTagValue.DateTimeDigitized); + public static ExifTag DateTimeDigitized { get; } = new(ExifTagValue.DateTimeDigitized); /// /// Gets the SubsecTime exif tag. /// - public static ExifTag SubsecTime { get; } = new ExifTag(ExifTagValue.SubsecTime); + public static ExifTag SubsecTime { get; } = new(ExifTagValue.SubsecTime); /// /// Gets the SubsecTimeOriginal exif tag. /// - public static ExifTag SubsecTimeOriginal { get; } = new ExifTag(ExifTagValue.SubsecTimeOriginal); + public static ExifTag SubsecTimeOriginal { get; } = new(ExifTagValue.SubsecTimeOriginal); /// /// Gets the SubsecTimeDigitized exif tag. /// - public static ExifTag SubsecTimeDigitized { get; } = new ExifTag(ExifTagValue.SubsecTimeDigitized); + public static ExifTag SubsecTimeDigitized { get; } = new(ExifTagValue.SubsecTimeDigitized); /// /// Gets the RelatedSoundFile exif tag. /// - public static ExifTag RelatedSoundFile { get; } = new ExifTag(ExifTagValue.RelatedSoundFile); + public static ExifTag RelatedSoundFile { get; } = new(ExifTagValue.RelatedSoundFile); /// /// Gets the FaxSubaddress exif tag. /// - public static ExifTag FaxSubaddress { get; } = new ExifTag(ExifTagValue.FaxSubaddress); + public static ExifTag FaxSubaddress { get; } = new(ExifTagValue.FaxSubaddress); /// /// Gets the OffsetTime exif tag. /// - public static ExifTag OffsetTime { get; } = new ExifTag(ExifTagValue.OffsetTime); + public static ExifTag OffsetTime { get; } = new(ExifTagValue.OffsetTime); /// /// Gets the OffsetTimeOriginal exif tag. /// - public static ExifTag OffsetTimeOriginal { get; } = new ExifTag(ExifTagValue.OffsetTimeOriginal); + public static ExifTag OffsetTimeOriginal { get; } = new(ExifTagValue.OffsetTimeOriginal); /// /// Gets the OffsetTimeDigitized exif tag. /// - public static ExifTag OffsetTimeDigitized { get; } = new ExifTag(ExifTagValue.OffsetTimeDigitized); + public static ExifTag OffsetTimeDigitized { get; } = new(ExifTagValue.OffsetTimeDigitized); /// /// Gets the SecurityClassification exif tag. /// - public static ExifTag SecurityClassification { get; } = new ExifTag(ExifTagValue.SecurityClassification); + public static ExifTag SecurityClassification { get; } = new(ExifTagValue.SecurityClassification); /// /// Gets the ImageHistory exif tag. /// - public static ExifTag ImageHistory { get; } = new ExifTag(ExifTagValue.ImageHistory); + public static ExifTag ImageHistory { get; } = new(ExifTagValue.ImageHistory); /// /// Gets the ImageUniqueID exif tag. /// - public static ExifTag ImageUniqueID { get; } = new ExifTag(ExifTagValue.ImageUniqueID); + public static ExifTag ImageUniqueID { get; } = new(ExifTagValue.ImageUniqueID); /// /// Gets the OwnerName exif tag. /// - public static ExifTag OwnerName { get; } = new ExifTag(ExifTagValue.OwnerName); + public static ExifTag OwnerName { get; } = new(ExifTagValue.OwnerName); /// /// Gets the SerialNumber exif tag. /// - public static ExifTag SerialNumber { get; } = new ExifTag(ExifTagValue.SerialNumber); + public static ExifTag SerialNumber { get; } = new(ExifTagValue.SerialNumber); /// /// Gets the LensMake exif tag. /// - public static ExifTag LensMake { get; } = new ExifTag(ExifTagValue.LensMake); + public static ExifTag LensMake { get; } = new(ExifTagValue.LensMake); /// /// Gets the LensModel exif tag. /// - public static ExifTag LensModel { get; } = new ExifTag(ExifTagValue.LensModel); + public static ExifTag LensModel { get; } = new(ExifTagValue.LensModel); /// /// Gets the LensSerialNumber exif tag. /// - public static ExifTag LensSerialNumber { get; } = new ExifTag(ExifTagValue.LensSerialNumber); + public static ExifTag LensSerialNumber { get; } = new(ExifTagValue.LensSerialNumber); /// /// Gets the GDALMetadata exif tag. /// - public static ExifTag GDALMetadata { get; } = new ExifTag(ExifTagValue.GDALMetadata); + public static ExifTag GDALMetadata { get; } = new(ExifTagValue.GDALMetadata); /// /// Gets the GDALNoData exif tag. /// - public static ExifTag GDALNoData { get; } = new ExifTag(ExifTagValue.GDALNoData); + public static ExifTag GDALNoData { get; } = new(ExifTagValue.GDALNoData); /// /// Gets the GPSLatitudeRef exif tag. /// - public static ExifTag GPSLatitudeRef { get; } = new ExifTag(ExifTagValue.GPSLatitudeRef); + public static ExifTag GPSLatitudeRef { get; } = new(ExifTagValue.GPSLatitudeRef); /// /// Gets the GPSLongitudeRef exif tag. /// - public static ExifTag GPSLongitudeRef { get; } = new ExifTag(ExifTagValue.GPSLongitudeRef); + public static ExifTag GPSLongitudeRef { get; } = new(ExifTagValue.GPSLongitudeRef); /// /// Gets the GPSSatellites exif tag. /// - public static ExifTag GPSSatellites { get; } = new ExifTag(ExifTagValue.GPSSatellites); + public static ExifTag GPSSatellites { get; } = new(ExifTagValue.GPSSatellites); /// /// Gets the GPSStatus exif tag. /// - public static ExifTag GPSStatus { get; } = new ExifTag(ExifTagValue.GPSStatus); + public static ExifTag GPSStatus { get; } = new(ExifTagValue.GPSStatus); /// /// Gets the GPSMeasureMode exif tag. /// - public static ExifTag GPSMeasureMode { get; } = new ExifTag(ExifTagValue.GPSMeasureMode); + public static ExifTag GPSMeasureMode { get; } = new(ExifTagValue.GPSMeasureMode); /// /// Gets the GPSSpeedRef exif tag. /// - public static ExifTag GPSSpeedRef { get; } = new ExifTag(ExifTagValue.GPSSpeedRef); + public static ExifTag GPSSpeedRef { get; } = new(ExifTagValue.GPSSpeedRef); /// /// Gets the GPSTrackRef exif tag. /// - public static ExifTag GPSTrackRef { get; } = new ExifTag(ExifTagValue.GPSTrackRef); + public static ExifTag GPSTrackRef { get; } = new(ExifTagValue.GPSTrackRef); /// /// Gets the GPSImgDirectionRef exif tag. /// - public static ExifTag GPSImgDirectionRef { get; } = new ExifTag(ExifTagValue.GPSImgDirectionRef); + public static ExifTag GPSImgDirectionRef { get; } = new(ExifTagValue.GPSImgDirectionRef); /// /// Gets the GPSMapDatum exif tag. /// - public static ExifTag GPSMapDatum { get; } = new ExifTag(ExifTagValue.GPSMapDatum); + public static ExifTag GPSMapDatum { get; } = new(ExifTagValue.GPSMapDatum); /// /// Gets the GPSDestLatitudeRef exif tag. /// - public static ExifTag GPSDestLatitudeRef { get; } = new ExifTag(ExifTagValue.GPSDestLatitudeRef); + public static ExifTag GPSDestLatitudeRef { get; } = new(ExifTagValue.GPSDestLatitudeRef); /// /// Gets the GPSDestLongitudeRef exif tag. /// - public static ExifTag GPSDestLongitudeRef { get; } = new ExifTag(ExifTagValue.GPSDestLongitudeRef); + public static ExifTag GPSDestLongitudeRef { get; } = new(ExifTagValue.GPSDestLongitudeRef); /// /// Gets the GPSDestBearingRef exif tag. /// - public static ExifTag GPSDestBearingRef { get; } = new ExifTag(ExifTagValue.GPSDestBearingRef); + public static ExifTag GPSDestBearingRef { get; } = new(ExifTagValue.GPSDestBearingRef); /// /// Gets the GPSDestDistanceRef exif tag. /// - public static ExifTag GPSDestDistanceRef { get; } = new ExifTag(ExifTagValue.GPSDestDistanceRef); + public static ExifTag GPSDestDistanceRef { get; } = new(ExifTagValue.GPSDestDistanceRef); /// /// Gets the GPSDateStamp exif tag. /// - public static ExifTag GPSDateStamp { get; } = new ExifTag(ExifTagValue.GPSDateStamp); + public static ExifTag GPSDateStamp { get; } = new(ExifTagValue.GPSDateStamp); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Ucs2String.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Ucs2String.cs index 65acc4bd7..e13b3b30e 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Ucs2String.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Ucs2String.cs @@ -9,25 +9,25 @@ public abstract partial class ExifTag /// /// Gets the title tag used by Windows (encoded in UCS2). /// - public static ExifTag XPTitle => new ExifTag(ExifTagValue.XPTitle); + public static ExifTag XPTitle => new(ExifTagValue.XPTitle); /// /// Gets the comment tag used by Windows (encoded in UCS2). /// - public static ExifTag XPComment => new ExifTag(ExifTagValue.XPComment); + public static ExifTag XPComment => new(ExifTagValue.XPComment); /// /// Gets the author tag used by Windows (encoded in UCS2). /// - public static ExifTag XPAuthor => new ExifTag(ExifTagValue.XPAuthor); + public static ExifTag XPAuthor => new(ExifTagValue.XPAuthor); /// /// Gets the keywords tag used by Windows (encoded in UCS2). /// - public static ExifTag XPKeywords => new ExifTag(ExifTagValue.XPKeywords); + public static ExifTag XPKeywords => new(ExifTagValue.XPKeywords); /// /// Gets the subject tag used by Windows (encoded in UCS2). /// - public static ExifTag XPSubject => new ExifTag(ExifTagValue.XPSubject); + public static ExifTag XPSubject => new(ExifTagValue.XPSubject); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Undefined.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Undefined.cs index 417673b4a..e822c2a11 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Undefined.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Undefined.cs @@ -9,70 +9,70 @@ public abstract partial class ExifTag /// /// Gets the JPEGTables exif tag. /// - public static ExifTag JPEGTables { get; } = new ExifTag(ExifTagValue.JPEGTables); + public static ExifTag JPEGTables { get; } = new(ExifTagValue.JPEGTables); /// /// Gets the OECF exif tag. /// - public static ExifTag OECF { get; } = new ExifTag(ExifTagValue.OECF); + public static ExifTag OECF { get; } = new(ExifTagValue.OECF); /// /// Gets the ExifVersion exif tag. /// - public static ExifTag ExifVersion { get; } = new ExifTag(ExifTagValue.ExifVersion); + public static ExifTag ExifVersion { get; } = new(ExifTagValue.ExifVersion); /// /// Gets the ComponentsConfiguration exif tag. /// - public static ExifTag ComponentsConfiguration { get; } = new ExifTag(ExifTagValue.ComponentsConfiguration); + public static ExifTag ComponentsConfiguration { get; } = new(ExifTagValue.ComponentsConfiguration); /// /// Gets the MakerNote exif tag. /// - public static ExifTag MakerNote { get; } = new ExifTag(ExifTagValue.MakerNote); + public static ExifTag MakerNote { get; } = new(ExifTagValue.MakerNote); /// /// Gets the FlashpixVersion exif tag. /// - public static ExifTag FlashpixVersion { get; } = new ExifTag(ExifTagValue.FlashpixVersion); + public static ExifTag FlashpixVersion { get; } = new(ExifTagValue.FlashpixVersion); /// /// Gets the SpatialFrequencyResponse exif tag. /// - public static ExifTag SpatialFrequencyResponse { get; } = new ExifTag(ExifTagValue.SpatialFrequencyResponse); + public static ExifTag SpatialFrequencyResponse { get; } = new(ExifTagValue.SpatialFrequencyResponse); /// /// Gets the SpatialFrequencyResponse2 exif tag. /// - public static ExifTag SpatialFrequencyResponse2 { get; } = new ExifTag(ExifTagValue.SpatialFrequencyResponse2); + public static ExifTag SpatialFrequencyResponse2 { get; } = new(ExifTagValue.SpatialFrequencyResponse2); /// /// Gets the Noise exif tag. /// - public static ExifTag Noise { get; } = new ExifTag(ExifTagValue.Noise); + public static ExifTag Noise { get; } = new(ExifTagValue.Noise); /// /// Gets the CFAPattern exif tag. /// - public static ExifTag CFAPattern { get; } = new ExifTag(ExifTagValue.CFAPattern); + public static ExifTag CFAPattern { get; } = new(ExifTagValue.CFAPattern); /// /// Gets the DeviceSettingDescription exif tag. /// - public static ExifTag DeviceSettingDescription { get; } = new ExifTag(ExifTagValue.DeviceSettingDescription); + public static ExifTag DeviceSettingDescription { get; } = new(ExifTagValue.DeviceSettingDescription); /// /// Gets the ImageSourceData exif tag. /// - public static ExifTag ImageSourceData { get; } = new ExifTag(ExifTagValue.ImageSourceData); + public static ExifTag ImageSourceData { get; } = new(ExifTagValue.ImageSourceData); /// /// Gets the FileSource exif tag. /// - public static ExifTag FileSource { get; } = new ExifTag(ExifTagValue.FileSource); + public static ExifTag FileSource { get; } = new(ExifTagValue.FileSource); /// /// Gets the ImageDescription exif tag. /// - public static ExifTag SceneType { get; } = new ExifTag(ExifTagValue.SceneType); + public static ExifTag SceneType { get; } = new(ExifTagValue.SceneType); } diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifEncodedString.cs b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifEncodedString.cs index a7b9d44ae..14b097f81 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifEncodedString.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifEncodedString.cs @@ -33,7 +33,7 @@ internal sealed class ExifEncodedString : ExifValue if (value is string stringValue) { - this.Value = new(stringValue); + this.Value = new EncodedString(stringValue); return true; } else if (value is byte[] buffer) diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRational.cs b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRational.cs index e5c27f60a..c25f0f5dc 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRational.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRational.cs @@ -39,7 +39,7 @@ internal sealed class ExifRational : ExifValue if (signed.Numerator >= uint.MinValue && signed.Denominator >= uint.MinValue) { - this.Value = new((uint)signed.Numerator, (uint)signed.Denominator); + this.Value = new Rational((uint)signed.Numerator, (uint)signed.Denominator); } return true; diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRationalArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRationalArray.cs index 4ae2850a1..e8b2006df 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRationalArray.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifRationalArray.cs @@ -38,7 +38,7 @@ internal sealed class ExifRationalArray : ExifArrayValue { if (signed.Numerator >= 0 && signed.Denominator >= 0) { - this.Value = [new((uint)signed.Numerator, (uint)signed.Denominator)]; + this.Value = [new Rational((uint)signed.Numerator, (uint)signed.Denominator)]; } return true; @@ -60,7 +60,7 @@ internal sealed class ExifRationalArray : ExifArrayValue for (int i = 0; i < signed.Length; i++) { SignedRational s = signed[i]; - unsigned[i] = new((uint)s.Numerator, (uint)s.Denominator); + unsigned[i] = new Rational((uint)s.Numerator, (uint)s.Denominator); } this.Value = unsigned; diff --git a/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Curves.cs b/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Curves.cs index 3e061c9d8..8663ebccc 100644 --- a/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Curves.cs +++ b/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Curves.cs @@ -30,7 +30,7 @@ internal sealed partial class IccDataReader segments[i] = this.ReadCurveSegment(); } - return new(breakPoints, segments); + return new IccOneDimensionalCurve(breakPoints, segments); } /// @@ -63,7 +63,7 @@ internal sealed partial class IccDataReader } } - return new(type, xyzValues, response); + return new IccResponseCurve(type, xyzValues, response); } /// @@ -106,11 +106,11 @@ internal sealed partial class IccDataReader switch (type) { - case 0: return new(gamma); - case 1: return new(gamma, a, b); - case 2: return new(gamma, a, b, c); - case 3: return new(gamma, a, b, c, d); - case 4: return new(gamma, a, b, c, d, e, f); + case 0: return new IccParametricCurve(gamma); + case 1: return new IccParametricCurve(gamma, a, b); + case 2: return new IccParametricCurve(gamma, a, b, c); + case 3: return new IccParametricCurve(gamma, a, b, c, d); + case 4: return new IccParametricCurve(gamma, a, b, c, d, e, f); default: throw new InvalidIccProfileException($"Invalid parametric curve type of {type}"); } } @@ -165,7 +165,7 @@ internal sealed partial class IccDataReader e = this.ReadSingle(); } - return new(type, gamma, a, b, c, d, e); + return new IccFormulaCurveElement(type, gamma, a, b, c, d, e); } /// @@ -181,7 +181,7 @@ internal sealed partial class IccDataReader entries[i] = this.ReadSingle(); } - return new(entries); + return new IccSampledCurveElement(entries); } /// diff --git a/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Lut.cs b/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Lut.cs index ff65125c3..700e43f97 100644 --- a/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Lut.cs +++ b/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Lut.cs @@ -27,7 +27,7 @@ internal sealed partial class IccDataReader values[i] = this.ReadUInt16(); } - return new(values); + return new IccLut(values); } /// @@ -92,7 +92,7 @@ internal sealed partial class IccDataReader } } - return new(values, gridPointCount, IccClutDataType.UInt8, outChannelCount); + return new IccClut(values, gridPointCount, IccClutDataType.UInt8, outChannelCount); } /// @@ -126,7 +126,7 @@ internal sealed partial class IccDataReader } this.currentIndex = start + (length * outChannelCount * 2); - return new(values, gridPointCount, IccClutDataType.UInt16, outChannelCount); + return new IccClut(values, gridPointCount, IccClutDataType.UInt16, outChannelCount); } /// @@ -158,6 +158,6 @@ internal sealed partial class IccDataReader } this.currentIndex = start + (length * outChCount * 4); - return new(values, gridPointCount, IccClutDataType.Float, outChCount); + return new IccClut(values, gridPointCount, IccClutDataType.Float, outChCount); } } diff --git a/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.MultiProcessElement.cs b/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.MultiProcessElement.cs index bff5e31bc..98b269f0b 100644 --- a/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.MultiProcessElement.cs +++ b/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.MultiProcessElement.cs @@ -55,7 +55,7 @@ internal sealed partial class IccDataReader this.AddPadding(); } - return new(curves); + return new IccCurveSetProcessElement(curves); } /// @@ -66,7 +66,7 @@ internal sealed partial class IccDataReader /// The read public IccMatrixProcessElement ReadMatrixProcessElement(int inChannelCount, int outChannelCount) { - return new( + return new IccMatrixProcessElement( this.ReadMatrix(inChannelCount, outChannelCount, true), this.ReadMatrix(outChannelCount, true)); } @@ -79,6 +79,6 @@ internal sealed partial class IccDataReader /// The read public IccClutProcessElement ReadClutProcessElement(int inChannelCount, int outChannelCount) { - return new(this.ReadClut(inChannelCount, outChannelCount, true)); + return new IccClutProcessElement(this.ReadClut(inChannelCount, outChannelCount, true)); } } diff --git a/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.NonPrimitives.cs b/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.NonPrimitives.cs index ea969b7ec..58b759555 100644 --- a/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.NonPrimitives.cs +++ b/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.NonPrimitives.cs @@ -18,7 +18,7 @@ internal sealed partial class IccDataReader { try { - return new( + return new DateTime( year: this.ReadUInt16(), month: this.ReadUInt16(), day: this.ReadUInt16(), @@ -45,7 +45,7 @@ internal sealed partial class IccDataReader int minor = (version >> 20) & 0x0F; int bugfix = (version >> 16) & 0x0F; - return new(major, minor, bugfix); + return new IccVersion(major, minor, bugfix); } /// @@ -54,7 +54,7 @@ internal sealed partial class IccDataReader /// the XYZ number public Vector3 ReadXyzNumber() { - return new( + return new Vector3( x: this.ReadFix16(), y: this.ReadFix16(), z: this.ReadFix16()); @@ -66,7 +66,7 @@ internal sealed partial class IccDataReader /// the profile ID public IccProfileId ReadProfileId() { - return new( + return new IccProfileId( p1: this.ReadUInt32(), p2: this.ReadUInt32(), p3: this.ReadUInt32(), @@ -79,7 +79,7 @@ internal sealed partial class IccDataReader /// the position number public IccPositionNumber ReadPositionNumber() { - return new( + return new IccPositionNumber( offset: this.ReadUInt32(), size: this.ReadUInt32()); } @@ -90,7 +90,7 @@ internal sealed partial class IccDataReader /// the response number public IccResponseNumber ReadResponseNumber() { - return new( + return new IccResponseNumber( deviceCode: this.ReadUInt16(), measurementValue: this.ReadFix16()); } @@ -111,7 +111,7 @@ internal sealed partial class IccDataReader deviceCoord[i] = this.ReadUInt16(); } - return new(name, pcsCoord, deviceCoord); + return new IccNamedColor(name, pcsCoord, deviceCoord); } /// @@ -128,7 +128,7 @@ internal sealed partial class IccDataReader IccMultiLocalizedUnicodeTagDataEntry manufacturerInfo = ReadText(); IccMultiLocalizedUnicodeTagDataEntry modelInfo = ReadText(); - return new( + return new IccProfileDescription( manufacturer, model, attributes, @@ -158,7 +158,7 @@ internal sealed partial class IccDataReader /// the profile description public IccColorantTableEntry ReadColorantTableEntry() { - return new( + return new IccColorantTableEntry( name: this.ReadAsciiString(32), pcs1: this.ReadUInt16(), pcs2: this.ReadUInt16(), @@ -171,7 +171,7 @@ internal sealed partial class IccDataReader /// the screening channel public IccScreeningChannel ReadScreeningChannel() { - return new( + return new IccScreeningChannel( frequency: this.ReadFix16(), angle: this.ReadFix16(), spotShape: (IccScreeningSpotType)this.ReadInt32()); diff --git a/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs b/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs index 591e08c6f..88281452e 100644 --- a/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs +++ b/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs @@ -130,7 +130,7 @@ internal sealed partial class IccDataReader public IccUnknownTagDataEntry ReadUnknownTagDataEntry(uint size) { int count = (int)size - 8; // 8 is the tag header size - return new(this.ReadBytes(count)); + return new IccUnknownTagDataEntry(this.ReadBytes(count)); } /// @@ -146,7 +146,7 @@ internal sealed partial class IccDataReader { // The type is known and so are the values (they are constant) // channelCount should always be 3 but it doesn't really matter if it's not - return new(colorant); + return new IccChromaticityTagDataEntry(colorant); } else { @@ -157,7 +157,7 @@ internal sealed partial class IccDataReader values[i] = new double[] { this.ReadUFix16(), this.ReadUFix16() }; } - return new(values); + return new IccChromaticityTagDataEntry(values); } } @@ -169,7 +169,7 @@ internal sealed partial class IccDataReader { uint colorantCount = this.ReadUInt32(); byte[] number = this.ReadBytes((int)colorantCount); - return new(number); + return new IccColorantOrderTagDataEntry(number); } /// @@ -185,7 +185,7 @@ internal sealed partial class IccDataReader cdata[i] = this.ReadColorantTableEntry(); } - return new(cdata); + return new IccColorantTableTagDataEntry(cdata); } /// @@ -198,12 +198,12 @@ internal sealed partial class IccDataReader if (pointCount == 0) { - return new(); + return new IccCurveTagDataEntry(); } if (pointCount == 1) { - return new(this.ReadUFix8()); + return new IccCurveTagDataEntry(this.ReadUFix8()); } float[] cdata = new float[pointCount]; @@ -212,7 +212,7 @@ internal sealed partial class IccDataReader cdata[i] = this.ReadUInt16() / 65535f; } - return new(cdata); + return new IccCurveTagDataEntry(cdata); // TODO: If the input is PCSXYZ, 1+(32 767/32 768) shall be mapped to the value 1,0. If the output is PCSXYZ, the value 1,0 shall be mapped to 1+(32 767/32 768). } @@ -232,7 +232,7 @@ internal sealed partial class IccDataReader int length = (int)size - 12; byte[] cdata = this.ReadBytes(length); - return new(cdata, ascii); + return new IccDataTagDataEntry(cdata, ascii); } /// @@ -276,7 +276,7 @@ internal sealed partial class IccDataReader outValues[i] = this.ReadLut16(outTableCount); } - return new(matrix, inValues, clut, outValues); + return new IccLut16TagDataEntry(matrix, inValues, clut, outValues); } /// @@ -311,7 +311,7 @@ internal sealed partial class IccDataReader outValues[i] = this.ReadLut8(); } - return new(matrix, inValues, clut, outValues); + return new IccLut8TagDataEntry(matrix, inValues, clut, outValues); } /// @@ -370,7 +370,7 @@ internal sealed partial class IccDataReader matrix3x1 = this.ReadMatrix(3, false); } - return new(bCurve, matrix3x3, matrix3x1, mCurve, clut, aCurve); + return new IccLutAToBTagDataEntry(bCurve, matrix3x3, matrix3x1, mCurve, clut, aCurve); } /// @@ -429,7 +429,7 @@ internal sealed partial class IccDataReader matrix3x1 = this.ReadMatrix(3, false); } - return new(bCurve, matrix3x3, matrix3x1, mCurve, clut, aCurve); + return new IccLutBToATagDataEntry(bCurve, matrix3x3, matrix3x1, mCurve, clut, aCurve); } /// @@ -472,10 +472,10 @@ internal sealed partial class IccDataReader for (int i = 0; i < recordCount; i++) { this.currentIndex = (int)(start + offset[i]); - text[i] = new(culture[i], this.ReadUnicodeString((int)length[i])); + text[i] = new IccLocalizedString(culture[i], this.ReadUnicodeString((int)length[i])); } - return new(text); + return new IccMultiLocalizedUnicodeTagDataEntry(text); CultureInfo ReadCulture(string language, string country) { @@ -487,7 +487,7 @@ internal sealed partial class IccDataReader { try { - return new(language); + return new CultureInfo(language); } catch (CultureNotFoundException) { @@ -498,7 +498,7 @@ internal sealed partial class IccDataReader { try { - return new($"{language}-{country}"); + return new CultureInfo($"{language}-{country}"); } catch (CultureNotFoundException) { @@ -533,7 +533,7 @@ internal sealed partial class IccDataReader elements[i] = this.ReadMultiProcessElement(); } - return new(elements); + return new IccMultiProcessElementsTagDataEntry(elements); } /// @@ -554,7 +554,7 @@ internal sealed partial class IccDataReader colors[i] = this.ReadNamedColor(coordCount); } - return new(vendorFlag, prefix, suffix, colors); + return new IccNamedColor2TagDataEntry(vendorFlag, prefix, suffix, colors); } /// @@ -576,7 +576,7 @@ internal sealed partial class IccDataReader description[i] = this.ReadProfileDescription(); } - return new(description); + return new IccProfileSequenceDescTagDataEntry(description); } /// @@ -600,10 +600,10 @@ internal sealed partial class IccDataReader IccProfileId id = this.ReadProfileId(); this.ReadCheckTagDataEntryHeader(IccTypeSignature.MultiLocalizedUnicode); IccMultiLocalizedUnicodeTagDataEntry description = this.ReadMultiLocalizedUnicodeTagDataEntry(); - entries[i] = new(id, description.Texts); + entries[i] = new IccProfileSequenceIdentifier(id, description.Texts); } - return new(entries); + return new IccProfileSequenceIdentifierTagDataEntry(entries); } /// @@ -629,7 +629,7 @@ internal sealed partial class IccDataReader curves[i] = this.ReadResponseCurve(channelCount); } - return new(curves); + return new IccResponseCurveSet16TagDataEntry(curves); } /// @@ -646,7 +646,7 @@ internal sealed partial class IccDataReader arrayData[i] = this.ReadFix16() / 256f; } - return new(arrayData); + return new IccFix16ArrayTagDataEntry(arrayData); } /// @@ -676,7 +676,7 @@ internal sealed partial class IccDataReader arrayData[i] = this.ReadUFix16(); } - return new(arrayData); + return new IccUFix16ArrayTagDataEntry(arrayData); } /// @@ -693,7 +693,7 @@ internal sealed partial class IccDataReader arrayData[i] = this.ReadUInt16(); } - return new(arrayData); + return new IccUInt16ArrayTagDataEntry(arrayData); } /// @@ -710,7 +710,7 @@ internal sealed partial class IccDataReader arrayData[i] = this.ReadUInt32(); } - return new(arrayData); + return new IccUInt32ArrayTagDataEntry(arrayData); } /// @@ -727,7 +727,7 @@ internal sealed partial class IccDataReader arrayData[i] = this.ReadUInt64(); } - return new(arrayData); + return new IccUInt64ArrayTagDataEntry(arrayData); } /// @@ -740,7 +740,7 @@ internal sealed partial class IccDataReader int count = (int)size - 8; // 8 is the tag header size byte[] adata = this.ReadBytes(count); - return new(adata); + return new IccUInt8ArrayTagDataEntry(adata); } /// @@ -766,7 +766,7 @@ internal sealed partial class IccDataReader arrayData[i] = this.ReadXyzNumber(); } - return new(arrayData); + return new IccXyzTagDataEntry(arrayData); } /// @@ -801,7 +801,7 @@ internal sealed partial class IccDataReader this.AddIndex(1); // Null terminator } - return new( + return new IccTextDescriptionTagDataEntry( asciiValue, unicodeValue, scriptcodeValue, @@ -830,7 +830,7 @@ internal sealed partial class IccDataReader uint crd3Count = this.ReadUInt32(); string crd3Name = this.ReadAsciiString((int)crd3Count); - return new(productName, crd0Name, crd1Name, crd2Name, crd3Name); + return new IccCrdInfoTagDataEntry(productName, crd0Name, crd1Name, crd2Name, crd3Name); } /// @@ -847,7 +847,7 @@ internal sealed partial class IccDataReader channels[i] = this.ReadScreeningChannel(); } - return new(flags, channels); + return new IccScreeningTagDataEntry(flags, channels); } /// @@ -876,6 +876,6 @@ internal sealed partial class IccDataReader int descriptionLength = (int)(size - 8 - dataSize); // 8 is the tag header size string description = this.ReadAsciiString(descriptionLength); - return new(ucrCurve, bgCurve, description); + return new IccUcrBgTagDataEntry(ucrCurve, bgCurve, description); } } diff --git a/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs b/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs index 8ad81415d..db199b438 100644 --- a/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs +++ b/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs @@ -111,9 +111,9 @@ internal sealed partial class IccDataWriter + this.WriteInt64((long)value.DeviceAttributes) + this.WriteUInt32((uint)value.TechnologyInformation) + this.WriteTagDataEntryHeader(IccTypeSignature.MultiLocalizedUnicode) - + this.WriteMultiLocalizedUnicodeTagDataEntry(new(value.DeviceManufacturerInfo)) + + this.WriteMultiLocalizedUnicodeTagDataEntry(new IccMultiLocalizedUnicodeTagDataEntry(value.DeviceManufacturerInfo)) + this.WriteTagDataEntryHeader(IccTypeSignature.MultiLocalizedUnicode) - + this.WriteMultiLocalizedUnicodeTagDataEntry(new(value.DeviceModelInfo)); + + this.WriteMultiLocalizedUnicodeTagDataEntry(new IccMultiLocalizedUnicodeTagDataEntry(value.DeviceModelInfo)); } /// diff --git a/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs b/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs index 1233beda7..6019a0bff 100644 --- a/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs +++ b/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs @@ -20,7 +20,7 @@ internal sealed partial class IccDataWriter uint offset = (uint)this.dataStream.Position; int count = this.WriteTagDataEntry(data); this.WritePadding(); - table = new(data.TagSignature, offset, (uint)count); + table = new IccTagTableEntry(data.TagSignature, offset, (uint)count); return count; } @@ -546,7 +546,7 @@ internal sealed partial class IccDataWriter uint offset = (uint)(this.dataStream.Position - start); int size = this.WriteMultiProcessElement(value.Data[i]); count += this.WritePadding(); - posTable[i] = new(offset, (uint)size); + posTable[i] = new IccPositionNumber(offset, (uint)size); count += size; } @@ -634,7 +634,7 @@ internal sealed partial class IccDataWriter int size = this.WriteProfileId(sequenceIdentifier.Id); size += this.WriteTagDataEntry(new IccMultiLocalizedUnicodeTagDataEntry(sequenceIdentifier.Description)); size += this.WritePadding(); - table[i] = new(offset, (uint)size); + table[i] = new IccPositionNumber(offset, (uint)size); count += size; } diff --git a/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.cs b/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.cs index 941d3bb65..ce5332544 100644 --- a/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.cs +++ b/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.cs @@ -23,7 +23,7 @@ internal sealed partial class IccDataWriter : IDisposable /// public IccDataWriter() { - this.dataStream = new(); + this.dataStream = new MemoryStream(); } /// diff --git a/src/ImageSharp/Metadata/Profiles/ICC/IccProfile.cs b/src/ImageSharp/Metadata/Profiles/ICC/IccProfile.cs index b33c98432..392ccb306 100644 --- a/src/ImageSharp/Metadata/Profiles/ICC/IccProfile.cs +++ b/src/ImageSharp/Metadata/Profiles/ICC/IccProfile.cs @@ -186,7 +186,7 @@ public sealed class IccProfile : IDeepCloneable if (this.data is null) { - this.header = new(); + this.header = new IccProfileHeader(); return; } diff --git a/src/ImageSharp/Metadata/Profiles/ICC/IccReader.cs b/src/ImageSharp/Metadata/Profiles/ICC/IccReader.cs index da3566514..074712d30 100644 --- a/src/ImageSharp/Metadata/Profiles/ICC/IccReader.cs +++ b/src/ImageSharp/Metadata/Profiles/ICC/IccReader.cs @@ -22,7 +22,7 @@ internal sealed class IccReader IccProfileHeader header = ReadHeader(reader); IccTagDataEntry[] tagData = ReadTagData(reader); - return new(header, tagData); + return new IccProfile(header, tagData); } /// @@ -57,7 +57,7 @@ internal sealed class IccReader { reader.SetIndex(0); - return new() + return new IccProfileHeader { Size = reader.ReadUInt32(), CmmType = reader.ReadAsciiString(4), @@ -128,7 +128,7 @@ internal sealed class IccReader // Exclude entries that have nonsense values and could cause exceptions further on if (tagOffset < reader.DataLength && tagSize < reader.DataLength - 128) { - table.Add(new((IccProfileTag)tagSignature, tagOffset, tagSize)); + table.Add(new IccTagTableEntry((IccProfileTag)tagSignature, tagOffset, tagSize)); } } diff --git a/src/ImageSharp/Metadata/Profiles/ICC/IccWriter.cs b/src/ImageSharp/Metadata/Profiles/ICC/IccWriter.cs index 8e0b4ae6d..5e73e2dd0 100644 --- a/src/ImageSharp/Metadata/Profiles/ICC/IccWriter.cs +++ b/src/ImageSharp/Metadata/Profiles/ICC/IccWriter.cs @@ -77,7 +77,7 @@ internal sealed class IccWriter writer.WriteTagDataEntry(group.Key, out IccTagTableEntry tableEntry); foreach (IccTagDataEntry item in group) { - table.Add(new(item.TagSignature, tableEntry.Offset, tableEntry.DataSize)); + table.Add(new IccTagTableEntry(item.TagSignature, tableEntry.Offset, tableEntry.DataSize)); } } diff --git a/src/ImageSharp/Metadata/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs b/src/ImageSharp/Metadata/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs index b8c29ae09..9ddd0ce13 100644 --- a/src/ImageSharp/Metadata/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs +++ b/src/ImageSharp/Metadata/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs @@ -147,7 +147,7 @@ internal sealed class IccLut16TagDataEntry : IccTagDataEntry, IEquatable= 0x41 && p4 <= 0x5A) { string culture = new(new[] { (char)p1, (char)p2, '-', (char)p3, (char)p4 }); - return new(culture); + return new CultureInfo(culture); } return null; diff --git a/src/ImageSharp/Metadata/Profiles/IPTC/IptcProfile.cs b/src/ImageSharp/Metadata/Profiles/IPTC/IptcProfile.cs index 8d13d3862..85c23d174 100644 --- a/src/ImageSharp/Metadata/Profiles/IPTC/IptcProfile.cs +++ b/src/ImageSharp/Metadata/Profiles/IPTC/IptcProfile.cs @@ -185,7 +185,7 @@ public sealed class IptcProfile : IDeepCloneable } } - this.values.Add(new(tag, encoding, value, strict)); + this.values.Add(new IptcValue(tag, encoding, value, strict)); } /// @@ -322,7 +322,7 @@ public sealed class IptcProfile : IDeepCloneable { byte[] iptcData = new byte[byteCount]; Buffer.BlockCopy(this.Data, offset, iptcData, 0, (int)byteCount); - this.values.Add(new(tag, iptcData, false)); + this.values.Add(new IptcValue(tag, iptcData, false)); } offset += (int)byteCount; diff --git a/src/ImageSharp/Metadata/Profiles/IPTC/IptcValue.cs b/src/ImageSharp/Metadata/Profiles/IPTC/IptcValue.cs index f0b1b717a..7c5662e1f 100644 --- a/src/ImageSharp/Metadata/Profiles/IPTC/IptcValue.cs +++ b/src/ImageSharp/Metadata/Profiles/IPTC/IptcValue.cs @@ -124,7 +124,7 @@ public sealed class IptcValue : IDeepCloneable public int Length => this.data.Length; /// - public IptcValue DeepClone() => new IptcValue(this); + public IptcValue DeepClone() => new(this); /// /// Determines whether the specified object is equal to the current . diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs index 63630dd55..ca358be31 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs @@ -179,7 +179,7 @@ internal static partial class PorterDuffFunctions float cg = OverlayValueFunction(backdrop.Y, source.Y); float cb = OverlayValueFunction(backdrop.Z, source.Z); - return Vector4.Min(Vector4.One, new(cr, cg, cb, 0)); + return Vector4.Min(Vector4.One, new Vector4(cr, cg, cb, 0)); } /// @@ -208,7 +208,7 @@ internal static partial class PorterDuffFunctions float cg = OverlayValueFunction(source.Y, backdrop.Y); float cb = OverlayValueFunction(source.Z, backdrop.Z); - return Vector4.Min(Vector4.One, new(cr, cg, cb, 0)); + return Vector4.Min(Vector4.One, new Vector4(cr, cg, cb, 0)); } /// diff --git a/src/ImageSharp/PixelFormats/PixelComponentInfo.cs b/src/ImageSharp/PixelFormats/PixelComponentInfo.cs index 00be93b22..1444b344b 100644 --- a/src/ImageSharp/PixelFormats/PixelComponentInfo.cs +++ b/src/ImageSharp/PixelFormats/PixelComponentInfo.cs @@ -81,7 +81,7 @@ public readonly struct PixelComponentInfo sum += p; } - return new(count, bitsPerPixel - sum, precisionData1, precisionData2); + return new PixelComponentInfo(count, bitsPerPixel - sum, precisionData1, precisionData2); } /// diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs index 453a39228..1190d307a 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs @@ -231,7 +231,7 @@ public partial struct Abgr32 : IPixel, IPackedVector public static Abgr32 FromL16(L16 source) { byte rgb = ColorNumerics.From16BitTo8Bit(source.PackedValue); - return new(rgb, rgb, rgb); + return new Abgr32(rgb, rgb, rgb); } /// @@ -243,7 +243,7 @@ public partial struct Abgr32 : IPixel, IPackedVector public static Abgr32 FromLa32(La32 source) { byte rgb = ColorNumerics.From16BitTo8Bit(source.L); - return new(rgb, rgb, rgb, ColorNumerics.From16BitTo8Bit(source.A)); + return new Abgr32(rgb, rgb, rgb, ColorNumerics.From16BitTo8Bit(source.A)); } /// @@ -320,6 +320,6 @@ public partial struct Abgr32 : IPixel, IPackedVector vector = Numerics.Clamp(vector, Vector4.Zero, MaxBytes); Vector128 result = Vector128.ConvertToInt32(vector.AsVector128()).AsByte(); - return new(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); + return new Abgr32(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs index f8608ecc5..b74f5db71 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs @@ -224,7 +224,7 @@ public partial struct Argb32 : IPixel, IPackedVector public static Argb32 FromL16(L16 source) { byte rgb = ColorNumerics.From16BitTo8Bit(source.PackedValue); - return new(rgb, rgb, rgb); + return new Argb32(rgb, rgb, rgb); } /// @@ -236,7 +236,7 @@ public partial struct Argb32 : IPixel, IPackedVector public static Argb32 FromLa32(La32 source) { byte rgb = ColorNumerics.From16BitTo8Bit(source.L); - return new(rgb, rgb, rgb, ColorNumerics.From16BitTo8Bit(source.A)); + return new Argb32(rgb, rgb, rgb, ColorNumerics.From16BitTo8Bit(source.A)); } /// @@ -296,6 +296,6 @@ public partial struct Argb32 : IPixel, IPackedVector vector = Numerics.Clamp(vector, Vector4.Zero, MaxBytes); Vector128 result = Vector128.ConvertToInt32(vector.AsVector128()).AsByte(); - return new(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); + return new Argb32(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs index a860edc56..944cdf7bf 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs @@ -110,7 +110,7 @@ public partial struct Bgr24 : IPixel source = Numerics.Clamp(source, Vector4.Zero, MaxBytes); Vector128 result = Vector128.ConvertToInt32(source.AsVector128()).AsByte(); - return new(result.GetElement(0), result.GetElement(4), result.GetElement(8)); + return new Bgr24(result.GetElement(0), result.GetElement(4), result.GetElement(8)); } /// @@ -142,7 +142,7 @@ public partial struct Bgr24 : IPixel public static Bgr24 FromL16(L16 source) { byte rgb = ColorNumerics.From16BitTo8Bit(source.PackedValue); - return new(rgb, rgb, rgb); + return new Bgr24(rgb, rgb, rgb); } /// @@ -154,7 +154,7 @@ public partial struct Bgr24 : IPixel public static Bgr24 FromLa32(La32 source) { byte rgb = ColorNumerics.From16BitTo8Bit(source.L); - return new(rgb, rgb, rgb); + return new Bgr24(rgb, rgb, rgb); } /// diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs index e81b3e66f..87055bf22 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs @@ -28,7 +28,7 @@ public partial struct Bgr565(Vector3 vector) : IPixel, IPackedVectorThe y-component /// The z-component public Bgr565(float x, float y, float z) - : this(new(x, y, z)) + : this(new Vector3(x, y, z)) { } @@ -84,7 +84,7 @@ public partial struct Bgr565(Vector3 vector) : IPixel, IPackedVector [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Bgr565 FromVector4(Vector4 source) => new() { PackedValue = Pack(new(source.X, source.Y, source.Z)) }; + public static Bgr565 FromVector4(Vector4 source) => new() { PackedValue = Pack(new Vector3(source.X, source.Y, source.Z)) }; /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs index 0fe7e4cc2..903d9dc8c 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs @@ -173,7 +173,7 @@ public partial struct Bgra32 : IPixel, IPackedVector public static Bgra32 FromL16(L16 source) { byte rgb = ColorNumerics.From16BitTo8Bit(source.PackedValue); - return new(rgb, rgb, rgb); + return new Bgra32(rgb, rgb, rgb); } /// @@ -185,7 +185,7 @@ public partial struct Bgra32 : IPixel, IPackedVector public static Bgra32 FromLa32(La32 source) { byte rgb = ColorNumerics.From16BitTo8Bit(source.L); - return new(rgb, rgb, rgb, ColorNumerics.From16BitTo8Bit(source.A)); + return new Bgra32(rgb, rgb, rgb, ColorNumerics.From16BitTo8Bit(source.A)); } /// @@ -242,6 +242,6 @@ public partial struct Bgra32 : IPixel, IPackedVector vector = Numerics.Clamp(vector, Vector4.Zero, MaxBytes); Vector128 result = Vector128.ConvertToInt32(vector.AsVector128()).AsByte(); - return new(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); + return new Bgra32(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs index d6ffa4723..55971210c 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs @@ -22,7 +22,7 @@ public partial struct Bgra4444 : IPixel, IPackedVector /// The z-component /// The w-component public Bgra4444(float x, float y, float z, float w) - : this(new(x, y, z, w)) + : this(new Vector4(x, y, z, w)) { } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra5551.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra5551.cs index 45f013fb1..4c94dea5f 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra5551.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra5551.cs @@ -23,7 +23,7 @@ public partial struct Bgra5551 : IPixel, IPackedVector /// The z-component /// The w-component public Bgra5551(float x, float y, float z, float w) - : this(new(x, y, z, w)) + : this(new Vector4(x, y, z, w)) { } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs index b4479fd50..680a7ee0b 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs @@ -25,7 +25,7 @@ public partial struct Byte4 : IPixel, IPackedVector /// The z-component /// The w-component public Byte4(float x, float y, float z, float w) - : this(new(x, y, z, w)) + : this(new Vector4(x, y, z, w)) { } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs b/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs index 3ef711d6a..00deadb12 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs @@ -55,7 +55,7 @@ public partial struct HalfSingle : IPixel, IPackedVector { float single = this.ToSingle() + 1F; single /= 2F; - return new(single, 0, 0, 1F); + return new Vector4(single, 0, 0, 1F); } /// @@ -79,7 +79,7 @@ public partial struct HalfSingle : IPixel, IPackedVector float scaled = source.X; scaled *= 2F; scaled--; - return new() { PackedValue = HalfTypeHelper.Pack(scaled) }; + return new HalfSingle { PackedValue = HalfTypeHelper.Pack(scaled) }; } /// diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs index 861a8480a..03d4dee89 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs @@ -63,7 +63,7 @@ public partial struct HalfVector2 : IPixel, IPackedVector Vector2 scaled = this.ToVector2(); scaled += Vector2.One; scaled /= 2F; - return new(scaled, 0F, 1F); + return new Vector4(scaled, 0F, 1F); } /// @@ -71,7 +71,7 @@ public partial struct HalfVector2 : IPixel, IPackedVector public readonly Vector4 ToVector4() { Vector2 vector = this.ToVector2(); - return new(vector.X, vector.Y, 0F, 1F); + return new Vector4(vector.X, vector.Y, 0F, 1F); } /// @@ -90,7 +90,7 @@ public partial struct HalfVector2 : IPixel, IPackedVector { Vector2 scaled = new Vector2(source.X, source.Y) * 2F; scaled -= Vector2.One; - return new() { PackedValue = Pack(scaled.X, scaled.Y) }; + return new HalfVector2 { PackedValue = Pack(scaled.X, scaled.Y) }; } /// diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs index 254e9290d..d0b57d788 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs @@ -22,7 +22,7 @@ public partial struct HalfVector4 : IPixel, IPackedVector /// The z-component. /// The w-component. public HalfVector4(float x, float y, float z, float w) - : this(new(x, y, z, w)) + : this(new Vector4(x, y, z, w)) { } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/L16.cs b/src/ImageSharp/PixelFormats/PixelImplementations/L16.cs index faad37ab5..c5893f770 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/L16.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/L16.cs @@ -52,7 +52,7 @@ public partial struct L16 : IPixel, IPackedVector public readonly Rgba32 ToRgba32() { byte rgb = ColorNumerics.From16BitTo8Bit(this.PackedValue); - return new(rgb, rgb, rgb); + return new Rgba32(rgb, rgb, rgb); } /// @@ -64,7 +64,7 @@ public partial struct L16 : IPixel, IPackedVector public readonly Vector4 ToVector4() { float scaled = this.PackedValue / Max; - return new(scaled, scaled, scaled, 1f); + return new Vector4(scaled, scaled, scaled, 1f); } /// diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs b/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs index 1ef5951fe..008eed459 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs @@ -54,7 +54,7 @@ public partial struct L8 : IPixel, IPackedVector public readonly Rgba32 ToRgba32() { byte rgb = this.PackedValue; - return new(rgb, rgb, rgb); + return new Rgba32(rgb, rgb, rgb); } /// @@ -66,7 +66,7 @@ public partial struct L8 : IPixel, IPackedVector public readonly Vector4 ToVector4() { float rgb = this.PackedValue / 255f; - return new(rgb, rgb, rgb, 1f); + return new Vector4(rgb, rgb, rgb, 1f); } /// diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs b/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs index b1149dc3e..6c3fa7829 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs @@ -93,7 +93,7 @@ public partial struct La16 : IPixel, IPackedVector { const float max = 255f; float rgb = this.L / max; - return new(rgb, rgb, rgb, this.A / max); + return new Vector4(rgb, rgb, rgb, this.A / max); } /// @@ -188,6 +188,6 @@ public partial struct La16 : IPixel, IPackedVector byte l = ColorNumerics.Get8BitBT709Luminance(result.GetElement(0), result.GetElement(4), result.GetElement(8)); byte a = result.GetElement(12); - return new(l, a); + return new La16(l, a); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs index ec2c38e3e..c99f6fe60 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs @@ -78,7 +78,7 @@ public partial struct La32 : IPixel, IPackedVector public readonly Rgba32 ToRgba32() { byte rgb = ColorNumerics.From16BitTo8Bit(this.L); - return new(rgb, rgb, rgb, ColorNumerics.From16BitTo8Bit(this.A)); + return new Rgba32(rgb, rgb, rgb, ColorNumerics.From16BitTo8Bit(this.A)); } /// @@ -90,7 +90,7 @@ public partial struct La32 : IPixel, IPackedVector public readonly Vector4 ToVector4() { float rgb = this.L / Max; - return new(rgb, rgb, rgb, this.A / Max); + return new Vector4(rgb, rgb, rgb, this.A / Max); } /// @@ -117,7 +117,7 @@ public partial struct La32 : IPixel, IPackedVector { ushort l = ColorNumerics.Get16BitBT709Luminance(source.R, source.G, source.B); ushort a = ColorNumerics.From8BitTo16Bit(source.A); - return new(l, a); + return new La32(l, a); } /// @@ -126,7 +126,7 @@ public partial struct La32 : IPixel, IPackedVector { ushort l = ColorNumerics.Get16BitBT709Luminance(source.R, source.G, source.B); ushort a = ColorNumerics.From8BitTo16Bit(source.A); - return new(l, a); + return new La32(l, a); } /// @@ -143,7 +143,7 @@ public partial struct La32 : IPixel, IPackedVector { ushort l = ColorNumerics.Get16BitBT709Luminance(source.R, source.G, source.B); ushort a = ColorNumerics.From8BitTo16Bit(source.A); - return new(l, a); + return new La32(l, a); } /// @@ -160,7 +160,7 @@ public partial struct La32 : IPixel, IPackedVector { ushort l = ColorNumerics.From8BitTo16Bit(source.L); ushort a = ColorNumerics.From8BitTo16Bit(source.A); - return new(l, a); + return new La32(l, a); } /// @@ -176,7 +176,7 @@ public partial struct La32 : IPixel, IPackedVector public static La32 FromRgb48(Rgb48 source) { ushort l = ColorNumerics.Get16BitBT709Luminance(source.R, source.G, source.B); - return new(l, ushort.MaxValue); + return new La32(l, ushort.MaxValue); } /// @@ -185,7 +185,7 @@ public partial struct La32 : IPixel, IPackedVector { ushort l = ColorNumerics.Get16BitBT709Luminance(source.R, source.G, source.B); ushort a = ColorNumerics.From8BitTo16Bit(source.A); - return new(l, a); + return new La32(l, a); } /// @@ -210,6 +210,6 @@ public partial struct La32 : IPixel, IPackedVector vector = Numerics.Clamp(vector, Vector4.Zero, Vector4.One) * Max; ushort l = ColorNumerics.Get16BitBT709Luminance(vector.X, vector.Y, vector.Z); ushort a = (ushort)MathF.Round(vector.W); - return new(l, a); + return new La32(l, a); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs index c4b6bf818..da2ab2440 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs @@ -24,7 +24,7 @@ public partial struct NormalizedByte2 : IPixel, IPackedVectorThe x-component. /// The y-component. public NormalizedByte2(float x, float y) - : this(new(x, y)) + : this(new Vector2(x, y)) { } @@ -70,7 +70,7 @@ public partial struct NormalizedByte2 : IPixel, IPackedVector @@ -93,12 +93,12 @@ public partial struct NormalizedByte2 : IPixel, IPackedVector [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static NormalizedByte2 FromVector4(Vector4 source) => new() { PackedValue = Pack(new(source.X, source.Y)) }; + public static NormalizedByte2 FromVector4(Vector4 source) => new() { PackedValue = Pack(new Vector2(source.X, source.Y)) }; /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs index 380465f4e..1fb386725 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs @@ -27,7 +27,7 @@ public partial struct NormalizedByte4 : IPixel, IPackedVectorThe z-component. /// The w-component. public NormalizedByte4(float x, float y, float z, float w) - : this(new(x, y, z, w)) + : this(new Vector4(x, y, z, w)) { } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs index edd2271ec..0942c3a76 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs @@ -26,7 +26,7 @@ public partial struct NormalizedShort2 : IPixel, IPackedVector /// The x-component. /// The y-component. public NormalizedShort2(float x, float y) - : this(new(x, y)) + : this(new Vector2(x, y)) { } @@ -72,7 +72,7 @@ public partial struct NormalizedShort2 : IPixel, IPackedVector Vector2 scaled = this.ToVector2(); scaled += Vector2.One; scaled /= 2f; - return new(scaled, 0f, 1f); + return new Vector4(scaled, 0f, 1f); } /// @@ -95,12 +95,12 @@ public partial struct NormalizedShort2 : IPixel, IPackedVector { Vector2 scaled = new Vector2(source.X, source.Y) * 2f; scaled -= Vector2.One; - return new() { PackedValue = Pack(scaled) }; + return new NormalizedShort2 { PackedValue = Pack(scaled) }; } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static NormalizedShort2 FromVector4(Vector4 source) => new() { PackedValue = Pack(new(source.X, source.Y)) }; + public static NormalizedShort2 FromVector4(Vector4 source) => new() { PackedValue = Pack(new Vector2(source.X, source.Y)) }; /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs index 2c30a0a56..2b33fec27 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs @@ -28,7 +28,7 @@ public partial struct NormalizedShort4 : IPixel, IPackedVector /// The z-component. /// The w-component. public NormalizedShort4(float x, float y, float z, float w) - : this(new(x, y, z, w)) + : this(new Vector4(x, y, z, w)) { } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs index 89b2a65b2..e7c97269e 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs @@ -22,7 +22,7 @@ public partial struct Rg32 : IPixel, IPackedVector /// The x-component /// The y-component public Rg32(float x, float y) - : this(new(x, y)) + : this(new Vector2(x, y)) { } @@ -90,7 +90,7 @@ public partial struct Rg32 : IPixel, IPackedVector /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Rg32 FromVector4(Vector4 source) => new() { PackedValue = Pack(new(source.X, source.Y)) }; + public static Rg32 FromVector4(Vector4 source) => new() { PackedValue = Pack(new Vector2(source.X, source.Y)) }; /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs index 8eaabe02e..190407296 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs @@ -62,7 +62,7 @@ public partial struct Rgb24 : IPixel /// An instance of . [MethodImpl(MethodImplOptions.AggressiveInlining)] public static implicit operator Rgb24(Rgb color) - => FromScaledVector4(new(color.ToScaledVector3(), 1F)); + => FromScaledVector4(new Vector4(color.ToScaledVector3(), 1F)); /// /// Compares two objects for equality. @@ -121,7 +121,7 @@ public partial struct Rgb24 : IPixel source = Numerics.Clamp(source, Vector4.Zero, MaxBytes); Vector128 result = Vector128.ConvertToInt32(source.AsVector128()).AsByte(); - return new(result.GetElement(0), result.GetElement(4), result.GetElement(8)); + return new Rgb24(result.GetElement(0), result.GetElement(4), result.GetElement(8)); } /// @@ -153,7 +153,7 @@ public partial struct Rgb24 : IPixel public static Rgb24 FromL16(L16 source) { byte rgb = ColorNumerics.From16BitTo8Bit(source.PackedValue); - return new(rgb, rgb, rgb); + return new Rgb24(rgb, rgb, rgb); } /// @@ -165,7 +165,7 @@ public partial struct Rgb24 : IPixel public static Rgb24 FromLa32(La32 source) { byte rgb = ColorNumerics.From16BitTo8Bit(source.L); - return new(rgb, rgb, rgb); + return new Rgb24(rgb, rgb, rgb); } /// diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs index e822d2abc..ed6f57abb 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs @@ -100,7 +100,7 @@ public partial struct Rgb48 : IPixel public static Rgb48 FromVector4(Vector4 source) { source = Numerics.Clamp(source, Vector4.Zero, Vector4.One) * Max; - return new((ushort)MathF.Round(source.X), (ushort)MathF.Round(source.Y), (ushort)MathF.Round(source.Z)); + return new Rgb48((ushort)MathF.Round(source.X), (ushort)MathF.Round(source.Y), (ushort)MathF.Round(source.Z)); } /// @@ -132,7 +132,7 @@ public partial struct Rgb48 : IPixel public static Rgb48 FromL8(L8 source) { ushort rgb = ColorNumerics.From8BitTo16Bit(source.PackedValue); - return new(rgb, rgb, rgb); + return new Rgb48(rgb, rgb, rgb); } /// @@ -144,7 +144,7 @@ public partial struct Rgb48 : IPixel public static Rgb48 FromLa16(La16 source) { ushort rgb = ColorNumerics.From8BitTo16Bit(source.L); - return new(rgb, rgb, rgb); + return new Rgb48(rgb, rgb, rgb); } /// diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs index a022476fd..cdee22964 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs @@ -25,7 +25,7 @@ public partial struct Rgba1010102 : IPixel, IPackedVector /// The z-component /// The w-component public Rgba1010102(float x, float y, float z, float w) - : this(new(x, y, z, w)) + : this(new Vector4(x, y, z, w)) { } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs index f618b9a2f..8980700c9 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs @@ -187,7 +187,7 @@ public partial struct Rgba32 : IPixel, IPackedVector /// The instance of to convert. /// An instance of . [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static implicit operator Rgba32(Rgb color) => FromScaledVector4(new(color.ToScaledVector3(), 1F)); + public static implicit operator Rgba32(Rgb color) => FromScaledVector4(new Vector4(color.ToScaledVector3(), 1F)); /// /// Compares two objects for equality. @@ -328,7 +328,7 @@ public partial struct Rgba32 : IPixel, IPackedVector public static Rgba32 FromL16(L16 source) { byte rgb = ColorNumerics.From16BitTo8Bit(source.PackedValue); - return new(rgb, rgb, rgb); + return new Rgba32(rgb, rgb, rgb); } /// @@ -340,7 +340,7 @@ public partial struct Rgba32 : IPixel, IPackedVector public static Rgba32 FromLa32(La32 source) { byte rgb = ColorNumerics.From16BitTo8Bit(source.L); - return new(rgb, rgb, rgb, ColorNumerics.From16BitTo8Bit(source.A)); + return new Rgba32(rgb, rgb, rgb, ColorNumerics.From16BitTo8Bit(source.A)); } /// @@ -407,7 +407,7 @@ public partial struct Rgba32 : IPixel, IPackedVector vector = Numerics.Clamp(vector, Vector4.Zero, MaxBytes); Vector128 result = Vector128.ConvertToInt32(vector.AsVector128()).AsByte(); - return new(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); + return new Rgba32(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); } /// @@ -444,6 +444,6 @@ public partial struct Rgba32 : IPixel, IPackedVector char g = hex[1]; char r = hex[0]; - return new(new[] { r, r, g, g, b, b, a, a }); + return new string(new[] { r, r, g, g, b, b, a, a }); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs index 27c4752e1..c73daaf86 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs @@ -245,7 +245,7 @@ public partial struct Rgba64 : IPixel, IPackedVector public static Rgba64 FromL8(L8 source) { ushort rgb = ColorNumerics.From8BitTo16Bit(source.PackedValue); - return new(rgb, rgb, rgb, ushort.MaxValue); + return new Rgba64(rgb, rgb, rgb, ushort.MaxValue); } /// @@ -257,7 +257,7 @@ public partial struct Rgba64 : IPixel, IPackedVector public static Rgba64 FromLa16(La16 source) { ushort rgb = ColorNumerics.From8BitTo16Bit(source.L); - return new(rgb, rgb, rgb, ColorNumerics.From8BitTo16Bit(source.A)); + return new Rgba64(rgb, rgb, rgb, ColorNumerics.From8BitTo16Bit(source.A)); } /// diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs index a27cffad8..3f9cab32f 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs @@ -115,7 +115,7 @@ public partial struct RgbaVector : IPixel public static RgbaVector FromVector4(Vector4 source) { source = Numerics.Clamp(source, Vector4.Zero, Vector4.One); - return new(source.X, source.Y, source.Z, source.W); + return new RgbaVector(source.X, source.Y, source.Z, source.W); } /// diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs index c76f87047..39c853a5e 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs @@ -29,7 +29,7 @@ public partial struct Short2 : IPixel, IPackedVector /// The x-component. /// The y-component. public Short2(float x, float y) - : this(new(x, y)) + : this(new Vector2(x, y)) { } @@ -75,7 +75,7 @@ public partial struct Short2 : IPixel, IPackedVector Vector2 scaled = this.ToVector2(); scaled += new Vector2(32767f); scaled /= 65534F; - return new(scaled, 0f, 1f); + return new Vector4(scaled, 0f, 1f); } /// @@ -98,12 +98,12 @@ public partial struct Short2 : IPixel, IPackedVector { Vector2 scaled = new Vector2(source.X, source.Y) * 65534F; scaled -= new Vector2(32767F); - return new() { PackedValue = Pack(scaled) }; + return new Short2 { PackedValue = Pack(scaled) }; } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Short2 FromVector4(Vector4 source) => new() { PackedValue = Pack(new(source.X, source.Y)) }; + public static Short2 FromVector4(Vector4 source) => new() { PackedValue = Pack(new Vector2(source.X, source.Y)) }; /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs index c657263c0..b6cece2be 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs @@ -31,7 +31,7 @@ public partial struct Short4 : IPixel, IPackedVector /// The z-component. /// The w-component. public Short4(float x, float y, float z, float w) - : this(new(x, y, z, w)) + : this(new Vector4(x, y, z, w)) { } diff --git a/src/ImageSharp/Primitives/ColorMatrix.Impl.cs b/src/ImageSharp/Primitives/ColorMatrix.Impl.cs index 7eb95569d..559fcdde0 100644 --- a/src/ImageSharp/Primitives/ColorMatrix.Impl.cs +++ b/src/ImageSharp/Primitives/ColorMatrix.Impl.cs @@ -181,11 +181,11 @@ public partial struct ColorMatrix float m41, float m42, float m43, float m44, float m51, float m52, float m53, float m54) { - this.X = new(m11, m12, m13, m14); - this.Y = new(m21, m22, m23, m24); - this.Z = new(m31, m32, m33, m34); - this.W = new(m41, m42, m43, m44); - this.V = new(m51, m52, m53, m54); + this.X = new Vector4(m11, m12, m13, m14); + this.Y = new Vector4(m21, m22, m23, m24); + this.Z = new Vector4(m31, m32, m33, m34); + this.W = new Vector4(m41, m42, m43, m44); + this.V = new Vector4(m51, m52, m53, m54); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp/Primitives/Complex64.cs b/src/ImageSharp/Primitives/Complex64.cs index 2a16df969..061e2bd80 100644 --- a/src/ImageSharp/Primitives/Complex64.cs +++ b/src/ImageSharp/Primitives/Complex64.cs @@ -53,7 +53,7 @@ internal readonly struct Complex64 : IEquatable [MethodImpl(InliningOptions.ShortMethod)] public static ComplexVector4 operator *(Complex64 value, Vector4 vector) { - return new() { Real = vector * value.Real, Imaginary = vector * value.Imaginary }; + return new ComplexVector4 { Real = vector * value.Real, Imaginary = vector * value.Imaginary }; } /// @@ -67,7 +67,7 @@ internal readonly struct Complex64 : IEquatable { Vector4 real = (value.Real * vector.Real) - (value.Imaginary * vector.Imaginary); Vector4 imaginary = (value.Real * vector.Imaginary) + (value.Imaginary * vector.Real); - return new() { Real = real, Imaginary = imaginary }; + return new ComplexVector4 { Real = real, Imaginary = imaginary }; } /// diff --git a/src/ImageSharp/Primitives/DenseMatrix{T}.cs b/src/ImageSharp/Primitives/DenseMatrix{T}.cs index b39f306cb..692507096 100644 --- a/src/ImageSharp/Primitives/DenseMatrix{T}.cs +++ b/src/ImageSharp/Primitives/DenseMatrix{T}.cs @@ -36,7 +36,7 @@ public readonly struct DenseMatrix : IEquatable> this.Rows = rows; this.Columns = columns; - this.Size = new(columns, rows); + this.Size = new Size(columns, rows); this.Count = columns * rows; this.Data = new T[this.Columns * this.Rows]; } @@ -56,7 +56,7 @@ public readonly struct DenseMatrix : IEquatable> this.Rows = rows; this.Columns = columns; - this.Size = new(columns, rows); + this.Size = new Size(columns, rows); this.Count = this.Columns * this.Rows; this.Data = new T[this.Columns * this.Rows]; @@ -84,7 +84,7 @@ public readonly struct DenseMatrix : IEquatable> this.Rows = rows; this.Columns = columns; - this.Size = new(columns, rows); + this.Size = new Size(columns, rows); this.Count = this.Columns * this.Rows; this.Data = new T[this.Columns * this.Rows]; diff --git a/src/ImageSharp/Primitives/LongRational.cs b/src/ImageSharp/Primitives/LongRational.cs index 0b3380ca9..69139ac9c 100644 --- a/src/ImageSharp/Primitives/LongRational.cs +++ b/src/ImageSharp/Primitives/LongRational.cs @@ -133,22 +133,22 @@ internal readonly struct LongRational : IEquatable { if (value == 0.0) { - return new(0, 1); + return new LongRational(0, 1); } if (double.IsNaN(value)) { - return new(0, 0); + return new LongRational(0, 0); } if (double.IsPositiveInfinity(value)) { - return new(1, 0); + return new LongRational(1, 0); } if (double.IsNegativeInfinity(value)) { - return new(-1, 0); + return new LongRational(-1, 0); } long numerator = 1; @@ -208,14 +208,14 @@ internal readonly struct LongRational : IEquatable if (this.Numerator == this.Denominator) { - return new(1, 1); + return new LongRational(1, 1); } long gcd = GreatestCommonDivisor(Math.Abs(this.Numerator), Math.Abs(this.Denominator)); if (gcd > 1) { - return new(this.Numerator / gcd, this.Denominator / gcd); + return new LongRational(this.Numerator / gcd, this.Denominator / gcd); } return this; diff --git a/src/ImageSharp/Primitives/Number.cs b/src/ImageSharp/Primitives/Number.cs index fae67bbea..a996a94f4 100644 --- a/src/ImageSharp/Primitives/Number.cs +++ b/src/ImageSharp/Primitives/Number.cs @@ -47,19 +47,19 @@ public struct Number : IEquatable, IComparable /// Converts the specified to an instance of this type. /// /// The value. - public static implicit operator Number(int value) => new Number(value); + public static implicit operator Number(int value) => new(value); /// /// Converts the specified to an instance of this type. /// /// The value. - public static implicit operator Number(uint value) => new Number(value); + public static implicit operator Number(uint value) => new(value); /// /// Converts the specified to an instance of this type. /// /// The value. - public static implicit operator Number(ushort value) => new Number((uint)value); + public static implicit operator Number(ushort value) => new((uint)value); /// /// Converts the specified to a . diff --git a/src/ImageSharp/Primitives/Point.cs b/src/ImageSharp/Primitives/Point.cs index 5eae087ed..8ace7ffac 100644 --- a/src/ImageSharp/Primitives/Point.cs +++ b/src/ImageSharp/Primitives/Point.cs @@ -232,7 +232,7 @@ public struct Point : IEquatable /// The transformation matrix used. /// The transformed . [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Point Transform(Point point, Matrix3x2 matrix) => Round(Vector2.Transform(new(point.X, point.Y), matrix)); + public static Point Transform(Point point, Matrix3x2 matrix) => Round(Vector2.Transform(new Vector2(point.X, point.Y), matrix)); /// /// Deconstructs this point into two integers. diff --git a/src/ImageSharp/Primitives/Rectangle.cs b/src/ImageSharp/Primitives/Rectangle.cs index a3cb89cf0..e2ae5071e 100644 --- a/src/ImageSharp/Primitives/Rectangle.cs +++ b/src/ImageSharp/Primitives/Rectangle.cs @@ -214,7 +214,7 @@ public struct Rectangle : IEquatable if (x2 >= x1 && y2 >= y1) { - return new(x1, y1, x2 - x1, y2 - y1); + return new Rectangle(x1, y1, x2 - x1, y2 - y1); } return Empty; @@ -245,7 +245,7 @@ public struct Rectangle : IEquatable { unchecked { - return new( + return new Rectangle( (int)MathF.Ceiling(rectangle.X), (int)MathF.Ceiling(rectangle.Y), (int)MathF.Ceiling(rectangle.Width), @@ -261,9 +261,9 @@ public struct Rectangle : IEquatable /// A transformed rectangle. public static RectangleF Transform(Rectangle rectangle, Matrix3x2 matrix) { - PointF bottomRight = Point.Transform(new(rectangle.Right, rectangle.Bottom), matrix); + PointF bottomRight = Point.Transform(new Point(rectangle.Right, rectangle.Bottom), matrix); PointF topLeft = Point.Transform(rectangle.Location, matrix); - return new(topLeft, new(bottomRight - topLeft)); + return new RectangleF(topLeft, new SizeF(bottomRight - topLeft)); } /// @@ -276,7 +276,7 @@ public struct Rectangle : IEquatable { unchecked { - return new( + return new Rectangle( (int)rectangle.X, (int)rectangle.Y, (int)rectangle.Width, @@ -294,7 +294,7 @@ public struct Rectangle : IEquatable { unchecked { - return new( + return new Rectangle( (int)MathF.Round(rectangle.X), (int)MathF.Round(rectangle.Y), (int)MathF.Round(rectangle.Width), @@ -316,7 +316,7 @@ public struct Rectangle : IEquatable int y1 = Math.Min(a.Y, b.Y); int y2 = Math.Max(a.Bottom, b.Bottom); - return new(x1, y1, x2 - x1, y2 - y1); + return new Rectangle(x1, y1, x2 - x1, y2 - y1); } /// diff --git a/src/ImageSharp/Primitives/RectangleF.cs b/src/ImageSharp/Primitives/RectangleF.cs index 9a7a97a13..68add77d0 100644 --- a/src/ImageSharp/Primitives/RectangleF.cs +++ b/src/ImageSharp/Primitives/RectangleF.cs @@ -207,7 +207,7 @@ public struct RectangleF : IEquatable if (x2 >= x1 && y2 >= y1) { - return new(x1, y1, x2 - x1, y2 - y1); + return new RectangleF(x1, y1, x2 - x1, y2 - y1); } return Empty; @@ -236,9 +236,9 @@ public struct RectangleF : IEquatable /// A transformed . public static RectangleF Transform(RectangleF rectangle, Matrix3x2 matrix) { - PointF bottomRight = PointF.Transform(new(rectangle.Right, rectangle.Bottom), matrix); + PointF bottomRight = PointF.Transform(new PointF(rectangle.Right, rectangle.Bottom), matrix); PointF topLeft = PointF.Transform(rectangle.Location, matrix); - return new(topLeft, new(bottomRight - topLeft)); + return new RectangleF(topLeft, new SizeF(bottomRight - topLeft)); } /// @@ -255,7 +255,7 @@ public struct RectangleF : IEquatable float y1 = MathF.Min(a.Y, b.Y); float y2 = MathF.Max(a.Bottom, b.Bottom); - return new(x1, y1, x2 - x1, y2 - y1); + return new RectangleF(x1, y1, x2 - x1, y2 - y1); } /// diff --git a/src/ImageSharp/Primitives/SignedRational.cs b/src/ImageSharp/Primitives/SignedRational.cs index 2b62b4c3e..0f8e6518a 100644 --- a/src/ImageSharp/Primitives/SignedRational.cs +++ b/src/ImageSharp/Primitives/SignedRational.cs @@ -117,7 +117,7 @@ public readonly struct SignedRational : IEquatable /// public static SignedRational FromDouble(double value) { - return new(value, false); + return new SignedRational(value, false); } /// @@ -130,7 +130,7 @@ public readonly struct SignedRational : IEquatable /// public static SignedRational FromDouble(double value, bool bestPrecision) { - return new(value, bestPrecision); + return new SignedRational(value, bestPrecision); } /// diff --git a/src/ImageSharp/Primitives/Size.cs b/src/ImageSharp/Primitives/Size.cs index 5ceab493f..0e65a8138 100644 --- a/src/ImageSharp/Primitives/Size.cs +++ b/src/ImageSharp/Primitives/Size.cs @@ -237,9 +237,9 @@ public struct Size : IEquatable /// A transformed size. public static SizeF Transform(Size size, Matrix3x2 matrix) { - Vector2 v = Vector2.Transform(new(size.Width, size.Height), matrix); + Vector2 v = Vector2.Transform(new Vector2(size.Width, size.Height), matrix); - return new(v.X, v.Y); + return new SizeF(v.X, v.Y); } /// diff --git a/src/ImageSharp/Primitives/SizeF.cs b/src/ImageSharp/Primitives/SizeF.cs index 88c3b8319..81c749875 100644 --- a/src/ImageSharp/Primitives/SizeF.cs +++ b/src/ImageSharp/Primitives/SizeF.cs @@ -191,9 +191,9 @@ public struct SizeF : IEquatable /// A transformed size. public static SizeF Transform(SizeF size, Matrix3x2 matrix) { - Vector2 v = Vector2.Transform(new(size.Width, size.Height), matrix); + Vector2 v = Vector2.Transform(new Vector2(size.Width, size.Height), matrix); - return new(v.X, v.Y); + return new SizeF(v.X, v.Y); } /// diff --git a/src/ImageSharp/Primitives/ValueSize.cs b/src/ImageSharp/Primitives/ValueSize.cs index 9a76269b3..f572dd658 100644 --- a/src/ImageSharp/Primitives/ValueSize.cs +++ b/src/ImageSharp/Primitives/ValueSize.cs @@ -68,7 +68,7 @@ internal readonly struct ValueSize : IEquatable /// a Values size with type PercentageOfWidth public static ValueSize PercentageOfWidth(float percentage) { - return new(percentage, ValueSizeType.PercentageOfWidth); + return new ValueSize(percentage, ValueSizeType.PercentageOfWidth); } /// @@ -78,7 +78,7 @@ internal readonly struct ValueSize : IEquatable /// a Values size with type PercentageOfHeight public static ValueSize PercentageOfHeight(float percentage) { - return new(percentage, ValueSizeType.PercentageOfHeight); + return new ValueSize(percentage, ValueSizeType.PercentageOfHeight); } /// @@ -88,7 +88,7 @@ internal readonly struct ValueSize : IEquatable /// a Values size with type Absolute. public static ValueSize Absolute(float value) { - return new(value, ValueSizeType.Absolute); + return new ValueSize(value, ValueSizeType.Absolute); } /// diff --git a/src/ImageSharp/Processing/Extensions/Normalization/HistogramEqualizationExtensions.cs b/src/ImageSharp/Processing/Extensions/Normalization/HistogramEqualizationExtensions.cs index 6af61338d..d7f4ba359 100644 --- a/src/ImageSharp/Processing/Extensions/Normalization/HistogramEqualizationExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Normalization/HistogramEqualizationExtensions.cs @@ -16,7 +16,7 @@ public static class HistogramEqualizationExtensions /// The current image processing context. /// The . public static IImageProcessingContext HistogramEqualization(this IImageProcessingContext source) => - HistogramEqualization(source, new()); + HistogramEqualization(source, new HistogramEqualizationOptions()); /// /// Equalizes the histogram of an image to increases the contrast. diff --git a/src/ImageSharp/Processing/Extensions/Transforms/CropExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/CropExtensions.cs index 256bac64e..3025806d4 100644 --- a/src/ImageSharp/Processing/Extensions/Transforms/CropExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Transforms/CropExtensions.cs @@ -19,7 +19,7 @@ public static class CropExtensions /// The target image height. /// The . public static IImageProcessingContext Crop(this IImageProcessingContext source, int width, int height) => - Crop(source, new(0, 0, width, height)); + Crop(source, new Rectangle(0, 0, width, height)); /// /// Crops an image to the given rectangle. diff --git a/src/ImageSharp/Processing/Extensions/Transforms/PadExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/PadExtensions.cs index cca3e4241..96b30d4f8 100644 --- a/src/ImageSharp/Processing/Extensions/Transforms/PadExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Transforms/PadExtensions.cs @@ -33,7 +33,7 @@ public static class PadExtensions ResizeOptions options = new() { // Prevent downsizing. - Size = new(Math.Max(width, size.Width), Math.Max(height, size.Height)), + Size = new Size(Math.Max(width, size.Width), Math.Max(height, size.Height)), Mode = ResizeMode.BoxPad, Sampler = KnownResamplers.NearestNeighbor, PadColor = color diff --git a/src/ImageSharp/Processing/Extensions/Transforms/ResizeExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/ResizeExtensions.cs index 3ac9553d4..4a09639f8 100644 --- a/src/ImageSharp/Processing/Extensions/Transforms/ResizeExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Transforms/ResizeExtensions.cs @@ -77,7 +77,7 @@ public static class ResizeExtensions /// The . /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio. public static IImageProcessingContext Resize(this IImageProcessingContext source, Size size, IResampler sampler, bool compand) - => Resize(source, size.Width, size.Height, sampler, new(0, 0, size.Width, size.Height), compand); + => Resize(source, size.Width, size.Height, sampler, new Rectangle(0, 0, size.Width, size.Height), compand); /// /// Resizes an image to the given width and height with the given sampler. @@ -90,7 +90,7 @@ public static class ResizeExtensions /// The . /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio. public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, IResampler sampler, bool compand) - => Resize(source, width, height, sampler, new(0, 0, width, height), compand); + => Resize(source, width, height, sampler, new Rectangle(0, 0, width, height), compand); /// /// Resizes an image to the given width and height with the given sampler and @@ -120,7 +120,7 @@ public static class ResizeExtensions { ResizeOptions options = new() { - Size = new(width, height), + Size = new Size(width, height), Mode = ResizeMode.Manual, Sampler = sampler, TargetRectangle = targetRectangle, @@ -153,7 +153,7 @@ public static class ResizeExtensions { ResizeOptions options = new() { - Size = new(width, height), + Size = new Size(width, height), Mode = ResizeMode.Manual, Sampler = sampler, TargetRectangle = targetRectangle, diff --git a/src/ImageSharp/Processing/Extensions/Transforms/TransformExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/TransformExtensions.cs index dedde797b..60f90b10f 100644 --- a/src/ImageSharp/Processing/Extensions/Transforms/TransformExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Transforms/TransformExtensions.cs @@ -34,7 +34,7 @@ public static class TransformExtensions this IImageProcessingContext source, AffineTransformBuilder builder, IResampler sampler) => - source.Transform(new(Point.Empty, source.GetCurrentSize()), builder, sampler); + source.Transform(new Rectangle(Point.Empty, source.GetCurrentSize()), builder, sampler); /// /// Performs an affine transform of an image using the specified sampling algorithm. @@ -96,7 +96,7 @@ public static class TransformExtensions this IImageProcessingContext source, ProjectiveTransformBuilder builder, IResampler sampler) => - source.Transform(new(Point.Empty, source.GetCurrentSize()), builder, sampler); + source.Transform(new Rectangle(Point.Empty, source.GetCurrentSize()), builder, sampler); /// /// Performs a projective transform of an image using the specified sampling algorithm. diff --git a/src/ImageSharp/Processing/KnownFilterMatrices.cs b/src/ImageSharp/Processing/KnownFilterMatrices.cs index 0b40fa945..fd512557d 100644 --- a/src/ImageSharp/Processing/KnownFilterMatrices.cs +++ b/src/ImageSharp/Processing/KnownFilterMatrices.cs @@ -221,7 +221,7 @@ public static class KnownFilterMatrices Guard.MustBeGreaterThanOrEqualTo(amount, 0, nameof(amount)); // See https://cs.chromium.org/chromium/src/cc/paint/render_surface_filters.cc - return new() + return new ColorMatrix { M11 = amount, M22 = amount, @@ -246,7 +246,7 @@ public static class KnownFilterMatrices // See https://cs.chromium.org/chromium/src/cc/paint/render_surface_filters.cc float contrast = (-.5F * amount) + .5F; - return new() + return new ColorMatrix { M11 = amount, M22 = amount, @@ -338,7 +338,7 @@ public static class KnownFilterMatrices // The matrix is set up to preserve the luminance of the image. // See http://graficaobscura.com/matrix/index.html // Number are taken from https://msdn.microsoft.com/en-us/library/jj192162(v=vs.85).aspx - return new() + return new ColorMatrix { M11 = .213F + (cosRadian * .787F) - (sinRadian * .213F), M21 = .715F - (cosRadian * .715F) - (sinRadian * .715F), @@ -367,7 +367,7 @@ public static class KnownFilterMatrices // See https://cs.chromium.org/chromium/src/cc/paint/render_surface_filters.cc float invert = 1F - (2F * amount); - return new() + return new ColorMatrix { M11 = invert, M22 = invert, @@ -389,7 +389,7 @@ public static class KnownFilterMatrices Guard.MustBeBetweenOrEqualTo(amount, 0, 1, nameof(amount)); // See https://cs.chromium.org/chromium/src/cc/paint/render_surface_filters.cc - return new() + return new ColorMatrix { M11 = 1F, M22 = 1F, @@ -443,7 +443,7 @@ public static class KnownFilterMatrices Guard.MustBeGreaterThanOrEqualTo(amount, 0, nameof(amount)); amount--; - return new() + return new ColorMatrix { M11 = 1F, M22 = 1F, @@ -467,7 +467,7 @@ public static class KnownFilterMatrices amount = 1F - amount; // See https://cs.chromium.org/chromium/src/cc/paint/render_surface_filters.cc - return new() + return new ColorMatrix { M11 = .393F + (.607F * amount), M21 = .769F - (.769F * amount), diff --git a/src/ImageSharp/Processing/Processors/CloningImageProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/CloningImageProcessor{TPixel}.cs index 2e675cdd4..bc34f759a 100644 --- a/src/ImageSharp/Processing/Processors/CloningImageProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/CloningImageProcessor{TPixel}.cs @@ -158,7 +158,7 @@ public abstract class CloningImageProcessor : ICloningImageProcessor[] destinationFrames = new ImageFrame[source.Frames.Count]; for (int i = 0; i < destinationFrames.Length; i++) { - destinationFrames[i] = new( + destinationFrames[i] = new ImageFrame( this.Configuration, destinationSize.Width, destinationSize.Height, @@ -166,7 +166,7 @@ public abstract class CloningImageProcessor : ICloningImageProcessor(this.Configuration, source.Metadata.DeepClone(), destinationFrames); } private void CheckFrameCount(Image a, Image b) diff --git a/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor{TPixel}.cs index 96daca47a..727e8e96a 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor{TPixel}.cs @@ -68,7 +68,7 @@ internal class BoxBlurProcessor : ImageProcessor /// protected override void OnFrameApply(ImageFrame source) { - using Convolution2PassProcessor processor = new Convolution2PassProcessor(this.Configuration, this.Kernel, false, this.Source, this.SourceRectangle, this.BorderWrapModeX, this.BorderWrapModeY); + using Convolution2PassProcessor processor = new(this.Configuration, this.Kernel, false, this.Source, this.SourceRectangle, this.BorderWrapModeX, this.BorderWrapModeY); processor.Apply(source); } diff --git a/src/ImageSharp/Processing/Processors/Convolution/Convolution2DRowOperation{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/Convolution2DRowOperation{TPixel}.cs index 08e8425bb..bccf19174 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Convolution2DRowOperation{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Convolution2DRowOperation{TPixel}.cs @@ -75,7 +75,7 @@ internal readonly struct Convolution2DRowOperation : IRowOperation targetYBuffer = span.Slice(boundsWidth, boundsWidth); Span targetXBuffer = span.Slice(boundsWidth * 2, boundsWidth); - Convolution2DState state = new Convolution2DState(in this.kernelMatrixY, in this.kernelMatrixX, this.map); + Convolution2DState state = new(in this.kernelMatrixY, in this.kernelMatrixX, this.map); ref int sampleRowBase = ref state.GetSampleRow((uint)(y - this.bounds.Y)); // Clear the target buffers for each row run. @@ -141,7 +141,7 @@ internal readonly struct Convolution2DRowOperation : IRowOperation targetYBuffer = span.Slice(boundsWidth, boundsWidth); Span targetXBuffer = span.Slice(boundsWidth * 2, boundsWidth); - Convolution2DState state = new Convolution2DState(in this.kernelMatrixY, in this.kernelMatrixX, this.map); + Convolution2DState state = new(in this.kernelMatrixY, in this.kernelMatrixX, this.map); ref int sampleRowBase = ref state.GetSampleRow((uint)(y - this.bounds.Y)); // Clear the target buffers for each row run. diff --git a/src/ImageSharp/Processing/Processors/Convolution/Convolution2DState.cs b/src/ImageSharp/Processing/Processors/Convolution/Convolution2DState.cs index b3dae6baa..6f5388e22 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Convolution2DState.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Convolution2DState.cs @@ -22,8 +22,8 @@ internal readonly ref struct Convolution2DState KernelSamplingMap map) { // We check the kernels are the same size upstream. - this.KernelY = new(kernelY); - this.KernelX = new(kernelX); + this.KernelY = new ReadOnlyKernel(kernelY); + this.KernelX = new ReadOnlyKernel(kernelX); this.kernelHeight = (uint)kernelY.Rows; this.kernelWidth = (uint)kernelY.Columns; this.rowOffsetMap = map.GetRowOffsetSpan(); diff --git a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionState.cs b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionState.cs index 20e95d058..6663c4502 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionState.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionState.cs @@ -20,7 +20,7 @@ internal readonly ref struct ConvolutionState in DenseMatrix kernel, KernelSamplingMap map) { - this.Kernel = new(kernel); + this.Kernel = new ReadOnlyKernel(kernel); this.kernelHeight = (uint)kernel.Rows; this.kernelWidth = (uint)kernel.Columns; this.rowOffsetMap = map.GetRowOffsetSpan(); diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetector2DProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetector2DProcessor{TPixel}.cs index fbf576c23..502c34402 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetector2DProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetector2DProcessor{TPixel}.cs @@ -55,7 +55,7 @@ internal class EdgeDetector2DProcessor : ImageProcessor /// protected override void OnFrameApply(ImageFrame source) { - using Convolution2DProcessor processor = new Convolution2DProcessor( + using Convolution2DProcessor processor = new( this.Configuration, in this.kernelX, in this.kernelY, diff --git a/src/ImageSharp/Processing/Processors/Convolution/Kernels/Implementation/LaplacianKernelFactory.cs b/src/ImageSharp/Processing/Processors/Convolution/Kernels/Implementation/LaplacianKernelFactory.cs index cd9f4d7ab..b51ed1819 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Kernels/Implementation/LaplacianKernelFactory.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Kernels/Implementation/LaplacianKernelFactory.cs @@ -19,7 +19,7 @@ internal static class LaplacianKernelFactory Guard.MustBeGreaterThanOrEqualTo(length, 3u, nameof(length)); Guard.IsFalse(length % 2 == 0, nameof(length), "The kernel length must be an odd number."); - DenseMatrix kernel = new DenseMatrix((int)length); + DenseMatrix kernel = new((int)length); kernel.Fill(-1); int mid = (int)(length / 2); diff --git a/src/ImageSharp/Processing/Processors/Convolution/MedianConvolutionState.cs b/src/ImageSharp/Processing/Processors/Convolution/MedianConvolutionState.cs index 5b2c903ba..137334c29 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/MedianConvolutionState.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/MedianConvolutionState.cs @@ -21,7 +21,7 @@ internal readonly ref struct MedianConvolutionState in DenseMatrix kernel, KernelSamplingMap map) { - this.Kernel = new(kernel); + this.Kernel = new Kernel(kernel); this.kernelHeight = kernel.Rows; this.kernelWidth = kernel.Columns; this.rowOffsetMap = map.GetRowOffsetSpan(); diff --git a/src/ImageSharp/Processing/Processors/Convolution/MedianRowOperation{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/MedianRowOperation{TPixel}.cs index 64fd40f15..ca2cabab5 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/MedianRowOperation{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/MedianRowOperation{TPixel}.cs @@ -153,7 +153,7 @@ internal readonly struct MedianRowOperation : IRowOperation // Taking the W value from the source pixels, where the middle index in the kernelSpan is by definition the resulting pixel. // This will preserve the alpha value. - return new(xChannel[halfLength], yChannel[halfLength], zChannel[halfLength], kernelSpan[halfLength].W); + return new Vector4(xChannel[halfLength], yChannel[halfLength], zChannel[halfLength], kernelSpan[halfLength].W); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -176,6 +176,6 @@ internal readonly struct MedianRowOperation : IRowOperation zChannel.Sort(); wChannel.Sort(); - return new(xChannel[halfLength], yChannel[halfLength], zChannel[halfLength], wChannel[halfLength]); + return new Vector4(xChannel[halfLength], yChannel[halfLength], zChannel[halfLength], wChannel[halfLength]); } } diff --git a/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurKernelDataProvider.cs b/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurKernelDataProvider.cs index 6832e2498..ae4483f2e 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurKernelDataProvider.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurKernelDataProvider.cs @@ -99,7 +99,7 @@ internal static class BokehBlurKernelDataProvider NormalizeKernels(kernels, kernelParameters); // Store them in the cache for future use - info = new(kernelParameters, kernels); + info = new BokehBlurKernelData(kernelParameters, kernels); Cache.TryAdd(parameters, info); } @@ -167,7 +167,7 @@ internal static class BokehBlurKernelDataProvider value *= value; // Fill in the complex kernel values - Unsafe.Add(ref baseRef, (uint)i) = new( + Unsafe.Add(ref baseRef, (uint)i) = new Complex64( MathF.Exp(-a * value) * MathF.Cos(b * value), MathF.Exp(-a * value) * MathF.Sin(b * value)); } diff --git a/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.KnownTypes.cs b/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.KnownTypes.cs index d58f9020c..57d8ef59a 100644 --- a/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.KnownTypes.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.KnownTypes.cs @@ -65,7 +65,7 @@ public readonly partial struct ErrorDither { 0, 1 / divisor, 0, 0 } }; - return new(matrix, offset); + return new ErrorDither(matrix, offset); } private static ErrorDither CreateBurks() @@ -79,7 +79,7 @@ public readonly partial struct ErrorDither { 2 / divisor, 4 / divisor, 8 / divisor, 4 / divisor, 2 / divisor } }; - return new(matrix, offset); + return new ErrorDither(matrix, offset); } private static ErrorDither CreateFloydSteinberg() @@ -93,7 +93,7 @@ public readonly partial struct ErrorDither { 3 / divisor, 5 / divisor, 1 / divisor } }; - return new(matrix, offset); + return new ErrorDither(matrix, offset); } private static ErrorDither CreateJarvisJudiceNinke() @@ -108,7 +108,7 @@ public readonly partial struct ErrorDither { 1 / divisor, 3 / divisor, 5 / divisor, 3 / divisor, 1 / divisor } }; - return new(matrix, offset); + return new ErrorDither(matrix, offset); } private static ErrorDither CreateSierra2() @@ -122,7 +122,7 @@ public readonly partial struct ErrorDither { 1 / divisor, 2 / divisor, 3 / divisor, 2 / divisor, 1 / divisor } }; - return new(matrix, offset); + return new ErrorDither(matrix, offset); } private static ErrorDither CreateSierra3() @@ -137,7 +137,7 @@ public readonly partial struct ErrorDither { 0, 2 / divisor, 3 / divisor, 2 / divisor, 0 } }; - return new(matrix, offset); + return new ErrorDither(matrix, offset); } private static ErrorDither CreateSierraLite() @@ -151,7 +151,7 @@ public readonly partial struct ErrorDither { 1 / divisor, 1 / divisor, 0 } }; - return new(matrix, offset); + return new ErrorDither(matrix, offset); } private static ErrorDither CreateStevensonArce() @@ -167,7 +167,7 @@ public readonly partial struct ErrorDither { 5 / divisor, 0, 12 / divisor, 0, 12 / divisor, 0, 5 / divisor } }; - return new(matrix, offset); + return new ErrorDither(matrix, offset); } private static ErrorDither CreateStucki() @@ -182,6 +182,6 @@ public readonly partial struct ErrorDither { 1 / divisor, 2 / divisor, 4 / divisor, 2 / divisor, 1 / divisor } }; - return new(matrix, offset); + return new ErrorDither(matrix, offset); } } diff --git a/src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs b/src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs index d4dd10b73..b0622cac5 100644 --- a/src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs @@ -32,7 +32,7 @@ public readonly partial struct OrderedDither : IDither, IEquatable thresholdMatrix = new DenseMatrix((int)length); + DenseMatrix thresholdMatrix = new((int)length); float m2 = length * length; for (int y = 0; y < length; y++) { diff --git a/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherFactory.cs b/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherFactory.cs index 9fa331d7b..ec82f01d7 100644 --- a/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherFactory.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherFactory.cs @@ -29,7 +29,7 @@ internal static class OrderedDitherFactory while (length > bayerLength); // Create our Bayer matrix that matches the given exponent and dimensions - DenseMatrix matrix = new DenseMatrix((int)length); + DenseMatrix matrix = new((int)length); uint i = 0; for (int y = 0; y < length; y++) { diff --git a/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{TPixel}.cs index 2f4a0a9f0..0d4680e21 100644 --- a/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{TPixel}.cs @@ -37,7 +37,7 @@ internal sealed class PaletteDitherProcessor : ImageProcessor this.paletteOwner = this.Configuration.MemoryAllocator.Allocate(sourcePalette.Length); Color.ToPixel(sourcePalette, this.paletteOwner.Memory.Span); - this.ditherProcessor = new( + this.ditherProcessor = new DitherProcessor( this.Configuration, this.paletteOwner.Memory, definition.DitherScale); diff --git a/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor{TPixelBg,TPixelFg}.cs b/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor{TPixelBg,TPixelFg}.cs index d5499d586..d2a99ce92 100644 --- a/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor{TPixelBg,TPixelFg}.cs +++ b/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor{TPixelBg,TPixelFg}.cs @@ -112,7 +112,7 @@ internal class DrawImageProcessor : ImageProcessor } // Sanitize the dimensions so that we don't try and sample outside the image. - Rectangle backgroundRectangle = Rectangle.Intersect(new(left, top, width, height), this.SourceRectangle); + Rectangle backgroundRectangle = Rectangle.Intersect(new Rectangle(left, top, width, height), this.SourceRectangle); Configuration configuration = this.Configuration; DrawImageProcessor.RowOperation operation = @@ -127,7 +127,7 @@ internal class DrawImageProcessor : ImageProcessor ParallelRowIterator.IterateRows( configuration, - new(0, 0, foregroundRectangle.Width, foregroundRectangle.Height), + new Rectangle(0, 0, foregroundRectangle.Width, foregroundRectangle.Height), in operation); } diff --git a/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor{TPixel}.cs index 5e491c1ee..f811bae0f 100644 --- a/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor{TPixel}.cs @@ -174,7 +174,7 @@ internal class OilPaintingProcessor : ImageProcessor float green = greenBinSpan[maxIndex] / maxIntensity; float alpha = sourceRowVector4Span[x].W; - targetRowVector4Span[x] = new(red, green, blue, alpha); + targetRowVector4Span[x] = new Vector4(red, green, blue, alpha); } } diff --git a/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor.cs index f1014c0df..06cfa49b3 100644 --- a/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor.cs @@ -37,7 +37,7 @@ internal sealed class PixelRowDelegateProcessor : IImageProcessor public IImageProcessor CreatePixelSpecificProcessor(Configuration configuration, Image source, Rectangle sourceRectangle) where TPixel : unmanaged, IPixel => new PixelRowDelegateProcessor( - new(this.PixelRowOperation), + new PixelRowDelegate(this.PixelRowOperation), configuration, this.Modifiers, source, diff --git a/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor{TPixel,TDelegate}.cs b/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor{TPixel,TDelegate}.cs index a3aba4cfc..d38ffc801 100644 --- a/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor{TPixel,TDelegate}.cs +++ b/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor{TPixel,TDelegate}.cs @@ -96,7 +96,7 @@ internal sealed class PixelRowDelegateProcessor : ImageProces PixelOperations.Instance.ToVector4(this.configuration, rowSpan, span, this.modifiers); // Run the user defined pixel shader to the current row of pixels - Unsafe.AsRef(in this.rowProcessor).Invoke(span, new(this.startX, y)); + Unsafe.AsRef(in this.rowProcessor).Invoke(span, new Point(this.startX, y)); PixelOperations.Instance.FromVector4Destructive(this.configuration, span, rowSpan, this.modifiers); } diff --git a/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelRowDelegateProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelRowDelegateProcessor.cs index a54a7bfd2..6786eb5f5 100644 --- a/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelRowDelegateProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelRowDelegateProcessor.cs @@ -38,7 +38,7 @@ internal sealed class PositionAwarePixelRowDelegateProcessor : IImageProcessor where TPixel : unmanaged, IPixel { return new PixelRowDelegateProcessor( - new(this.PixelRowOperation), + new PixelRowDelegate(this.PixelRowOperation), configuration, this.Modifiers, source, diff --git a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs index e91124958..3d54836c5 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs @@ -81,7 +81,7 @@ internal class AdaptiveHistogramEqualizationProcessor : HistogramEqualiz RowIntervalOperation operation = new(cdfData, tileYStartPositions, tileWidth, tileHeight, tileCount, halfTileWidth, luminanceLevels, source.PixelBuffer); ParallelRowIterator.IterateRowIntervals( this.Configuration, - new(0, 0, sourceWidth, tileYStartPositions.Count), + new Rectangle(0, 0, sourceWidth, tileYStartPositions.Count), in operation); // Fix left column @@ -145,7 +145,7 @@ internal class AdaptiveHistogramEqualizationProcessor : HistogramEqualiz { ref TPixel pixel = ref rowSpan[dx]; float luminanceEqualized = cdfData.RemapGreyValue(cdfX, cdfY, GetLuminance(pixel, luminanceLevels)); - pixel = TPixel.FromVector4(new(luminanceEqualized, luminanceEqualized, luminanceEqualized, pixel.ToVector4().W)); + pixel = TPixel.FromVector4(new Vector4(luminanceEqualized, luminanceEqualized, luminanceEqualized, pixel.ToVector4().W)); } } } @@ -191,7 +191,7 @@ internal class AdaptiveHistogramEqualizationProcessor : HistogramEqualiz { ref TPixel pixel = ref rowSpan[dx]; float luminanceEqualized = InterpolateBetweenTwoTiles(pixel, cdfData, cdfX, cdfY, cdfX, cdfY + 1, tileY, tileHeight, luminanceLevels); - pixel = TPixel.FromVector4(new(luminanceEqualized, luminanceEqualized, luminanceEqualized, pixel.ToVector4().W)); + pixel = TPixel.FromVector4(new Vector4(luminanceEqualized, luminanceEqualized, luminanceEqualized, pixel.ToVector4().W)); } tileY++; @@ -243,7 +243,7 @@ internal class AdaptiveHistogramEqualizationProcessor : HistogramEqualiz { ref TPixel pixel = ref rowSpan[dx]; float luminanceEqualized = InterpolateBetweenTwoTiles(pixel, cdfData, cdfX, cdfY, cdfX + 1, cdfY, tileX, tileWidth, luminanceLevels); - pixel = TPixel.FromVector4(new(luminanceEqualized, luminanceEqualized, luminanceEqualized, pixel.ToVector4().W)); + pixel = TPixel.FromVector4(new Vector4(luminanceEqualized, luminanceEqualized, luminanceEqualized, pixel.ToVector4().W)); tileX++; } } @@ -432,7 +432,7 @@ internal class AdaptiveHistogramEqualizationProcessor : HistogramEqualiz this.tileHeight, this.luminanceLevels); - pixel = TPixel.FromVector4(new(luminanceEqualized, luminanceEqualized, luminanceEqualized, pixel.ToVector4().W)); + pixel = TPixel.FromVector4(new Vector4(luminanceEqualized, luminanceEqualized, luminanceEqualized, pixel.ToVector4().W)); tileX++; } @@ -515,7 +515,7 @@ internal class AdaptiveHistogramEqualizationProcessor : HistogramEqualiz ParallelRowIterator.IterateRowIntervals( this.configuration, - new(0, 0, this.sourceWidth, this.tileYStartPositions.Count), + new Rectangle(0, 0, this.sourceWidth, this.tileYStartPositions.Count), in operation); } diff --git a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs index 93144653e..8ca4a86a2 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs @@ -383,7 +383,7 @@ internal class AdaptiveHistogramEqualizationSlidingWindowProcessor : His // Map the current pixel to the new equalized value. int luminance = GetLuminance(this.source[x, y], this.processor.LuminanceLevels); float luminanceEqualized = Unsafe.Add(ref cdfBase, (uint)luminance) / numberOfPixelsMinusCdfMin; - this.targetPixels[x, y] = TPixel.FromVector4(new(luminanceEqualized, luminanceEqualized, luminanceEqualized, this.source[x, y].ToVector4().W)); + this.targetPixels[x, y] = TPixel.FromVector4(new Vector4(luminanceEqualized, luminanceEqualized, luminanceEqualized, this.source[x, y].ToVector4().W)); // Remove top most row from the histogram, mirroring rows which exceeds the borders. if (this.useFastPath) diff --git a/src/ImageSharp/Processing/Processors/Normalization/AutoLevelProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/AutoLevelProcessor{TPixel}.cs index f104ee34a..e830cc55f 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/AutoLevelProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/AutoLevelProcessor{TPixel}.cs @@ -150,7 +150,7 @@ internal class AutoLevelProcessor : HistogramEqualizationProcessor.Instance.FromVector4Destructive(this.configuration, vectorBuffer, pixelRow); @@ -214,7 +214,7 @@ internal class AutoLevelProcessor : HistogramEqualizationProcessor.Instance.FromVector4Destructive(this.configuration, vectorBuffer, pixelRow); diff --git a/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs index b159847bb..3ab8f7431 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs @@ -132,7 +132,7 @@ internal class GlobalHistogramEqualizationProcessor : HistogramEqualizat Vector4 vector = Unsafe.Add(ref vectorRef, (uint)x); int luminance = ColorNumerics.GetBT709Luminance(ref vector, levels); float luminanceEqualized = Unsafe.Add(ref cdfBase, (uint)luminance) / noOfPixelsMinusCdfMin; - Unsafe.Add(ref vectorRef, (uint)x) = new(luminanceEqualized, luminanceEqualized, luminanceEqualized, vector.W); + Unsafe.Add(ref vectorRef, (uint)x) = new Vector4(luminanceEqualized, luminanceEqualized, luminanceEqualized, vector.W); } PixelOperations.Instance.FromVector4Destructive(this.configuration, vectorBuffer, pixelRow); diff --git a/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor{TPixel}.cs index 317fa7e60..d73e7bea1 100644 --- a/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor{TPixel}.cs @@ -105,7 +105,7 @@ internal class GlowProcessor : ImageProcessor for (int i = 0; i < this.bounds.Width; i++) { - float distance = Vector2.Distance(this.center, new(i + this.bounds.X, y)); + float distance = Vector2.Distance(this.center, new Vector2(i + this.bounds.X, y)); span[i] = Numerics.Clamp(this.blendPercent * (1 - (.95F * (distance / this.maxDistance))), 0, 1F); } diff --git a/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor{TPixel}.cs index b24ed7ed5..b08cd898e 100644 --- a/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor{TPixel}.cs @@ -113,7 +113,7 @@ internal class VignetteProcessor : ImageProcessor for (int i = 0; i < this.bounds.Width; i++) { - float distance = Vector2.Distance(this.center, new(i + this.bounds.X, y)); + float distance = Vector2.Distance(this.center, new Vector2(i + this.bounds.X, y)); span[i] = Numerics.Clamp(this.blendPercent * (.9F * (distance / this.maxDistance)), 0, 1F); } diff --git a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer.cs b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer.cs index 9a46a9883..0a1032bf0 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer.cs @@ -16,7 +16,7 @@ public class OctreeQuantizer : IQuantizer /// using the default . /// public OctreeQuantizer() - : this(new()) + : this(new QuantizerOptions()) { } diff --git a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs index 25d3e7416..07596b68a 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs @@ -44,7 +44,7 @@ public struct OctreeQuantizer : IQuantizer this.maxColors = this.Options.MaxColors; this.bitDepth = Numerics.Clamp(ColorNumerics.GetBitsNeededForColorDepth(this.maxColors), 1, 8); - this.octree = new(configuration, this.bitDepth, this.maxColors, this.Options.TransparencyThreshold); + this.octree = new Octree(configuration, this.bitDepth, this.maxColors, this.Options.TransparencyThreshold); this.paletteOwner = configuration.MemoryAllocator.Allocate(this.maxColors, AllocationOptions.Clean); this.pixelMap = default; this.palette = default; @@ -547,14 +547,14 @@ public struct OctreeQuantizer : IQuantizer Vector4 vector = Vector4.Clamp( (sum + offset) / this.PixelCount, Vector4.Zero, - new(255)); + new Vector4(255)); if (vector.W < octree.transparencyThreshold255) { vector = Vector4.Zero; } - palette[paletteIndex] = TPixel.FromRgba32(new((byte)vector.X, (byte)vector.Y, (byte)vector.Z, (byte)vector.W)); + palette[paletteIndex] = TPixel.FromRgba32(new Rgba32((byte)vector.X, (byte)vector.Y, (byte)vector.Z, (byte)vector.W)); this.PaletteIndex = paletteIndex++; } diff --git a/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer.cs b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer.cs index 91d086fc6..a49691515 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer.cs @@ -19,7 +19,7 @@ public class PaletteQuantizer : IQuantizer /// /// The color palette. public PaletteQuantizer(ReadOnlyMemory palette) - : this(palette, new()) + : this(palette, new QuantizerOptions()) { } diff --git a/src/ImageSharp/Processing/Processors/Quantization/WebSafePaletteQuantizer.cs b/src/ImageSharp/Processing/Processors/Quantization/WebSafePaletteQuantizer.cs index b1dace40b..fa1763367 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/WebSafePaletteQuantizer.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/WebSafePaletteQuantizer.cs @@ -12,7 +12,7 @@ public sealed class WebSafePaletteQuantizer : PaletteQuantizer /// Initializes a new instance of the class. /// public WebSafePaletteQuantizer() - : this(new()) + : this(new QuantizerOptions()) { } diff --git a/src/ImageSharp/Processing/Processors/Quantization/WernerPaletteQuantizer.cs b/src/ImageSharp/Processing/Processors/Quantization/WernerPaletteQuantizer.cs index 02c217c36..cd7b80e81 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/WernerPaletteQuantizer.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/WernerPaletteQuantizer.cs @@ -13,7 +13,7 @@ public sealed class WernerPaletteQuantizer : PaletteQuantizer /// Initializes a new instance of the class. /// public WernerPaletteQuantizer() - : this(new()) + : this(new QuantizerOptions()) { } diff --git a/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer.cs b/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer.cs index cda78c7d1..86d798d96 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer.cs @@ -15,7 +15,7 @@ public class WuQuantizer : IQuantizer /// using the default . /// public WuQuantizer() - : this(new()) + : this(new QuantizerOptions()) { } diff --git a/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs index cb7020486..03d6ac0da 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs @@ -513,7 +513,7 @@ internal struct WuQuantizer : IQuantizer continue; } - vector = new(half.R, half.G, half.B, half.A); + vector = new Vector4(half.R, half.G, half.B, half.A); temp += Vector4.Dot(vector, vector) / half.Weight; if (temp > max) diff --git a/src/ImageSharp/Processing/Processors/Transforms/CropProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/CropProcessor{TPixel}.cs index 5465b502b..37e61b7d7 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/CropProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/CropProcessor{TPixel}.cs @@ -29,7 +29,7 @@ internal class CropProcessor : TransformProcessor => this.cropRectangle = definition.CropRectangle; /// - protected override Size GetDestinationSize() => new Size(this.cropRectangle.Width, this.cropRectangle.Height); + protected override Size GetDestinationSize() => new(this.cropRectangle.Width, this.cropRectangle.Height); /// protected override void OnFrameApply(ImageFrame source, ImageFrame destination) @@ -50,7 +50,7 @@ internal class CropProcessor : TransformProcessor ParallelExecutionSettings parallelSettings = ParallelExecutionSettings.FromConfiguration(this.Configuration).MultiplyMinimumPixelsPerTask(4); - RowOperation operation = new RowOperation(bounds, source.PixelBuffer, destination.PixelBuffer); + RowOperation operation = new(bounds, source.PixelBuffer, destination.PixelBuffer); ParallelRowIterator.IterateRows( bounds, diff --git a/src/ImageSharp/Processing/Processors/Transforms/Linear/AffineTransformProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/Linear/AffineTransformProcessor{TPixel}.cs index 6115ded03..b3919e584 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Linear/AffineTransformProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Linear/AffineTransformProcessor{TPixel}.cs @@ -132,7 +132,7 @@ internal class AffineTransformProcessor : TransformProcessor, IR for (int x = 0; x < destinationRowSpan.Length; x++) { - Vector2 point = Vector2.Transform(new(x, y), this.matrix); + Vector2 point = Vector2.Transform(new Vector2(x, y), this.matrix); int px = (int)MathF.Round(point.X); int py = (int)MathF.Round(point.Y); @@ -204,7 +204,7 @@ internal class AffineTransformProcessor : TransformProcessor, IR for (int x = 0; x < span.Length; x++) { - Vector2 point = Vector2.Transform(new(x, y), matrix); + Vector2 point = Vector2.Transform(new Vector2(x, y), matrix); float pY = point.Y; float pX = point.X; diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs index e9e2849ae..d90f948b6 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs @@ -72,7 +72,7 @@ internal static class ResizeHelper // case ResizeMode.Stretch: default: - return (new(Sanitize(width), Sanitize(height)), new(0, 0, Sanitize(width), Sanitize(height))); + return (new Size(Sanitize(width), Sanitize(height)), new Rectangle(0, 0, Sanitize(width), Sanitize(height))); } } @@ -143,7 +143,7 @@ internal static class ResizeHelper } // Target image width and height can be different to the rectangle width and height. - return (new(Sanitize(width), Sanitize(height)), new(targetX, targetY, Sanitize(targetWidth), Sanitize(targetHeight))); + return (new Size(Sanitize(width), Sanitize(height)), new Rectangle(targetX, targetY, Sanitize(targetWidth), Sanitize(targetHeight))); } // Switch to pad mode to downscale and calculate from there. @@ -253,7 +253,7 @@ internal static class ResizeHelper } // Target image width and height can be different to the rectangle width and height. - return (new(Sanitize(width), Sanitize(height)), new(targetX, targetY, Sanitize(targetWidth), Sanitize(targetHeight))); + return (new Size(Sanitize(width), Sanitize(height)), new Rectangle(targetX, targetY, Sanitize(targetWidth), Sanitize(targetHeight))); } private static (Size Size, Rectangle Rectangle) CalculateMaxRectangle( @@ -282,7 +282,7 @@ internal static class ResizeHelper } // Replace the size to match the rectangle. - return (new(Sanitize(targetWidth), Sanitize(targetHeight)), new(0, 0, Sanitize(targetWidth), Sanitize(targetHeight))); + return (new Size(Sanitize(targetWidth), Sanitize(targetHeight)), new Rectangle(0, 0, Sanitize(targetWidth), Sanitize(targetHeight))); } private static (Size Size, Rectangle Rectangle) CalculateMinRectangle( @@ -298,7 +298,7 @@ internal static class ResizeHelper // Don't upscale if (width > sourceWidth || height > sourceHeight) { - return (new(sourceWidth, sourceHeight), new(0, 0, sourceWidth, sourceHeight)); + return (new Size(sourceWidth, sourceHeight), new Rectangle(0, 0, sourceWidth, sourceHeight)); } // Find the shortest distance to go. @@ -330,7 +330,7 @@ internal static class ResizeHelper } // Replace the size to match the rectangle. - return (new(Sanitize(targetWidth), Sanitize(targetHeight)), new(0, 0, Sanitize(targetWidth), Sanitize(targetHeight))); + return (new Size(Sanitize(targetWidth), Sanitize(targetHeight)), new Rectangle(0, 0, Sanitize(targetWidth), Sanitize(targetHeight))); } private static (Size Size, Rectangle Rectangle) CalculatePadRectangle( @@ -398,7 +398,7 @@ internal static class ResizeHelper } // Target image width and height can be different to the rectangle width and height. - return (new(Sanitize(width), Sanitize(height)), new(targetX, targetY, Sanitize(targetWidth), Sanitize(targetHeight))); + return (new Size(Sanitize(width), Sanitize(height)), new Rectangle(targetX, targetY, Sanitize(targetWidth), Sanitize(targetHeight))); } private static (Size Size, Rectangle Rectangle) CalculateManualRectangle( @@ -419,7 +419,7 @@ internal static class ResizeHelper int targetHeight = targetRectangle.Height > 0 ? targetRectangle.Height : height; // Target image width and height can be different to the rectangle width and height. - return (new(Sanitize(width), Sanitize(height)), new(targetX, targetY, Sanitize(targetWidth), Sanitize(targetHeight))); + return (new Size(Sanitize(width), Sanitize(height)), new Rectangle(targetX, targetY, Sanitize(targetWidth), Sanitize(targetHeight))); } [DoesNotReturn] diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs index fb4d31988..c1907bb52 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs @@ -255,7 +255,7 @@ internal partial class ResizeKernelMap : IDisposable ref float rowReference = ref MemoryMarshal.GetReference(rowSpan); float* rowPtr = (float*)Unsafe.AsPointer(ref rowReference); - return new(left, rowPtr, length); + return new ResizeKernel(left, rowPtr, length); } [Conditional("DEBUG")] diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs index a2bd29116..a047015d9 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs @@ -158,7 +158,7 @@ internal class ResizeProcessor : TransformProcessor, IResampling float widthFactor = sourceRectangle.Width / (float)destinationRectangle.Width; float heightFactor = sourceRectangle.Height / (float)destinationRectangle.Height; - NNRowOperation operation = new NNRowOperation( + NNRowOperation operation = new( sourceRectangle, destinationRectangle, interest, @@ -208,7 +208,7 @@ internal class ResizeProcessor : TransformProcessor, IResampling // To reintroduce parallel processing, we would launch multiple workers // for different row intervals of the image. - using ResizeWorker worker = new ResizeWorker( + using ResizeWorker worker = new( configuration, sourceRegion, conversionModifiers, @@ -218,7 +218,7 @@ internal class ResizeProcessor : TransformProcessor, IResampling destinationRectangle.Location); worker.Initialize(); - RowInterval workingInterval = new RowInterval(interest.Top, interest.Bottom); + RowInterval workingInterval = new(interest.Top, interest.Bottom); worker.FillDestinationPixels(workingInterval, destination.PixelBuffer); } diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs index 3da3fcb6a..cce27a401 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs @@ -89,7 +89,7 @@ internal sealed class ResizeWorker : IDisposable this.tempRowBuffer = configuration.MemoryAllocator.Allocate(this.sourceRectangle.Width); this.tempColumnBuffer = configuration.MemoryAllocator.Allocate(targetWorkingRect.Width); - this.currentWindow = new(0, this.workerHeight); + this.currentWindow = new RowInterval(0, this.workerHeight); } public void Dispose() @@ -158,7 +158,7 @@ internal sealed class ResizeWorker : IDisposable 0, this.windowBandHeight); - this.currentWindow = new(minY, maxY); + this.currentWindow = new RowInterval(minY, maxY); // Calculate the remainder: this.CalculateFirstPassValues(this.currentWindow.Slice(this.windowBandHeight)); diff --git a/src/ImageSharp/Processing/Processors/Transforms/TransformUtils.cs b/src/ImageSharp/Processing/Processors/Transforms/TransformUtils.cs index 1813be2fd..06a2dd292 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/TransformUtils.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/TransformUtils.cs @@ -407,10 +407,10 @@ internal static class TransformUtils float scaleY = 1F / new Vector2(matrix.M12, matrix.M22).Length(); // sqrt(M12^2 + M22^2) // Apply the offset relative to the scale - SizeF offsetSize = usePixelSpace ? new(scaleX, scaleY) : SizeF.Empty; + SizeF offsetSize = usePixelSpace ? new SizeF(scaleX, scaleY) : SizeF.Empty; // Subtract the offset size to translate to the appropriate space (pixel or coordinate). - if (TryGetTransformedRectangle(new(Point.Empty, size - offsetSize), matrix, out Rectangle bounds)) + if (TryGetTransformedRectangle(new RectangleF(Point.Empty, size - offsetSize), matrix, out Rectangle bounds)) { // Add the offset size back to translate the transformed bounds to the correct space. return Size.Ceiling(ConstrainSize(bounds) + offsetSize); @@ -455,11 +455,11 @@ internal static class TransformUtils { float scaleX = 1F / new Vector2(matrix.M11, matrix.M21).Length(); // sqrt(M11^2 + M21^2) float scaleY = 1F / new Vector2(matrix.M12, matrix.M22).Length(); // sqrt(M12^2 + M22^2) - offsetSize = new(scaleX, scaleY); + offsetSize = new SizeF(scaleX, scaleY); } // Subtract the offset size to translate to the pixel space. - if (TryGetTransformedRectangle(new(Point.Empty, size - offsetSize), matrix, out Rectangle bounds)) + if (TryGetTransformedRectangle(new RectangleF(Point.Empty, size - offsetSize), matrix, out Rectangle bounds)) { // Add the offset size back to translate the transformed bounds to the coordinate space. return Size.Ceiling((constrain ? ConstrainSize(bounds) : bounds.Size) + offsetSize); @@ -485,10 +485,10 @@ internal static class TransformUtils return false; } - Vector2 tl = Vector2.Transform(new(rectangle.Left, rectangle.Top), matrix); - Vector2 tr = Vector2.Transform(new(rectangle.Right, rectangle.Top), matrix); - Vector2 bl = Vector2.Transform(new(rectangle.Left, rectangle.Bottom), matrix); - Vector2 br = Vector2.Transform(new(rectangle.Right, rectangle.Bottom), matrix); + Vector2 tl = Vector2.Transform(new Vector2(rectangle.Left, rectangle.Top), matrix); + Vector2 tr = Vector2.Transform(new Vector2(rectangle.Right, rectangle.Top), matrix); + Vector2 bl = Vector2.Transform(new Vector2(rectangle.Left, rectangle.Bottom), matrix); + Vector2 br = Vector2.Transform(new Vector2(rectangle.Right, rectangle.Bottom), matrix); bounds = GetBoundingRectangle(tl, tr, bl, br); return true; @@ -540,7 +540,7 @@ internal static class TransformUtils width = rectangle.Width; } - return new(width, height); + return new Size(width, height); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp/Processing/ProjectiveTransformBuilder.cs b/src/ImageSharp/Processing/ProjectiveTransformBuilder.cs index 321196582..82b897ea5 100644 --- a/src/ImageSharp/Processing/ProjectiveTransformBuilder.cs +++ b/src/ImageSharp/Processing/ProjectiveTransformBuilder.cs @@ -69,7 +69,7 @@ public class ProjectiveTransformBuilder /// The amount of rotation, in radians. /// The . public ProjectiveTransformBuilder PrependRotationRadians(float radians) - => this.Prepend(size => new(TransformUtils.CreateRotationTransformMatrixRadians(radians, size, this.TransformSpace))); + => this.Prepend(size => new Matrix4x4(TransformUtils.CreateRotationTransformMatrixRadians(radians, size, this.TransformSpace))); /// /// Prepends a centered rotation matrix using the given rotation in degrees at the given origin. @@ -87,7 +87,7 @@ public class ProjectiveTransformBuilder /// The rotation origin point. /// The . internal ProjectiveTransformBuilder PrependRotationRadians(float radians, Vector2 origin) - => this.PrependMatrix(Matrix4x4.CreateRotationZ(radians, new(origin, 0))); + => this.PrependMatrix(Matrix4x4.CreateRotationZ(radians, new Vector3(origin, 0))); /// /// Appends a centered rotation matrix using the given rotation in degrees. @@ -103,7 +103,7 @@ public class ProjectiveTransformBuilder /// The amount of rotation, in radians. /// The . public ProjectiveTransformBuilder AppendRotationRadians(float radians) - => this.Append(size => new(TransformUtils.CreateRotationTransformMatrixRadians(radians, size, this.TransformSpace))); + => this.Append(size => new Matrix4x4(TransformUtils.CreateRotationTransformMatrixRadians(radians, size, this.TransformSpace))); /// /// Appends a centered rotation matrix using the given rotation in degrees at the given origin. @@ -121,7 +121,7 @@ public class ProjectiveTransformBuilder /// The rotation origin point. /// The . internal ProjectiveTransformBuilder AppendRotationRadians(float radians, Vector2 origin) - => this.AppendMatrix(Matrix4x4.CreateRotationZ(radians, new(origin, 0))); + => this.AppendMatrix(Matrix4x4.CreateRotationZ(radians, new Vector3(origin, 0))); /// /// Prepends a scale matrix from the given uniform scale. @@ -187,7 +187,7 @@ public class ProjectiveTransformBuilder /// The Y angle, in radians. /// The . public ProjectiveTransformBuilder PrependSkewRadians(float radiansX, float radiansY) - => this.Prepend(size => new(TransformUtils.CreateSkewTransformMatrixRadians(radiansX, radiansY, size, this.TransformSpace))); + => this.Prepend(size => new Matrix4x4(TransformUtils.CreateSkewTransformMatrixRadians(radiansX, radiansY, size, this.TransformSpace))); /// /// Prepends a skew matrix using the given angles in degrees at the given origin. @@ -207,7 +207,7 @@ public class ProjectiveTransformBuilder /// The skew origin point. /// The . public ProjectiveTransformBuilder PrependSkewRadians(float radiansX, float radiansY, Vector2 origin) - => this.PrependMatrix(new(Matrix3x2.CreateSkew(radiansX, radiansY, origin))); + => this.PrependMatrix(new Matrix4x4(Matrix3x2.CreateSkew(radiansX, radiansY, origin))); /// /// Appends a centered skew matrix from the give angles in degrees. @@ -225,7 +225,7 @@ public class ProjectiveTransformBuilder /// The Y angle, in radians. /// The . public ProjectiveTransformBuilder AppendSkewRadians(float radiansX, float radiansY) - => this.Append(size => new(TransformUtils.CreateSkewTransformMatrixRadians(radiansX, radiansY, size, this.TransformSpace))); + => this.Append(size => new Matrix4x4(TransformUtils.CreateSkewTransformMatrixRadians(radiansX, radiansY, size, this.TransformSpace))); /// /// Appends a skew matrix using the given angles in degrees at the given origin. @@ -245,7 +245,7 @@ public class ProjectiveTransformBuilder /// The skew origin point. /// The . public ProjectiveTransformBuilder AppendSkewRadians(float radiansX, float radiansY, Vector2 origin) - => this.AppendMatrix(new(Matrix3x2.CreateSkew(radiansX, radiansY, origin))); + => this.AppendMatrix(new Matrix4x4(Matrix3x2.CreateSkew(radiansX, radiansY, origin))); /// /// Prepends a translation matrix from the given vector. @@ -261,7 +261,7 @@ public class ProjectiveTransformBuilder /// The translation position. /// The . public ProjectiveTransformBuilder PrependTranslation(Vector2 position) - => this.PrependMatrix(Matrix4x4.CreateTranslation(new(position, 0))); + => this.PrependMatrix(Matrix4x4.CreateTranslation(new Vector3(position, 0))); /// /// Appends a translation matrix from the given vector. @@ -277,7 +277,7 @@ public class ProjectiveTransformBuilder /// The translation position. /// The . public ProjectiveTransformBuilder AppendTranslation(Vector2 position) - => this.AppendMatrix(Matrix4x4.CreateTranslation(new(position, 0))); + => this.AppendMatrix(Matrix4x4.CreateTranslation(new Vector3(position, 0))); /// /// Prepends a quad distortion matrix using the specified corner points. @@ -289,7 +289,7 @@ public class ProjectiveTransformBuilder /// The . public ProjectiveTransformBuilder PrependQuadDistortion(PointF topLeft, PointF topRight, PointF bottomRight, PointF bottomLeft) => this.Prepend(size => TransformUtils.CreateQuadDistortionMatrix( - new(Point.Empty, size), topLeft, topRight, bottomRight, bottomLeft, this.TransformSpace)); + new Rectangle(Point.Empty, size), topLeft, topRight, bottomRight, bottomLeft, this.TransformSpace)); /// /// Appends a quad distortion matrix using the specified corner points. @@ -301,7 +301,7 @@ public class ProjectiveTransformBuilder /// The . public ProjectiveTransformBuilder AppendQuadDistortion(PointF topLeft, PointF topRight, PointF bottomRight, PointF bottomLeft) => this.Append(size => TransformUtils.CreateQuadDistortionMatrix( - new(Point.Empty, size), topLeft, topRight, bottomRight, bottomLeft, this.TransformSpace)); + new Rectangle(Point.Empty, size), topLeft, topRight, bottomRight, bottomLeft, this.TransformSpace)); /// /// Prepends a raw matrix. @@ -359,7 +359,7 @@ public class ProjectiveTransformBuilder Guard.MustBeGreaterThan(sourceRectangle.Height, 0, nameof(sourceRectangle)); // Translate the origin matrix to cater for source rectangle offsets. - Matrix4x4 matrix = Matrix4x4.CreateTranslation(new(-sourceRectangle.Location, 0)); + Matrix4x4 matrix = Matrix4x4.CreateTranslation(new Vector3(-sourceRectangle.Location, 0)); Size size = sourceRectangle.Size; diff --git a/tests/ImageSharp.Benchmarks/Bulk/FromRgba32Bytes.cs b/tests/ImageSharp.Benchmarks/Bulk/FromRgba32Bytes.cs index e263e3c62..92d5bcdbf 100644 --- a/tests/ImageSharp.Benchmarks/Bulk/FromRgba32Bytes.cs +++ b/tests/ImageSharp.Benchmarks/Bulk/FromRgba32Bytes.cs @@ -49,7 +49,7 @@ public abstract class FromRgba32Bytes for (int i = 0; i < this.Count; i++) { int i4 = i * 4; - d[i] = TPixel.FromRgba32(new(s[i4], s[i4 + 1], s[i4 + 2], s[i4 + 3])); + d[i] = TPixel.FromRgba32(new Rgba32(s[i4], s[i4 + 1], s[i4 + 2], s[i4 + 3])); } } diff --git a/tests/ImageSharp.Benchmarks/Codecs/Bmp/DecodeBmp.cs b/tests/ImageSharp.Benchmarks/Codecs/Bmp/DecodeBmp.cs index 53b76201c..eec926a23 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Bmp/DecodeBmp.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Bmp/DecodeBmp.cs @@ -37,6 +37,6 @@ public class DecodeBmp { using MemoryStream memoryStream = new(this.bmpBytes); using Image image = Image.Load(memoryStream); - return new(image.Width, image.Height); + return new Size(image.Width, image.Height); } } diff --git a/tests/ImageSharp.Benchmarks/Codecs/Gif/DecodeEncodeGif.cs b/tests/ImageSharp.Benchmarks/Codecs/Gif/DecodeEncodeGif.cs index 84428d2fc..3238e8dac 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Gif/DecodeEncodeGif.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Gif/DecodeEncodeGif.cs @@ -23,7 +23,7 @@ public abstract class DecodeEncodeGif private string TestImageFullPath => Path.Combine(TestEnvironment.InputImagesDirectoryFullPath, this.TestImage); [GlobalSetup] - public void Setup() => this.outputStream = new(); + public void Setup() => this.outputStream = new MemoryStream(); [GlobalCleanup] public void Cleanup() => this.outputStream.Close(); @@ -54,6 +54,6 @@ public class DecodeEncodeGif_CoarsePaletteEncoder : DecodeEncodeGif { protected override GifEncoder Encoder => new() { - Quantizer = new WebSafePaletteQuantizer(new() { Dither = KnownDitherings.Bayer4x4, ColorMatchingMode = ColorMatchingMode.Coarse }) + Quantizer = new WebSafePaletteQuantizer(new QuantizerOptions { Dither = KnownDitherings.Bayer4x4, ColorMatchingMode = ColorMatchingMode.Coarse }) }; } diff --git a/tests/ImageSharp.Benchmarks/Codecs/Gif/DecodeGif.cs b/tests/ImageSharp.Benchmarks/Codecs/Gif/DecodeGif.cs index 044a50d04..117cdd25b 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Gif/DecodeGif.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Gif/DecodeGif.cs @@ -36,6 +36,6 @@ public class DecodeGif { using MemoryStream memoryStream = new(this.gifBytes); using Image image = Image.Load(memoryStream); - return new(image.Width, image.Height); + return new Size(image.Width, image.Height); } } diff --git a/tests/ImageSharp.Benchmarks/Codecs/Gif/EncodeGif.cs b/tests/ImageSharp.Benchmarks/Codecs/Gif/EncodeGif.cs index 60c14ff25..b8f8f7851 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Gif/EncodeGif.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Gif/EncodeGif.cs @@ -38,7 +38,7 @@ public abstract class EncodeGif this.bmpDrawing = SDImage.FromStream(this.bmpStream); this.bmpStream.Position = 0; - this.magickImage = new(this.bmpStream); + this.magickImage = new MagickImageCollection(this.bmpStream); } } @@ -83,6 +83,6 @@ public class EncodeGif_CoarsePaletteEncoder : EncodeGif { protected override GifEncoder Encoder => new() { - Quantizer = new WebSafePaletteQuantizer(new() { Dither = KnownDitherings.Bayer4x4, ColorMatchingMode = ColorMatchingMode.Coarse }) + Quantizer = new WebSafePaletteQuantizer(new QuantizerOptions { Dither = KnownDitherings.Bayer4x4, ColorMatchingMode = ColorMatchingMode.Coarse }) }; } diff --git a/tests/ImageSharp.Benchmarks/Codecs/Gif/EncodeGifMultiple.cs b/tests/ImageSharp.Benchmarks/Codecs/Gif/EncodeGifMultiple.cs index 7a0542981..303272837 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Gif/EncodeGifMultiple.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Gif/EncodeGifMultiple.cs @@ -24,7 +24,7 @@ public class EncodeGifMultiple : MultiImageBenchmarkBase.WithImagesPreloaded // Try to get as close to System.Drawing's output as possible GifEncoder options = new() { - Quantizer = new WebSafePaletteQuantizer(new() { Dither = KnownDitherings.Bayer4x4 }) + Quantizer = new WebSafePaletteQuantizer(new QuantizerOptions { Dither = KnownDitherings.Bayer4x4 }) }; img.Save(ms, options); diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs index 29a3ae5de..4ea0a92f1 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs @@ -185,15 +185,15 @@ public class Block8x8F_CopyTo2x2 ref Vector2 dBottomLeft = ref Unsafe.Add(ref dTopLeft, (uint)destStride); ref Vector2 dBottomRight = ref Unsafe.Add(ref dBottomLeft, 4); - Vector2 xLeft = new Vector2(sLeft.X); - Vector2 yLeft = new Vector2(sLeft.Y); - Vector2 zLeft = new Vector2(sLeft.Z); - Vector2 wLeft = new Vector2(sLeft.W); + Vector2 xLeft = new(sLeft.X); + Vector2 yLeft = new(sLeft.Y); + Vector2 zLeft = new(sLeft.Z); + Vector2 wLeft = new(sLeft.W); - Vector2 xRight = new Vector2(sRight.X); - Vector2 yRight = new Vector2(sRight.Y); - Vector2 zRight = new Vector2(sRight.Z); - Vector2 wRight = new Vector2(sRight.W); + Vector2 xRight = new(sRight.X); + Vector2 yRight = new(sRight.Y); + Vector2 zRight = new(sRight.Z); + Vector2 wRight = new(sRight.W); dTopLeft = xLeft; Unsafe.Add(ref dTopLeft, 1) = yLeft; @@ -245,15 +245,15 @@ public class Block8x8F_CopyTo2x2 ref Vector2 dBottomLeft = ref Unsafe.Add(ref dTopLeft, (uint)destStride); ref Vector2 dBottomRight = ref Unsafe.Add(ref dBottomLeft, 4); - Vector4 xLeft = new Vector4(sLeft.X); - Vector4 yLeft = new Vector4(sLeft.Y); - Vector4 zLeft = new Vector4(sLeft.Z); - Vector4 wLeft = new Vector4(sLeft.W); + Vector4 xLeft = new(sLeft.X); + Vector4 yLeft = new(sLeft.Y); + Vector4 zLeft = new(sLeft.Z); + Vector4 wLeft = new(sLeft.W); - Vector4 xRight = new Vector4(sRight.X); - Vector4 yRight = new Vector4(sRight.Y); - Vector4 zRight = new Vector4(sRight.Z); - Vector4 wRight = new Vector4(sRight.W); + Vector4 xRight = new(sRight.X); + Vector4 yRight = new(sRight.Y); + Vector4 zRight = new(sRight.Z); + Vector4 wRight = new(sRight.W); Unsafe.As(ref dTopLeft) = xLeft; Unsafe.As(ref Unsafe.Add(ref dTopLeft, 1)) = yLeft; @@ -303,15 +303,15 @@ public class Block8x8F_CopyTo2x2 ref Vector2 dTopLeft = ref Unsafe.Add(ref destBase, (uint)(2 * row * destStride)); ref Vector2 dBottomLeft = ref Unsafe.Add(ref dTopLeft, (uint)destStride); - Vector4 xLeft = new Vector4(sLeft.X); - Vector4 yLeft = new Vector4(sLeft.Y); - Vector4 zLeft = new Vector4(sLeft.Z); - Vector4 wLeft = new Vector4(sLeft.W); + Vector4 xLeft = new(sLeft.X); + Vector4 yLeft = new(sLeft.Y); + Vector4 zLeft = new(sLeft.Z); + Vector4 wLeft = new(sLeft.W); - Vector4 xRight = new Vector4(sRight.X); - Vector4 yRight = new Vector4(sRight.Y); - Vector4 zRight = new Vector4(sRight.Z); - Vector2 wRight = new Vector2(sRight.W); + Vector4 xRight = new(sRight.X); + Vector4 yRight = new(sRight.Y); + Vector4 zRight = new(sRight.Z); + Vector2 wRight = new(sRight.W); Unsafe.As(ref dTopLeft) = xLeft; Unsafe.As(ref Unsafe.Add(ref dTopLeft, 1)) = yLeft; @@ -362,25 +362,25 @@ public class Block8x8F_CopyTo2x2 ref Vector4 dTopLeft = ref Unsafe.As(ref Unsafe.Add(ref destBase, (uint)offset)); ref Vector4 dBottomLeft = ref Unsafe.As(ref Unsafe.Add(ref destBase, (uint)(offset + destStride))); - Vector4 xyLeft = new Vector4(sLeft.X) + Vector4 xyLeft = new(sLeft.X) { Z = sLeft.Y, W = sLeft.Y }; - Vector4 zwLeft = new Vector4(sLeft.Z) + Vector4 zwLeft = new(sLeft.Z) { Z = sLeft.W, W = sLeft.W }; - Vector4 xyRight = new Vector4(sRight.X) + Vector4 xyRight = new(sRight.X) { Z = sRight.Y, W = sRight.Y }; - Vector4 zwRight = new Vector4(sRight.Z) + Vector4 zwRight = new(sRight.Z) { Z = sRight.W, W = sRight.W diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_DivideRound.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_DivideRound.cs index ea8a1c47b..45c6f63b9 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_DivideRound.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_DivideRound.cs @@ -19,8 +19,8 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg.BlockOperations; public unsafe class Block8x8F_DivideRound { private const int ExecutionCount = 5; // Added this to reduce the effect of copying the blocks - private static readonly Vector4 MinusOne = new Vector4(-1); - private static readonly Vector4 Half = new Vector4(0.5f); + private static readonly Vector4 MinusOne = new(-1); + private static readonly Vector4 Half = new(0.5f); private Block8x8F inputDividend; private Block8x8F inputDivisor; diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/ColorConversion/ColorConversionBenchmark.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/ColorConversion/ColorConversionBenchmark.cs index 959522d81..436aa9bcd 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/ColorConversion/ColorConversionBenchmark.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/ColorConversion/ColorConversionBenchmark.cs @@ -38,7 +38,7 @@ public abstract class ColorConversionBenchmark float minVal = 0f, float maxVal = 255f) { - Random rnd = new Random(42); + Random rnd = new(42); Buffer2D[] buffers = new Buffer2D[componentCount]; for (int i = 0; i < componentCount; i++) { diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg.cs index 6e089d443..dbd255722 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg.cs @@ -19,7 +19,7 @@ public class DecodeJpeg { this.decoder = JpegDecoder.Instance; byte[] bytes = File.ReadAllBytes(Path.Combine(TestEnvironment.InputImagesDirectoryFullPath, imageSubpath)); - this.preloadedImageStream = new(bytes); + this.preloadedImageStream = new MemoryStream(bytes); } private void GenericBenchmark() diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs index 91ee82136..e7b66576d 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs @@ -2,6 +2,7 @@ // Licensed under the Six Labors Split License. using BenchmarkDotNet.Attributes; +using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Jpeg; using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using SixLabors.ImageSharp.IO; @@ -38,7 +39,7 @@ public class DecodeJpegParseStreamOnly { using MemoryStream memoryStream = new(this.jpegBytes); using BufferedReadStream bufferedStream = new(Configuration.Default, memoryStream); - JpegDecoderOptions options = new() { GeneralOptions = new() { SkipMetadata = true } }; + JpegDecoderOptions options = new() { GeneralOptions = new DecoderOptions { SkipMetadata = true } }; using JpegDecoderCore decoder = new(options); NoopSpectralConverter spectralConverter = new(); diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg_ImageSpecific.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg_ImageSpecific.cs index 78beda5ef..9a4ee3967 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg_ImageSpecific.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg_ImageSpecific.cs @@ -49,8 +49,8 @@ public class DecodeJpeg_ImageSpecific public Size ImageSharp() { using MemoryStream memoryStream = new(this.jpegBytes); - using Image image = Image.Load(new() { SkipMetadata = true }, memoryStream); - return new(image.Width, image.Height); + using Image image = Image.Load(new DecoderOptions { SkipMetadata = true }, memoryStream); + return new Size(image.Width, image.Height); } /* diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/EncodeJpegComparison.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/EncodeJpegComparison.cs index b865bb85d..c7cecd1a5 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/EncodeJpegComparison.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/EncodeJpegComparison.cs @@ -38,9 +38,9 @@ public class EncodeJpegComparison using FileStream imageBinaryStream = File.OpenRead(Path.Combine(TestEnvironment.InputImagesDirectoryFullPath, TestImage)); this.imageImageSharp = Image.Load(imageBinaryStream); - this.encoderImageSharp = new() { Quality = this.Quality, ColorType = JpegColorType.YCbCrRatio420 }; + this.encoderImageSharp = new JpegEncoder { Quality = this.Quality, ColorType = JpegColorType.YCbCrRatio420 }; - this.destinationStream = new(); + this.destinationStream = new MemoryStream(); } [GlobalCleanup(Target = nameof(BenchmarkImageSharp))] @@ -67,7 +67,7 @@ public class EncodeJpegComparison this.imageSkiaSharp = SKBitmap.Decode(imageBinaryStream); - this.destinationStream = new(); + this.destinationStream = new MemoryStream(); } [GlobalCleanup(Target = nameof(BenchmarkSkiaSharp))] diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/EncodeJpegFeatures.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/EncodeJpegFeatures.cs index 2e1cae973..858917995 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/EncodeJpegFeatures.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/EncodeJpegFeatures.cs @@ -44,13 +44,13 @@ public class EncodeJpegFeatures { using FileStream imageBinaryStream = File.OpenRead(Path.Combine(TestEnvironment.InputImagesDirectoryFullPath, TestImage)); this.bmpCore = Image.Load(imageBinaryStream); - this.encoder = new() + this.encoder = new JpegEncoder { Quality = this.Quality, ColorType = this.TargetColorSpace, Interleaved = true, }; - this.destinationStream = new(); + this.destinationStream = new MemoryStream(); } [GlobalCleanup] diff --git a/tests/ImageSharp.Benchmarks/Codecs/MultiImageBenchmarkBase.cs b/tests/ImageSharp.Benchmarks/Codecs/MultiImageBenchmarkBase.cs index 64d06ac17..0adc52441 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/MultiImageBenchmarkBase.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/MultiImageBenchmarkBase.cs @@ -155,7 +155,7 @@ public abstract class MultiImageBenchmarkBase this.FileNamesToImageSharpImages[fn] = Image.Load(ms1); } - this.FileNamesToSystemDrawingImages[fn] = new(new MemoryStream(bytes)); + this.FileNamesToSystemDrawingImages[fn] = new Bitmap(new MemoryStream(bytes)); } } diff --git a/tests/ImageSharp.Benchmarks/Codecs/Png/EncodeIndexedPng.cs b/tests/ImageSharp.Benchmarks/Codecs/Png/EncodeIndexedPng.cs index 4c60de663..125b42680 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Png/EncodeIndexedPng.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Png/EncodeIndexedPng.cs @@ -52,7 +52,7 @@ public class EncodeIndexedPng public void PngCoreOctreeNoDither() { using MemoryStream memoryStream = new(); - PngEncoder options = new() { Quantizer = new OctreeQuantizer(new() { Dither = null }) }; + PngEncoder options = new() { Quantizer = new OctreeQuantizer(new QuantizerOptions { Dither = null }) }; this.bmpCore.SaveAsPng(memoryStream, options); } @@ -68,7 +68,7 @@ public class EncodeIndexedPng public void PngCorePaletteNoDither() { using MemoryStream memoryStream = new(); - PngEncoder options = new() { Quantizer = new WebSafePaletteQuantizer(new() { Dither = null }) }; + PngEncoder options = new() { Quantizer = new WebSafePaletteQuantizer(new QuantizerOptions { Dither = null }) }; this.bmpCore.SaveAsPng(memoryStream, options); } @@ -84,7 +84,7 @@ public class EncodeIndexedPng public void PngCoreWuNoDither() { using MemoryStream memoryStream = new(); - PngEncoder options = new() { Quantizer = new WuQuantizer(new() { Dither = null }), ColorType = PngColorType.Palette }; + PngEncoder options = new() { Quantizer = new WuQuantizer(new QuantizerOptions { Dither = null }), ColorType = PngColorType.Palette }; this.bmpCore.SaveAsPng(memoryStream, options); } } diff --git a/tests/ImageSharp.Benchmarks/Codecs/Tga/EncodeTga.cs b/tests/ImageSharp.Benchmarks/Codecs/Tga/EncodeTga.cs index c9ab74eda..169a44d91 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Tga/EncodeTga.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Tga/EncodeTga.cs @@ -26,7 +26,7 @@ public class EncodeTga if (this.tga == null) { this.tga = Image.Load(this.TestImageFullPath); - this.tgaMagick = new(this.TestImageFullPath); + this.tgaMagick = new MagickImage(this.TestImageFullPath); } } diff --git a/tests/ImageSharp.Benchmarks/Codecs/Tiff/EncodeTiff.cs b/tests/ImageSharp.Benchmarks/Codecs/Tiff/EncodeTiff.cs index 44c04caef..6fa6a15ed 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Tiff/EncodeTiff.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Tiff/EncodeTiff.cs @@ -62,7 +62,7 @@ public class EncodeTiff ImageCodecInfo codec = FindCodecForType("image/tiff"); using EncoderParameters parameters = new(1) { - Param = { [0] = new(Encoder.Compression, (long)Cast(this.Compression)) } + Param = { [0] = new EncoderParameter(Encoder.Compression, (long)Cast(this.Compression)) } }; using MemoryStream memoryStream = new(); diff --git a/tests/ImageSharp.Benchmarks/Codecs/Webp/EncodeWebp.cs b/tests/ImageSharp.Benchmarks/Codecs/Webp/EncodeWebp.cs index 9c134c0e1..3b9058498 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Webp/EncodeWebp.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Webp/EncodeWebp.cs @@ -30,7 +30,7 @@ public class EncodeWebp if (this.webp == null) { this.webp = Image.Load(this.TestImageFullPath); - this.webpMagick = new(this.TestImageFullPath); + this.webpMagick = new MagickImage(this.TestImageFullPath); } } diff --git a/tests/ImageSharp.Benchmarks/Color/ColorEquality.cs b/tests/ImageSharp.Benchmarks/Color/ColorEquality.cs index 38715e6ca..5166c89a9 100644 --- a/tests/ImageSharp.Benchmarks/Color/ColorEquality.cs +++ b/tests/ImageSharp.Benchmarks/Color/ColorEquality.cs @@ -15,5 +15,5 @@ public class ColorEquality [Benchmark(Description = "ImageSharp Color Equals")] public bool ColorEqual() - => new Rgba32(128, 128, 128, 128).Equals(new(128, 128, 128, 128)); + => new Rgba32(128, 128, 128, 128).Equals(new Rgba32(128, 128, 128, 128)); } diff --git a/tests/ImageSharp.Benchmarks/Color/RgbWorkingSpaceAdapt.cs b/tests/ImageSharp.Benchmarks/Color/RgbWorkingSpaceAdapt.cs index dcc46df37..b847e3ac5 100644 --- a/tests/ImageSharp.Benchmarks/Color/RgbWorkingSpaceAdapt.cs +++ b/tests/ImageSharp.Benchmarks/Color/RgbWorkingSpaceAdapt.cs @@ -13,7 +13,7 @@ public class RgbWorkingSpaceAdapt private static readonly RGBColor RGBColor = new(0.206162, 0.260277, 0.746717); - private static readonly ColorProfileConverter ColorProfileConverter = new(new() { SourceRgbWorkingSpace = KnownRgbWorkingSpaces.WideGamutRgb, TargetRgbWorkingSpace = KnownRgbWorkingSpaces.SRgb }); + private static readonly ColorProfileConverter ColorProfileConverter = new(new ColorConversionOptions { SourceRgbWorkingSpace = KnownRgbWorkingSpaces.WideGamutRgb, TargetRgbWorkingSpace = KnownRgbWorkingSpaces.SRgb }); private static readonly IColorConverter ColourfulConverter = new ConverterBuilder().FromRGB(RGBWorkingSpaces.WideGamutRGB).ToRGB(RGBWorkingSpaces.sRGB).Build(); diff --git a/tests/ImageSharp.Benchmarks/Color/YcbCrToRgb.cs b/tests/ImageSharp.Benchmarks/Color/YcbCrToRgb.cs index 37db166ae..093397ad5 100644 --- a/tests/ImageSharp.Benchmarks/Color/YcbCrToRgb.cs +++ b/tests/ImageSharp.Benchmarks/Color/YcbCrToRgb.cs @@ -22,7 +22,7 @@ public class YcbCrToRgb byte g = (byte)Numerics.Clamp(y - (0.34414F * ccb) - (0.71414F * ccr), 0, 255); byte b = (byte)Numerics.Clamp(y + (1.772F * ccb), 0, 255); - return new(r, g, b); + return new Vector3(r, g, b); } [Benchmark(Description = "Scaled Integer Conversion")] @@ -45,6 +45,6 @@ public class YcbCrToRgb byte g = (byte)Numerics.Clamp(y - (g0 >> 10) - (g1 >> 10), 0, 255); byte b = (byte)Numerics.Clamp(y + (b0 >> 10), 0, 255); - return new(r, g, b); + return new Vector3(r, g, b); } } diff --git a/tests/ImageSharp.Benchmarks/General/Adler32Benchmark.cs b/tests/ImageSharp.Benchmarks/General/Adler32Benchmark.cs index 30023feca..64a8092c6 100644 --- a/tests/ImageSharp.Benchmarks/General/Adler32Benchmark.cs +++ b/tests/ImageSharp.Benchmarks/General/Adler32Benchmark.cs @@ -11,7 +11,7 @@ namespace SixLabors.ImageSharp.Benchmarks.General; public class Adler32Benchmark { private byte[] data; - private readonly SharpAdler32 adler = new SharpAdler32(); + private readonly SharpAdler32 adler = new(); [Params(1024, 2048, 4096)] public int Count { get; set; } diff --git a/tests/ImageSharp.Benchmarks/General/Array2D.cs b/tests/ImageSharp.Benchmarks/General/Array2D.cs index 2d244607b..f0a36ee1d 100644 --- a/tests/ImageSharp.Benchmarks/General/Array2D.cs +++ b/tests/ImageSharp.Benchmarks/General/Array2D.cs @@ -44,7 +44,7 @@ public class Array2D this.jaggedData[i] = new float[this.Count]; } - this.matrix = new(this.array2D); + this.matrix = new DenseMatrix(this.array2D); this.Min = (this.Count / 2) - 10; this.Min = Math.Max(0, this.Min); diff --git a/tests/ImageSharp.Benchmarks/General/BasicMath/ClampSpan.cs b/tests/ImageSharp.Benchmarks/General/BasicMath/ClampSpan.cs index 458927a35..b61ba27ff 100644 --- a/tests/ImageSharp.Benchmarks/General/BasicMath/ClampSpan.cs +++ b/tests/ImageSharp.Benchmarks/General/BasicMath/ClampSpan.cs @@ -12,7 +12,7 @@ public class ClampSpan public void Setup() { - Random r = new Random(); + Random r = new(); for (int i = 0; i < A.Length; i++) { diff --git a/tests/ImageSharp.Benchmarks/General/BasicMath/ClampVector4.cs b/tests/ImageSharp.Benchmarks/General/BasicMath/ClampVector4.cs index 5d93d2083..186f88bb7 100644 --- a/tests/ImageSharp.Benchmarks/General/BasicMath/ClampVector4.cs +++ b/tests/ImageSharp.Benchmarks/General/BasicMath/ClampVector4.cs @@ -42,13 +42,13 @@ public class ClampVector4 [MethodImpl(MethodImplOptions.AggressiveInlining)] private static Vector4 ClampUsingVectorClamp(float x, float min, float max) { - return Vector4.Clamp(new(x), new(min), new(max)); + return Vector4.Clamp(new Vector4(x), new Vector4(min), new Vector4(max)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static Vector4 ClampUsingVectorMinMax(float x, float min, float max) { - return Vector4.Min(new(max), Vector4.Max(new(min), new(x))); + return Vector4.Min(new Vector4(max), Vector4.Max(new Vector4(min), new Vector4(x))); } // RESULTS diff --git a/tests/ImageSharp.Benchmarks/General/CopyBuffers.cs b/tests/ImageSharp.Benchmarks/General/CopyBuffers.cs index 85daa5bd2..031f9ecf2 100644 --- a/tests/ImageSharp.Benchmarks/General/CopyBuffers.cs +++ b/tests/ImageSharp.Benchmarks/General/CopyBuffers.cs @@ -36,11 +36,11 @@ public class CopyBuffers public void Setup() { this.sourceArray = new byte[this.Count]; - this.sourceMemory = new(this.sourceArray); + this.sourceMemory = new Memory(this.sourceArray); this.sourceHandle = this.sourceMemory.Pin(); this.destArray = new byte[this.Count]; - this.destMemory = new(this.destArray); + this.destMemory = new Memory(this.destArray); this.destHandle = this.destMemory.Pin(); } diff --git a/tests/ImageSharp.Benchmarks/General/IO/BufferedStreams.cs b/tests/ImageSharp.Benchmarks/General/IO/BufferedStreams.cs index f9b32d22a..d32e1fdd0 100644 --- a/tests/ImageSharp.Benchmarks/General/IO/BufferedStreams.cs +++ b/tests/ImageSharp.Benchmarks/General/IO/BufferedStreams.cs @@ -31,28 +31,28 @@ public class BufferedStreams [GlobalSetup] public void CreateStreams() { - this.stream1 = new(this.buffer); - this.stream2 = new(this.buffer); - this.stream3 = new(this.buffer); - this.stream4 = new(this.buffer); - this.stream5 = new(this.buffer); - this.stream6 = new(this.buffer); - this.stream6 = new(this.buffer); - - this.chunkedMemoryStream1 = new(Configuration.Default.MemoryAllocator); + this.stream1 = new MemoryStream(this.buffer); + this.stream2 = new MemoryStream(this.buffer); + this.stream3 = new MemoryStream(this.buffer); + this.stream4 = new MemoryStream(this.buffer); + this.stream5 = new MemoryStream(this.buffer); + this.stream6 = new MemoryStream(this.buffer); + this.stream6 = new MemoryStream(this.buffer); + + this.chunkedMemoryStream1 = new ChunkedMemoryStream(Configuration.Default.MemoryAllocator); this.chunkedMemoryStream1.Write(this.buffer); this.chunkedMemoryStream1.Position = 0; - this.chunkedMemoryStream2 = new(Configuration.Default.MemoryAllocator); + this.chunkedMemoryStream2 = new ChunkedMemoryStream(Configuration.Default.MemoryAllocator); this.chunkedMemoryStream2.Write(this.buffer); this.chunkedMemoryStream2.Position = 0; - this.bufferedStream1 = new(Configuration.Default, this.stream3); - this.bufferedStream2 = new(Configuration.Default, this.stream4); - this.bufferedStream3 = new(Configuration.Default, this.chunkedMemoryStream1); - this.bufferedStream4 = new(Configuration.Default, this.chunkedMemoryStream2); - this.bufferedStreamWrap1 = new(this.stream5); - this.bufferedStreamWrap2 = new(this.stream6); + this.bufferedStream1 = new BufferedReadStream(Configuration.Default, this.stream3); + this.bufferedStream2 = new BufferedReadStream(Configuration.Default, this.stream4); + this.bufferedStream3 = new BufferedReadStream(Configuration.Default, this.chunkedMemoryStream1); + this.bufferedStream4 = new BufferedReadStream(Configuration.Default, this.chunkedMemoryStream2); + this.bufferedStreamWrap1 = new BufferedReadStreamWrapper(this.stream5); + this.bufferedStreamWrap2 = new BufferedReadStreamWrapper(this.stream6); } [GlobalCleanup] diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromRgba32.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromRgba32.cs index 33fe56fc6..c864e26c6 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromRgba32.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromRgba32.cs @@ -96,9 +96,9 @@ public abstract class PixelConversion_ConvertFromRgba32 [GlobalSetup] public void Setup() { - this.CompatibleMemLayoutRunner = new(this.Count); - this.PermutedRunnerRgbaToArgb = new(this.Count); - this.RunnerRgbaToRgbaVector = new(this.Count); + this.CompatibleMemLayoutRunner = new ConversionRunner(this.Count); + this.PermutedRunnerRgbaToArgb = new ConversionRunner(this.Count); + this.RunnerRgbaToRgbaVector = new ConversionRunner(this.Count); } } diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromVector4.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromVector4.cs index c0dd6b93d..57f79ba1f 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromVector4.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromVector4.cs @@ -65,8 +65,8 @@ public class PixelConversion_ConvertFromVector4 [GlobalSetup] public void Setup() { - this.nonVectorRunner = new(this.Count); - this.vectorRunner = new(this.Count); + this.nonVectorRunner = new ConversionRunner(this.Count); + this.vectorRunner = new ConversionRunner(this.Count); } [Benchmark(Baseline = true)] diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32.cs index 4a36e9cf1..1a03a0c04 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32.cs @@ -69,8 +69,8 @@ public class PixelConversion_ConvertToRgba32 [GlobalSetup] public void Setup() { - this.compatibleMemoryLayoutRunner = new(this.Count); - this.permutedRunner = new(this.Count); + this.compatibleMemoryLayoutRunner = new ConversionRunner(this.Count); + this.permutedRunner = new ConversionRunner(this.Count); } [Benchmark(Baseline = true)] diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32_AsPartOfCompositeOperation.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32_AsPartOfCompositeOperation.cs index ad2e71626..69a71734a 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32_AsPartOfCompositeOperation.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32_AsPartOfCompositeOperation.cs @@ -76,8 +76,8 @@ public class PixelConversion_ConvertToRgba32_AsPartOfCompositeOperation [GlobalSetup] public void Setup() { - this.compatibleMemoryLayoutRunner = new(this.Count); - this.permutedRunner = new(this.Count); + this.compatibleMemoryLayoutRunner = new ConversionRunner(this.Count); + this.permutedRunner = new ConversionRunner(this.Count); } [Benchmark(Baseline = true)] diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4.cs index ee0fbb499..9b498b0f2 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4.cs @@ -59,7 +59,7 @@ public class PixelConversion_ConvertToVector4 [GlobalSetup] public void Setup() { - this.runner = new(this.Count); + this.runner = new ConversionRunner(this.Count); } [Benchmark(Baseline = true)] diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4_AsPartOfCompositeOperation.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4_AsPartOfCompositeOperation.cs index d9723b0e3..50c3d0d13 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4_AsPartOfCompositeOperation.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4_AsPartOfCompositeOperation.cs @@ -73,7 +73,7 @@ public class PixelConversion_ConvertToVector4_AsPartOfCompositeOperation [GlobalSetup] public void Setup() { - this.runner = new(this.Count); + this.runner = new ConversionRunner(this.Count); } [Benchmark(Baseline = true)] diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Bgra32.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Bgra32.cs index 21808b5ef..232d8b3e2 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Bgra32.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Bgra32.cs @@ -252,8 +252,8 @@ public class PixelConversion_Rgba32_To_Bgra32 private static void BitopsSimdImpl(ref Octet s, ref Octet d) { Vector sVec = Unsafe.As, Vector>(ref s); - Vector aMask = new Vector(0xFF00FF00); - Vector bMask = new Vector(0x00FF00FF); + Vector aMask = new(0xFF00FF00); + Vector bMask = new(0x00FF00FF); Vector aa = sVec & aMask; Vector bb = sVec & bMask; diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/TestArgb.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/TestArgb.cs index 21bef5a15..8698f8223 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/TestArgb.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/TestArgb.cs @@ -103,6 +103,6 @@ public struct TestArgb : ITestPixel vector = Numerics.Clamp(vector, Vector4.Zero, MaxBytes); Vector128 result = Vector128.ConvertToInt32(vector.AsVector128()).AsByte(); - return new(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); + return new TestArgb(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); } } diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/TestRgba.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/TestRgba.cs index 1499fb7d3..751cd68b4 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/TestRgba.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/TestRgba.cs @@ -79,6 +79,6 @@ public struct TestRgba : ITestPixel vector = Numerics.Clamp(vector, Vector4.Zero, MaxBytes); Vector128 result = Vector128.ConvertToInt32(vector.AsVector128()).AsByte(); - return new(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); + return new TestRgba(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); } } diff --git a/tests/ImageSharp.Benchmarks/General/Vector4Constants.cs b/tests/ImageSharp.Benchmarks/General/Vector4Constants.cs index c7df2467b..5919137bf 100644 --- a/tests/ImageSharp.Benchmarks/General/Vector4Constants.cs +++ b/tests/ImageSharp.Benchmarks/General/Vector4Constants.cs @@ -24,8 +24,8 @@ public class Vector4Constants [GlobalSetup] public void Setup() { - this.random = new(42); - this.parameter = new( + this.random = new Random(42); + this.parameter = new Vector4( this.GetRandomFloat(), this.GetRandomFloat(), this.GetRandomFloat(), @@ -51,8 +51,8 @@ public class Vector4Constants Vector4 x = (p * new Vector4(1.2f) / new Vector4(2.3f)) + (p * new Vector4(4.5f) / new Vector4(6.7f)); Vector4 y = (p / new Vector4(1.2f) * new Vector4(2.3f)) + (p / new Vector4(4.5f) * new Vector4(6.7f)); - Vector4 z = Vector4.Min(p, new(1.2f)); - Vector4 w = Vector4.Max(p, new(2.3f)); + Vector4 z = Vector4.Min(p, new Vector4(1.2f)); + Vector4 w = Vector4.Max(p, new Vector4(2.3f)); return x + y + z + w; } diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/BitwiseOrUint32.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/BitwiseOrUint32.cs index 69babfb92..2f9b02b59 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/BitwiseOrUint32.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/BitwiseOrUint32.cs @@ -43,11 +43,11 @@ public class BitwiseOrUInt32 [Benchmark] public void Simd() { - Vector v = new Vector(this.testValue); + Vector v = new(this.testValue); for (int i = 0; i < this.input.Length; i += Vector.Count) { - Vector a = new Vector(this.input, i); + Vector a = new(this.input, i); a = Vector.BitwiseOr(a, v); a.CopyTo(this.result, i); } diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/DivFloat.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/DivFloat.cs index 2c30cd103..fd243638b 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/DivFloat.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/DivFloat.cs @@ -43,11 +43,11 @@ public class DivFloat [Benchmark] public void Simd() { - Vector v = new Vector(this.testValue); + Vector v = new(this.testValue); for (int i = 0; i < this.input.Length; i += Vector.Count) { - Vector a = new Vector(this.input, i); + Vector a = new(this.input, i); a = a / v; a.CopyTo(this.result, i); } diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/DivUInt32.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/DivUInt32.cs index 6bdbccace..0d2923b61 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/DivUInt32.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/DivUInt32.cs @@ -44,11 +44,11 @@ public class DivUInt32 [Benchmark] public void Simd() { - Vector v = new Vector(this.testValue); + Vector v = new(this.testValue); for (int i = 0; i < this.input.Length; i += Vector.Count) { - Vector a = new Vector(this.input, i); + Vector a = new(this.input, i); a = a / v; a.CopyTo(this.result, i); diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/Divide.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/Divide.cs index 5277897bb..61ff9466e 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/Divide.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/Divide.cs @@ -57,7 +57,7 @@ public class DivInt16 : SIMDBenchmarkBase.Divide { protected override short GetTestValue() => 42; - protected override Vector GetTestVector() => new Vector(new short[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }); + protected override Vector GetTestVector() => new(new short[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }); [Benchmark(Baseline = true)] public void Standard() diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/MulFloat.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/MulFloat.cs index 8d5d66c4b..801b0e161 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/MulFloat.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/MulFloat.cs @@ -43,11 +43,11 @@ public class MulFloat [Benchmark] public void SimdMultiplyByVector() { - Vector v = new Vector(this.testValue); + Vector v = new(this.testValue); for (int i = 0; i < this.input.Length; i += Vector.Count) { - Vector a = new Vector(this.input, i); + Vector a = new(this.input, i); a = a * v; a.CopyTo(this.result, i); } @@ -60,7 +60,7 @@ public class MulFloat for (int i = 0; i < this.input.Length; i += Vector.Count) { - Vector a = new Vector(this.input, i); + Vector a = new(this.input, i); a = a * v; a.CopyTo(this.result, i); } diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/MulUInt32.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/MulUInt32.cs index d8079423f..db64486ad 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/MulUInt32.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/MulUInt32.cs @@ -43,11 +43,11 @@ public class MulUInt32 [Benchmark] public void Simd() { - Vector v = new Vector(this.testValue); + Vector v = new(this.testValue); for (int i = 0; i < this.input.Length; i += Vector.Count) { - Vector a = new Vector(this.input, i); + Vector a = new(this.input, i); a = a * v; a.CopyTo(this.result, i); } diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/Multiply.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/Multiply.cs index 7e890cb92..d9542bc3f 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/Multiply.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/Multiply.cs @@ -40,7 +40,7 @@ public class MulInt16 : SIMDBenchmarkBase.Multiply { protected override short GetTestValue() => 42; - protected override Vector GetTestVector() => new Vector(new short[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }); + protected override Vector GetTestVector() => new(new short[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }); [Benchmark(Baseline = true)] public void Standard() diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/Premultiply.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/Premultiply.cs index 8129222c3..f99b141b4 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/Premultiply.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/Premultiply.cs @@ -12,14 +12,14 @@ public class Premultiply [Benchmark(Baseline = true)] public Vector4 PremultiplyByVal() { - Vector4 input = new Vector4(.5F); + Vector4 input = new(.5F); return Vector4Utils.Premultiply(input); } [Benchmark] public Vector4 PremultiplyByRef() { - Vector4 input = new Vector4(.5F); + Vector4 input = new(.5F); Vector4Utils.PremultiplyRef(ref input); return input; } @@ -27,7 +27,7 @@ public class Premultiply [Benchmark] public Vector4 PremultiplyRefWithPropertyAssign() { - Vector4 input = new Vector4(.5F); + Vector4 input = new(.5F); Vector4Utils.PremultiplyRefWithPropertyAssign(ref input); return input; } diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/ReinterpretUInt32AsFloat.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/ReinterpretUInt32AsFloat.cs index d7204d96d..557d8ff38 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/ReinterpretUInt32AsFloat.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/ReinterpretUInt32AsFloat.cs @@ -53,7 +53,7 @@ public class ReinterpretUInt32AsFloat { for (int i = 0; i < this.input.Length; i += Vector.Count) { - Vector a = new Vector(this.input, i); + Vector a = new(this.input, i); Vector b = Vector.AsVectorSingle(a); b.CopyTo(this.result, i); } diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/UInt32ToSingle.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/UInt32ToSingle.cs index 54e9622a3..4048bc210 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/UInt32ToSingle.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/UInt32ToSingle.cs @@ -27,10 +27,10 @@ public class UInt32ToSingle nuint n = Count / (uint)Vector.Count; - Vector bVec = new Vector(256.0f / 255.0f); - Vector magicFloat = new Vector(32768.0f); - Vector magicInt = new Vector(1191182336); // reinterpreted value of 32768.0f - Vector mask = new Vector(255); + Vector bVec = new(256.0f / 255.0f); + Vector magicFloat = new(32768.0f); + Vector magicInt = new(1191182336); // reinterpreted value of 32768.0f + Vector mask = new(255); for (nuint i = 0; i < n; i++) { @@ -55,7 +55,7 @@ public class UInt32ToSingle ref Vector bf = ref Unsafe.As>(ref this.data[0]); ref Vector bu = ref Unsafe.As, Vector>(ref bf); - Vector scale = new Vector(1f / 255f); + Vector scale = new(1f / 255f); for (nuint i = 0; i < n; i++) { @@ -74,7 +74,7 @@ public class UInt32ToSingle ref Vector bf = ref Unsafe.As>(ref this.data[0]); ref Vector bu = ref Unsafe.As, Vector>(ref bf); - Vector scale = new Vector(1f / 255f); + Vector scale = new(1f / 255f); for (nuint i = 0; i < n; i++) { @@ -91,7 +91,7 @@ public class UInt32ToSingle nuint n = Count / (uint)Vector.Count; ref Vector bf = ref Unsafe.As>(ref this.data[0]); - Vector scale = new Vector(1f / 255f); + Vector scale = new(1f / 255f); for (nuint i = 0; i < n; i++) { diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/VectorFetching.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/VectorFetching.cs index e8b6626cd..9c7fd5b6c 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/VectorFetching.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/VectorFetching.cs @@ -47,11 +47,11 @@ public class VectorFetching [Benchmark] public void FetchWithVectorConstructor() { - Vector v = new Vector(this.testValue); + Vector v = new(this.testValue); for (int i = 0; i < this.data.Length; i += Vector.Count) { - Vector a = new Vector(this.data, i); + Vector a = new(this.data, i); a = a * v; a.CopyTo(this.data, i); } @@ -60,7 +60,7 @@ public class VectorFetching [Benchmark] public void FetchWithUnsafeCast() { - Vector v = new Vector(this.testValue); + Vector v = new(this.testValue); ref Vector start = ref Unsafe.As>(ref this.data[0]); nuint n = (uint)this.InputSize / (uint)Vector.Count; @@ -79,7 +79,7 @@ public class VectorFetching [Benchmark] public void FetchWithUnsafeCastNoTempVector() { - Vector v = new Vector(this.testValue); + Vector v = new(this.testValue); ref Vector start = ref Unsafe.As>(ref this.data[0]); nuint n = (uint)this.InputSize / (uint)Vector.Count; @@ -94,9 +94,9 @@ public class VectorFetching [Benchmark] public void FetchWithUnsafeCastFromReference() { - Vector v = new Vector(this.testValue); + Vector v = new(this.testValue); - Span span = new Span(this.data); + Span span = new(this.data); ref Vector start = ref Unsafe.As>(ref MemoryMarshal.GetReference(span)); diff --git a/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressBenchmarks.cs b/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressBenchmarks.cs index 65ca779ca..5d137a615 100644 --- a/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressBenchmarks.cs +++ b/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressBenchmarks.cs @@ -18,7 +18,7 @@ public class LoadResizeSaveStressBenchmarks [GlobalSetup] public void Setup() { - this.runner = new() + this.runner = new LoadResizeSaveStressRunner { ImageCount = Environment.ProcessorCount, Filter = Filter diff --git a/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressRunner.cs b/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressRunner.cs index 1a2d0360e..75bc5289c 100644 --- a/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressRunner.cs +++ b/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressRunner.cs @@ -117,7 +117,7 @@ public class LoadResizeSaveStressRunner public void ForEachImageParallel(Action action) => Parallel.ForEach( this.Images, - new() { MaxDegreeOfParallelism = this.MaxDegreeOfParallelism }, + new ParallelOptions { MaxDegreeOfParallelism = this.MaxDegreeOfParallelism }, action); public Task ForEachImageParallelAsync(Func action) @@ -148,7 +148,7 @@ public class LoadResizeSaveStressRunner private void LogImageProcessed(int width, int height) { - this.LastProcessedImageSize = new(width, height); + this.LastProcessedImageSize = new ImageSharpSize(width, height); double pixels = width * (double)height; this.TotalProcessedMegapixels += pixels / 1_000_000.0; } @@ -322,7 +322,7 @@ public class LoadResizeSaveStressRunner (int width, int height) = this.ScaledSize(info.Width, info.Height, this.ThumbnailSize); SKSizeI supportedScale = codec.GetScaledDimensions((float)width / info.Width); - using SKBitmap original = SKBitmap.Decode(codec, new(supportedScale.Width, supportedScale.Height)); + using SKBitmap original = SKBitmap.Decode(codec, new SKImageInfo(supportedScale.Width, supportedScale.Height)); using SKBitmap resized = original.Resize(new SKImageInfo(width, height), SKFilterQuality.High); if (resized == null) { diff --git a/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs b/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs index 9f75f9dc2..a308c0c46 100644 --- a/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs +++ b/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs @@ -73,7 +73,7 @@ public class PorterDuffBulkVsPixel BulkVectorConvert(span, span, span, amounts.GetSpan()); } - return new(image.Width, image.Height); + return new Size(image.Width, image.Height); } [Benchmark(Description = "ImageSharp BulkPixelConvert")] @@ -89,6 +89,6 @@ public class PorterDuffBulkVsPixel BulkPixelConvert(span, span, span, amounts.GetSpan()); } - return new(image.Width, image.Height); + return new Size(image.Width, image.Height); } } diff --git a/tests/ImageSharp.Benchmarks/Processing/Crop.cs b/tests/ImageSharp.Benchmarks/Processing/Crop.cs index d526c6ba4..e14366bfd 100644 --- a/tests/ImageSharp.Benchmarks/Processing/Crop.cs +++ b/tests/ImageSharp.Benchmarks/Processing/Crop.cs @@ -24,7 +24,7 @@ public class Crop graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; graphics.CompositingQuality = CompositingQuality.HighQuality; - graphics.DrawImage(source, new(0, 0, 100, 100), 0, 0, 100, 100, GraphicsUnit.Pixel); + graphics.DrawImage(source, new SDRectangle(0, 0, 100, 100), 0, 0, 100, 100, GraphicsUnit.Pixel); return destination.Size; } @@ -34,6 +34,6 @@ public class Crop { using Image image = new(800, 800); image.Mutate(x => x.Crop(100, 100)); - return new(image.Width, image.Height); + return new Size(image.Width, image.Height); } } diff --git a/tests/ImageSharp.Benchmarks/Processing/HistogramEqualization.cs b/tests/ImageSharp.Benchmarks/Processing/HistogramEqualization.cs index 8be48260a..93ac9fc0e 100644 --- a/tests/ImageSharp.Benchmarks/Processing/HistogramEqualization.cs +++ b/tests/ImageSharp.Benchmarks/Processing/HistogramEqualization.cs @@ -33,7 +33,7 @@ public class HistogramEqualization [Benchmark(Description = "Global Histogram Equalization")] public void GlobalHistogramEqualization() => this.image.Mutate(img => img.HistogramEqualization( - new() + new HistogramEqualizationOptions { LuminanceLevels = 256, Method = HistogramEqualizationMethod.Global @@ -42,7 +42,7 @@ public class HistogramEqualization [Benchmark(Description = "AdaptiveHistogramEqualization (Tile interpolation)")] public void AdaptiveHistogramEqualization() => this.image.Mutate(img => img.HistogramEqualization( - new() + new HistogramEqualizationOptions { LuminanceLevels = 256, Method = HistogramEqualizationMethod.AdaptiveTileInterpolation diff --git a/tests/ImageSharp.Benchmarks/Processing/OilPaint.cs b/tests/ImageSharp.Benchmarks/Processing/OilPaint.cs index e3e413fe4..707748499 100644 --- a/tests/ImageSharp.Benchmarks/Processing/OilPaint.cs +++ b/tests/ImageSharp.Benchmarks/Processing/OilPaint.cs @@ -13,7 +13,7 @@ public class OilPaint [Benchmark] public void DoOilPaint() { - using Image image = new Image(1920, 1200, new(127, 191, 255)); + using Image image = new(1920, 1200, new RgbaVector(127, 191, 255)); image.Mutate(ctx => ctx.OilPaint()); } } diff --git a/tests/ImageSharp.Benchmarks/Processing/Resize.cs b/tests/ImageSharp.Benchmarks/Processing/Resize.cs index 949b14afa..356027221 100644 --- a/tests/ImageSharp.Benchmarks/Processing/Resize.cs +++ b/tests/ImageSharp.Benchmarks/Processing/Resize.cs @@ -218,9 +218,9 @@ public class Resize_Bicubic_Compare_Rgba32_Rgb24 [GlobalSetup] public void Setup() { - this.rgb24 = new(); + this.rgb24 = new Resize_Bicubic_Rgb24(); this.rgb24.Setup(); - this.rgba32 = new(); + this.rgba32 = new Resize_Bicubic_Rgba32(); this.rgba32.Setup(); } diff --git a/tests/ImageSharp.Tests.ProfilingSandbox/LoadResizeSaveParallelMemoryStress.cs b/tests/ImageSharp.Tests.ProfilingSandbox/LoadResizeSaveParallelMemoryStress.cs index 79128cfee..6850756df 100644 --- a/tests/ImageSharp.Tests.ProfilingSandbox/LoadResizeSaveParallelMemoryStress.cs +++ b/tests/ImageSharp.Tests.ProfilingSandbox/LoadResizeSaveParallelMemoryStress.cs @@ -17,7 +17,7 @@ internal class LoadResizeSaveParallelMemoryStress { private LoadResizeSaveParallelMemoryStress() { - this.Benchmarks = new() + this.Benchmarks = new LoadResizeSaveStressRunner { Filter = JpegKind.Baseline, }; @@ -295,7 +295,7 @@ internal class LoadResizeSaveParallelMemoryStress (int)B(this.MaxContiguousPoolBufferMegaBytes), B(this.MaxPoolSizeMegaBytes), (int)B(this.MaxCapacityOfNonPoolBuffersMegaBytes), - new() + new UniformUnmanagedMemoryPool.TrimSettings { TrimPeriodMilliseconds = this.TrimTimeSeconds.Value * 1000 }); diff --git a/tests/ImageSharp.Tests.ProfilingSandbox/Program.cs b/tests/ImageSharp.Tests.ProfilingSandbox/Program.cs index 43e17f5c9..3e4f77f9e 100644 --- a/tests/ImageSharp.Tests.ProfilingSandbox/Program.cs +++ b/tests/ImageSharp.Tests.ProfilingSandbox/Program.cs @@ -64,13 +64,13 @@ public class Program private static void RunResizeProfilingTest() { - ResizeProfilingBenchmarks test = new ResizeProfilingBenchmarks(new ConsoleOutput()); + ResizeProfilingBenchmarks test = new(new ConsoleOutput()); test.ResizeBicubic(4000, 4000); } private static void RunToVector4ProfilingTest() { - PixelOperationsTests.Rgba32_OperationsTests tests = new PixelOperationsTests.Rgba32_OperationsTests(new ConsoleOutput()); + PixelOperationsTests.Rgba32_OperationsTests tests = new(new ConsoleOutput()); tests.Benchmark_ToVector4(); } } diff --git a/tests/ImageSharp.Tests/Color/ColorTests.CastTo.cs b/tests/ImageSharp.Tests/Color/ColorTests.CastTo.cs index 6c3377d10..2e2f0d07d 100644 --- a/tests/ImageSharp.Tests/Color/ColorTests.CastTo.cs +++ b/tests/ImageSharp.Tests/Color/ColorTests.CastTo.cs @@ -108,10 +108,10 @@ public partial class ColorTests Color color = Color.FromScaledVector(Vector4.One); // Assert: - Assert.Equal(new(1, 1, 1, 1), color.ToPixel()); - Assert.Equal(new(65535, 65535, 65535, 65535), color.ToPixel()); - Assert.Equal(new(255, 255, 255, 255), color.ToPixel()); - Assert.Equal(new(255), color.ToPixel()); + Assert.Equal(new RgbaVector(1, 1, 1, 1), color.ToPixel()); + Assert.Equal(new Rgba64(65535, 65535, 65535, 65535), color.ToPixel()); + Assert.Equal(new Rgba32(255, 255, 255, 255), color.ToPixel()); + Assert.Equal(new L8(255), color.ToPixel()); } [Fact] diff --git a/tests/ImageSharp.Tests/Color/ColorTests.cs b/tests/ImageSharp.Tests/Color/ColorTests.cs index 8b636ee39..d430df5b4 100644 --- a/tests/ImageSharp.Tests/Color/ColorTests.cs +++ b/tests/ImageSharp.Tests/Color/ColorTests.cs @@ -108,29 +108,29 @@ public partial class ColorTests [Fact] public void ShortHex() { - Assert.Equal(new(255, 255, 255), Color.ParseHex("#fff").ToPixel()); - Assert.Equal(new(255, 255, 255), Color.ParseHex("fff").ToPixel()); - Assert.Equal(new(0, 0, 0, 255), Color.ParseHex("000f").ToPixel()); + Assert.Equal(new Rgb24(255, 255, 255), Color.ParseHex("#fff").ToPixel()); + Assert.Equal(new Rgb24(255, 255, 255), Color.ParseHex("fff").ToPixel()); + Assert.Equal(new Rgba32(0, 0, 0, 255), Color.ParseHex("000f").ToPixel()); } [Fact] public void TryShortHex() { Assert.True(Color.TryParseHex("#fff", out Color actual)); - Assert.Equal(new(255, 255, 255), actual.ToPixel()); + Assert.Equal(new Rgb24(255, 255, 255), actual.ToPixel()); Assert.True(Color.TryParseHex("fff", out actual)); - Assert.Equal(new(255, 255, 255), actual.ToPixel()); + Assert.Equal(new Rgb24(255, 255, 255), actual.ToPixel()); Assert.True(Color.TryParseHex("000f", out actual)); - Assert.Equal(new(0, 0, 0, 255), actual.ToPixel()); + Assert.Equal(new Rgba32(0, 0, 0, 255), actual.ToPixel()); } [Fact] public void LeadingPoundIsOptional() { - Assert.Equal(new(0, 128, 128), Color.ParseHex("#008080").ToPixel()); - Assert.Equal(new(0, 128, 128), Color.ParseHex("008080").ToPixel()); + Assert.Equal(new Rgb24(0, 128, 128), Color.ParseHex("#008080").ToPixel()); + Assert.Equal(new Rgb24(0, 128, 128), Color.ParseHex("008080").ToPixel()); } [Fact] diff --git a/tests/ImageSharp.Tests/Color/ReferencePalette.cs b/tests/ImageSharp.Tests/Color/ReferencePalette.cs index 8e2696109..2db2aae19 100644 --- a/tests/ImageSharp.Tests/Color/ReferencePalette.cs +++ b/tests/ImageSharp.Tests/Color/ReferencePalette.cs @@ -273,7 +273,7 @@ internal static class ReferencePalette }; public static readonly Dictionary ColorNames = - new Dictionary(StringComparer.OrdinalIgnoreCase) + new(StringComparer.OrdinalIgnoreCase) { { nameof(Color.AliceBlue), Color.AliceBlue }, { nameof(Color.AntiqueWhite), Color.AntiqueWhite }, diff --git a/tests/ImageSharp.Tests/Color/RgbaDouble.cs b/tests/ImageSharp.Tests/Color/RgbaDouble.cs index 9a751e879..76fdf365c 100644 --- a/tests/ImageSharp.Tests/Color/RgbaDouble.cs +++ b/tests/ImageSharp.Tests/Color/RgbaDouble.cs @@ -115,7 +115,7 @@ public struct RgbaDouble : IPixel public static RgbaDouble FromVector4(Vector4 source) { source = Numerics.Clamp(source, Vector4.Zero, Vector4.One); - return new(source.X, source.Y, source.Z, source.W); + return new RgbaDouble(source.X, source.Y, source.Z, source.W); } /// diff --git a/tests/ImageSharp.Tests/ColorProfiles/CieLabTests.cs b/tests/ImageSharp.Tests/ColorProfiles/CieLabTests.cs index 93e64aa9b..69fabc750 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/CieLabTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/CieLabTests.cs @@ -35,8 +35,8 @@ public class CieLabTests Assert.True(new CieLab(1, 0, 1) != default); Assert.False(new CieLab(1, 0, 1) == default); Assert.Equal(default, default(CieLab)); - Assert.Equal(new(1, 0, 1), new CieLab(1, 0, 1)); - Assert.Equal(new(Vector3.One), new CieLab(Vector3.One)); + Assert.Equal(new CieLab(1, 0, 1), new CieLab(1, 0, 1)); + Assert.Equal(new CieLab(Vector3.One), new CieLab(Vector3.One)); Assert.False(x.Equals(y)); Assert.False(new CieLab(1, 0, 1) == default); Assert.False(x.Equals((object)y)); diff --git a/tests/ImageSharp.Tests/ColorProfiles/CieLchTests.cs b/tests/ImageSharp.Tests/ColorProfiles/CieLchTests.cs index e2bf8655e..484db3e8c 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/CieLchTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/CieLchTests.cs @@ -33,8 +33,8 @@ public class CieLchTests Assert.True(default == default(CieLch)); Assert.False(default != default(CieLch)); Assert.Equal(default, default(CieLch)); - Assert.Equal(new(1, 0, 1), new CieLch(1, 0, 1)); - Assert.Equal(new(Vector3.One), new CieLch(Vector3.One)); + Assert.Equal(new CieLch(1, 0, 1), new CieLch(1, 0, 1)); + Assert.Equal(new CieLch(Vector3.One), new CieLch(Vector3.One)); Assert.False(x.Equals(y)); Assert.False(x.Equals((object)y)); Assert.False(x.GetHashCode().Equals(y.GetHashCode())); diff --git a/tests/ImageSharp.Tests/ColorProfiles/CieLchuvTests.cs b/tests/ImageSharp.Tests/ColorProfiles/CieLchuvTests.cs index cc8f9789a..3fe550a5b 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/CieLchuvTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/CieLchuvTests.cs @@ -34,8 +34,8 @@ public class CieLchuvTests Assert.True(default == default(CieLchuv)); Assert.False(default != default(CieLchuv)); Assert.Equal(default, default(CieLchuv)); - Assert.Equal(new(1, 0, 1), new CieLchuv(1, 0, 1)); - Assert.Equal(new(Vector3.One), new CieLchuv(Vector3.One)); + Assert.Equal(new CieLchuv(1, 0, 1), new CieLchuv(1, 0, 1)); + Assert.Equal(new CieLchuv(Vector3.One), new CieLchuv(Vector3.One)); Assert.False(x.Equals(y)); Assert.False(x.Equals((object)y)); Assert.False(x.GetHashCode().Equals(y.GetHashCode())); diff --git a/tests/ImageSharp.Tests/ColorProfiles/CieLuvTests.cs b/tests/ImageSharp.Tests/ColorProfiles/CieLuvTests.cs index 7d715349f..173491081 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/CieLuvTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/CieLuvTests.cs @@ -34,8 +34,8 @@ public class CieLuvTests Assert.True(default == default(CieLuv)); Assert.False(default != default(CieLuv)); Assert.Equal(default, default(CieLuv)); - Assert.Equal(new(1, 0, 1), new CieLuv(1, 0, 1)); - Assert.Equal(new(Vector3.One), new CieLuv(Vector3.One)); + Assert.Equal(new CieLuv(1, 0, 1), new CieLuv(1, 0, 1)); + Assert.Equal(new CieLuv(Vector3.One), new CieLuv(Vector3.One)); Assert.False(x.Equals(y)); Assert.False(x.Equals((object)y)); Assert.False(x.GetHashCode().Equals(y.GetHashCode())); diff --git a/tests/ImageSharp.Tests/ColorProfiles/CieXyChromaticityCoordinatesTests.cs b/tests/ImageSharp.Tests/ColorProfiles/CieXyChromaticityCoordinatesTests.cs index 5875b78c1..8bc71f1e1 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/CieXyChromaticityCoordinatesTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/CieXyChromaticityCoordinatesTests.cs @@ -32,8 +32,8 @@ public class CieXyChromaticityCoordinatesTests Assert.True(new CieXyChromaticityCoordinates(1, 0) != default); Assert.False(new CieXyChromaticityCoordinates(1, 0) == default); Assert.Equal(default, default(CieXyChromaticityCoordinates)); - Assert.Equal(new(1, 0), new CieXyChromaticityCoordinates(1, 0)); - Assert.Equal(new(1, 1), new CieXyChromaticityCoordinates(1, 1)); + Assert.Equal(new CieXyChromaticityCoordinates(1, 0), new CieXyChromaticityCoordinates(1, 0)); + Assert.Equal(new CieXyChromaticityCoordinates(1, 1), new CieXyChromaticityCoordinates(1, 1)); Assert.False(x.Equals(y)); Assert.False(new CieXyChromaticityCoordinates(1, 0) == default); Assert.False(x.Equals((object)y)); diff --git a/tests/ImageSharp.Tests/ColorProfiles/CieXyyTests.cs b/tests/ImageSharp.Tests/ColorProfiles/CieXyyTests.cs index 6290546a8..80904c5df 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/CieXyyTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/CieXyyTests.cs @@ -34,8 +34,8 @@ public class CieXyyTests Assert.True(default == default(CieXyy)); Assert.False(default != default(CieXyy)); Assert.Equal(default, default(CieXyy)); - Assert.Equal(new(1, 0, 1), new CieXyy(1, 0, 1)); - Assert.Equal(new(Vector3.One), new CieXyy(Vector3.One)); + Assert.Equal(new CieXyy(1, 0, 1), new CieXyy(1, 0, 1)); + Assert.Equal(new CieXyy(Vector3.One), new CieXyy(Vector3.One)); Assert.False(x.Equals(y)); Assert.False(x.Equals((object)y)); Assert.False(x.GetHashCode().Equals(y.GetHashCode())); diff --git a/tests/ImageSharp.Tests/ColorProfiles/CieXyzTests.cs b/tests/ImageSharp.Tests/ColorProfiles/CieXyzTests.cs index e7e4261c6..683b3b661 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/CieXyzTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/CieXyzTests.cs @@ -34,8 +34,8 @@ public class CieXyzTests Assert.True(default == default(CieXyz)); Assert.False(default != default(CieXyz)); Assert.Equal(default, default(CieXyz)); - Assert.Equal(new(1, 0, 1), new CieXyz(1, 0, 1)); - Assert.Equal(new(Vector3.One), new CieXyz(Vector3.One)); + Assert.Equal(new CieXyz(1, 0, 1), new CieXyz(1, 0, 1)); + Assert.Equal(new CieXyz(Vector3.One), new CieXyz(Vector3.One)); Assert.False(x.Equals(y)); Assert.False(x.Equals((object)y)); Assert.False(x.GetHashCode().Equals(y.GetHashCode())); diff --git a/tests/ImageSharp.Tests/ColorProfiles/CmykTests.cs b/tests/ImageSharp.Tests/ColorProfiles/CmykTests.cs index a732c68c5..22b7a7f70 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/CmykTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/CmykTests.cs @@ -36,8 +36,8 @@ public class CmykTests Assert.True(default == default(Cmyk)); Assert.False(default != default(Cmyk)); Assert.Equal(default, default(Cmyk)); - Assert.Equal(new(1, 0, 1, 0), new Cmyk(1, 0, 1, 0)); - Assert.Equal(new(Vector4.One), new Cmyk(Vector4.One)); + Assert.Equal(new Cmyk(1, 0, 1, 0), new Cmyk(1, 0, 1, 0)); + Assert.Equal(new Cmyk(Vector4.One), new Cmyk(Vector4.One)); Assert.False(x.Equals(y)); Assert.False(x.Equals((object)y)); Assert.False(x.GetHashCode().Equals(y.GetHashCode())); diff --git a/tests/ImageSharp.Tests/ColorProfiles/CompandingTests.cs b/tests/ImageSharp.Tests/ColorProfiles/CompandingTests.cs index 24b221155..1bdefa109 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/CompandingTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/CompandingTests.cs @@ -102,7 +102,7 @@ public class CompandingTests private static void CompandingIsCorrectImpl(Vector4 e, Vector4 c, float expanded, Vector4 compressed) { // W (alpha) is already the linear representation of the color. - Assert.Equal(new(expanded, expanded, expanded, e.W), e, Comparer); + Assert.Equal(new Vector4(expanded, expanded, expanded, e.W), e, Comparer); Assert.Equal(compressed, c, Comparer); } } diff --git a/tests/ImageSharp.Tests/ColorProfiles/HslTests.cs b/tests/ImageSharp.Tests/ColorProfiles/HslTests.cs index 6d9af0eee..6697cbfde 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/HslTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/HslTests.cs @@ -34,8 +34,8 @@ public class HslTests Assert.True(default == default(Hsl)); Assert.False(default != default(Hsl)); Assert.Equal(default, default(Hsl)); - Assert.Equal(new(1, 0, 1), new Hsl(1, 0, 1)); - Assert.Equal(new(Vector3.One), new Hsl(Vector3.One)); + Assert.Equal(new Hsl(1, 0, 1), new Hsl(1, 0, 1)); + Assert.Equal(new Hsl(Vector3.One), new Hsl(Vector3.One)); Assert.False(x.Equals(y)); Assert.False(x.Equals((object)y)); Assert.False(x.GetHashCode().Equals(y.GetHashCode())); diff --git a/tests/ImageSharp.Tests/ColorProfiles/HsvTests.cs b/tests/ImageSharp.Tests/ColorProfiles/HsvTests.cs index 36a8d599b..dd71fcd3f 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/HsvTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/HsvTests.cs @@ -34,8 +34,8 @@ public class HsvTests Assert.True(default == default(Hsv)); Assert.False(default != default(Hsv)); Assert.Equal(default, default(Hsv)); - Assert.Equal(new(1, 0, 1), new Hsv(1, 0, 1)); - Assert.Equal(new(Vector3.One), new Hsv(Vector3.One)); + Assert.Equal(new Hsv(1, 0, 1), new Hsv(1, 0, 1)); + Assert.Equal(new Hsv(Vector3.One), new Hsv(Vector3.One)); Assert.False(x.Equals(y)); Assert.False(x.Equals((object)y)); Assert.False(x.GetHashCode().Equals(y.GetHashCode())); diff --git a/tests/ImageSharp.Tests/ColorProfiles/HunterLabTests.cs b/tests/ImageSharp.Tests/ColorProfiles/HunterLabTests.cs index f136aa288..af06b3c91 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/HunterLabTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/HunterLabTests.cs @@ -35,8 +35,8 @@ public class HunterLabTests Assert.True(new HunterLab(1, 0, 1) != default); Assert.False(new HunterLab(1, 0, 1) == default); Assert.Equal(default, default(HunterLab)); - Assert.Equal(new(1, 0, 1), new HunterLab(1, 0, 1)); - Assert.Equal(new(Vector3.One), new HunterLab(Vector3.One)); + Assert.Equal(new HunterLab(1, 0, 1), new HunterLab(1, 0, 1)); + Assert.Equal(new HunterLab(Vector3.One), new HunterLab(Vector3.One)); Assert.False(x.Equals(y)); Assert.False(x.Equals((object)y)); Assert.False(x.GetHashCode().Equals(y.GetHashCode())); diff --git a/tests/ImageSharp.Tests/ColorProfiles/Icc/ColorProfileConverterTests.Icc.cs b/tests/ImageSharp.Tests/ColorProfiles/Icc/ColorProfileConverterTests.Icc.cs index cd6fe33cc..6c56dc682 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/Icc/ColorProfileConverterTests.Icc.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/Icc/ColorProfileConverterTests.Icc.cs @@ -152,7 +152,7 @@ public class ColorProfileConverterTests(ITestOutputHelper testOutputHelper) private static Vector4 GetActualTargetValues(float[] input, string sourceProfile, string targetProfile) { - ColorProfileConverter converter = new(new() + ColorProfileConverter converter = new(new ColorConversionOptions { SourceIccProfile = TestIccProfiles.GetProfile(sourceProfile), TargetIccProfile = TestIccProfiles.GetProfile(targetProfile) @@ -163,20 +163,20 @@ public class ColorProfileConverterTests(ITestOutputHelper testOutputHelper) return sourceDataSpace switch { IccColorSpaceType.Cmyk when targetDataSpace == IccColorSpaceType.Cmyk - => converter.Convert(new(new(input))).ToScaledVector4(), + => converter.Convert(new Cmyk(new Vector4(input))).ToScaledVector4(), IccColorSpaceType.Cmyk when targetDataSpace == IccColorSpaceType.Rgb - => converter.Convert(new(new(input))).ToScaledVector4(), + => converter.Convert(new Cmyk(new Vector4(input))).ToScaledVector4(), IccColorSpaceType.Rgb when targetDataSpace == IccColorSpaceType.Cmyk - => converter.Convert(new(new(input))).ToScaledVector4(), + => converter.Convert(new Rgb(new Vector3(input))).ToScaledVector4(), IccColorSpaceType.Rgb when targetDataSpace == IccColorSpaceType.Rgb - => converter.Convert(new(new(input))).ToScaledVector4(), + => converter.Convert(new Rgb(new Vector3(input))).ToScaledVector4(), _ => throw new NotSupportedException($"Unsupported ICC profile data color space conversion: {sourceDataSpace} -> {targetDataSpace}") }; } private static List GetBulkActualTargetValues(List inputs, string sourceProfile, string targetProfile) { - ColorProfileConverter converter = new(new() + ColorProfileConverter converter = new(new ColorConversionOptions { SourceIccProfile = TestIccProfiles.GetProfile(sourceProfile), TargetIccProfile = TestIccProfiles.GetProfile(targetProfile) @@ -189,7 +189,7 @@ public class ColorProfileConverterTests(ITestOutputHelper testOutputHelper) { case IccColorSpaceType.Cmyk: { - Span inputSpan = inputs.Select(x => new Cmyk(new(x))).ToArray(); + Span inputSpan = inputs.Select(x => new Cmyk(new Vector4(x))).ToArray(); switch (targetDataSpace) { @@ -214,7 +214,7 @@ public class ColorProfileConverterTests(ITestOutputHelper testOutputHelper) case IccColorSpaceType.Rgb: { - Span inputSpan = inputs.Select(x => new Rgb(new(x))).ToArray(); + Span inputSpan = inputs.Select(x => new Rgb(new Vector3(x))).ToArray(); switch (targetDataSpace) { diff --git a/tests/ImageSharp.Tests/ColorProfiles/Icc/TestIccProfiles.cs b/tests/ImageSharp.Tests/ColorProfiles/Icc/TestIccProfiles.cs index c5f950784..eec27fcd7 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/Icc/TestIccProfiles.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/Icc/TestIccProfiles.cs @@ -3,6 +3,7 @@ using System.Collections.Concurrent; using SixLabors.ImageSharp.Metadata.Profiles.Icc; +using Wacton.Unicolour; using Wacton.Unicolour.Icc; namespace SixLabors.ImageSharp.Tests.ColorProfiles.Icc; @@ -58,12 +59,12 @@ internal static class TestIccProfiles public const string StandardRgbV2 = "sRGB2014.icc"; public static IccProfile GetProfile(string file) - => ProfileCache.GetOrAdd(file, f => new(File.ReadAllBytes(GetFullPath(f)))); + => ProfileCache.GetOrAdd(file, f => new IccProfile(File.ReadAllBytes(GetFullPath(f)))); public static Wacton.Unicolour.Configuration GetUnicolourConfiguration(string file) => UnicolourConfigurationCache.GetOrAdd( file, - f => new(iccConfig: new(GetFullPath(f), Intent.Unspecified, f))); + f => new Wacton.Unicolour.Configuration(iccConfig: new IccConfiguration(GetFullPath(f), Intent.Unspecified, f))); public static bool HasUnicolourConfiguration(string file) => UnicolourConfigurationCache.ContainsKey(file); diff --git a/tests/ImageSharp.Tests/ColorProfiles/LmsTests.cs b/tests/ImageSharp.Tests/ColorProfiles/LmsTests.cs index c409bfd69..395b547fd 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/LmsTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/LmsTests.cs @@ -35,8 +35,8 @@ public class LmsTests Assert.True(new Lms(1, 0, 1) != default); Assert.False(new Lms(1, 0, 1) == default); Assert.Equal(default, default(Lms)); - Assert.Equal(new(1, 0, 1), new Lms(1, 0, 1)); - Assert.Equal(new(Vector3.One), new Lms(Vector3.One)); + Assert.Equal(new Lms(1, 0, 1), new Lms(1, 0, 1)); + Assert.Equal(new Lms(Vector3.One), new Lms(Vector3.One)); Assert.False(x.Equals(y)); Assert.False(x.Equals((object)y)); Assert.False(x.GetHashCode().Equals(y.GetHashCode())); diff --git a/tests/ImageSharp.Tests/ColorProfiles/RgbTests.cs b/tests/ImageSharp.Tests/ColorProfiles/RgbTests.cs index 5ee4dac11..707b3e2a7 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/RgbTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/RgbTests.cs @@ -35,8 +35,8 @@ public class RgbTests Assert.True(default == default(Rgb)); Assert.False(default != default(Rgb)); Assert.Equal(default, default(Rgb)); - Assert.Equal(new(1, 0, 1), new Rgb(1, 0, 1)); - Assert.Equal(new(Vector3.One), new Rgb(Vector3.One)); + Assert.Equal(new Rgb(1, 0, 1), new Rgb(1, 0, 1)); + Assert.Equal(new Rgb(Vector3.One), new Rgb(Vector3.One)); Assert.False(x.Equals(y)); Assert.False(x.Equals((object)y)); Assert.False(x.GetHashCode().Equals(y.GetHashCode())); diff --git a/tests/ImageSharp.Tests/ColorProfiles/StringRepresentationTests.cs b/tests/ImageSharp.Tests/ColorProfiles/StringRepresentationTests.cs index 1a52d8a7f..f61124d8f 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/StringRepresentationTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/StringRepresentationTests.cs @@ -50,7 +50,7 @@ public class StringRepresentationTests { new HunterLab(Random), "HunterLab(42.4, 94.5, 83.4)" }, { new Lms(Random), "Lms(42.4, 94.5, 83.4)" }, { new Rgb(Random), "Rgb(42.4, 94.5, 83.4)" }, - { Rgb.Clamp(new(Random)), "Rgb(1, 1, 1)" }, + { Rgb.Clamp(new Rgb(Random)), "Rgb(1, 1, 1)" }, { new Hsl(Random), "Hsl(42.4, 1, 1)" }, // clamping to 1 is expected { new Hsv(Random), "Hsv(42.4, 1, 1)" }, // clamping to 1 is expected { new Y(Random.X), "Y(1)" }, diff --git a/tests/ImageSharp.Tests/ColorProfiles/YCbCrTests.cs b/tests/ImageSharp.Tests/ColorProfiles/YCbCrTests.cs index 7bd7c5167..64558a3f8 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/YCbCrTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/YCbCrTests.cs @@ -34,8 +34,8 @@ public class YCbCrTests Assert.True(default == default(YCbCr)); Assert.False(default != default(YCbCr)); Assert.Equal(default, default(YCbCr)); - Assert.Equal(new(1, 0, 1), new YCbCr(1, 0, 1)); - Assert.Equal(new(Vector3.One), new YCbCr(Vector3.One)); + Assert.Equal(new YCbCr(1, 0, 1), new YCbCr(1, 0, 1)); + Assert.Equal(new YCbCr(Vector3.One), new YCbCr(Vector3.One)); Assert.False(x.Equals(y)); Assert.False(x.Equals((object)y)); Assert.False(x.GetHashCode().Equals(y.GetHashCode())); diff --git a/tests/ImageSharp.Tests/ColorProfiles/YTests.cs b/tests/ImageSharp.Tests/ColorProfiles/YTests.cs index e92448418..7e5e48b69 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/YTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/YTests.cs @@ -28,9 +28,9 @@ public class YTests Assert.True(default == default(Y)); Assert.False(default != default(Y)); Assert.Equal(default, default(Y)); - Assert.Equal(new(1), new Y(1)); + Assert.Equal(new Y(1), new Y(1)); - Assert.Equal(new(.5F), new Y(.5F)); + Assert.Equal(new Y(.5F), new Y(.5F)); Assert.False(x.Equals(y)); Assert.False(x.Equals((object)y)); Assert.False(x.GetHashCode().Equals(y.GetHashCode())); diff --git a/tests/ImageSharp.Tests/ColorProfiles/YccKTests.cs b/tests/ImageSharp.Tests/ColorProfiles/YccKTests.cs index ada125f59..bfe0bdb17 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/YccKTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/YccKTests.cs @@ -34,8 +34,8 @@ public class YccKTests Assert.True(default == default(YccK)); Assert.False(default != default(YccK)); Assert.Equal(default, default(YccK)); - Assert.Equal(new(1, 1, 1, 1), new YccK(1, 1, 1, 1)); - Assert.Equal(new(.5F, .5F, .5F, .5F), new YccK(.5F, .5F, .5F, .5F)); + Assert.Equal(new YccK(1, 1, 1, 1), new YccK(1, 1, 1, 1)); + Assert.Equal(new YccK(.5F, .5F, .5F, .5F), new YccK(.5F, .5F, .5F, .5F)); Assert.False(x.Equals(y)); Assert.False(x.Equals((object)y)); diff --git a/tests/ImageSharp.Tests/Common/EncoderExtensionsTests.cs b/tests/ImageSharp.Tests/Common/EncoderExtensionsTests.cs index db2da6a69..8421c1fd7 100644 --- a/tests/ImageSharp.Tests/Common/EncoderExtensionsTests.cs +++ b/tests/ImageSharp.Tests/Common/EncoderExtensionsTests.cs @@ -20,7 +20,7 @@ public class EncoderExtensionsTests [Fact] public void GetString_Buffer_ReturnsString() { - ReadOnlySpan buffer = new ReadOnlySpan(new byte[] { 73, 109, 97, 103, 101, 83, 104, 97, 114, 112 }); + ReadOnlySpan buffer = new(new byte[] { 73, 109, 97, 103, 101, 83, 104, 97, 114, 112 }); string result = Encoding.UTF8.GetString(buffer); diff --git a/tests/ImageSharp.Tests/Common/NumericsTests.cs b/tests/ImageSharp.Tests/Common/NumericsTests.cs index 69f8f9c2c..ebee57060 100644 --- a/tests/ImageSharp.Tests/Common/NumericsTests.cs +++ b/tests/ImageSharp.Tests/Common/NumericsTests.cs @@ -28,7 +28,7 @@ public class NumericsTests [InlineData(1, 100)] public void DivideCeil_RandomValues(int seed, int count) { - Random rng = new Random(seed); + Random rng = new(seed); for (int i = 0; i < count; i++) { uint value = (uint)rng.Next(); diff --git a/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs b/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs index e4d9a04b4..36b301264 100644 --- a/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs +++ b/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs @@ -51,7 +51,7 @@ public partial class SimdUtilsTests data[i] = data[i - 4] + 100f; } - return new(data); + return new Vector(data); } private static Vector CreateRandomTestVector(int seed, float min, float max) @@ -66,7 +66,7 @@ public partial class SimdUtilsTests data[i] = v; } - return new(data); + return new Vector(data); } [Fact] @@ -287,7 +287,7 @@ public partial class SimdUtilsTests TPixel[] expected = new TPixel[count]; for (int i = 0; i < count; i++) { - expected[i] = TPixel.FromRgb24(new(r[i], g[i], b[i])); + expected[i] = TPixel.FromRgb24(new Rgb24(r[i], g[i], b[i])); } TPixel[] actual = new TPixel[count + 3]; // padding for Rgb24 AVX2 diff --git a/tests/ImageSharp.Tests/Common/StreamExtensionsTests.cs b/tests/ImageSharp.Tests/Common/StreamExtensionsTests.cs index 3df5e8f30..5ea7afaf8 100644 --- a/tests/ImageSharp.Tests/Common/StreamExtensionsTests.cs +++ b/tests/ImageSharp.Tests/Common/StreamExtensionsTests.cs @@ -10,7 +10,7 @@ public class StreamExtensionsTests [InlineData(-1)] public void Skip_CountZeroOrLower_PositionNotChanged(int count) { - using (MemoryStream memStream = new MemoryStream(5)) + using (MemoryStream memStream = new(5)) { memStream.Position = 4; memStream.Skip(count); @@ -22,7 +22,7 @@ public class StreamExtensionsTests [Fact] public void Skip_SeekableStream_SeekIsCalled() { - using (SeekableStream seekableStream = new SeekableStream(4)) + using (SeekableStream seekableStream = new(4)) { seekableStream.Skip(4); @@ -34,7 +34,7 @@ public class StreamExtensionsTests [Fact] public void Skip_NonSeekableStream_BytesAreRead() { - using (NonSeekableStream nonSeekableStream = new NonSeekableStream()) + using (NonSeekableStream nonSeekableStream = new()) { nonSeekableStream.Skip(5); @@ -49,7 +49,7 @@ public class StreamExtensionsTests [Fact] public void Skip_EofStream_NoExceptionIsThrown() { - using (EofStream eofStream = new EofStream(7)) + using (EofStream eofStream = new(7)) { eofStream.Skip(7); @@ -79,7 +79,7 @@ public class StreamExtensionsTests { public override bool CanSeek => false; - public List Counts = new List(); + public List Counts = new(); public NonSeekableStream() : base(4) diff --git a/tests/ImageSharp.Tests/ConfigurationTests.cs b/tests/ImageSharp.Tests/ConfigurationTests.cs index b90579a02..3c6c759f8 100644 --- a/tests/ImageSharp.Tests/ConfigurationTests.cs +++ b/tests/ImageSharp.Tests/ConfigurationTests.cs @@ -27,7 +27,7 @@ public class ConfigurationTests // The shallow copy of configuration should behave exactly like the default configuration, // so by using the copy, we test both the default and the copy. this.DefaultConfiguration = Configuration.CreateDefaultInstance().Clone(); - this.ConfigurationEmpty = new(); + this.ConfigurationEmpty = new Configuration(); } [Fact] diff --git a/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs b/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs index 2e2c30784..1d0fdf62d 100644 --- a/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs +++ b/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs @@ -77,11 +77,11 @@ public class DrawImageTests PngEncoder encoder; if (provider.PixelType == PixelTypes.Rgba64) { - encoder = new() { BitDepth = PngBitDepth.Bit16 }; + encoder = new PngEncoder { BitDepth = PngBitDepth.Bit16 }; } else { - encoder = new(); + encoder = new PngEncoder(); } image.DebugSave(provider, testInfo, encoder: encoder); @@ -195,9 +195,9 @@ public class DrawImageTests where TPixel : unmanaged, IPixel { using Image foreground = provider.GetImage(); - using Image background = new(100, 100, new(0, 255, 255)); + using Image background = new(100, 100, new Rgba32(0, 255, 255)); - background.Mutate(c => c.DrawImage(foreground, new(64, 10), new Rectangle(32, 32, 32, 32), 1F)); + background.Mutate(c => c.DrawImage(foreground, new Point(64, 10), new Rectangle(32, 32, 32, 32), 1F)); background.DebugSave( provider, @@ -216,9 +216,9 @@ public class DrawImageTests where TPixel : unmanaged, IPixel { using Image foreground = provider.GetImage(); - using Image background = new(100, 100, new(0, 255, 255)); + using Image background = new(100, 100, new Rgba32(0, 255, 255)); - background.Mutate(c => c.DrawImage(foreground, new(10, 10), new Rectangle(320, 128, 32, 32), 1F)); + background.Mutate(c => c.DrawImage(foreground, new Point(10, 10), new Rectangle(320, 128, 32, 32), 1F)); background.DebugSave( provider, @@ -237,9 +237,9 @@ public class DrawImageTests where TPixel : unmanaged, IPixel { using Image foreground = provider.GetImage(); - using Image background = new(100, 100, new(0, 255, 255)); + using Image background = new(100, 100, new Rgba32(0, 255, 255)); - background.Mutate(c => c.DrawImage(foreground, new(10, 10), new Rectangle(32, 32, 32, 32), 1F)); + background.Mutate(c => c.DrawImage(foreground, new Point(10, 10), new Rectangle(32, 32, 32, 32), 1F)); background.DebugSave( provider, @@ -258,9 +258,9 @@ public class DrawImageTests where TPixel : unmanaged, IPixel { using Image foreground = provider.GetImage(); - using Image background = new(100, 100, new(0, 255, 255)); + using Image background = new(100, 100, new Rgba32(0, 255, 255)); - background.Mutate(c => c.DrawImage(foreground, new(-10, -10), new Rectangle(32, 32, 32, 32), 1F)); + background.Mutate(c => c.DrawImage(foreground, new Point(-10, -10), new Rectangle(32, 32, 32, 32), 1F)); background.DebugSave( provider, @@ -279,9 +279,9 @@ public class DrawImageTests where TPixel : unmanaged, IPixel { using Image foreground = provider.GetImage(); - using Image background = new(100, 100, new(0, 255, 255)); + using Image background = new(100, 100, new Rgba32(0, 255, 255)); - background.Mutate(c => c.DrawImage(foreground, new(80, 80), new Rectangle(32, 32, 32, 32), 1F)); + background.Mutate(c => c.DrawImage(foreground, new Point(80, 80), new Rectangle(32, 32, 32, 32), 1F)); background.DebugSave( provider, diff --git a/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs index 09ef49a61..5ebcc8bb9 100644 --- a/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs @@ -332,7 +332,7 @@ public class BmpEncoderTests public void Encode_PreservesColorProfile(TestImageProvider provider) where TPixel : unmanaged, IPixel { - using Image input = provider.GetImage(BmpDecoder.Instance, new()); + using Image input = provider.GetImage(BmpDecoder.Instance, new BmpDecoderOptions()); ImageSharp.Metadata.Profiles.Icc.IccProfile expectedProfile = input.Metadata.IccProfile; byte[] expectedProfileBytes = expectedProfile.ToByteArray(); diff --git a/tests/ImageSharp.Tests/Formats/Bmp/BmpFileHeaderTests.cs b/tests/ImageSharp.Tests/Formats/Bmp/BmpFileHeaderTests.cs index 8b4857645..00a19466a 100644 --- a/tests/ImageSharp.Tests/Formats/Bmp/BmpFileHeaderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Bmp/BmpFileHeaderTests.cs @@ -11,7 +11,7 @@ public class BmpFileHeaderTests [Fact] public void TestWrite() { - BmpFileHeader header = new BmpFileHeader(1, 2, 3, 4); + BmpFileHeader header = new(1, 2, 3, 4); byte[] buffer = new byte[14]; diff --git a/tests/ImageSharp.Tests/Formats/Bmp/ImageExtensionsTest.cs b/tests/ImageSharp.Tests/Formats/Bmp/ImageExtensionsTest.cs index 988e8935a..14b017bee 100644 --- a/tests/ImageSharp.Tests/Formats/Bmp/ImageExtensionsTest.cs +++ b/tests/ImageSharp.Tests/Formats/Bmp/ImageExtensionsTest.cs @@ -47,7 +47,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsBmp(file, new()); + image.SaveAsBmp(file, new BmpEncoder()); } IImageFormat format = Image.DetectFormat(file); @@ -108,7 +108,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsBmp(memoryStream, new()); + image.SaveAsBmp(memoryStream, new BmpEncoder()); } memoryStream.Position = 0; diff --git a/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs index 9bf5a13c4..48253bee7 100644 --- a/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs @@ -90,7 +90,7 @@ public class GifDecoderTests { DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 }, + TargetSize = new Size { Width = 150, Height = 150 }, MaxFrames = 1 }; @@ -257,7 +257,7 @@ public class GifDecoderTests public void Issue405_BadApplicationExtensionBlockLength(TestImageProvider provider) where TPixel : unmanaged, IPixel { - using Image image = provider.GetImage(GifDecoder.Instance, new() { MaxFrames = 1 }); + using Image image = provider.GetImage(GifDecoder.Instance, new DecoderOptions { MaxFrames = 1 }); image.DebugSave(provider); image.CompareFirstFrameToReferenceOutput(ImageComparer.Exact, provider); @@ -269,7 +269,7 @@ public class GifDecoderTests public void Issue1668_InvalidColorIndex(TestImageProvider provider) where TPixel : unmanaged, IPixel { - using Image image = provider.GetImage(GifDecoder.Instance, new() { MaxFrames = 1 }); + using Image image = provider.GetImage(GifDecoder.Instance, new DecoderOptions { MaxFrames = 1 }); image.DebugSave(provider); image.CompareFirstFrameToReferenceOutput(ImageComparer.Exact, provider); @@ -318,7 +318,7 @@ public class GifDecoderTests public void Issue1962(TestImageProvider provider) where TPixel : unmanaged, IPixel { - using Image image = provider.GetImage(GifDecoder.Instance, new() { MaxFrames = 1 }); + using Image image = provider.GetImage(GifDecoder.Instance, new DecoderOptions { MaxFrames = 1 }); image.DebugSave(provider); image.CompareFirstFrameToReferenceOutput(ImageComparer.Exact, provider); @@ -330,7 +330,7 @@ public class GifDecoderTests public void Issue2012EmptyXmp(TestImageProvider provider) where TPixel : unmanaged, IPixel { - using Image image = provider.GetImage(GifDecoder.Instance, new() { MaxFrames = 1 }); + using Image image = provider.GetImage(GifDecoder.Instance, new DecoderOptions { MaxFrames = 1 }); image.DebugSave(provider); image.CompareFirstFrameToReferenceOutput(ImageComparer.Exact, provider); diff --git a/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs index 740cb9ac7..370106ca3 100644 --- a/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs @@ -56,7 +56,7 @@ public class GifEncoderTests { // Use the palette quantizer without dithering to ensure results // are consistent - Quantizer = new WebSafePaletteQuantizer(new() { Dither = null, TransparencyThreshold = 0 }) + Quantizer = new WebSafePaletteQuantizer(new QuantizerOptions { Dither = null, TransparencyThreshold = 0 }) }; // Always save as we need to compare the encoded output. @@ -115,16 +115,16 @@ public class GifEncoderTests GifEncoder encoder = new() { ColorTableMode = FrameColorTableMode.Global, - Quantizer = new OctreeQuantizer(new() { Dither = null }) + Quantizer = new OctreeQuantizer(new QuantizerOptions { Dither = null }) }; // Always save as we need to compare the encoded output. provider.Utility.SaveTestOutputFile(image, "gif", encoder, "global"); - encoder = new() + encoder = new GifEncoder { ColorTableMode = FrameColorTableMode.Local, - Quantizer = new OctreeQuantizer(new() { Dither = null }), + Quantizer = new OctreeQuantizer(new QuantizerOptions { Dither = null }), }; provider.Utility.SaveTestOutputFile(image, "gif", encoder, "local"); @@ -191,7 +191,7 @@ public class GifEncoderTests GifEncoder encoder = new() { ColorTableMode = colorMode, - Quantizer = new OctreeQuantizer(new() { MaxColors = maxColors }) + Quantizer = new OctreeQuantizer(new QuantizerOptions { MaxColors = maxColors }) }; image.Save(outStream, encoder); diff --git a/tests/ImageSharp.Tests/Formats/Gif/GifMetadataTests.cs b/tests/ImageSharp.Tests/Formats/Gif/GifMetadataTests.cs index 625b043d4..dd3879703 100644 --- a/tests/ImageSharp.Tests/Formats/Gif/GifMetadataTests.cs +++ b/tests/ImageSharp.Tests/Formats/Gif/GifMetadataTests.cs @@ -86,7 +86,7 @@ public class GifMetadataTests using Image image = testFile.CreateRgba32Image(GifDecoder.Instance); GifMetadata metadata = image.Metadata.GetGifMetadata(); Assert.Equal(2, metadata.Comments.Count); - Assert.Equal(new('c', 349), metadata.Comments[0]); + Assert.Equal(new string('c', 349), metadata.Comments[0]); Assert.Equal("ImageSharp", metadata.Comments[1]); } @@ -104,7 +104,7 @@ public class GifMetadataTests using Image image = decoder.Decode(DecoderOptions.Default, memoryStream); GifMetadata metadata = image.Metadata.GetGifMetadata(); Assert.Equal(2, metadata.Comments.Count); - Assert.Equal(new('c', 349), metadata.Comments[0]); + Assert.Equal(new string('c', 349), metadata.Comments[0]); Assert.Equal("ImageSharp", metadata.Comments[1]); } diff --git a/tests/ImageSharp.Tests/Formats/Gif/ImageExtensionsTest.cs b/tests/ImageSharp.Tests/Formats/Gif/ImageExtensionsTest.cs index d23efdd79..97fdb38e7 100644 --- a/tests/ImageSharp.Tests/Formats/Gif/ImageExtensionsTest.cs +++ b/tests/ImageSharp.Tests/Formats/Gif/ImageExtensionsTest.cs @@ -47,7 +47,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsGif(file, new()); + image.SaveAsGif(file, new GifEncoder()); } IImageFormat format = Image.DetectFormat(file); @@ -108,7 +108,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsGif(memoryStream, new()); + image.SaveAsGif(memoryStream, new GifEncoder()); } memoryStream.Position = 0; diff --git a/tests/ImageSharp.Tests/Formats/Icon/Ico/IcoDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Icon/Ico/IcoDecoderTests.cs index e076ccab6..85ff51b18 100644 --- a/tests/ImageSharp.Tests/Formats/Icon/Ico/IcoDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Icon/Ico/IcoDecoderTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Bmp; using SixLabors.ImageSharp.Formats.Ico; using SixLabors.ImageSharp.Formats.Icon; @@ -277,7 +278,7 @@ public class IcoDecoderTests [WithFile(MultiSizeF, PixelTypes.Rgba32)] public void MultiSize_CanDecodeSingleFrame(TestImageProvider provider) { - using Image image = provider.GetImage(IcoDecoder.Instance, new() { MaxFrames = 1 }); + using Image image = provider.GetImage(IcoDecoder.Instance, new DecoderOptions { MaxFrames = 1 }); Assert.Single(image.Frames); } @@ -293,7 +294,7 @@ public class IcoDecoderTests TestFile testFile = TestFile.Create(imagePath); using MemoryStream stream = new(testFile.Bytes, false); - ImageInfo imageInfo = Image.Identify(new() { MaxFrames = 1 }, stream); + ImageInfo imageInfo = Image.Identify(new DecoderOptions { MaxFrames = 1 }, stream); Assert.Single(imageInfo.FrameMetadataCollection); } diff --git a/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs b/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs index f7743e149..324bd4783 100644 --- a/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs +++ b/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs @@ -24,7 +24,7 @@ public class ImageFormatManagerTests public ImageFormatManagerTests() { this.DefaultFormatsManager = Configuration.CreateDefaultInstance().ImageFormatsManager; - this.FormatsManagerEmpty = new(); + this.FormatsManagerEmpty = new ImageFormatManager(); } [Fact] diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8Tests.cs b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8Tests.cs index ae6f0331d..fb1e062f2 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8Tests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8Tests.cs @@ -157,7 +157,7 @@ public class Block8x8Tests : JpegFixture static void RunTest(string seedSerialized) { int seed = FeatureTestRunner.Deserialize(seedSerialized); - Random rng = new Random(seed); + Random rng = new(seed); for (int i = 0; i < 1000; i++) { @@ -188,7 +188,7 @@ public class Block8x8Tests : JpegFixture static void RunTest(string seedSerialized) { int seed = FeatureTestRunner.Deserialize(seedSerialized); - Random rng = new Random(seed); + Random rng = new(seed); for (int i = 0; i < 1000; i++) { @@ -223,7 +223,7 @@ public class Block8x8Tests : JpegFixture static void RunTest(string seedSerialized) { int seed = FeatureTestRunner.Deserialize(seedSerialized); - Random rng = new Random(seed); + Random rng = new(seed); for (int i = 0; i < 1000; i++) { diff --git a/tests/ImageSharp.Tests/Formats/Jpg/HuffmanScanEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/HuffmanScanEncoderTests.cs index 625932e2a..36b792fa1 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/HuffmanScanEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/HuffmanScanEncoderTests.cs @@ -69,7 +69,7 @@ public class HuffmanScanEncoderTests { int maxNumber = 1 << 16; - Random rng = new Random(seed); + Random rng = new(seed); for (int i = 0; i < 1000; i++) { uint number = (uint)rng.Next(0, maxNumber); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ImageExtensionsTest.cs b/tests/ImageSharp.Tests/Formats/Jpg/ImageExtensionsTest.cs index 0d8bf3a74..b1f799732 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/ImageExtensionsTest.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/ImageExtensionsTest.cs @@ -48,7 +48,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsJpeg(file, new()); + image.SaveAsJpeg(file, new JpegEncoder()); } IImageFormat format = Image.DetectFormat(file); @@ -109,7 +109,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsJpeg(memoryStream, new()); + image.SaveAsJpeg(memoryStream, new JpegEncoder()); } memoryStream.Position = 0; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs index ba60139c5..d58ff9823 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs @@ -620,10 +620,10 @@ public class JpegColorConverterTests // no need to dispose when buffer is not array owner Memory memory = new(values); MemoryGroup source = MemoryGroup.Wrap(memory); - buffers[i] = new(source, values.Length, 1); + buffers[i] = new Buffer2D(source, values.Length, 1); } - return new(buffers, 0); + return new JpegColorConverterBase.ComponentValues(buffers, 0); } private static float[] CreateRandomValues(int length, Random rnd) @@ -783,8 +783,8 @@ public class JpegColorConverterTests g /= MaxColorChannelValue; b /= MaxColorChannelValue; - Rgb expected = Rgb.Clamp(new(r, g, b)); - Rgb actual = Rgb.Clamp(new(result.Component0[i], result.Component1[i], result.Component2[i])); + Rgb expected = Rgb.Clamp(new Rgb(r, g, b)); + Rgb actual = Rgb.Clamp(new Rgb(result.Component0[i], result.Component1[i], result.Component2[i])); bool equal = ColorSpaceComparer.Equals(expected, actual); Assert.True(equal, $"Colors {expected} and {actual} are not equal at index {i}"); @@ -804,9 +804,9 @@ public class JpegColorConverterTests r /= MaxColorChannelValue; g /= MaxColorChannelValue; b /= MaxColorChannelValue; - Rgb expected = Rgb.Clamp(new(r, g, b)); + Rgb expected = Rgb.Clamp(new Rgb(r, g, b)); - Rgb actual = Rgb.Clamp(new(result.Component0[i], result.Component1[i], result.Component2[i])); + Rgb actual = Rgb.Clamp(new Rgb(result.Component0[i], result.Component1[i], result.Component2[i])); bool equal = ColorSpaceComparer.Equals(expected, actual); Assert.True(equal, $"Colors {expected} and {actual} are not equal at index {i}"); @@ -817,9 +817,9 @@ public class JpegColorConverterTests float r = values.Component0[i] / MaxColorChannelValue; float g = values.Component1[i] / MaxColorChannelValue; float b = values.Component2[i] / MaxColorChannelValue; - Rgb expected = Rgb.Clamp(new(r, g, b)); + Rgb expected = Rgb.Clamp(new Rgb(r, g, b)); - Rgb actual = Rgb.Clamp(new(result.Component0[i], result.Component1[i], result.Component2[i])); + Rgb actual = Rgb.Clamp(new Rgb(result.Component0[i], result.Component1[i], result.Component2[i])); bool equal = ColorSpaceComparer.Equals(expected, actual); Assert.True(equal, $"Colors {expected} and {actual} are not equal at index {i}"); @@ -828,9 +828,9 @@ public class JpegColorConverterTests private static void ValidateGrayScale(in JpegColorConverterBase.ComponentValues values, in JpegColorConverterBase.ComponentValues result, int i) { float y = values.Component0[i] / MaxColorChannelValue; - Rgb expected = Rgb.Clamp(new(y, y, y)); + Rgb expected = Rgb.Clamp(new Rgb(y, y, y)); - Rgb actual = Rgb.Clamp(new(result.Component0[i], result.Component0[i], result.Component0[i])); + Rgb actual = Rgb.Clamp(new Rgb(result.Component0[i], result.Component0[i], result.Component0[i])); bool equal = ColorSpaceComparer.Equals(expected, actual); Assert.True(equal, $"Colors {expected} and {actual} are not equal at index {i}"); @@ -846,9 +846,9 @@ public class JpegColorConverterTests float r = c * k / MaxColorChannelValue; float g = m * k / MaxColorChannelValue; float b = y * k / MaxColorChannelValue; - Rgb expected = Rgb.Clamp(new(r, g, b)); + Rgb expected = Rgb.Clamp(new Rgb(r, g, b)); - Rgb actual = Rgb.Clamp(new(result.Component0[i], result.Component1[i], result.Component2[i])); + Rgb actual = Rgb.Clamp(new Rgb(result.Component0[i], result.Component1[i], result.Component2[i])); bool equal = ColorSpaceComparer.Equals(expected, actual); Assert.True(equal, $"Colors {expected} and {actual} are not equal at index {i}"); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs index d2c7bcd5c..11c7dc86d 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs @@ -400,10 +400,10 @@ public partial class JpegDecoderTests exif.SetValue(ExifTag.XPSubject, "This is a subject"); // exif.SetValue(ExifTag.UserComment, new EncodedString(EncodedString.CharacterCode.JIS, "ビッ")); - exif.SetValue(ExifTag.UserComment, new(EncodedString.CharacterCode.JIS, "eng comment text (JIS)")); + exif.SetValue(ExifTag.UserComment, new EncodedString(EncodedString.CharacterCode.JIS, "eng comment text (JIS)")); - exif.SetValue(ExifTag.GPSProcessingMethod, new(EncodedString.CharacterCode.ASCII, "GPS processing method (ASCII)")); - exif.SetValue(ExifTag.GPSAreaInformation, new(EncodedString.CharacterCode.Unicode, "GPS area info (Unicode)")); + exif.SetValue(ExifTag.GPSProcessingMethod, new EncodedString(EncodedString.CharacterCode.ASCII, "GPS processing method (ASCII)")); + exif.SetValue(ExifTag.GPSAreaInformation, new EncodedString(EncodedString.CharacterCode.Unicode, "GPS area info (Unicode)")); image.Metadata.ExifProfile = exif; @@ -461,7 +461,7 @@ public partial class JpegDecoderTests // We want to test the encoder to ensure the determined values can be encoded but not by encoding // the full size image as it would be too slow. // We will crop the image to a smaller size and then encode it. - image.Mutate(x => x.Crop(new(0, 0, 100, 100))); + image.Mutate(x => x.Crop(new Rectangle(0, 0, 100, 100))); using MemoryStream ms = new(); image.Save(ms, new JpegEncoder()); @@ -495,13 +495,13 @@ public partial class JpegDecoderTests Assert.Equal("Carers; seniors; caregiver; senior care; retirement home; hands; old; elderly; elderly caregiver; elder care; elderly care; geriatric care; nursing home; age; old age care; outpatient; needy; health care; home nurse; home care; sick; retirement; medical; mobile; the elderly; nursing department; nursing treatment; nursing; care services; nursing services; nursing care; nursing allowance; nursing homes; home nursing; care category; nursing class; care; nursing shortage; nursing patient care staff\0", exifProfile.GetValue(ExifTag.XPKeywords).Value); Assert.Equal( - new(EncodedString.CharacterCode.ASCII, "StockSubmitter|Miscellaneous||Miscellaneous$|00|0000330000000110000000000000000|22$@NA_1005010.460@145$$@Miscellaneous.Miscellaneous$$@$@26$$@$@$@$@205$@$@$@$@$@$@$@$@$@43$@$@$@$$@Miscellaneous.Miscellaneous$$@90$$@22$@$@$@$@$@$@$|||"), + new EncodedString(EncodedString.CharacterCode.ASCII, "StockSubmitter|Miscellaneous||Miscellaneous$|00|0000330000000110000000000000000|22$@NA_1005010.460@145$$@Miscellaneous.Miscellaneous$$@$@26$$@$@$@$@205$@$@$@$@$@$@$@$@$@43$@$@$@$$@Miscellaneous.Miscellaneous$$@90$$@22$@$@$@$@$@$@$|||"), exifProfile.GetValue(ExifTag.UserComment).Value); // the profile contains 4 duplicated UserComment Assert.Equal(1, exifProfile.Values.Count(t => t.Tag == ExifTag.UserComment)); - image.Mutate(x => x.Crop(new(0, 0, 100, 100))); + image.Mutate(x => x.Crop(new Rectangle(0, 0, 100, 100))); image.Save(ms, new JpegEncoder()); } diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs index 6df354276..8126a37fe 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs @@ -116,7 +116,7 @@ public partial class JpegDecoderTests public void JpegDecoder_Decode_Resize(TestImageProvider provider) where TPixel : unmanaged, IPixel { - DecoderOptions options = new() { TargetSize = new() { Width = 150, Height = 150 } }; + DecoderOptions options = new() { TargetSize = new Size { Width = 150, Height = 150 } }; using Image image = provider.GetImage(JpegDecoder.Instance, options); FormattableString details = $"{options.TargetSize.Value.Width}_{options.TargetSize.Value.Height}"; @@ -136,7 +136,7 @@ public partial class JpegDecoderTests { DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 }, + TargetSize = new Size { Width = 150, Height = 150 }, Sampler = KnownResamplers.Bicubic }; using Image image = provider.GetImage(JpegDecoder.Instance, options); @@ -156,7 +156,7 @@ public partial class JpegDecoderTests public void JpegDecoder_Decode_Specialized_IDCT_Resize(TestImageProvider provider) where TPixel : unmanaged, IPixel { - DecoderOptions options = new() { TargetSize = new() { Width = 150, Height = 150 } }; + DecoderOptions options = new() { TargetSize = new Size { Width = 150, Height = 150 } }; JpegDecoderOptions specializedOptions = new() { GeneralOptions = options, @@ -180,7 +180,7 @@ public partial class JpegDecoderTests public void JpegDecoder_Decode_Specialized_Scale_Resize(TestImageProvider provider) where TPixel : unmanaged, IPixel { - DecoderOptions options = new() { TargetSize = new() { Width = 150, Height = 150 } }; + DecoderOptions options = new() { TargetSize = new Size { Width = 150, Height = 150 } }; JpegDecoderOptions specializedOptions = new() { GeneralOptions = options, @@ -204,7 +204,7 @@ public partial class JpegDecoderTests public void JpegDecoder_Decode_Specialized_Combined_Resize(TestImageProvider provider) where TPixel : unmanaged, IPixel { - DecoderOptions options = new() { TargetSize = new() { Width = 150, Height = 150 } }; + DecoderOptions options = new() { TargetSize = new Size { Width = 150, Height = 150 } }; JpegDecoderOptions specializedOptions = new() { GeneralOptions = options, @@ -372,7 +372,7 @@ public partial class JpegDecoderTests { JpegDecoderOptions options = new() { - GeneralOptions = new() { ColorProfileHandling = ColorProfileHandling.Convert } + GeneralOptions = new DecoderOptions { ColorProfileHandling = ColorProfileHandling.Convert } }; using Image image = provider.GetImage(JpegDecoder.Instance, options); @@ -387,7 +387,7 @@ public partial class JpegDecoderTests { JpegDecoderOptions options = new() { - GeneralOptions = new() { ColorProfileHandling = ColorProfileHandling.Convert } + GeneralOptions = new DecoderOptions { ColorProfileHandling = ColorProfileHandling.Convert } }; using Image image = provider.GetImage(JpegDecoder.Instance, options); @@ -407,7 +407,7 @@ public partial class JpegDecoderTests { JpegDecoderOptions options = new() { - GeneralOptions = new() { ColorProfileHandling = ColorProfileHandling.Convert } + GeneralOptions = new DecoderOptions { ColorProfileHandling = ColorProfileHandling.Convert } }; using Image image = provider.GetImage(JpegDecoder.Instance, options); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.Metadata.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.Metadata.cs index ebc5a77a9..99322687c 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.Metadata.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.Metadata.cs @@ -57,7 +57,7 @@ public partial class JpegEncoderTests { // arrange using Image input = new(1, 1); - input.Metadata.ExifProfile = new(); + input.Metadata.ExifProfile = new ExifProfile(); input.Metadata.ExifProfile.SetValue(ExifTag.Software, "unit_test"); // act @@ -78,7 +78,7 @@ public partial class JpegEncoderTests { // arrange using Image input = new(1, 1); - input.Metadata.IccProfile = new(IccTestDataProfiles.ProfileRandomArray); + input.Metadata.IccProfile = new IccProfile(IccTestDataProfiles.ProfileRandomArray); // act using MemoryStream memStream = new(); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegFileMarkerTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegFileMarkerTests.cs index 1f8bdd67a..62362ec80 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegFileMarkerTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegFileMarkerTests.cs @@ -14,7 +14,7 @@ public class JpegFileMarkerTests { const byte app1 = JpegConstants.Markers.APP1; const int position = 5; - JpegFileMarker marker = new JpegFileMarker(app1, position); + JpegFileMarker marker = new(app1, position); Assert.Equal(app1, marker.Marker); Assert.Equal(position, marker.Position); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegMetadataTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegMetadataTests.cs index df0595d7b..37be0f8f5 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegMetadataTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegMetadataTests.cs @@ -12,7 +12,7 @@ public class JpegMetadataTests [Fact] public void CloneIsDeep() { - JpegMetadata meta = new JpegMetadata { ColorType = JpegColorType.Luminance }; + JpegMetadata meta = new() { ColorType = JpegColorType.Luminance }; JpegMetadata clone = (JpegMetadata)meta.DeepClone(); clone.ColorType = JpegColorType.YCbCrRatio420; @@ -23,7 +23,7 @@ public class JpegMetadataTests [Fact] public void Quality_DefaultQuality() { - JpegMetadata meta = new JpegMetadata(); + JpegMetadata meta = new(); Assert.Equal(meta.Quality, ImageSharp.Formats.Jpeg.Components.Quantization.DefaultQualityFactor); } @@ -33,7 +33,7 @@ public class JpegMetadataTests { int quality = 50; - JpegMetadata meta = new JpegMetadata { LuminanceQuality = quality }; + JpegMetadata meta = new() { LuminanceQuality = quality }; Assert.Equal(meta.Quality, quality); } @@ -43,7 +43,7 @@ public class JpegMetadataTests { int quality = 50; - JpegMetadata meta = new JpegMetadata { LuminanceQuality = quality, ChrominanceQuality = quality }; + JpegMetadata meta = new() { LuminanceQuality = quality, ChrominanceQuality = quality }; Assert.Equal(meta.Quality, quality); } @@ -54,7 +54,7 @@ public class JpegMetadataTests int qualityLuma = 50; int qualityChroma = 30; - JpegMetadata meta = new JpegMetadata { LuminanceQuality = qualityLuma, ChrominanceQuality = qualityChroma }; + JpegMetadata meta = new() { LuminanceQuality = qualityLuma, ChrominanceQuality = qualityChroma }; Assert.Equal(meta.Quality, qualityLuma); } @@ -62,7 +62,7 @@ public class JpegMetadataTests [Fact] public void Comment_EmptyComment() { - JpegMetadata meta = new JpegMetadata(); + JpegMetadata meta = new(); Assert.True(Array.Empty().SequenceEqual(meta.Comments)); } @@ -71,9 +71,9 @@ public class JpegMetadataTests public void Comment_OnlyComment() { string comment = "test comment"; - Collection expectedCollection = new Collection { comment }; + Collection expectedCollection = new() { comment }; - JpegMetadata meta = new JpegMetadata(); + JpegMetadata meta = new(); meta.Comments.Add(JpegComData.FromString(comment)); Assert.Equal(1, meta.Comments.Count); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs index e9821db4c..b6a59fa93 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs @@ -47,7 +47,7 @@ public class ParseStreamTests Assert.Equal(expectedSizeInBlocks, decoder.Frame.McuSize); - Size uniform1 = new Size(1, 1); + Size uniform1 = new(1, 1); IJpegComponent c0 = decoder.Components[0]; VerifyJpeg.VerifyComponent(c0, expectedSizeInBlocks, uniform1, uniform1); } @@ -62,7 +62,7 @@ public class ParseStreamTests [InlineData(TestImages.Jpeg.Baseline.Cmyk)] public void PrintComponentData(string imageFile) { - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new(); using (JpegDecoderCore decoder = JpegFixture.ParseJpegStream(imageFile)) { @@ -110,7 +110,7 @@ public class ParseStreamTests IJpegComponent c1 = decoder.Components[1]; IJpegComponent c2 = decoder.Components[2]; - Size uniform1 = new Size(1, 1); + Size uniform1 = new(1, 1); Size expectedLumaSizeInBlocks = decoder.Frame.McuSize.MultiplyBy(fLuma); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/SpectralJpegTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/SpectralJpegTests.cs index e069296d1..60de0a204 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/SpectralJpegTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/SpectralJpegTests.cs @@ -101,7 +101,7 @@ public class SpectralJpegTests int componentCount = imageSharpData.ComponentCount; if (libJpegData.ComponentCount != componentCount) { - throw new("libJpegData.ComponentCount != componentCount"); + throw new Exception("libJpegData.ComponentCount != componentCount"); } double averageDifference = 0; @@ -202,10 +202,10 @@ public class SpectralJpegTests for (int i = 0; i < spectralComponents.Length; i++) { JpegComponent component = this.frame.Components[i]; - spectralComponents[i] = new(component.WidthInBlocks, component.HeightInBlocks, component.Index); + spectralComponents[i] = new LibJpegTools.ComponentData(component.WidthInBlocks, component.HeightInBlocks, component.Index); } - this.spectralData = new(spectralComponents); + this.spectralData = new LibJpegTools.SpectralData(spectralComponents); } } } diff --git a/tests/ImageSharp.Tests/Formats/Jpg/SpectralToPixelConversionTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/SpectralToPixelConversionTests.cs index 186f72341..d55a25453 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/SpectralToPixelConversionTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/SpectralToPixelConversionTests.cs @@ -48,7 +48,7 @@ public class SpectralToPixelConversionTests provider.Utility.TestName = JpegDecoderTests.DecodeBaselineJpegOutputName; // Comparison - using Image image = new(Configuration.Default, converter.GetPixelBuffer(null, CancellationToken.None), new()); + using Image image = new(Configuration.Default, converter.GetPixelBuffer(null, CancellationToken.None), new ImageMetadata()); using Image referenceImage = provider.GetReferenceOutputImage(appendPixelTypeToFileName: false); ImageSimilarityReport report = ImageComparer.Exact.CompareImagesOrFrames(referenceImage, image); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegFixture.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegFixture.cs index 511150c52..33e95c5aa 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegFixture.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegFixture.cs @@ -72,7 +72,7 @@ public class JpegFixture : MeasureFixture // ReSharper disable once InconsistentNaming public static int[] Create8x8RandomIntData(int minValue, int maxValue, int seed = 42) { - Random rnd = new Random(seed); + Random rnd = new(seed); int[] result = new int[64]; for (int i = 0; i < 8; i++) { @@ -87,7 +87,7 @@ public class JpegFixture : MeasureFixture public static float[] Create8x8RandomFloatData(float minValue, float maxValue, int seed = 42, int xBorder = 8, int yBorder = 8) { - Random rnd = new Random(seed); + Random rnd = new(seed); float[] result = new float[64]; for (int y = 0; y < yBorder; y++) { @@ -112,7 +112,7 @@ public class JpegFixture : MeasureFixture internal void Print8x8Data(Span data) { - StringBuilder bld = new StringBuilder(); + StringBuilder bld = new(); for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) @@ -135,7 +135,7 @@ public class JpegFixture : MeasureFixture count = data.Length; } - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new(); for (int i = 0; i < count; i++) { sb.Append($"{data[i],3} "); @@ -158,7 +158,7 @@ public class JpegFixture : MeasureFixture internal void CompareBlocks(Span a, Span b, float tolerance) { - ApproximateFloatComparer comparer = new ApproximateFloatComparer(tolerance); + ApproximateFloatComparer comparer = new(tolerance); double totalDifference = 0.0; bool failed = false; @@ -192,7 +192,7 @@ public class JpegFixture : MeasureFixture internal static bool CompareBlocks(Span a, Span b, float tolerance, out float diff) { - ApproximateFloatComparer comparer = new ApproximateFloatComparer(tolerance); + ApproximateFloatComparer comparer = new(tolerance); bool failed = false; diff = 0; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.cs index b08202df5..888459112 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.cs @@ -18,12 +18,12 @@ internal static partial class LibJpegTools BigInteger totalDiff = 0; if (actual.WidthInBlocks < expected.WidthInBlocks) { - throw new("actual.WidthInBlocks < expected.WidthInBlocks"); + throw new Exception("actual.WidthInBlocks < expected.WidthInBlocks"); } if (actual.HeightInBlocks < expected.HeightInBlocks) { - throw new("actual.HeightInBlocks < expected.HeightInBlocks"); + throw new Exception("actual.HeightInBlocks < expected.HeightInBlocks"); } int w = expected.WidthInBlocks; @@ -127,7 +127,7 @@ internal static partial class LibJpegTools } } - return new(result); + return new SpectralData(result); } } finally diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs index acb3d27e3..7c7f47f94 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs @@ -219,8 +219,8 @@ internal static partial class ReferenceImplementations y[6] = c3 * r[6] - c2 * r[2]; */ - w0 = new(1.175876f); - w1 = new(0.785695f); + w0 = new Vector4(1.175876f); + w1 = new Vector4(0.785695f); c3 = (w0 * t4) + (w1 * t7); c0 = (w0 * t7) - (w1 * t4); /* @@ -228,8 +228,8 @@ internal static partial class ReferenceImplementations c0 = t7 * r[3] - t4 * r[5]; */ - w0 = new(1.387040f); - w1 = new(0.275899f); + w0 = new Vector4(1.387040f); + w1 = new Vector4(0.275899f); c2 = (w0 * t5) + (w1 * t6); c1 = (w0 * t6) - (w1 * t5); /* @@ -300,7 +300,7 @@ internal static partial class ReferenceImplementations #pragma warning restore SA1300 // Element should begin with upper-case letter { src = src.Slice(offset); - return new(src[0], src[1], src[2], src[3]); + return new Vector4(src[0], src[1], src[2], src[3]); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/VerifyJpeg.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/VerifyJpeg.cs index d7b0b64b2..7a31e35d0 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/VerifyJpeg.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/VerifyJpeg.cs @@ -11,7 +11,7 @@ internal static class VerifyJpeg { internal static void VerifySize(IJpegComponent component, int expectedBlocksX, int expectedBlocksY) { - Assert.Equal(new(expectedBlocksX, expectedBlocksY), component.SizeInBlocks); + Assert.Equal(new Size(expectedBlocksX, expectedBlocksY), component.SizeInBlocks); } internal static void VerifyComponent( diff --git a/tests/ImageSharp.Tests/Formats/Pbm/ImageExtensionsTest.cs b/tests/ImageSharp.Tests/Formats/Pbm/ImageExtensionsTest.cs index 1b71f49d5..5cbdd3dab 100644 --- a/tests/ImageSharp.Tests/Formats/Pbm/ImageExtensionsTest.cs +++ b/tests/ImageSharp.Tests/Formats/Pbm/ImageExtensionsTest.cs @@ -47,7 +47,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsPbm(file, new()); + image.SaveAsPbm(file, new PbmEncoder()); } IImageFormat format = Image.DetectFormat(file); @@ -108,7 +108,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsPbm(memoryStream, new()); + image.SaveAsPbm(memoryStream, new PbmEncoder()); } memoryStream.Position = 0; diff --git a/tests/ImageSharp.Tests/Formats/Pbm/PbmDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Pbm/PbmDecoderTests.cs index 2da801532..476538ccd 100644 --- a/tests/ImageSharp.Tests/Formats/Pbm/PbmDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Pbm/PbmDecoderTests.cs @@ -108,7 +108,7 @@ public class PbmDecoderTests { DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 } + TargetSize = new Size { Width = 150, Height = 150 } }; using Image image = provider.GetImage(PbmDecoder.Instance, options); @@ -130,7 +130,7 @@ public class PbmDecoderTests using EofHitCounter eofHitCounter = EofHitCounter.RunDecoder(bytes); Assert.True(eofHitCounter.EofHitCount <= 2); - Assert.Equal(new(100, 100), eofHitCounter.Image.Size); + Assert.Equal(new Size(100, 100), eofHitCounter.Image.Size); } [Fact] @@ -139,6 +139,6 @@ public class PbmDecoderTests using EofHitCounter eofHitCounter = EofHitCounter.RunDecoder(RgbBinaryPrematureEof); Assert.True(eofHitCounter.EofHitCount <= 2); - Assert.Equal(new(29, 30), eofHitCounter.Image.Size); + Assert.Equal(new Size(29, 30), eofHitCounter.Image.Size); } } diff --git a/tests/ImageSharp.Tests/Formats/Pbm/PbmEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Pbm/PbmEncoderTests.cs index 0501ed2b2..0fea65f6e 100644 --- a/tests/ImageSharp.Tests/Formats/Pbm/PbmEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Pbm/PbmEncoderTests.cs @@ -38,12 +38,12 @@ public class PbmEncoderTests [MemberData(nameof(PbmColorTypeFiles))] public void PbmEncoder_PreserveColorType(string imagePath, PbmColorType pbmColorType) { - PbmEncoder options = new PbmEncoder(); + PbmEncoder options = new(); TestFile testFile = TestFile.Create(imagePath); using (Image input = testFile.CreateRgba32Image()) { - using (MemoryStream memStream = new MemoryStream()) + using (MemoryStream memStream = new()) { input.Save(memStream, options); memStream.Position = 0; @@ -60,7 +60,7 @@ public class PbmEncoderTests [MemberData(nameof(PbmColorTypeFiles))] public void PbmEncoder_WithPlainEncoding_PreserveBitsPerPixel(string imagePath, PbmColorType pbmColorType) { - PbmEncoder options = new PbmEncoder() + PbmEncoder options = new() { Encoding = PbmEncoding.Plain }; @@ -68,7 +68,7 @@ public class PbmEncoderTests TestFile testFile = TestFile.Create(imagePath); using (Image input = testFile.CreateRgba32Image()) { - using (MemoryStream memStream = new MemoryStream()) + using (MemoryStream memStream = new()) { input.Save(memStream, options); @@ -132,9 +132,9 @@ public class PbmEncoderTests { using (Image image = provider.GetImage()) { - PbmEncoder encoder = new PbmEncoder { ColorType = colorType, Encoding = encoding }; + PbmEncoder encoder = new() { ColorType = colorType, Encoding = encoding }; - using (MemoryStream memStream = new MemoryStream()) + using (MemoryStream memStream = new()) { image.Save(memStream, encoder); memStream.Position = 0; diff --git a/tests/ImageSharp.Tests/Formats/Pbm/PbmRoundTripTests.cs b/tests/ImageSharp.Tests/Formats/Pbm/PbmRoundTripTests.cs index f7c6dc171..6524b3506 100644 --- a/tests/ImageSharp.Tests/Formats/Pbm/PbmRoundTripTests.cs +++ b/tests/ImageSharp.Tests/Formats/Pbm/PbmRoundTripTests.cs @@ -22,7 +22,7 @@ public class PbmRoundTripTests { // Arrange TestFile testFile = TestFile.Create(imagePath); - using MemoryStream stream = new MemoryStream(testFile.Bytes, false); + using MemoryStream stream = new(testFile.Bytes, false); // Act using Image originalImage = Image.Load(stream); @@ -43,7 +43,7 @@ public class PbmRoundTripTests { // Arrange TestFile testFile = TestFile.Create(imagePath); - using MemoryStream stream = new MemoryStream(testFile.Bytes, false); + using MemoryStream stream = new(testFile.Bytes, false); // Act using Image originalImage = Image.Load(stream); @@ -57,7 +57,7 @@ public class PbmRoundTripTests private Image RoundTrip(Image originalImage) where TPixel : unmanaged, IPixel { - using MemoryStream decodedStream = new MemoryStream(); + using MemoryStream decodedStream = new(); originalImage.SaveAsPbm(decodedStream); decodedStream.Seek(0, SeekOrigin.Begin); Image encodedImage = Image.Load(decodedStream); diff --git a/tests/ImageSharp.Tests/Formats/Png/Adler32Tests.cs b/tests/ImageSharp.Tests/Formats/Png/Adler32Tests.cs index 6e03042fa..53f9a0278 100644 --- a/tests/ImageSharp.Tests/Formats/Png/Adler32Tests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/Adler32Tests.cs @@ -30,7 +30,7 @@ public class Adler32Tests { // arrange byte[] data = GetBuffer(length); - SharpAdler32 adler = new SharpAdler32(); + SharpAdler32 adler = new(); adler.Update(data); long expected = adler.Value; diff --git a/tests/ImageSharp.Tests/Formats/Png/ImageExtensionsTest.cs b/tests/ImageSharp.Tests/Formats/Png/ImageExtensionsTest.cs index 145cc1d68..a03e1a7aa 100644 --- a/tests/ImageSharp.Tests/Formats/Png/ImageExtensionsTest.cs +++ b/tests/ImageSharp.Tests/Formats/Png/ImageExtensionsTest.cs @@ -48,7 +48,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsPng(file, new()); + image.SaveAsPng(file, new PngEncoder()); } IImageFormat format = Image.DetectFormat(file); @@ -109,7 +109,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsPng(memoryStream, new()); + image.SaveAsPng(memoryStream, new PngEncoder()); } memoryStream.Position = 0; diff --git a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.Chunks.cs b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.Chunks.cs index 71523d5b6..829cc64ff 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.Chunks.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.Chunks.cs @@ -64,7 +64,7 @@ public partial class PngDecoderTests { string chunkName = GetChunkTypeName(chunkType); - using (MemoryStream memStream = new MemoryStream()) + using (MemoryStream memStream = new()) { WriteHeaderChunk(memStream); WriteChunk(memStream, chunkName); diff --git a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs index 26da6f521..1a74fe5b2 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs @@ -140,7 +140,7 @@ public partial class PngDecoderTests { DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 } + TargetSize = new Size { Width = 150, Height = 150 } }; using Image image = provider.GetImage(PngDecoder.Instance, options); @@ -178,7 +178,7 @@ public partial class PngDecoderTests DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 } + TargetSize = new Size { Width = 150, Height = 150 } }; using Image image = provider.GetImage(PngDecoder.Instance, options); @@ -389,7 +389,7 @@ public partial class PngDecoderTests TestFile testFile = TestFile.Create(imagePath); using MemoryStream stream = new(testFile.Bytes, false); - ImageInfo imageInfo = Image.Identify(new() { SegmentIntegrityHandling = SegmentIntegrityHandling.IgnoreData }, stream); + ImageInfo imageInfo = Image.Identify(new DecoderOptions { SegmentIntegrityHandling = SegmentIntegrityHandling.IgnoreData }, stream); Assert.NotNull(imageInfo); Assert.Equal(expectedPixelSize, imageInfo.PixelType.BitsPerPixel); @@ -674,12 +674,12 @@ public partial class PngDecoderTests public void Binary_PrematureEof() { PngDecoder decoder = PngDecoder.Instance; - PngDecoderOptions options = new() { GeneralOptions = new() { SegmentIntegrityHandling = SegmentIntegrityHandling.IgnoreData } }; + PngDecoderOptions options = new() { GeneralOptions = new DecoderOptions { SegmentIntegrityHandling = SegmentIntegrityHandling.IgnoreData } }; using EofHitCounter eofHitCounter = EofHitCounter.RunDecoder(TestImages.Png.Bad.FlagOfGermany0000016446, decoder, options); // TODO: Try to reduce this to 1. Assert.True(eofHitCounter.EofHitCount <= 3); - Assert.Equal(new(200, 120), eofHitCounter.Image.Size); + Assert.Equal(new Size(200, 120), eofHitCounter.Image.Size); } [Fact] diff --git a/tests/ImageSharp.Tests/Formats/Png/PngEncoderFilterTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngEncoderFilterTests.cs index 9ce1a9386..a930426b6 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngEncoderFilterTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngEncoderFilterTests.cs @@ -31,7 +31,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - TestData data = new TestData(PngFilterMethod.Average, Size); + TestData data = new(PngFilterMethod.Average, Size); data.TestFilter(); } @@ -45,7 +45,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - TestData data = new TestData(PngFilterMethod.Average, Size); + TestData data = new(PngFilterMethod.Average, Size); data.TestFilter(); } @@ -59,7 +59,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - TestData data = new TestData(PngFilterMethod.Average, Size); + TestData data = new(PngFilterMethod.Average, Size); data.TestFilter(); } @@ -73,7 +73,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - TestData data = new TestData(PngFilterMethod.Average, Size); + TestData data = new(PngFilterMethod.Average, Size); data.TestFilter(); } @@ -87,7 +87,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - TestData data = new TestData(PngFilterMethod.Paeth, Size); + TestData data = new(PngFilterMethod.Paeth, Size); data.TestFilter(); } @@ -101,7 +101,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - TestData data = new TestData(PngFilterMethod.Paeth, Size); + TestData data = new(PngFilterMethod.Paeth, Size); data.TestFilter(); } @@ -115,7 +115,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - TestData data = new TestData(PngFilterMethod.Paeth, Size); + TestData data = new(PngFilterMethod.Paeth, Size); data.TestFilter(); } @@ -129,7 +129,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - TestData data = new TestData(PngFilterMethod.Up, Size); + TestData data = new(PngFilterMethod.Up, Size); data.TestFilter(); } @@ -143,7 +143,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - TestData data = new TestData(PngFilterMethod.Up, Size); + TestData data = new(PngFilterMethod.Up, Size); data.TestFilter(); } @@ -157,7 +157,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - TestData data = new TestData(PngFilterMethod.Up, Size); + TestData data = new(PngFilterMethod.Up, Size); data.TestFilter(); } @@ -171,7 +171,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - TestData data = new TestData(PngFilterMethod.Sub, Size); + TestData data = new(PngFilterMethod.Sub, Size); data.TestFilter(); } @@ -185,7 +185,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - TestData data = new TestData(PngFilterMethod.Sub, Size); + TestData data = new(PngFilterMethod.Sub, Size); data.TestFilter(); } @@ -199,7 +199,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - TestData data = new TestData(PngFilterMethod.Sub, Size); + TestData data = new(PngFilterMethod.Sub, Size); data.TestFilter(); } @@ -227,7 +227,7 @@ public class PngEncoderFilterTests : MeasureFixture this.expectedResult = new byte[1 + (size * size * bpp)]; this.resultBuffer = new byte[1 + (size * size * bpp)]; - Random rng = new Random(12345678); + Random rng = new(12345678); byte[] tmp = new byte[6]; for (int i = 0; i < this.previousScanline.Length; i += bpp) { diff --git a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs index 56909b9dc..f1dcb357c 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs @@ -380,7 +380,7 @@ public partial class PngEncoderTests if (colorType is PngColorType.Grayscale or PngColorType.GrayscaleWithAlpha) { byte luminance = ColorNumerics.Get8BitBT709Luminance(expectedColor.R, expectedColor.G, expectedColor.B); - expectedColor = new(luminance, luminance, luminance); + expectedColor = new Rgba32(luminance, luminance, luminance); } actual.ProcessPixelRows(accessor => @@ -680,7 +680,7 @@ public partial class PngEncoderTests PaletteQuantizer quantizer = new( palette.Select(Color.FromPixel).ToArray(), - new() { ColorMatchingMode = ColorMatchingMode.Hybrid }); + new QuantizerOptions { ColorMatchingMode = ColorMatchingMode.Hybrid }); using MemoryStream ms = new(); image.Save(ms, new PngEncoder @@ -720,7 +720,7 @@ public partial class PngEncoderTests FilterMethod = pngFilterMethod, CompressionLevel = compressionLevel, BitDepth = bitDepth, - Quantizer = new WuQuantizer(new() { MaxColors = paletteSize }), + Quantizer = new WuQuantizer(new QuantizerOptions { MaxColors = paletteSize }), InterlaceMethod = interlaceMode, ChunkFilter = optimizeMethod, }; diff --git a/tests/ImageSharp.Tests/Formats/Png/PngFrameMetadataTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngFrameMetadataTests.cs index 8fde21654..efc18c16a 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngFrameMetadataTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngFrameMetadataTests.cs @@ -14,7 +14,7 @@ public class PngFrameMetadataTests { PngFrameMetadata meta = new() { - FrameDelay = new(1, 0), + FrameDelay = new Rational(1, 0), DisposalMode = FrameDisposalMode.RestoreToBackground, BlendMode = FrameBlendMode.Over, }; @@ -25,7 +25,7 @@ public class PngFrameMetadataTests Assert.True(meta.DisposalMode.Equals(clone.DisposalMode)); Assert.True(meta.BlendMode.Equals(clone.BlendMode)); - clone.FrameDelay = new(2, 1); + clone.FrameDelay = new Rational(2, 1); clone.DisposalMode = FrameDisposalMode.RestoreToPrevious; clone.BlendMode = FrameBlendMode.Source; diff --git a/tests/ImageSharp.Tests/Formats/Png/PngMetadataTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngMetadataTests.cs index 690299024..5cbc27611 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngMetadataTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngMetadataTests.cs @@ -111,10 +111,10 @@ public class PngMetadataTests using MemoryStream memoryStream = new(); // This will be a zTXt chunk. - PngTextData expectedText = new("large-text", new('c', 100), string.Empty, string.Empty); + PngTextData expectedText = new("large-text", new string('c', 100), string.Empty, string.Empty); // This will be a iTXt chunk. - PngTextData expectedTextNoneLatin = new("large-text-non-latin", new('Ф', 100), "language-tag", "translated-keyword"); + PngTextData expectedTextNoneLatin = new("large-text-non-latin", new string('Ф', 100), "language-tag", "translated-keyword"); PngMetadata inputMetadata = input.Metadata.GetFormatMetadata(PngFormat.Instance); inputMetadata.TextData.Add(expectedText); inputMetadata.TextData.Add(expectedTextNoneLatin); diff --git a/tests/ImageSharp.Tests/Formats/Png/PngTextDataTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngTextDataTests.cs index f4c2f5897..4c46692f3 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngTextDataTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngTextDataTests.cs @@ -65,7 +65,7 @@ public class PngTextDataTests Assert.Equal("unit", property.LanguageTag); Assert.Equal("test", property.TranslatedKeyword); - property = new("Foo", string.Empty, string.Empty, null); + property = new PngTextData("Foo", string.Empty, string.Empty, null); Assert.Equal("Foo", property.Keyword); Assert.Equal(string.Empty, property.Value); Assert.Equal(string.Empty, property.LanguageTag); diff --git a/tests/ImageSharp.Tests/Formats/Qoi/ImageExtensionsTest.cs b/tests/ImageSharp.Tests/Formats/Qoi/ImageExtensionsTest.cs index 11e79512e..31ec27da0 100644 --- a/tests/ImageSharp.Tests/Formats/Qoi/ImageExtensionsTest.cs +++ b/tests/ImageSharp.Tests/Formats/Qoi/ImageExtensionsTest.cs @@ -47,7 +47,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsQoi(file, new()); + image.SaveAsQoi(file, new QoiEncoder()); } IImageFormat format = Image.DetectFormat(file); @@ -108,7 +108,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsQoi(memoryStream, new()); + image.SaveAsQoi(memoryStream, new QoiEncoder()); } memoryStream.Position = 0; diff --git a/tests/ImageSharp.Tests/Formats/Tga/ImageExtensionsTest.cs b/tests/ImageSharp.Tests/Formats/Tga/ImageExtensionsTest.cs index 9648f93e5..9b6daee4c 100644 --- a/tests/ImageSharp.Tests/Formats/Tga/ImageExtensionsTest.cs +++ b/tests/ImageSharp.Tests/Formats/Tga/ImageExtensionsTest.cs @@ -47,7 +47,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsTga(file, new()); + image.SaveAsTga(file, new TgaEncoder()); } IImageFormat format = Image.DetectFormat(file); @@ -108,7 +108,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsTga(memoryStream, new()); + image.SaveAsTga(memoryStream, new TgaEncoder()); } memoryStream.Position = 0; diff --git a/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs index dbd7885e5..03669908e 100644 --- a/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs @@ -749,7 +749,7 @@ public class TgaDecoderTests { DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 } + TargetSize = new Size { Width = 150, Height = 150 } }; using Image image = provider.GetImage(TgaDecoder.Instance, options); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/BigTiffMetadataTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/BigTiffMetadataTests.cs index 04e8f2940..d19f27807 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/BigTiffMetadataTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/BigTiffMetadataTests.cs @@ -131,7 +131,7 @@ public class BigTiffMetadataTests values.Add(newExifValue); } - input.Frames.RootFrame.Metadata.ExifProfile = new(values, Array.Empty()); + input.Frames.RootFrame.Metadata.ExifProfile = new ExifProfile(values, Array.Empty()); // act TiffEncoder encoder = new(); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/Compression/DeflateTiffCompressionTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/Compression/DeflateTiffCompressionTests.cs index ca39cd5be..cc2faeab7 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/Compression/DeflateTiffCompressionTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/Compression/DeflateTiffCompressionTests.cs @@ -41,6 +41,6 @@ public class DeflateTiffCompressionTests } compressedStream.Seek(0, SeekOrigin.Begin); - return new(Configuration.Default, compressedStream); + return new BufferedReadStream(Configuration.Default, compressedStream); } } diff --git a/tests/ImageSharp.Tests/Formats/Tiff/Compression/LzwTiffCompressionTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/Compression/LzwTiffCompressionTests.cs index 01aaca9f5..25c9633c1 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/Compression/LzwTiffCompressionTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/Compression/LzwTiffCompressionTests.cs @@ -54,6 +54,6 @@ public class LzwTiffCompressionTests compressedStream.Seek(0, SeekOrigin.Begin); - return new(Configuration.Default, compressedStream); + return new BufferedReadStream(Configuration.Default, compressedStream); } } diff --git a/tests/ImageSharp.Tests/Formats/Tiff/Compression/NoneTiffCompressionTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/Compression/NoneTiffCompressionTests.cs index 0a2726c21..b911d1b17 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/Compression/NoneTiffCompressionTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/Compression/NoneTiffCompressionTests.cs @@ -14,11 +14,11 @@ public class NoneTiffCompressionTests [InlineData(new byte[] { 10, 15, 20, 25, 30, 35, 40, 45 }, 5, new byte[] { 10, 15, 20, 25, 30 })] public void Decompress_ReadsData(byte[] inputData, uint byteCount, byte[] expectedResult) { - using MemoryStream memoryStream = new MemoryStream(inputData); - using BufferedReadStream stream = new BufferedReadStream(Configuration.Default, memoryStream); + using MemoryStream memoryStream = new(inputData); + using BufferedReadStream stream = new(Configuration.Default, memoryStream); byte[] buffer = new byte[expectedResult.Length]; - using NoneTiffCompression decompressor = new NoneTiffCompression(default, default, default); + using NoneTiffCompression decompressor = new(default, default, default); decompressor.Decompress(stream, 0, byteCount, 1, buffer, default); Assert.Equal(expectedResult, buffer); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/Compression/PackBitsTiffCompressionTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/Compression/PackBitsTiffCompressionTests.cs index f5fbcb2e1..8f71cdda7 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/Compression/PackBitsTiffCompressionTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/Compression/PackBitsTiffCompressionTests.cs @@ -22,11 +22,11 @@ public class PackBitsTiffCompressionTests [InlineData(new byte[] { 0xFE, 0xAA, 0x02, 0x80, 0x00, 0x2A, 0xFD, 0xAA, 0x03, 0x80, 0x00, 0x2A, 0x22, 0xF7, 0xAA }, new byte[] { 0xAA, 0xAA, 0xAA, 0x80, 0x00, 0x2A, 0xAA, 0xAA, 0xAA, 0xAA, 0x80, 0x00, 0x2A, 0x22, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA })] // Apple PackBits sample public void Decompress_ReadsData(byte[] inputData, byte[] expectedResult) { - using MemoryStream memoryStream = new MemoryStream(inputData); - using BufferedReadStream stream = new BufferedReadStream(Configuration.Default, memoryStream); + using MemoryStream memoryStream = new(inputData); + using BufferedReadStream stream = new(Configuration.Default, memoryStream); byte[] buffer = new byte[expectedResult.Length]; - using PackBitsTiffCompression decompressor = new PackBitsTiffCompression(MemoryAllocator.Create(), default, default); + using PackBitsTiffCompression decompressor = new(MemoryAllocator.Create(), default, default); decompressor.Decompress(stream, 0, (uint)inputData.Length, 1, buffer, default); Assert.Equal(expectedResult, buffer); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/ImageExtensionsTest.cs b/tests/ImageSharp.Tests/Formats/Tiff/ImageExtensionsTest.cs index 69d70e5e7..bf9e73ea6 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/ImageExtensionsTest.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/ImageExtensionsTest.cs @@ -48,7 +48,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsTiff(file, new()); + image.SaveAsTiff(file, new TiffEncoder()); } IImageFormat format = Image.DetectFormat(file); @@ -109,7 +109,7 @@ public class ImageExtensionsTest using (Image image = new(10, 10)) { - image.SaveAsTiff(memoryStream, new()); + image.SaveAsTiff(memoryStream, new TiffEncoder()); } memoryStream.Position = 0; diff --git a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColorTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColorTests.cs index d2176f7e6..0fa7e01e8 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColorTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColorTests.cs @@ -154,7 +154,7 @@ public class BlackIsZeroTiffColorTests : PhotometricInterpretationTestBase public void Decode_WritesPixelData(byte[] inputData, ushort bitsPerSample, int left, int top, int width, int height, Rgba32[][] expectedResult) => AssertDecode( expectedResult, - pixels => new BlackIsZeroTiffColor(new(bitsPerSample, 0, 0)).Decode(inputData, pixels, left, top, width, height)); + pixels => new BlackIsZeroTiffColor(new TiffBitsPerSample(bitsPerSample, 0, 0)).Decode(inputData, pixels, left, top, width, height)); [Theory] [MemberData(nameof(BilevelData))] diff --git a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PaletteTiffColorTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PaletteTiffColorTests.cs index fce40c4c4..13be77a29 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PaletteTiffColorTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PaletteTiffColorTests.cs @@ -83,7 +83,7 @@ public class PaletteTiffColorTests : PhotometricInterpretationTestBase public void Decode_WritesPixelData(byte[] inputData, ushort bitsPerSample, ushort[] colorMap, int left, int top, int width, int height, Rgba32[][] expectedResult) => AssertDecode(expectedResult, pixels => { - new PaletteTiffColor(new(bitsPerSample, 0, 0), colorMap).Decode(inputData, pixels, left, top, width, height); + new PaletteTiffColor(new TiffBitsPerSample(bitsPerSample, 0, 0), colorMap).Decode(inputData, pixels, left, top, width, height); }); private static uint[][] GeneratePalette(int count) @@ -124,7 +124,7 @@ public class PaletteTiffColorTests : PhotometricInterpretationTestBase for (int x = 0; x < pixelLookup[y].Length; x++) { uint[] sourceColor = colorPalette[pixelLookup[y][x]]; - result[y][x] = new(sourceColor[0] / 65535F, sourceColor[1] / 65535F, sourceColor[2] / 65535F); + result[y][x] = new Rgba32(sourceColor[0] / 65535F, sourceColor[1] / 65535F, sourceColor[2] / 65535F); } } diff --git a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PhotometricInterpretationTestBase.cs b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PhotometricInterpretationTestBase.cs index ef57b288c..7040e167d 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PhotometricInterpretationTestBase.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PhotometricInterpretationTestBase.cs @@ -10,7 +10,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff.PhotometricInterpretation; [Trait("Format", "Tiff")] public abstract class PhotometricInterpretationTestBase { - public static Rgba32 DefaultColor = new Rgba32(42, 96, 18, 128); + public static Rgba32 DefaultColor = new(42, 96, 18, 128); public static Rgba32[][] Offset(Rgba32[][] input, int xOffset, int yOffset, int width, int height) { @@ -45,7 +45,7 @@ public abstract class PhotometricInterpretationTestBase int resultWidth = expectedResult[0].Length; int resultHeight = expectedResult.Length; - using (Image image = new Image(resultWidth, resultHeight)) + using (Image image = new(resultWidth, resultHeight)) { image.Mutate(x => x.BackgroundColor(Color.FromPixel(DefaultColor))); Buffer2D pixels = image.GetRootFramePixelBuffer(); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColorTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColorTests.cs index 6e0d5b2be..2ca9df3d0 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColorTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColorTests.cs @@ -12,19 +12,19 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff.PhotometricInterpretation; [Trait("Format", "Tiff")] public class RgbPlanarTiffColorTests : PhotometricInterpretationTestBase { - private static readonly Rgba32 Rgb4_000 = new Rgba32(0, 0, 0, 255); - private static readonly Rgba32 Rgb4_444 = new Rgba32(68, 68, 68, 255); - private static readonly Rgba32 Rgb4_888 = new Rgba32(136, 136, 136, 255); - private static readonly Rgba32 Rgb4_CCC = new Rgba32(204, 204, 204, 255); - private static readonly Rgba32 Rgb4_FFF = new Rgba32(255, 255, 255, 255); - private static readonly Rgba32 Rgb4_F00 = new Rgba32(255, 0, 0, 255); - private static readonly Rgba32 Rgb4_0F0 = new Rgba32(0, 255, 0, 255); - private static readonly Rgba32 Rgb4_00F = new Rgba32(0, 0, 255, 255); - private static readonly Rgba32 Rgb4_F0F = new Rgba32(255, 0, 255, 255); - private static readonly Rgba32 Rgb4_400 = new Rgba32(68, 0, 0, 255); - private static readonly Rgba32 Rgb4_800 = new Rgba32(136, 0, 0, 255); - private static readonly Rgba32 Rgb4_C00 = new Rgba32(204, 0, 0, 255); - private static readonly Rgba32 Rgb4_48C = new Rgba32(68, 136, 204, 255); + private static readonly Rgba32 Rgb4_000 = new(0, 0, 0, 255); + private static readonly Rgba32 Rgb4_444 = new(68, 68, 68, 255); + private static readonly Rgba32 Rgb4_888 = new(136, 136, 136, 255); + private static readonly Rgba32 Rgb4_CCC = new(204, 204, 204, 255); + private static readonly Rgba32 Rgb4_FFF = new(255, 255, 255, 255); + private static readonly Rgba32 Rgb4_F00 = new(255, 0, 0, 255); + private static readonly Rgba32 Rgb4_0F0 = new(0, 255, 0, 255); + private static readonly Rgba32 Rgb4_00F = new(0, 0, 255, 255); + private static readonly Rgba32 Rgb4_F0F = new(255, 0, 255, 255); + private static readonly Rgba32 Rgb4_400 = new(68, 0, 0, 255); + private static readonly Rgba32 Rgb4_800 = new(136, 0, 0, 255); + private static readonly Rgba32 Rgb4_C00 = new(204, 0, 0, 255); + private static readonly Rgba32 Rgb4_48C = new(68, 136, 204, 255); private static readonly byte[] Rgb4Bytes4X4R = { @@ -112,19 +112,19 @@ public class RgbPlanarTiffColorTests : PhotometricInterpretationTestBase } } - private static readonly Rgba32 Rgb8_000 = new Rgba32(0, 0, 0, 255); - private static readonly Rgba32 Rgb8_444 = new Rgba32(64, 64, 64, 255); - private static readonly Rgba32 Rgb8_888 = new Rgba32(128, 128, 128, 255); - private static readonly Rgba32 Rgb8_CCC = new Rgba32(192, 192, 192, 255); - private static readonly Rgba32 Rgb8_FFF = new Rgba32(255, 255, 255, 255); - private static readonly Rgba32 Rgb8_F00 = new Rgba32(255, 0, 0, 255); - private static readonly Rgba32 Rgb8_0F0 = new Rgba32(0, 255, 0, 255); - private static readonly Rgba32 Rgb8_00F = new Rgba32(0, 0, 255, 255); - private static readonly Rgba32 Rgb8_F0F = new Rgba32(255, 0, 255, 255); - private static readonly Rgba32 Rgb8_400 = new Rgba32(64, 0, 0, 255); - private static readonly Rgba32 Rgb8_800 = new Rgba32(128, 0, 0, 255); - private static readonly Rgba32 Rgb8_C00 = new Rgba32(192, 0, 0, 255); - private static readonly Rgba32 Rgb8_48C = new Rgba32(64, 128, 192, 255); + private static readonly Rgba32 Rgb8_000 = new(0, 0, 0, 255); + private static readonly Rgba32 Rgb8_444 = new(64, 64, 64, 255); + private static readonly Rgba32 Rgb8_888 = new(128, 128, 128, 255); + private static readonly Rgba32 Rgb8_CCC = new(192, 192, 192, 255); + private static readonly Rgba32 Rgb8_FFF = new(255, 255, 255, 255); + private static readonly Rgba32 Rgb8_F00 = new(255, 0, 0, 255); + private static readonly Rgba32 Rgb8_0F0 = new(0, 255, 0, 255); + private static readonly Rgba32 Rgb8_00F = new(0, 0, 255, 255); + private static readonly Rgba32 Rgb8_F0F = new(255, 0, 255, 255); + private static readonly Rgba32 Rgb8_400 = new(64, 0, 0, 255); + private static readonly Rgba32 Rgb8_800 = new(128, 0, 0, 255); + private static readonly Rgba32 Rgb8_C00 = new(192, 0, 0, 255); + private static readonly Rgba32 Rgb8_48C = new(64, 128, 192, 255); private static readonly byte[] Rgb8Bytes4X4R = { @@ -175,19 +175,19 @@ public class RgbPlanarTiffColorTests : PhotometricInterpretationTestBase } } - private static readonly Rgba32 Rgb484_000 = new Rgba32(0, 0, 0, 255); - private static readonly Rgba32 Rgb484_444 = new Rgba32(68, 64, 68, 255); - private static readonly Rgba32 Rgb484_888 = new Rgba32(136, 128, 136, 255); - private static readonly Rgba32 Rgb484_CCC = new Rgba32(204, 192, 204, 255); - private static readonly Rgba32 Rgb484_FFF = new Rgba32(255, 255, 255, 255); - private static readonly Rgba32 Rgb484_F00 = new Rgba32(255, 0, 0, 255); - private static readonly Rgba32 Rgb484_0F0 = new Rgba32(0, 255, 0, 255); - private static readonly Rgba32 Rgb484_00F = new Rgba32(0, 0, 255, 255); - private static readonly Rgba32 Rgb484_F0F = new Rgba32(255, 0, 255, 255); - private static readonly Rgba32 Rgb484_400 = new Rgba32(68, 0, 0, 255); - private static readonly Rgba32 Rgb484_800 = new Rgba32(136, 0, 0, 255); - private static readonly Rgba32 Rgb484_C00 = new Rgba32(204, 0, 0, 255); - private static readonly Rgba32 Rgb484_48C = new Rgba32(68, 128, 204, 255); + private static readonly Rgba32 Rgb484_000 = new(0, 0, 0, 255); + private static readonly Rgba32 Rgb484_444 = new(68, 64, 68, 255); + private static readonly Rgba32 Rgb484_888 = new(136, 128, 136, 255); + private static readonly Rgba32 Rgb484_CCC = new(204, 192, 204, 255); + private static readonly Rgba32 Rgb484_FFF = new(255, 255, 255, 255); + private static readonly Rgba32 Rgb484_F00 = new(255, 0, 0, 255); + private static readonly Rgba32 Rgb484_0F0 = new(0, 255, 0, 255); + private static readonly Rgba32 Rgb484_00F = new(0, 0, 255, 255); + private static readonly Rgba32 Rgb484_F0F = new(255, 0, 255, 255); + private static readonly Rgba32 Rgb484_400 = new(68, 0, 0, 255); + private static readonly Rgba32 Rgb484_800 = new(136, 0, 0, 255); + private static readonly Rgba32 Rgb484_C00 = new(204, 0, 0, 255); + private static readonly Rgba32 Rgb484_48C = new(68, 128, 204, 255); private static readonly byte[] Rgb484Bytes4X4R = { diff --git a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbTiffColorTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbTiffColorTests.cs index aeb135773..80a04a7d1 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbTiffColorTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbTiffColorTests.cs @@ -10,19 +10,19 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff.PhotometricInterpretation; [Trait("Format", "Tiff")] public class RgbTiffColorTests : PhotometricInterpretationTestBase { - private static readonly Rgba32 Rgb4_000 = new Rgba32(0, 0, 0, 255); - private static readonly Rgba32 Rgb4_444 = new Rgba32(68, 68, 68, 255); - private static readonly Rgba32 Rgb4_888 = new Rgba32(136, 136, 136, 255); - private static readonly Rgba32 Rgb4_CCC = new Rgba32(204, 204, 204, 255); - private static readonly Rgba32 Rgb4_FFF = new Rgba32(255, 255, 255, 255); - private static readonly Rgba32 Rgb4_F00 = new Rgba32(255, 0, 0, 255); - private static readonly Rgba32 Rgb4_0F0 = new Rgba32(0, 255, 0, 255); - private static readonly Rgba32 Rgb4_00F = new Rgba32(0, 0, 255, 255); - private static readonly Rgba32 Rgb4_F0F = new Rgba32(255, 0, 255, 255); - private static readonly Rgba32 Rgb4_400 = new Rgba32(68, 0, 0, 255); - private static readonly Rgba32 Rgb4_800 = new Rgba32(136, 0, 0, 255); - private static readonly Rgba32 Rgb4_C00 = new Rgba32(204, 0, 0, 255); - private static readonly Rgba32 Rgb4_48C = new Rgba32(68, 136, 204, 255); + private static readonly Rgba32 Rgb4_000 = new(0, 0, 0, 255); + private static readonly Rgba32 Rgb4_444 = new(68, 68, 68, 255); + private static readonly Rgba32 Rgb4_888 = new(136, 136, 136, 255); + private static readonly Rgba32 Rgb4_CCC = new(204, 204, 204, 255); + private static readonly Rgba32 Rgb4_FFF = new(255, 255, 255, 255); + private static readonly Rgba32 Rgb4_F00 = new(255, 0, 0, 255); + private static readonly Rgba32 Rgb4_0F0 = new(0, 255, 0, 255); + private static readonly Rgba32 Rgb4_00F = new(0, 0, 255, 255); + private static readonly Rgba32 Rgb4_F0F = new(255, 0, 255, 255); + private static readonly Rgba32 Rgb4_400 = new(68, 0, 0, 255); + private static readonly Rgba32 Rgb4_800 = new(136, 0, 0, 255); + private static readonly Rgba32 Rgb4_C00 = new(204, 0, 0, 255); + private static readonly Rgba32 Rgb4_48C = new(68, 136, 204, 255); private static readonly byte[] Rgb4Bytes4X4 = { @@ -74,19 +74,19 @@ public class RgbTiffColorTests : PhotometricInterpretationTestBase } } - private static readonly Rgba32 Rgb8_000 = new Rgba32(0, 0, 0, 255); - private static readonly Rgba32 Rgb8_444 = new Rgba32(64, 64, 64, 255); - private static readonly Rgba32 Rgb8_888 = new Rgba32(128, 128, 128, 255); - private static readonly Rgba32 Rgb8_CCC = new Rgba32(192, 192, 192, 255); - private static readonly Rgba32 Rgb8_FFF = new Rgba32(255, 255, 255, 255); - private static readonly Rgba32 Rgb8_F00 = new Rgba32(255, 0, 0, 255); - private static readonly Rgba32 Rgb8_0F0 = new Rgba32(0, 255, 0, 255); - private static readonly Rgba32 Rgb8_00F = new Rgba32(0, 0, 255, 255); - private static readonly Rgba32 Rgb8_F0F = new Rgba32(255, 0, 255, 255); - private static readonly Rgba32 Rgb8_400 = new Rgba32(64, 0, 0, 255); - private static readonly Rgba32 Rgb8_800 = new Rgba32(128, 0, 0, 255); - private static readonly Rgba32 Rgb8_C00 = new Rgba32(192, 0, 0, 255); - private static readonly Rgba32 Rgb8_48C = new Rgba32(64, 128, 192, 255); + private static readonly Rgba32 Rgb8_000 = new(0, 0, 0, 255); + private static readonly Rgba32 Rgb8_444 = new(64, 64, 64, 255); + private static readonly Rgba32 Rgb8_888 = new(128, 128, 128, 255); + private static readonly Rgba32 Rgb8_CCC = new(192, 192, 192, 255); + private static readonly Rgba32 Rgb8_FFF = new(255, 255, 255, 255); + private static readonly Rgba32 Rgb8_F00 = new(255, 0, 0, 255); + private static readonly Rgba32 Rgb8_0F0 = new(0, 255, 0, 255); + private static readonly Rgba32 Rgb8_00F = new(0, 0, 255, 255); + private static readonly Rgba32 Rgb8_F0F = new(255, 0, 255, 255); + private static readonly Rgba32 Rgb8_400 = new(64, 0, 0, 255); + private static readonly Rgba32 Rgb8_800 = new(128, 0, 0, 255); + private static readonly Rgba32 Rgb8_C00 = new(192, 0, 0, 255); + private static readonly Rgba32 Rgb8_48C = new(64, 128, 192, 255); private static readonly byte[] Rgb8Bytes4X4 = { @@ -116,19 +116,19 @@ public class RgbTiffColorTests : PhotometricInterpretationTestBase } } - private static readonly Rgba32 Rgb484_000 = new Rgba32(0, 0, 0, 255); - private static readonly Rgba32 Rgb484_444 = new Rgba32(68, 64, 68, 255); - private static readonly Rgba32 Rgb484_888 = new Rgba32(136, 128, 136, 255); - private static readonly Rgba32 Rgb484_CCC = new Rgba32(204, 192, 204, 255); - private static readonly Rgba32 Rgb484_FFF = new Rgba32(255, 255, 255, 255); - private static readonly Rgba32 Rgb484_F00 = new Rgba32(255, 0, 0, 255); - private static readonly Rgba32 Rgb484_0F0 = new Rgba32(0, 255, 0, 255); - private static readonly Rgba32 Rgb484_00F = new Rgba32(0, 0, 255, 255); - private static readonly Rgba32 Rgb484_F0F = new Rgba32(255, 0, 255, 255); - private static readonly Rgba32 Rgb484_400 = new Rgba32(68, 0, 0, 255); - private static readonly Rgba32 Rgb484_800 = new Rgba32(136, 0, 0, 255); - private static readonly Rgba32 Rgb484_C00 = new Rgba32(204, 0, 0, 255); - private static readonly Rgba32 Rgb484_48C = new Rgba32(68, 128, 204, 255); + private static readonly Rgba32 Rgb484_000 = new(0, 0, 0, 255); + private static readonly Rgba32 Rgb484_444 = new(68, 64, 68, 255); + private static readonly Rgba32 Rgb484_888 = new(136, 128, 136, 255); + private static readonly Rgba32 Rgb484_CCC = new(204, 192, 204, 255); + private static readonly Rgba32 Rgb484_FFF = new(255, 255, 255, 255); + private static readonly Rgba32 Rgb484_F00 = new(255, 0, 0, 255); + private static readonly Rgba32 Rgb484_0F0 = new(0, 255, 0, 255); + private static readonly Rgba32 Rgb484_00F = new(0, 0, 255, 255); + private static readonly Rgba32 Rgb484_F0F = new(255, 0, 255, 255); + private static readonly Rgba32 Rgb484_400 = new(68, 0, 0, 255); + private static readonly Rgba32 Rgb484_800 = new(136, 0, 0, 255); + private static readonly Rgba32 Rgb484_C00 = new(204, 0, 0, 255); + private static readonly Rgba32 Rgb484_48C = new(68, 128, 204, 255); private static readonly byte[] Rgb484Bytes4X4 = { diff --git a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColorTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColorTests.cs index a79cc0058..fa193c184 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColorTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColorTests.cs @@ -155,7 +155,7 @@ public class WhiteIsZeroTiffColorTests : PhotometricInterpretationTestBase { AssertDecode(expectedResult, pixels => { - new WhiteIsZeroTiffColor(new(bitsPerSample, 0, 0)).Decode(inputData, pixels, left, top, width, height); + new WhiteIsZeroTiffColor(new TiffBitsPerSample(bitsPerSample, 0, 0)).Decode(inputData, pixels, left, top, width, height); }); } diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs index a16b26f9e..5dd1f7884 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs @@ -810,7 +810,7 @@ public class TiffDecoderTests : TiffDecoderBaseTester { DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 } + TargetSize = new Size { Width = 150, Height = 150 } }; using Image image = provider.GetImage(TiffDecoder.Instance, options); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderBaseTester.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderBaseTester.cs index 70ba2e5df..158a0d473 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderBaseTester.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderBaseTester.cs @@ -26,9 +26,9 @@ public abstract class TiffEncoderBaseTester where TPixel : unmanaged, IPixel { // arrange - TiffEncoder tiffEncoder = new TiffEncoder() { PhotometricInterpretation = photometricInterpretation, Compression = compression }; + TiffEncoder tiffEncoder = new() { PhotometricInterpretation = photometricInterpretation, Compression = compression }; using Image input = provider.GetImage(); - using MemoryStream memStream = new MemoryStream(); + using MemoryStream memStream = new(); TiffFrameMetadata inputMeta = input.Frames.RootFrame.Metadata.GetTiffMetadata(); TiffCompression inputCompression = inputMeta.Compression; @@ -89,7 +89,7 @@ public abstract class TiffEncoderBaseTester where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - TiffEncoder encoder = new TiffEncoder + TiffEncoder encoder = new() { PhotometricInterpretation = photometricInterpretation, BitsPerPixel = bitsPerPixel, diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderMultiframeTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderMultiframeTests.cs index a138d9ef8..9f6e74183 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderMultiframeTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderMultiframeTests.cs @@ -46,7 +46,7 @@ public class TiffEncoderMultiframeTests : TiffEncoderBaseTester image.Frames.RemoveFrame(0); TiffBitsPerPixel bitsPerPixel = TiffBitsPerPixel.Bit24; - TiffEncoder encoder = new TiffEncoder + TiffEncoder encoder = new() { PhotometricInterpretation = TiffPhotometricInterpretation.Rgb, BitsPerPixel = bitsPerPixel, @@ -69,22 +69,22 @@ public class TiffEncoderMultiframeTests : TiffEncoderBaseTester using Image image = provider.GetImage(); Assert.Equal(1, image.Frames.Count); - using Image image1 = new Image(image.Width, image.Height, Color.Green.ToPixel()); + using Image image1 = new(image.Width, image.Height, Color.Green.ToPixel()); - using Image image2 = new Image(image.Width, image.Height, Color.Yellow.ToPixel()); + using Image image2 = new(image.Width, image.Height, Color.Yellow.ToPixel()); image.Frames.AddFrame(image1.Frames.RootFrame); image.Frames.AddFrame(image2.Frames.RootFrame); TiffBitsPerPixel bitsPerPixel = TiffBitsPerPixel.Bit24; - TiffEncoder encoder = new TiffEncoder + TiffEncoder encoder = new() { PhotometricInterpretation = TiffPhotometricInterpretation.Rgb, BitsPerPixel = bitsPerPixel, Compression = TiffCompression.Deflate }; - using (MemoryStream ms = new System.IO.MemoryStream()) + using (MemoryStream ms = new()) { image.Save(ms, encoder); @@ -121,11 +121,11 @@ public class TiffEncoderMultiframeTests : TiffEncoderBaseTester { using Image image = provider.GetImage(); - using Image image0 = new Image(image.Width, image.Height, Color.Red.ToPixel()); + using Image image0 = new(image.Width, image.Height, Color.Red.ToPixel()); - using Image image1 = new Image(image.Width, image.Height, Color.Green.ToPixel()); + using Image image1 = new(image.Width, image.Height, Color.Green.ToPixel()); - using Image image2 = new Image(image.Width, image.Height, Color.Yellow.ToPixel()); + using Image image2 = new(image.Width, image.Height, Color.Yellow.ToPixel()); image.Frames.AddFrame(image0.Frames.RootFrame); image.Frames.AddFrame(image1.Frames.RootFrame); @@ -133,14 +133,14 @@ public class TiffEncoderMultiframeTests : TiffEncoderBaseTester image.Frames.RemoveFrame(0); TiffBitsPerPixel bitsPerPixel = TiffBitsPerPixel.Bit8; - TiffEncoder encoder = new TiffEncoder + TiffEncoder encoder = new() { PhotometricInterpretation = TiffPhotometricInterpretation.PaletteColor, BitsPerPixel = bitsPerPixel, Compression = TiffCompression.Lzw }; - using (MemoryStream ms = new System.IO.MemoryStream()) + using (MemoryStream ms = new()) { image.Save(ms, encoder); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs index b00b8d7ac..4317c2714 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs @@ -334,7 +334,7 @@ public class TiffEncoderTests : TiffEncoderBaseTester foreach (ImageFrame frame in image.Frames) { TiffFrameMetadata metadata = frame.Metadata.GetTiffMetadata(); - encodedDimensions.Add(new(metadata.EncodingWidth, metadata.EncodingHeight)); + encodedDimensions.Add(new Size(metadata.EncodingWidth, metadata.EncodingHeight)); } const int scale = 2; diff --git a/tests/ImageSharp.Tests/Formats/Tiff/Utils/TiffWriterTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/Utils/TiffWriterTests.cs index 3bcbd26e5..939baeeb6 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/Utils/TiffWriterTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/Utils/TiffWriterTests.cs @@ -11,8 +11,8 @@ public class TiffWriterTests [Fact] public void IsLittleEndian_IsTrueOnWindows() { - using MemoryStream stream = new MemoryStream(); - using TiffStreamWriter writer = new TiffStreamWriter(stream); + using MemoryStream stream = new(); + using TiffStreamWriter writer = new(stream); Assert.True(TiffStreamWriter.IsLittleEndian); } @@ -22,8 +22,8 @@ public class TiffWriterTests [InlineData(new byte[] { 1, 2, 3, 4, 5 }, 5)] public void Position_EqualsTheStreamPosition(byte[] data, long expectedResult) { - using MemoryStream stream = new MemoryStream(); - using TiffStreamWriter writer = new TiffStreamWriter(stream); + using MemoryStream stream = new(); + using TiffStreamWriter writer = new(stream); writer.Write(data); Assert.Equal(writer.Position, expectedResult); } @@ -31,8 +31,8 @@ public class TiffWriterTests [Fact] public void Write_WritesByte() { - using MemoryStream stream = new MemoryStream(); - using TiffStreamWriter writer = new TiffStreamWriter(stream); + using MemoryStream stream = new(); + using TiffStreamWriter writer = new(stream); writer.Write(42); Assert.Equal(new byte[] { 42 }, stream.ToArray()); @@ -41,8 +41,8 @@ public class TiffWriterTests [Fact] public void Write_WritesByteArray() { - using MemoryStream stream = new MemoryStream(); - using TiffStreamWriter writer = new TiffStreamWriter(stream); + using MemoryStream stream = new(); + using TiffStreamWriter writer = new(stream); writer.Write(new byte[] { 2, 4, 6, 8 }); Assert.Equal(new byte[] { 2, 4, 6, 8 }, stream.ToArray()); @@ -51,8 +51,8 @@ public class TiffWriterTests [Fact] public void Write_WritesUInt16() { - using MemoryStream stream = new MemoryStream(); - using TiffStreamWriter writer = new TiffStreamWriter(stream); + using MemoryStream stream = new(); + using TiffStreamWriter writer = new(stream); writer.Write(1234, stackalloc byte[2]); Assert.Equal(new byte[] { 0xD2, 0x04 }, stream.ToArray()); @@ -61,8 +61,8 @@ public class TiffWriterTests [Fact] public void Write_WritesUInt32() { - using MemoryStream stream = new MemoryStream(); - using TiffStreamWriter writer = new TiffStreamWriter(stream); + using MemoryStream stream = new(); + using TiffStreamWriter writer = new(stream); writer.Write(12345678U, stackalloc byte[4]); Assert.Equal(new byte[] { 0x4E, 0x61, 0xBC, 0x00 }, stream.ToArray()); @@ -78,8 +78,8 @@ public class TiffWriterTests public void WritePadded_WritesByteArray(byte[] bytes, byte[] expectedResult) { - using MemoryStream stream = new MemoryStream(); - using TiffStreamWriter writer = new TiffStreamWriter(stream); + using MemoryStream stream = new(); + using TiffStreamWriter writer = new(stream); writer.WritePadded(bytes); Assert.Equal(expectedResult, stream.ToArray()); @@ -88,10 +88,10 @@ public class TiffWriterTests [Fact] public void WriteMarker_WritesToPlacedPosition() { - using MemoryStream stream = new MemoryStream(); + using MemoryStream stream = new(); Span buffer = stackalloc byte[4]; - using (TiffStreamWriter writer = new TiffStreamWriter(stream)) + using (TiffStreamWriter writer = new(stream)) { writer.Write(0x11111111, buffer); long marker = writer.PlaceMarker(buffer); diff --git a/tests/ImageSharp.Tests/Formats/WebP/ImageExtensionsTests.cs b/tests/ImageSharp.Tests/Formats/WebP/ImageExtensionsTests.cs index 510d67103..ea13fd712 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/ImageExtensionsTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/ImageExtensionsTests.cs @@ -48,7 +48,7 @@ public class ImageExtensionsTests using (Image image = new(10, 10)) { - image.SaveAsWebp(file, new()); + image.SaveAsWebp(file, new WebpEncoder()); } IImageFormat format = Image.DetectFormat(file); @@ -109,7 +109,7 @@ public class ImageExtensionsTests using (Image image = new(10, 10)) { - image.SaveAsWebp(memoryStream, new()); + image.SaveAsWebp(memoryStream, new WebpEncoder()); } memoryStream.Position = 0; diff --git a/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs b/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs index 321aff2bd..09aa94c75 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs @@ -89,7 +89,7 @@ public class LosslessUtilsTests 392450, 196861, 16712192, 16711680, 130564, 16451071 }; - Vp8LMultipliers m = new Vp8LMultipliers() + Vp8LMultipliers m = new() { GreenToBlue = 240, GreenToRed = 232, @@ -121,7 +121,7 @@ public class LosslessUtilsTests 16711680, 65027, 16712962 }; - Vp8LMultipliers m = new Vp8LMultipliers() + Vp8LMultipliers m = new() { GreenToBlue = 240, GreenToRed = 232, diff --git a/tests/ImageSharp.Tests/Formats/WebP/PredictorEncoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/PredictorEncoderTests.cs index a15441756..b4279b045 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/PredictorEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/PredictorEncoderTests.cs @@ -150,7 +150,7 @@ public class PredictorEncoderTests where TPixel : unmanaged, IPixel { Rgba32 rgba = color.ToRgba32(); - return new(rgba.R, rgba.G, rgba.B, rgba.A); + return new Bgra32(rgba.R, rgba.G, rgba.B, rgba.A); } private static string TestImageFullPath(string path) diff --git a/tests/ImageSharp.Tests/Formats/WebP/Vp8HistogramTests.cs b/tests/ImageSharp.Tests/Formats/WebP/Vp8HistogramTests.cs index 79c7ff26b..990c58385 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/Vp8HistogramTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/Vp8HistogramTests.cs @@ -13,7 +13,7 @@ public class Vp8HistogramTests { get { - List result = new List(); + List result = new(); result.Add(new object[] { new byte[] @@ -69,7 +69,7 @@ public class Vp8HistogramTests private static void RunCollectHistogramTest() { // arrange - Vp8Histogram histogram = new Vp8Histogram(); + Vp8Histogram histogram = new(); byte[] reference = { @@ -172,7 +172,7 @@ public class Vp8HistogramTests public void GetAlpha_WithEmptyHistogram_Works() { // arrange - Vp8Histogram histogram = new Vp8Histogram(); + Vp8Histogram histogram = new(); // act int alpha = histogram.GetAlpha(); @@ -186,7 +186,7 @@ public class Vp8HistogramTests public void GetAlpha_Works(byte[] reference, byte[] pred) { // arrange - Vp8Histogram histogram = new Vp8Histogram(); + Vp8Histogram histogram = new(); histogram.CollectHistogram(reference, pred, 0, 1); // act @@ -201,9 +201,9 @@ public class Vp8HistogramTests public void Merge_Works(byte[] reference, byte[] pred) { // arrange - Vp8Histogram histogram1 = new Vp8Histogram(); + Vp8Histogram histogram1 = new(); histogram1.CollectHistogram(reference, pred, 0, 1); - Vp8Histogram histogram2 = new Vp8Histogram(); + Vp8Histogram histogram2 = new(); histogram1.Merge(histogram2); // act diff --git a/tests/ImageSharp.Tests/Formats/WebP/Vp8ModeScoreTests.cs b/tests/ImageSharp.Tests/Formats/WebP/Vp8ModeScoreTests.cs index a014e8991..ded637967 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/Vp8ModeScoreTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/Vp8ModeScoreTests.cs @@ -11,7 +11,7 @@ public class Vp8ModeScoreTests [Fact] public void InitScore_Works() { - Vp8ModeScore score = new Vp8ModeScore(); + Vp8ModeScore score = new(); score.InitScore(); Assert.Equal(0, score.D); Assert.Equal(0, score.SD); @@ -25,7 +25,7 @@ public class Vp8ModeScoreTests public void CopyScore_Works() { // arrange - Vp8ModeScore score1 = new Vp8ModeScore + Vp8ModeScore score1 = new() { Score = 123, Nz = 1, @@ -36,7 +36,7 @@ public class Vp8ModeScoreTests R = 6, SD = 7 }; - Vp8ModeScore score2 = new Vp8ModeScore(); + Vp8ModeScore score2 = new(); score2.InitScore(); // act @@ -55,7 +55,7 @@ public class Vp8ModeScoreTests public void AddScore_Works() { // arrange - Vp8ModeScore score1 = new Vp8ModeScore + Vp8ModeScore score1 = new() { Score = 123, Nz = 1, @@ -66,7 +66,7 @@ public class Vp8ModeScoreTests R = 6, SD = 7 }; - Vp8ModeScore score2 = new Vp8ModeScore + Vp8ModeScore score2 = new() { Score = 123, Nz = 1, diff --git a/tests/ImageSharp.Tests/Formats/WebP/Vp8ResidualTests.cs b/tests/ImageSharp.Tests/Formats/WebP/Vp8ResidualTests.cs index dcb54dc19..4982929c2 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/Vp8ResidualTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/Vp8ResidualTests.cs @@ -80,7 +80,7 @@ public class Vp8ResidualTests Vp8BandProbas[] bandProbas = new Vp8BandProbas[8]; for (int i = 0; i < bandProbas.Length; i++) { - bandProbas[i] = new(); + bandProbas[i] = new Vp8BandProbas(); for (int j = 0; j < bandProbas[i].Probabilities.Length; j++) { for (int k = 0; k < 11; k++) @@ -95,7 +95,7 @@ public class Vp8ResidualTests residual.Costs = new Vp8Costs[16]; for (int i = 0; i < residual.Costs.Length; i++) { - residual.Costs[i] = new(); + residual.Costs[i] = new Vp8Costs(); Vp8CostArray[] costsArray = residual.Costs[i].Costs; for (int j = 0; j < costsArray.Length; j++) { @@ -109,7 +109,7 @@ public class Vp8ResidualTests residual.Stats = new Vp8Stats[8]; for (int i = 0; i < residual.Stats.Length; i++) { - residual.Stats[i] = new(); + residual.Stats[i] = new Vp8Stats(); for (int j = 0; j < residual.Stats[i].Stats.Length; j++) { for (int k = 0; k < residual.Stats[i].Stats[j].Stats.Length; k++) diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs index f8c7770e6..111544f7f 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs @@ -349,7 +349,7 @@ public class WebpDecoderTests WebpDecoderOptions options = new() { BackgroundColorHandling = BackgroundColorHandling.Ignore, - GeneralOptions = new() + GeneralOptions = new DecoderOptions { MaxFrames = 1 } @@ -388,7 +388,7 @@ public class WebpDecoderTests { DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 } + TargetSize = new Size { Width = 150, Height = 150 } }; using Image image = provider.GetImage(WebpDecoder.Instance, options); @@ -460,7 +460,7 @@ public class WebpDecoderTests // Web using Image image = provider.GetImage( WebpDecoder.Instance, - new() { BackgroundColorHandling = BackgroundColorHandling.Ignore }); + new WebpDecoderOptions { BackgroundColorHandling = BackgroundColorHandling.Ignore }); // We can't use the reference decoder here. // It creates frames of different size without blending the frames. diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs index 55a6e8ba0..f9836ffb1 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs @@ -139,14 +139,14 @@ public class WebpEncoderTests }; provider.Utility.SaveTestOutputFile(image, "gif", gifEncoder, "octree"); - gifEncoder = new() + gifEncoder = new GifEncoder { Quantizer = new WuQuantizer(options) }; provider.Utility.SaveTestOutputFile(image, "gif", gifEncoder, "wu"); // Now clone and quantize the image using the same quantizers without alpha thresholding and save as webp. - options = new() + options = new QuantizerOptions { TransparencyThreshold = 0 }; diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebpMetaDataTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebpMetaDataTests.cs index fefe27790..020b42f37 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebpMetaDataTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpMetaDataTests.cs @@ -103,9 +103,9 @@ public class WebpMetaDataTests public void Encode_WritesExifWithPadding(WebpFileFormatType fileFormatType) { // arrange - using Image input = new Image(25, 25); - using MemoryStream memoryStream = new MemoryStream(); - ExifProfile expectedExif = new ExifProfile(); + using Image input = new(25, 25); + using MemoryStream memoryStream = new(); + ExifProfile expectedExif = new(); string expectedSoftware = "ImageSharp"; expectedExif.SetValue(ExifTag.Software, expectedSoftware); input.Metadata.ExifProfile = expectedExif; @@ -129,7 +129,7 @@ public class WebpMetaDataTests { // arrange using Image input = provider.GetImage(WebpDecoder.Instance); - using MemoryStream memoryStream = new MemoryStream(); + using MemoryStream memoryStream = new(); ExifProfile expectedExif = input.Metadata.ExifProfile; // act @@ -150,7 +150,7 @@ public class WebpMetaDataTests { // arrange using Image input = provider.GetImage(WebpDecoder.Instance); - using MemoryStream memoryStream = new MemoryStream(); + using MemoryStream memoryStream = new(); ExifProfile expectedExif = input.Metadata.ExifProfile; // act @@ -174,7 +174,7 @@ public class WebpMetaDataTests ImageSharp.Metadata.Profiles.Icc.IccProfile expectedProfile = input.Metadata.IccProfile; byte[] expectedProfileBytes = expectedProfile.ToByteArray(); - using MemoryStream memStream = new MemoryStream(); + using MemoryStream memStream = new(); input.Save(memStream, new WebpEncoder() { FileFormat = fileFormat diff --git a/tests/ImageSharp.Tests/GraphicOptionsDefaultsExtensionsTests.cs b/tests/ImageSharp.Tests/GraphicOptionsDefaultsExtensionsTests.cs index e894f7b86..682f5373d 100644 --- a/tests/ImageSharp.Tests/GraphicOptionsDefaultsExtensionsTests.cs +++ b/tests/ImageSharp.Tests/GraphicOptionsDefaultsExtensionsTests.cs @@ -12,9 +12,9 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void SetDefaultOptionsOnProcessingContext() { - GraphicsOptions option = new GraphicsOptions(); - Configuration config = new Configuration(); - FakeImageOperationsProvider.FakeImageOperations context = new FakeImageOperationsProvider.FakeImageOperations(config, null, true); + GraphicsOptions option = new(); + Configuration config = new(); + FakeImageOperationsProvider.FakeImageOperations context = new(config, null, true); context.SetGraphicsOptions(option); @@ -26,12 +26,12 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void UpdateDefaultOptionsOnProcessingContext_AlwaysNewInstance() { - GraphicsOptions option = new GraphicsOptions() + GraphicsOptions option = new() { BlendPercentage = 0.9f }; - Configuration config = new Configuration(); - FakeImageOperationsProvider.FakeImageOperations context = new FakeImageOperationsProvider.FakeImageOperations(config, null, true); + Configuration config = new(); + FakeImageOperationsProvider.FakeImageOperations context = new(config, null, true); context.SetGraphicsOptions(option); context.SetGraphicsOptions(o => @@ -48,8 +48,8 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void SetDefaultOptionsOnConfiguration() { - GraphicsOptions option = new GraphicsOptions(); - Configuration config = new Configuration(); + GraphicsOptions option = new(); + Configuration config = new(); config.SetGraphicsOptions(option); @@ -59,11 +59,11 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void UpdateDefaultOptionsOnConfiguration_AlwaysNewInstance() { - GraphicsOptions option = new GraphicsOptions() + GraphicsOptions option = new() { BlendPercentage = 0.9f }; - Configuration config = new Configuration(); + Configuration config = new(); config.SetGraphicsOptions(option); config.SetGraphicsOptions(o => @@ -80,7 +80,7 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void GetDefaultOptionsFromConfiguration_SettingNullThenReturnsNewInstance() { - Configuration config = new Configuration(); + Configuration config = new(); GraphicsOptions options = config.GetGraphicsOptions(); Assert.NotNull(options); @@ -96,7 +96,7 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void GetDefaultOptionsFromConfiguration_IgnoreIncorectlyTypesDictionEntry() { - Configuration config = new Configuration(); + Configuration config = new(); config.Properties[typeof(GraphicsOptions)] = "wronge type"; GraphicsOptions options = config.GetGraphicsOptions(); @@ -107,7 +107,7 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void GetDefaultOptionsFromConfiguration_AlwaysReturnsInstance() { - Configuration config = new Configuration(); + Configuration config = new(); Assert.DoesNotContain(typeof(GraphicsOptions), config.Properties.Keys); GraphicsOptions options = config.GetGraphicsOptions(); @@ -117,7 +117,7 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void GetDefaultOptionsFromConfiguration_AlwaysReturnsSameValue() { - Configuration config = new Configuration(); + Configuration config = new(); GraphicsOptions options = config.GetGraphicsOptions(); GraphicsOptions options2 = config.GetGraphicsOptions(); @@ -127,8 +127,8 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void GetDefaultOptionsFromProcessingContext_AlwaysReturnsInstance() { - Configuration config = new Configuration(); - FakeImageOperationsProvider.FakeImageOperations context = new FakeImageOperationsProvider.FakeImageOperations(config, null, true); + Configuration config = new(); + FakeImageOperationsProvider.FakeImageOperations context = new(config, null, true); GraphicsOptions ctxOptions = context.GetGraphicsOptions(); Assert.NotNull(ctxOptions); @@ -137,8 +137,8 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void GetDefaultOptionsFromProcessingContext_AlwaysReturnsInstanceEvenIfSetToNull() { - Configuration config = new Configuration(); - FakeImageOperationsProvider.FakeImageOperations context = new FakeImageOperationsProvider.FakeImageOperations(config, null, true); + Configuration config = new(); + FakeImageOperationsProvider.FakeImageOperations context = new(config, null, true); context.SetGraphicsOptions((GraphicsOptions)null); GraphicsOptions ctxOptions = context.GetGraphicsOptions(); @@ -148,10 +148,10 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void GetDefaultOptionsFromProcessingContext_FallbackToConfigsInstance() { - GraphicsOptions option = new GraphicsOptions(); - Configuration config = new Configuration(); + GraphicsOptions option = new(); + Configuration config = new(); config.SetGraphicsOptions(option); - FakeImageOperationsProvider.FakeImageOperations context = new FakeImageOperationsProvider.FakeImageOperations(config, null, true); + FakeImageOperationsProvider.FakeImageOperations context = new(config, null, true); GraphicsOptions ctxOptions = context.GetGraphicsOptions(); Assert.Equal(option, ctxOptions); @@ -160,8 +160,8 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void GetDefaultOptionsFromProcessingContext_IgnoreIncorectlyTypesDictionEntry() { - Configuration config = new Configuration(); - FakeImageOperationsProvider.FakeImageOperations context = new FakeImageOperationsProvider.FakeImageOperations(config, null, true); + Configuration config = new(); + FakeImageOperationsProvider.FakeImageOperations context = new(config, null, true); context.Properties[typeof(GraphicsOptions)] = "wronge type"; GraphicsOptions options = context.GetGraphicsOptions(); Assert.NotNull(options); diff --git a/tests/ImageSharp.Tests/GraphicsOptionsTests.cs b/tests/ImageSharp.Tests/GraphicsOptionsTests.cs index 351254e40..0ccb80d3f 100644 --- a/tests/ImageSharp.Tests/GraphicsOptionsTests.cs +++ b/tests/ImageSharp.Tests/GraphicsOptionsTests.cs @@ -8,8 +8,8 @@ namespace SixLabors.ImageSharp.Tests; public class GraphicsOptionsTests { - private static readonly GraphicsOptionsComparer GraphicsOptionsComparer = new GraphicsOptionsComparer(); - private readonly GraphicsOptions newGraphicsOptions = new GraphicsOptions(); + private static readonly GraphicsOptionsComparer GraphicsOptionsComparer = new(); + private readonly GraphicsOptions newGraphicsOptions = new(); private readonly GraphicsOptions cloneGraphicsOptions = new GraphicsOptions().DeepClone(); [Fact] @@ -57,7 +57,7 @@ public class GraphicsOptionsTests [Fact] public void NonDefaultClone() { - GraphicsOptions expected = new GraphicsOptions + GraphicsOptions expected = new() { AlphaCompositionMode = PixelAlphaCompositionMode.DestAtop, Antialias = false, @@ -74,7 +74,7 @@ public class GraphicsOptionsTests [Fact] public void CloneIsDeep() { - GraphicsOptions expected = new GraphicsOptions(); + GraphicsOptions expected = new(); GraphicsOptions actual = expected.DeepClone(); actual.AlphaCompositionMode = PixelAlphaCompositionMode.DestAtop; diff --git a/tests/ImageSharp.Tests/Helpers/ColorNumericsTests.cs b/tests/ImageSharp.Tests/Helpers/ColorNumericsTests.cs index 1e6ab7bc9..1bf137f34 100644 --- a/tests/ImageSharp.Tests/Helpers/ColorNumericsTests.cs +++ b/tests/ImageSharp.Tests/Helpers/ColorNumericsTests.cs @@ -15,7 +15,7 @@ public class ColorNumericsTests public void GetBT709Luminance_WithVector4(float x, float y, float z, int luminanceLevels, int expected) { // arrange - Vector4 vector = new Vector4(x, y, z, 0.0f); + Vector4 vector = new(x, y, z, 0.0f); // act int actual = ColorNumerics.GetBT709Luminance(ref vector, luminanceLevels); diff --git a/tests/ImageSharp.Tests/Helpers/NumericsTests.cs b/tests/ImageSharp.Tests/Helpers/NumericsTests.cs index c40fffd55..1106144c4 100644 --- a/tests/ImageSharp.Tests/Helpers/NumericsTests.cs +++ b/tests/ImageSharp.Tests/Helpers/NumericsTests.cs @@ -9,7 +9,7 @@ public class NumericsTests { private delegate void SpanAction(Span span, TArg arg, TArg1 arg1); - private readonly ApproximateFloatComparer approximateFloatComparer = new ApproximateFloatComparer(1e-6f); + private readonly ApproximateFloatComparer approximateFloatComparer = new(1e-6f); [Theory] [InlineData(0)] @@ -162,7 +162,7 @@ public class NumericsTests [InlineData(63)] public void PremultiplyVectorSpan(int length) { - Random rnd = new Random(42); + Random rnd = new(42); Vector4[] source = rnd.GenerateRandomVectorArray(length, 0, 1); Vector4[] expected = source.Select(v => { @@ -182,7 +182,7 @@ public class NumericsTests [InlineData(63)] public void UnPremultiplyVectorSpan(int length) { - Random rnd = new Random(42); + Random rnd = new(42); Vector4[] source = rnd.GenerateRandomVectorArray(length, 0, 1); Vector4[] expected = source.Select(v => { @@ -280,7 +280,7 @@ public class NumericsTests { Span actual = new T[length]; - Random r = new Random(); + Random r = new(); for (int i = 0; i < length; i++) { actual[i] = (T)Convert.ChangeType(r.Next(byte.MinValue, byte.MaxValue), typeof(T)); diff --git a/tests/ImageSharp.Tests/Helpers/ParallelExecutionSettingsTests.cs b/tests/ImageSharp.Tests/Helpers/ParallelExecutionSettingsTests.cs index eadae9124..983c3cc2b 100644 --- a/tests/ImageSharp.Tests/Helpers/ParallelExecutionSettingsTests.cs +++ b/tests/ImageSharp.Tests/Helpers/ParallelExecutionSettingsTests.cs @@ -28,7 +28,7 @@ public class ParallelExecutionSettingsTests } else { - ParallelExecutionSettings parallelSettings = new ParallelExecutionSettings( + ParallelExecutionSettings parallelSettings = new( maxDegreeOfParallelism, Configuration.Default.MemoryAllocator); Assert.Equal(maxDegreeOfParallelism, parallelSettings.MaxDegreeOfParallelism); diff --git a/tests/ImageSharp.Tests/Helpers/ParallelRowIteratorTests.cs b/tests/ImageSharp.Tests/Helpers/ParallelRowIteratorTests.cs index e5e6b18f8..4b06f877f 100644 --- a/tests/ImageSharp.Tests/Helpers/ParallelRowIteratorTests.cs +++ b/tests/ImageSharp.Tests/Helpers/ParallelRowIteratorTests.cs @@ -328,7 +328,7 @@ public class ParallelRowIteratorTests { for (int x = rect.Left; x < rect.Right; x++) { - buffer[x, y] = new(x, y); + buffer[x, y] = new Point(x, y); } } diff --git a/tests/ImageSharp.Tests/Helpers/RowIntervalTests.cs b/tests/ImageSharp.Tests/Helpers/RowIntervalTests.cs index cc367df30..215cd58bc 100644 --- a/tests/ImageSharp.Tests/Helpers/RowIntervalTests.cs +++ b/tests/ImageSharp.Tests/Helpers/RowIntervalTests.cs @@ -10,7 +10,7 @@ public class RowIntervalTests [Fact] public void Slice1() { - RowInterval rowInterval = new RowInterval(10, 20); + RowInterval rowInterval = new(10, 20); RowInterval sliced = rowInterval.Slice(5); Assert.Equal(15, sliced.Min); @@ -20,7 +20,7 @@ public class RowIntervalTests [Fact] public void Slice2() { - RowInterval rowInterval = new RowInterval(10, 20); + RowInterval rowInterval = new(10, 20); RowInterval sliced = rowInterval.Slice(3, 5); Assert.Equal(13, sliced.Min); @@ -30,8 +30,8 @@ public class RowIntervalTests [Fact] public void Equality_WhenTrue() { - RowInterval a = new RowInterval(42, 123); - RowInterval b = new RowInterval(42, 123); + RowInterval a = new(42, 123); + RowInterval b = new(42, 123); Assert.True(a.Equals(b)); Assert.True(a.Equals((object)b)); @@ -42,9 +42,9 @@ public class RowIntervalTests [Fact] public void Equality_WhenFalse() { - RowInterval a = new RowInterval(42, 123); - RowInterval b = new RowInterval(42, 125); - RowInterval c = new RowInterval(40, 123); + RowInterval a = new(42, 123); + RowInterval b = new(42, 125); + RowInterval c = new(40, 123); Assert.False(a.Equals(b)); Assert.False(c.Equals(a)); diff --git a/tests/ImageSharp.Tests/Helpers/TolerantMathTests.cs b/tests/ImageSharp.Tests/Helpers/TolerantMathTests.cs index 64f79840c..0cacbdc87 100644 --- a/tests/ImageSharp.Tests/Helpers/TolerantMathTests.cs +++ b/tests/ImageSharp.Tests/Helpers/TolerantMathTests.cs @@ -7,7 +7,7 @@ namespace SixLabors.ImageSharp.Tests.Helpers; public class TolerantMathTests { - private readonly TolerantMath tolerantMath = new TolerantMath(0.1); + private readonly TolerantMath tolerantMath = new(0.1); [Theory] [InlineData(0)] diff --git a/tests/ImageSharp.Tests/IO/ChunkedMemoryStreamTests.cs b/tests/ImageSharp.Tests/IO/ChunkedMemoryStreamTests.cs index 560d77e21..390170cfe 100644 --- a/tests/ImageSharp.Tests/IO/ChunkedMemoryStreamTests.cs +++ b/tests/ImageSharp.Tests/IO/ChunkedMemoryStreamTests.cs @@ -269,7 +269,7 @@ public class ChunkedMemoryStreamTests { ChunkedMemoryStream memoryStream; const string bufferSize = nameof(bufferSize); - using (memoryStream = new(this.allocator)) + using (memoryStream = new ChunkedMemoryStream(this.allocator)) { const string destination = nameof(destination); Assert.Throws(destination, () => memoryStream.CopyTo(destination: null)); @@ -293,7 +293,7 @@ public class ChunkedMemoryStreamTests Assert.Throws(() => memoryStream.CopyTo(disposedStream, 1)); // Then for the destination being disposed. - memoryStream = new(this.allocator); + memoryStream = new ChunkedMemoryStream(this.allocator); Assert.Throws(() => memoryStream.CopyTo(disposedStream, 1)); memoryStream.Dispose(); } diff --git a/tests/ImageSharp.Tests/Image/ImageCloneTests.cs b/tests/ImageSharp.Tests/Image/ImageCloneTests.cs index 409fd46b9..0680c9a82 100644 --- a/tests/ImageSharp.Tests/Image/ImageCloneTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageCloneTests.cs @@ -10,7 +10,7 @@ public class ImageCloneTests [Fact] public void CloneAs_WhenDisposed_Throws() { - Image image = new Image(5, 5); + Image image = new(5, 5); image.Dispose(); Assert.Throws(() => image.CloneAs()); @@ -19,7 +19,7 @@ public class ImageCloneTests [Fact] public void Clone_WhenDisposed_Throws() { - Image image = new Image(5, 5); + Image image = new(5, 5); image.Dispose(); Assert.Throws(() => image.Clone()); diff --git a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.cs b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.cs index c3ed16dcd..887a67dd3 100644 --- a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Globalization; using SixLabors.ImageSharp.PixelFormats; namespace SixLabors.ImageSharp.Tests; @@ -14,10 +15,10 @@ public abstract partial class ImageFrameCollectionTests : IDisposable public ImageFrameCollectionTests() { // Needed to get English exception messages, which are checked in several tests. - System.Threading.Thread.CurrentThread.CurrentUICulture = new("en-US"); + System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); - this.Image = new(10, 10); - this.Collection = new(this.Image, 10, 10, default(Rgba32)); + this.Image = new Image(10, 10); + this.Collection = new ImageFrameCollection(this.Image, 10, 10, default(Rgba32)); } public void Dispose() diff --git a/tests/ImageSharp.Tests/Image/ImageFrameTests.cs b/tests/ImageSharp.Tests/Image/ImageFrameTests.cs index f3070311d..f8146363c 100644 --- a/tests/ImageSharp.Tests/Image/ImageFrameTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageFrameTests.cs @@ -16,7 +16,7 @@ public class ImageFrameTests private void LimitBufferCapacity(int bufferCapacityInBytes) { - TestMemoryAllocator allocator = new TestMemoryAllocator(); + TestMemoryAllocator allocator = new(); allocator.BufferCapacityInBytes = bufferCapacityInBytes; this.configuration.MemoryAllocator = allocator; } @@ -31,7 +31,7 @@ public class ImageFrameTests this.LimitBufferCapacity(100); } - using Image image = new Image(this.configuration, 10, 10); + using Image image = new(this.configuration, 10, 10); ImageFrame frame = image.Frames.RootFrame; Rgba32 val = frame[3, 4]; Assert.Equal(default(Rgba32), val); @@ -40,7 +40,7 @@ public class ImageFrameTests Assert.Equal(Color.Red.ToPixel(), val); } - public static TheoryData OutOfRangeData = new TheoryData() + public static TheoryData OutOfRangeData = new() { { false, -1 }, { false, 10 }, @@ -57,7 +57,7 @@ public class ImageFrameTests this.LimitBufferCapacity(100); } - using Image image = new Image(this.configuration, 10, 10); + using Image image = new(this.configuration, 10, 10); ImageFrame frame = image.Frames.RootFrame; ArgumentOutOfRangeException ex = Assert.Throws(() => _ = frame[x, 3]); Assert.Equal("x", ex.ParamName); @@ -72,7 +72,7 @@ public class ImageFrameTests this.LimitBufferCapacity(100); } - using Image image = new Image(this.configuration, 10, 10); + using Image image = new(this.configuration, 10, 10); ImageFrame frame = image.Frames.RootFrame; ArgumentOutOfRangeException ex = Assert.Throws(() => frame[x, 3] = default); Assert.Equal("x", ex.ParamName); @@ -87,7 +87,7 @@ public class ImageFrameTests this.LimitBufferCapacity(100); } - using Image image = new Image(this.configuration, 10, 10); + using Image image = new(this.configuration, 10, 10); ImageFrame frame = image.Frames.RootFrame; ArgumentOutOfRangeException ex = Assert.Throws(() => frame[3, y] = default); Assert.Equal("y", ex.ParamName); @@ -105,7 +105,7 @@ public class ImageFrameTests this.LimitBufferCapacity(20); } - using Image image = new Image(this.configuration, 10, 10); + using Image image = new(this.configuration, 10, 10); if (disco) { Assert.True(image.GetPixelMemoryGroup().Count > 1); @@ -131,7 +131,7 @@ public class ImageFrameTests [InlineData(true)] public void CopyPixelDataTo_DestinationTooShort_Throws(bool byteSpan) { - using Image image = new Image(this.configuration, 10, 10); + using Image image = new(this.configuration, 10, 10); Assert.ThrowsAny(() => { @@ -173,7 +173,7 @@ public class ImageFrameTests [Fact] public void NullReference_Throws() { - using Image img = new Image(1, 1); + using Image img = new(1, 1); ImageFrame frame = img.Frames.RootFrame; Assert.Throws(() => frame.ProcessPixelRows(null)); diff --git a/tests/ImageSharp.Tests/Image/ImageRotationTests.cs b/tests/ImageSharp.Tests/Image/ImageRotationTests.cs index e9bdd5128..e7d3b548b 100644 --- a/tests/ImageSharp.Tests/Image/ImageRotationTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageRotationTests.cs @@ -12,14 +12,14 @@ public class ImageRotationTests public void RotateImageByMinus90Degrees() { (Size original, Size rotated) = Rotate(-90); - Assert.Equal(new(original.Height, original.Width), rotated); + Assert.Equal(new Size(original.Height, original.Width), rotated); } [Fact] public void RotateImageBy90Degrees() { (Size original, Size rotated) = Rotate(90); - Assert.Equal(new(original.Height, original.Width), rotated); + Assert.Equal(new Size(original.Height, original.Width), rotated); } [Fact] @@ -33,7 +33,7 @@ public class ImageRotationTests public void RotateImageBy270Degrees() { (Size original, Size rotated) = Rotate(270); - Assert.Equal(new(original.Height, original.Width), rotated); + Assert.Equal(new Size(original.Height, original.Width), rotated); } [Fact] diff --git a/tests/ImageSharp.Tests/Image/ImageSaveTests.cs b/tests/ImageSharp.Tests/Image/ImageSaveTests.cs index c92383ca8..e2f3c6337 100644 --- a/tests/ImageSharp.Tests/Image/ImageSaveTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageSaveTests.cs @@ -23,22 +23,22 @@ public class ImageSaveTests : IDisposable public ImageSaveTests() { - this.localImageFormat = new(); + this.localImageFormat = new Mock(); this.localImageFormat.Setup(x => x.FileExtensions).Returns(new[] { "png" }); this.localMimeTypeDetector = new MockImageFormatDetector(this.localImageFormat.Object); - this.encoder = new(); + this.encoder = new Mock(); - this.encoderNotInFormat = new(); + this.encoderNotInFormat = new Mock(); - this.fileSystem = new(); + this.fileSystem = new Mock(); Configuration config = new() { FileSystem = this.fileSystem.Object }; config.ImageFormatsManager.AddImageFormatDetector(this.localMimeTypeDetector); config.ImageFormatsManager.SetEncoder(this.localImageFormat.Object, this.encoder.Object); - this.image = new(config, 1, 1); + this.image = new Image(config, 1, 1); } [Fact] diff --git a/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.cs b/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.cs index f9a68c8bf..a1966e2bb 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.cs @@ -114,7 +114,7 @@ public partial class ImageTests { DecoderOptions options = new() { - Configuration = new() + Configuration = new Configuration() }; Assert.Throws(() => Image.DetectFormat(options, this.DataStream)); @@ -145,7 +145,7 @@ public partial class ImageTests { DecoderOptions options = new() { - Configuration = new() + Configuration = new Configuration() }; return Assert.ThrowsAsync(async () => await Image.DetectFormatAsync(options, new AsyncStreamWrapper(this.DataStream, () => false))); diff --git a/tests/ImageSharp.Tests/Image/ImageTests.EncodeCancellation.cs b/tests/ImageSharp.Tests/Image/ImageTests.EncodeCancellation.cs index 88e2b86ed..f3b1a01c9 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.EncodeCancellation.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.EncodeCancellation.cs @@ -15,7 +15,7 @@ public partial class ImageTests { using Image image = new(10, 10); await Assert.ThrowsAsync( - async () => await image.SaveAsBmpAsync(Stream.Null, new(canceled: true))); + async () => await image.SaveAsBmpAsync(Stream.Null, new CancellationToken(canceled: true))); } [Fact] @@ -23,7 +23,7 @@ public partial class ImageTests { using Image image = new(10, 10); await Assert.ThrowsAsync( - async () => await image.SaveAsCurAsync(Stream.Null, new(canceled: true))); + async () => await image.SaveAsCurAsync(Stream.Null, new CancellationToken(canceled: true))); } [Fact] @@ -31,7 +31,7 @@ public partial class ImageTests { using Image image = new(10, 10); await Assert.ThrowsAsync( - async () => await image.SaveAsGifAsync(Stream.Null, new(canceled: true))); + async () => await image.SaveAsGifAsync(Stream.Null, new CancellationToken(canceled: true))); } [Fact] @@ -41,7 +41,7 @@ public partial class ImageTests image.Frames.CreateFrame(); await Assert.ThrowsAsync( - async () => await image.SaveAsGifAsync(Stream.Null, new(canceled: true))); + async () => await image.SaveAsGifAsync(Stream.Null, new CancellationToken(canceled: true))); } [Fact] @@ -49,7 +49,7 @@ public partial class ImageTests { using Image image = new(10, 10); await Assert.ThrowsAsync( - async () => await image.SaveAsIcoAsync(Stream.Null, new(canceled: true))); + async () => await image.SaveAsIcoAsync(Stream.Null, new CancellationToken(canceled: true))); } [Fact] @@ -57,7 +57,7 @@ public partial class ImageTests { using Image image = new(10, 10); await Assert.ThrowsAsync( - async () => await image.SaveAsJpegAsync(Stream.Null, new(canceled: true))); + async () => await image.SaveAsJpegAsync(Stream.Null, new CancellationToken(canceled: true))); } [Fact] @@ -65,7 +65,7 @@ public partial class ImageTests { using Image image = new(10, 10); await Assert.ThrowsAsync( - async () => await image.SaveAsPbmAsync(Stream.Null, new(canceled: true))); + async () => await image.SaveAsPbmAsync(Stream.Null, new CancellationToken(canceled: true))); } [Fact] @@ -73,7 +73,7 @@ public partial class ImageTests { using Image image = new(10, 10); await Assert.ThrowsAsync( - async () => await image.SaveAsPngAsync(Stream.Null, new(canceled: true))); + async () => await image.SaveAsPngAsync(Stream.Null, new CancellationToken(canceled: true))); } [Fact] @@ -83,7 +83,7 @@ public partial class ImageTests image.Frames.CreateFrame(); await Assert.ThrowsAsync( - async () => await image.SaveAsPngAsync(Stream.Null, new(canceled: true))); + async () => await image.SaveAsPngAsync(Stream.Null, new CancellationToken(canceled: true))); } [Fact] @@ -91,7 +91,7 @@ public partial class ImageTests { using Image image = new(10, 10); await Assert.ThrowsAsync( - async () => await image.SaveAsQoiAsync(Stream.Null, new(canceled: true))); + async () => await image.SaveAsQoiAsync(Stream.Null, new CancellationToken(canceled: true))); } [Fact] @@ -99,7 +99,7 @@ public partial class ImageTests { using Image image = new(10, 10); await Assert.ThrowsAsync( - async () => await image.SaveAsTgaAsync(Stream.Null, new(canceled: true))); + async () => await image.SaveAsTgaAsync(Stream.Null, new CancellationToken(canceled: true))); } [Fact] @@ -107,7 +107,7 @@ public partial class ImageTests { using Image image = new(10, 10); await Assert.ThrowsAsync( - async () => await image.SaveAsTiffAsync(Stream.Null, new(canceled: true))); + async () => await image.SaveAsTiffAsync(Stream.Null, new CancellationToken(canceled: true))); } [Fact] @@ -115,7 +115,7 @@ public partial class ImageTests { using Image image = new(10, 10); await Assert.ThrowsAsync( - async () => await image.SaveAsWebpAsync(Stream.Null, new(canceled: true))); + async () => await image.SaveAsWebpAsync(Stream.Null, new CancellationToken(canceled: true))); } [Fact] @@ -125,7 +125,7 @@ public partial class ImageTests image.Frames.CreateFrame(); await Assert.ThrowsAsync( - async () => await image.SaveAsWebpAsync(Stream.Null, new(canceled: true))); + async () => await image.SaveAsWebpAsync(Stream.Null, new CancellationToken(canceled: true))); } } } diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Identify.cs b/tests/ImageSharp.Tests/Image/ImageTests.Identify.cs index 7f6651d90..6a196fd16 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Identify.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Identify.cs @@ -131,7 +131,7 @@ public partial class ImageTests [Fact] public void WhenNoMatchingFormatFound_Throws_UnknownImageFormatException() { - DecoderOptions options = new() { Configuration = new() }; + DecoderOptions options = new() { Configuration = new Configuration() }; Assert.Throws(() => Image.Identify(options, this.DataStream)); } @@ -279,7 +279,7 @@ public partial class ImageTests [Fact] public Task WhenNoMatchingFormatFoundAsync_Throws_UnknownImageFormatException() { - DecoderOptions options = new() { Configuration = new() }; + DecoderOptions options = new() { Configuration = new Configuration() }; AsyncStreamWrapper asyncStream = new(this.DataStream, () => false); return Assert.ThrowsAsync(async () => await Image.IdentifyAsync(options, asyncStream)); diff --git a/tests/ImageSharp.Tests/Image/ImageTests.ImageLoadTestBase.cs b/tests/ImageSharp.Tests/Image/ImageTests.ImageLoadTestBase.cs index ae48fde39..b0875a1e6 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.ImageLoadTestBase.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.ImageLoadTestBase.cs @@ -56,13 +56,13 @@ public partial class ImageTests protected ImageLoadTestBase() { // TODO: Remove all this mocking. It's too complicated and we can now use fakes. - this.localStreamReturnImageRgba32 = new(1, 1); - this.localStreamReturnImageAgnostic = new(1, 1); - this.LocalImageInfo = new(new(1, 1), new() { DecodedImageFormat = PngFormat.Instance }); + this.localStreamReturnImageRgba32 = new Image(1, 1); + this.localStreamReturnImageAgnostic = new Image(1, 1); + this.LocalImageInfo = new ImageInfo(new Size(1, 1), new ImageMetadata { DecodedImageFormat = PngFormat.Instance }); - this.localImageFormatMock = new(); + this.localImageFormatMock = new Mock(); - this.localDecoder = new(); + this.localDecoder = new Mock(); this.localDecoder.Setup(x => x.Identify(It.IsAny(), It.IsAny())) .Returns(this.LocalImageInfo); @@ -111,15 +111,15 @@ public partial class ImageTests this.localMimeTypeDetector = new MockImageFormatDetector(this.localImageFormatMock.Object); - this.LocalConfiguration = new(); + this.LocalConfiguration = new Configuration(); this.LocalConfiguration.ImageFormatsManager.AddImageFormatDetector(this.localMimeTypeDetector); this.LocalConfiguration.ImageFormatsManager.SetDecoder(this.localImageFormatMock.Object, this.localDecoder.Object); - this.TopLevelConfiguration = new(this.TestFormat); + this.TopLevelConfiguration = new Configuration(this.TestFormat); this.Marker = Guid.NewGuid().ToByteArray(); - this.dataStreamLazy = new(this.CreateStream); + this.dataStreamLazy = new Lazy(this.CreateStream); Stream StreamFactory() => this.DataStream; this.LocalFileSystemMock.Setup(x => x.OpenRead(this.MockFilePath)).Returns(StreamFactory); diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs index 8c110d143..3e488be9a 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs @@ -12,7 +12,7 @@ public partial class ImageTests { private string Path { get; } = TestFile.GetInputFileFullPath(TestImages.Bmp.Bit8); - private static void VerifyDecodedImage(Image img) => Assert.Equal(new(127, 64), img.Size); + private static void VerifyDecodedImage(Image img) => Assert.Equal(new Size(127, 64), img.Size); [Fact] public void Path_Specific() diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_UseGlobalConfiguration.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_UseGlobalConfiguration.cs index 80a407a35..00ec985ac 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_UseGlobalConfiguration.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_UseGlobalConfiguration.cs @@ -14,7 +14,7 @@ public partial class ImageTests private static Span ByteSpan => new(ByteArray); - private static void VerifyDecodedImage(Image img) => Assert.Equal(new(127, 64), img.Size); + private static void VerifyDecodedImage(Image img) => Assert.Equal(new Size(127, 64), img.Size); [Fact] public void Bytes_Specific() diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs index 9b9f968bb..a03157822 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs @@ -12,7 +12,7 @@ public partial class ImageTests { private static readonly byte[] Data = new byte[] { 0x01 }; - private MemoryStream Stream { get; } = new MemoryStream(Data); + private MemoryStream Stream { get; } = new(Data); [Fact] public void Image_Load_Throws_UnknownImageFormatException() diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_UseDefaultConfiguration.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_UseDefaultConfiguration.cs index c16a50b43..7a5bd186b 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_UseDefaultConfiguration.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_UseDefaultConfiguration.cs @@ -21,12 +21,12 @@ public partial class ImageTests public Load_FromStream_UseDefaultConfiguration() { - this.BaseStream = new(Data); - this.Stream = new(this.BaseStream, () => this.AllowSynchronousIO); + this.BaseStream = new MemoryStream(Data); + this.Stream = new AsyncStreamWrapper(this.BaseStream, () => this.AllowSynchronousIO); } private static void VerifyDecodedImage(Image img) - => Assert.Equal(new(127, 64), img.Size); + => Assert.Equal(new Size(127, 64), img.Size); [Fact] public void Stream_Specific() diff --git a/tests/ImageSharp.Tests/Image/ImageTests.WrapMemory.cs b/tests/ImageSharp.Tests/Image/ImageTests.WrapMemory.cs index d38ed749a..6322e65aa 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.WrapMemory.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.WrapMemory.cs @@ -64,13 +64,13 @@ public partial class ImageTests public override unsafe Span GetSpan() { void* ptr = (void*)this.bmpData.Scan0; - return new(ptr, this.length); + return new Span(ptr, this.length); } public override unsafe MemoryHandle Pin(int elementIndex = 0) { void* ptr = (void*)this.bmpData.Scan0; - return new(ptr, pinnable: this); + return new MemoryHandle(ptr, pinnable: this); } public override void Unpin() diff --git a/tests/ImageSharp.Tests/Image/LargeImageIntegrationTests.cs b/tests/ImageSharp.Tests/Image/LargeImageIntegrationTests.cs index ffb89923a..8d1b54658 100644 --- a/tests/ImageSharp.Tests/Image/LargeImageIntegrationTests.cs +++ b/tests/ImageSharp.Tests/Image/LargeImageIntegrationTests.cs @@ -31,7 +31,7 @@ public class LargeImageIntegrationTests Configuration configuration = Configuration.Default.Clone(); configuration.PreferContiguousImageBuffers = true; - using Image image = new Image(configuration, 2048, 2048); + using Image image = new(configuration, 2048, 2048); Assert.True(image.DangerousTryGetSinglePixelMemory(out Memory mem)); Assert.Equal(2048 * 2048, mem.Length); } diff --git a/tests/ImageSharp.Tests/Image/ProcessPixelRowsTestBase.cs b/tests/ImageSharp.Tests/Image/ProcessPixelRowsTestBase.cs index 1a6d563c8..27e42f84e 100644 --- a/tests/ImageSharp.Tests/Image/ProcessPixelRowsTestBase.cs +++ b/tests/ImageSharp.Tests/Image/ProcessPixelRowsTestBase.cs @@ -51,7 +51,7 @@ public abstract class ProcessPixelRowsTestBase Span row = accessor.GetRowSpan(y); for (int x = 0; x < row.Length; x++) { - row[x] = new((ushort)(x * y)); + row[x] = new L16((ushort)(x * y)); } } }); @@ -78,7 +78,7 @@ public abstract class ProcessPixelRowsTestBase Span row = buffer.DangerousGetRowSpan(y); for (int x = 0; x < 256; x++) { - row[x] = new((ushort)(x * y)); + row[x] = new L16((ushort)(x * y)); } } @@ -116,7 +116,7 @@ public abstract class ProcessPixelRowsTestBase Span row = buffer2.DangerousGetRowSpan(y); for (int x = 0; x < 256; x++) { - row[x] = new((ushort)(x * y)); + row[x] = new L16((ushort)(x * y)); } } diff --git a/tests/ImageSharp.Tests/Issues/Issue594.cs b/tests/ImageSharp.Tests/Issues/Issue594.cs index 7f976a373..36308edae 100644 --- a/tests/ImageSharp.Tests/Issues/Issue594.cs +++ b/tests/ImageSharp.Tests/Issues/Issue594.cs @@ -40,7 +40,7 @@ public class Issue594 const float z = 0.5f; const float w = -0.7f; - pixel = new(x, y, z, w); + pixel = new NormalizedByte4(x, y, z, w); Assert.Equal(0xA740DA0D, pixel.PackedValue); NormalizedByte4 n = NormalizedByte4.FromRgba32(pixel.ToRgba32()); Assert.Equal(0xA740DA0D, n.PackedValue); diff --git a/tests/ImageSharp.Tests/Memory/Allocators/BufferTestSuite.cs b/tests/ImageSharp.Tests/Memory/Allocators/BufferTestSuite.cs index 6b9907ef5..c4cef5d93 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/BufferTestSuite.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/BufferTestSuite.cs @@ -58,7 +58,7 @@ public abstract class BufferTestSuite } } - public static readonly TheoryData LengthValues = new TheoryData { 0, 1, 7, 1023, 1024 }; + public static readonly TheoryData LengthValues = new() { 0, 1, 7, 1023, 1024 }; [Theory] [MemberData(nameof(LengthValues))] diff --git a/tests/ImageSharp.Tests/Memory/Allocators/RefCountedLifetimeGuardTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/RefCountedLifetimeGuardTests.cs index ac03863fd..8eb364828 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/RefCountedLifetimeGuardTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/RefCountedLifetimeGuardTests.cs @@ -14,7 +14,7 @@ public class RefCountedLifetimeGuardTests [InlineData(3)] public void Dispose_ResultsInSingleRelease(int disposeCount) { - MockLifetimeGuard guard = new MockLifetimeGuard(); + MockLifetimeGuard guard = new(); Assert.Equal(0, guard.ReleaseInvocationCount); for (int i = 0; i < disposeCount; i++) @@ -45,7 +45,7 @@ public class RefCountedLifetimeGuardTests [InlineData(3)] public void AddRef_PreventsReleaseOnDispose(int addRefCount) { - MockLifetimeGuard guard = new MockLifetimeGuard(); + MockLifetimeGuard guard = new(); for (int i = 0; i < addRefCount; i++) { @@ -80,7 +80,7 @@ public class RefCountedLifetimeGuardTests [Fact] public void AddRefReleaseRefMisuse_DoesntLeadToMultipleReleases() { - MockLifetimeGuard guard = new MockLifetimeGuard(); + MockLifetimeGuard guard = new(); guard.Dispose(); guard.AddRef(); guard.ReleaseRef(); @@ -92,7 +92,7 @@ public class RefCountedLifetimeGuardTests public void UnmanagedBufferLifetimeGuard_Handle_IsReturnedByRef() { UnmanagedMemoryHandle h = UnmanagedMemoryHandle.Allocate(10); - using UnmanagedBufferLifetimeGuard.FreeHandle guard = new UnmanagedBufferLifetimeGuard.FreeHandle(h); + using UnmanagedBufferLifetimeGuard.FreeHandle guard = new(h); Assert.True(guard.Handle.IsValid); guard.Handle.Free(); Assert.False(guard.Handle.IsValid); @@ -101,7 +101,7 @@ public class RefCountedLifetimeGuardTests [MethodImpl(MethodImplOptions.NoInlining)] private static void LeakGuard(bool addRef) { - MockLifetimeGuard guard = new MockLifetimeGuard(); + MockLifetimeGuard guard = new(); if (addRef) { guard.AddRef(); diff --git a/tests/ImageSharp.Tests/Memory/Allocators/SharedArrayPoolBufferTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/SharedArrayPoolBufferTests.cs index 51552be7d..72b90c238 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/SharedArrayPoolBufferTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/SharedArrayPoolBufferTests.cs @@ -16,7 +16,7 @@ public class SharedArrayPoolBufferTests static void RunTest() { - using (SharedArrayPoolBuffer buffer = new SharedArrayPoolBuffer(900)) + using (SharedArrayPoolBuffer buffer = new(900)) { Assert.Equal(900, buffer.GetSpan().Length); buffer.GetSpan().Fill(42); @@ -36,7 +36,7 @@ public class SharedArrayPoolBufferTests static void RunTest() { - SharedArrayPoolBuffer buffer = new SharedArrayPoolBuffer(900); + SharedArrayPoolBuffer buffer = new(900); Span span = buffer.GetSpan(); buffer.AddRef(); diff --git a/tests/ImageSharp.Tests/Memory/Allocators/SimpleGcMemoryAllocatorTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/SimpleGcMemoryAllocatorTests.cs index 665f34a34..0e791c5d9 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/SimpleGcMemoryAllocatorTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/SimpleGcMemoryAllocatorTests.cs @@ -17,7 +17,7 @@ public class SimpleGcMemoryAllocatorTests } } - protected SimpleGcMemoryAllocator MemoryAllocator { get; } = new SimpleGcMemoryAllocator(); + protected SimpleGcMemoryAllocator MemoryAllocator { get; } = new(); public static TheoryData InvalidLengths { get; set; } = new() { diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs index c5820c27f..f518b2272 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs @@ -24,8 +24,8 @@ public partial class UniformUnmanagedMemoryPoolTests RemoteExecutor.Invoke(RunTest).Dispose(); static void RunTest() { - UniformUnmanagedMemoryPool.TrimSettings trimSettings = new UniformUnmanagedMemoryPool.TrimSettings { TrimPeriodMilliseconds = 5_000 }; - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(128, 256, trimSettings); + UniformUnmanagedMemoryPool.TrimSettings trimSettings = new() { TrimPeriodMilliseconds = 5_000 }; + UniformUnmanagedMemoryPool pool = new(128, 256, trimSettings); UnmanagedMemoryHandle[] a = pool.Rent(64); UnmanagedMemoryHandle[] b = pool.Rent(64); @@ -77,11 +77,11 @@ public partial class UniformUnmanagedMemoryPoolTests static void RunTest() { - UniformUnmanagedMemoryPool.TrimSettings trimSettings1 = new UniformUnmanagedMemoryPool.TrimSettings { TrimPeriodMilliseconds = 6_000 }; - UniformUnmanagedMemoryPool pool1 = new UniformUnmanagedMemoryPool(128, 256, trimSettings1); + UniformUnmanagedMemoryPool.TrimSettings trimSettings1 = new() { TrimPeriodMilliseconds = 6_000 }; + UniformUnmanagedMemoryPool pool1 = new(128, 256, trimSettings1); Thread.Sleep(8_000); // Let some callbacks fire already - UniformUnmanagedMemoryPool.TrimSettings trimSettings2 = new UniformUnmanagedMemoryPool.TrimSettings { TrimPeriodMilliseconds = 3_000 }; - UniformUnmanagedMemoryPool pool2 = new UniformUnmanagedMemoryPool(128, 256, trimSettings2); + UniformUnmanagedMemoryPool.TrimSettings trimSettings2 = new() { TrimPeriodMilliseconds = 3_000 }; + UniformUnmanagedMemoryPool pool2 = new(128, 256, trimSettings2); pool1.Return(pool1.Rent(64)); pool2.Return(pool2.Rent(64)); @@ -104,7 +104,7 @@ public partial class UniformUnmanagedMemoryPoolTests [MethodImpl(MethodImplOptions.NoInlining)] static void LeakPoolInstance() { - UniformUnmanagedMemoryPool.TrimSettings trimSettings = new UniformUnmanagedMemoryPool.TrimSettings { TrimPeriodMilliseconds = 4_000 }; + UniformUnmanagedMemoryPool.TrimSettings trimSettings = new() { TrimPeriodMilliseconds = 4_000 }; _ = new UniformUnmanagedMemoryPool(128, 256, trimSettings); } } @@ -129,13 +129,13 @@ public partial class UniformUnmanagedMemoryPoolTests Assert.False(Environment.Is64BitProcess); const int oneMb = 1 << 20; - UniformUnmanagedMemoryPool.TrimSettings trimSettings = new UniformUnmanagedMemoryPool.TrimSettings { HighPressureThresholdRate = 0.2f }; + UniformUnmanagedMemoryPool.TrimSettings trimSettings = new() { HighPressureThresholdRate = 0.2f }; GCMemoryInfo memInfo = GC.GetGCMemoryInfo(); int highLoadThreshold = (int)(memInfo.HighMemoryLoadThresholdBytes / oneMb); highLoadThreshold = (int)(trimSettings.HighPressureThresholdRate * highLoadThreshold); - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(oneMb, 16, trimSettings); + UniformUnmanagedMemoryPool pool = new(oneMb, 16, trimSettings); pool.Return(pool.Rent(16)); Assert.Equal(16, UnmanagedMemoryHandle.TotalOutstandingHandles); diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs index c0c7f5c22..ec79d91c3 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs @@ -55,7 +55,7 @@ public partial class UniformUnmanagedMemoryPoolTests [InlineData(7, 4)] public void Constructor_InitializesProperties(int arrayLength, int capacity) { - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(arrayLength, capacity); + UniformUnmanagedMemoryPool pool = new(arrayLength, capacity); Assert.Equal(arrayLength, pool.BufferLength); Assert.Equal(capacity, pool.Capacity); } @@ -65,8 +65,8 @@ public partial class UniformUnmanagedMemoryPoolTests [InlineData(8, 10)] public void Rent_SingleBuffer_ReturnsCorrectBuffer(int length, int capacity) { - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(length, capacity); - using CleanupUtil cleanup = new CleanupUtil(pool); + UniformUnmanagedMemoryPool pool = new(length, capacity); + using CleanupUtil cleanup = new(pool); for (int i = 0; i < capacity; i++) { @@ -83,7 +83,7 @@ public partial class UniformUnmanagedMemoryPoolTests static void RunTest() { - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(16, 16); + UniformUnmanagedMemoryPool pool = new(16, 16); UnmanagedMemoryHandle a = pool.Rent(); UnmanagedMemoryHandle[] b = pool.Rent(2); @@ -105,7 +105,7 @@ public partial class UniformUnmanagedMemoryPoolTests Assert.True(span.SequenceEqual(expected)); } - private static unsafe Span GetSpan(UnmanagedMemoryHandle h, int length) => new Span(h.Pointer, length); + private static unsafe Span GetSpan(UnmanagedMemoryHandle h, int length) => new(h.Pointer, length); [Theory] [InlineData(1, 1)] @@ -114,8 +114,8 @@ public partial class UniformUnmanagedMemoryPoolTests [InlineData(5, 10)] public void Rent_MultiBuffer_ReturnsCorrectBuffers(int length, int bufferCount) { - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(length, 10); - using CleanupUtil cleanup = new CleanupUtil(pool); + UniformUnmanagedMemoryPool pool = new(length, 10); + using CleanupUtil cleanup = new(pool); UnmanagedMemoryHandle[] handles = pool.Rent(bufferCount); cleanup.Register(handles); @@ -131,8 +131,8 @@ public partial class UniformUnmanagedMemoryPoolTests [Fact] public void Rent_MultipleTimesWithoutReturn_ReturnsDifferentHandles() { - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(128, 10); - using CleanupUtil cleanup = new CleanupUtil(pool); + UniformUnmanagedMemoryPool pool = new(128, 10); + using CleanupUtil cleanup = new(pool); UnmanagedMemoryHandle[] a = pool.Rent(2); cleanup.Register(a); UnmanagedMemoryHandle b = pool.Rent(); @@ -149,10 +149,10 @@ public partial class UniformUnmanagedMemoryPoolTests [InlineData(12, 4, 12)] public void RentReturnRent_SameBuffers(int totalCount, int rentUnit, int capacity) { - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(128, capacity); - using CleanupUtil cleanup = new CleanupUtil(pool); - HashSet allHandles = new HashSet(); - List handleUnits = new List(); + UniformUnmanagedMemoryPool pool = new(128, capacity); + using CleanupUtil cleanup = new(pool); + HashSet allHandles = new(); + List handleUnits = new(); UnmanagedMemoryHandle[] handles; for (int i = 0; i < totalCount; i += rentUnit) @@ -197,8 +197,8 @@ public partial class UniformUnmanagedMemoryPoolTests [Fact] public void Rent_SingleBuffer_OverCapacity_ReturnsInvalidBuffer() { - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(7, 1000); - using CleanupUtil cleanup = new CleanupUtil(pool); + UniformUnmanagedMemoryPool pool = new(7, 1000); + using CleanupUtil cleanup = new(pool); UnmanagedMemoryHandle[] initial = pool.Rent(1000); Assert.NotNull(initial); cleanup.Register(initial); @@ -212,8 +212,8 @@ public partial class UniformUnmanagedMemoryPoolTests [InlineData(4, 7, 10)] public void Rent_MultiBuffer_OverCapacity_ReturnsNull(int initialRent, int attempt, int capacity) { - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(128, capacity); - using CleanupUtil cleanup = new CleanupUtil(pool); + UniformUnmanagedMemoryPool pool = new(128, capacity); + using CleanupUtil cleanup = new(pool); UnmanagedMemoryHandle[] initial = pool.Rent(initialRent); Assert.NotNull(initial); cleanup.Register(initial); @@ -228,8 +228,8 @@ public partial class UniformUnmanagedMemoryPoolTests [InlineData(3, 3, 7)] public void Rent_MultiBuff_BelowCapacity_Succeeds(int initialRent, int attempt, int capacity) { - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(128, capacity); - using CleanupUtil cleanup = new CleanupUtil(pool); + UniformUnmanagedMemoryPool pool = new(128, capacity); + using CleanupUtil cleanup = new(pool); UnmanagedMemoryHandle[] b0 = pool.Rent(initialRent); Assert.NotNull(b0); cleanup.Register(b0); @@ -250,8 +250,8 @@ public partial class UniformUnmanagedMemoryPoolTests static void RunTest(string multipleInner) { - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(16, 16); - using CleanupUtil cleanup = new CleanupUtil(pool); + UniformUnmanagedMemoryPool pool = new(16, 16); + using CleanupUtil cleanup = new(pool); UnmanagedMemoryHandle b0 = pool.Rent(); IntPtr h0 = b0.Handle; UnmanagedMemoryHandle b1 = pool.Rent(); @@ -290,7 +290,7 @@ public partial class UniformUnmanagedMemoryPoolTests static void RunTest() { - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(16, 16); + UniformUnmanagedMemoryPool pool = new(16, 16); UnmanagedMemoryHandle a = pool.Rent(); UnmanagedMemoryHandle[] b = pool.Rent(2); pool.Return(a); @@ -306,13 +306,13 @@ public partial class UniformUnmanagedMemoryPoolTests public void RentReturn_IsThreadSafe() { int count = Environment.ProcessorCount * 200; - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(8, count); - using CleanupUtil cleanup = new CleanupUtil(pool); - Random rnd = new Random(0); + UniformUnmanagedMemoryPool pool = new(8, count); + using CleanupUtil cleanup = new(pool); + Random rnd = new(0); Parallel.For(0, Environment.ProcessorCount, (int i) => { - List allHandles = new List(); + List allHandles = new(); int pauseAt = rnd.Next(100); for (int j = 0; j < 100; j++) { @@ -359,7 +359,7 @@ public partial class UniformUnmanagedMemoryPoolTests [MethodImpl(MethodImplOptions.NoInlining)] static void LeakPoolInstance(bool withGuardedBuffers) { - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(16, 128); + UniformUnmanagedMemoryPool pool = new(16, 128); if (withGuardedBuffers) { UnmanagedMemoryHandle h = pool.Rent(); diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs index e0f129a65..f62e99a8b 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs @@ -165,7 +165,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests static void RunTest() { - MemoryAllocator allocator = MemoryAllocator.Create(new() + MemoryAllocator allocator = MemoryAllocator.Create(new MemoryAllocatorOptions { MaximumPoolSizeMegabytes = 8 }); @@ -422,7 +422,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests [Fact] public void Allocate_OverLimit_ThrowsInvalidMemoryOperationException() { - MemoryAllocator allocator = MemoryAllocator.Create(new() + MemoryAllocator allocator = MemoryAllocator.Create(new MemoryAllocatorOptions { AllocationLimitMegabytes = 4 }); @@ -434,7 +434,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests [Fact] public void AllocateGroup_OverLimit_ThrowsInvalidMemoryOperationException() { - MemoryAllocator allocator = MemoryAllocator.Create(new() + MemoryAllocator allocator = MemoryAllocator.Create(new MemoryAllocatorOptions { AllocationLimitMegabytes = 4 }); @@ -450,7 +450,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests static void RunTest() { const long threeGB = 3L * (1 << 30); - MemoryAllocator allocator = MemoryAllocator.Create(new() + MemoryAllocator allocator = MemoryAllocator.Create(new MemoryAllocatorOptions { AllocationLimitMegabytes = (int)(threeGB / 1024) }); diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedBufferTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedBufferTests.cs index 1e4795bc8..3b33eae5e 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedBufferTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedBufferTests.cs @@ -76,7 +76,7 @@ public class UnmanagedBufferTests static List> FillList(int countInner) { - List> l = new List>(); + List> l = new(); for (int i = 0; i < countInner; i++) { UnmanagedBuffer h = UnmanagedBuffer.Allocate(42); diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedMemoryHandleTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedMemoryHandleTests.cs index ef3af71f4..59b793e01 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedMemoryHandleTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedMemoryHandleTests.cs @@ -47,7 +47,7 @@ public class UnmanagedMemoryHandleTests static void RunTest(string countStr) { int countInner = int.Parse(countStr); - List l = new List(); + List l = new(); for (int i = 0; i < countInner; i++) { Assert.Equal(i, UnmanagedMemoryHandle.TotalOutstandingHandles); diff --git a/tests/ImageSharp.Tests/Memory/Buffer2DTests.SwapOrCopyContent.cs b/tests/ImageSharp.Tests/Memory/Buffer2DTests.SwapOrCopyContent.cs index 578ffc480..e17c8c46f 100644 --- a/tests/ImageSharp.Tests/Memory/Buffer2DTests.SwapOrCopyContent.cs +++ b/tests/ImageSharp.Tests/Memory/Buffer2DTests.SwapOrCopyContent.cs @@ -29,8 +29,8 @@ public partial class Buffer2DTests Assert.Equal(bb, a.FastMemoryGroup.Single()); Assert.Equal(aa, b.FastMemoryGroup.Single()); - Assert.Equal(new(3, 7), a.Size()); - Assert.Equal(new(10, 5), b.Size()); + Assert.Equal(new Size(3, 7), a.Size()); + Assert.Equal(new Size(10, 5), b.Size()); Assert.Equal(666, b[1, 3]); Assert.Equal(444, a[1, 3]); diff --git a/tests/ImageSharp.Tests/Memory/Buffer2DTests.cs b/tests/ImageSharp.Tests/Memory/Buffer2DTests.cs index a5c2eea2d..6dfdd294c 100644 --- a/tests/ImageSharp.Tests/Memory/Buffer2DTests.cs +++ b/tests/ImageSharp.Tests/Memory/Buffer2DTests.cs @@ -72,7 +72,7 @@ public partial class Buffer2DTests using Buffer2D buffer = useSizeOverload ? this.MemoryAllocator.Allocate2D( - new(200, 200), + new Size(200, 200), preferContiguosImageBuffers: true) : this.MemoryAllocator.Allocate2D( 200, @@ -169,7 +169,7 @@ public partial class Buffer2DTests } // Re-seed - rnd = new(42); + rnd = new Random(42); for (int y = 0; y < buffer.Height; y++) { Span span = buffer.GetSafeRowMemory(y).Span; @@ -341,9 +341,9 @@ public partial class Buffer2DTests public static TheoryData InvalidLengths { get; set; } = new() { - { new(-1, -1) }, - { new(32768, 32769) }, - { new(32769, 32768) } + { new Size(-1, -1) }, + { new Size(32768, 32769) }, + { new Size(32769, 32768) } }; [Theory] @@ -354,7 +354,7 @@ public partial class Buffer2DTests [Theory] [MemberData(nameof(InvalidLengths))] public void Allocate_IncorrectAmount_ThrowsCorrect_InvalidMemoryOperationException_Size(Size size) - => Assert.Throws(() => this.MemoryAllocator.Allocate2D(new(size))); + => Assert.Throws(() => this.MemoryAllocator.Allocate2D(new Size(size))); [Theory] [MemberData(nameof(InvalidLengths))] diff --git a/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs b/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs index cb89f6cf6..be7edbacc 100644 --- a/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs +++ b/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs @@ -7,14 +7,14 @@ namespace SixLabors.ImageSharp.Tests.Memory; public class BufferAreaTests { - private readonly TestMemoryAllocator memoryAllocator = new TestMemoryAllocator(); + private readonly TestMemoryAllocator memoryAllocator = new(); [Fact] public void Construct() { using Buffer2D buffer = this.memoryAllocator.Allocate2D(10, 20); - Rectangle rectangle = new Rectangle(3, 2, 5, 6); - Buffer2DRegion area = new Buffer2DRegion(buffer, rectangle); + Rectangle rectangle = new(3, 2, 5, 6); + Buffer2DRegion area = new(buffer, rectangle); Assert.Equal(buffer, area.Buffer); Assert.Equal(rectangle, area.Rectangle); @@ -43,7 +43,7 @@ public class BufferAreaTests { this.memoryAllocator.BufferCapacityInBytes = sizeof(int) * bufferCapacity; using Buffer2D buffer = this.CreateTestBuffer(20, 30); - Rectangle r = new Rectangle(rx, ry, 5, 6); + Rectangle r = new(rx, ry, 5, 6); Buffer2DRegion region = buffer.GetRegion(r); @@ -62,7 +62,7 @@ public class BufferAreaTests this.memoryAllocator.BufferCapacityInBytes = sizeof(int) * bufferCapacity; using Buffer2D buffer = this.CreateTestBuffer(20, 30); - Rectangle r = new Rectangle(rx, ry, w, h); + Rectangle r = new(rx, ry, w, h); Buffer2DRegion region = buffer.GetRegion(r); @@ -87,7 +87,7 @@ public class BufferAreaTests Buffer2DRegion area1 = area0.GetSubRegion(4, 4, 5, 5); - Rectangle expectedRect = new Rectangle(10, 12, 5, 5); + Rectangle expectedRect = new(10, 12, 5, 5); Assert.Equal(buffer, area1.Buffer); Assert.Equal(expectedRect, area1.Rectangle); diff --git a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupIndex.cs b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupIndex.cs index ea98357cb..878084674 100644 --- a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupIndex.cs +++ b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupIndex.cs @@ -27,7 +27,7 @@ public struct MemoryGroupIndex : IEquatable public static MemoryGroupIndex operator +(MemoryGroupIndex idx, int val) { int nextElementIndex = idx.ElementIndex + val; - return new( + return new MemoryGroupIndex( idx.BufferLength, idx.BufferIndex + (nextElementIndex / idx.BufferLength), nextElementIndex % idx.BufferLength); @@ -105,14 +105,14 @@ internal static class MemoryGroupIndexExtensions public static MemoryGroupIndex MinIndex(this IMemoryGroup group) where T : struct { - return new(group.BufferLength, 0, 0); + return new MemoryGroupIndex(group.BufferLength, 0, 0); } public static MemoryGroupIndex MaxIndex(this IMemoryGroup group) where T : struct { return group.Count == 0 - ? new(group.BufferLength, 0, 0) + ? new MemoryGroupIndex(group.BufferLength, 0, 0) : new MemoryGroupIndex(group.BufferLength, group.Count - 1, group[group.Count - 1].Length); } } diff --git a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupIndexTests.cs b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupIndexTests.cs index 9c7915e22..4e67df53b 100644 --- a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupIndexTests.cs +++ b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupIndexTests.cs @@ -47,7 +47,7 @@ public class MemoryGroupIndexTests { MemoryGroupIndex a = new(10, 3, 3); a += 1; - Assert.Equal(new(10, 3, 4), a); + Assert.Equal(new MemoryGroupIndex(10, 3, 4), a); } [Fact] @@ -58,7 +58,7 @@ public class MemoryGroupIndexTests a += 8; b += 1; - Assert.Equal(new(10, 6, 1), a); - Assert.Equal(new(10, 6, 0), b); + Assert.Equal(new MemoryGroupIndex(10, 6, 1), a); + Assert.Equal(new MemoryGroupIndex(10, 6, 0), b); } } diff --git a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.Allocate.cs b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.Allocate.cs index ac242e846..678a089a8 100644 --- a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.Allocate.cs +++ b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.Allocate.cs @@ -83,7 +83,7 @@ public partial class MemoryGroupTests return; } - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(bufferCapacity, expectedNumberOfBuffers); + UniformUnmanagedMemoryPool pool = new(bufferCapacity, expectedNumberOfBuffers); // Act: Assert.True(MemoryGroup.TryAllocate(pool, totalLength, bufferAlignment, AllocationOptions.None, out MemoryGroup g)); @@ -98,7 +98,7 @@ public partial class MemoryGroupTests [InlineData(AllocationOptions.Clean)] public unsafe void Allocate_FromPool_AllocationOptionsAreApplied(AllocationOptions options) { - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(10, 5); + UniformUnmanagedMemoryPool pool = new(10, 5); UnmanagedMemoryHandle[] buffers = pool.Rent(5); foreach (UnmanagedMemoryHandle b in buffers) { @@ -128,7 +128,7 @@ public partial class MemoryGroupTests int requestBytes, bool shouldSucceed) { - UniformUnmanagedMemoryPool pool = new UniformUnmanagedMemoryPool(bufferCapacityBytes, poolCapacity); + UniformUnmanagedMemoryPool pool = new(bufferCapacityBytes, poolCapacity); int alignmentElements = alignmentBytes / Unsafe.SizeOf(); int requestElements = requestBytes / Unsafe.SizeOf(); diff --git a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.cs b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.cs index 044c8f584..fe1867f20 100644 --- a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.cs +++ b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.cs @@ -28,7 +28,7 @@ public partial class MemoryGroupTests : MemoryGroupTestsBase #pragma warning disable SA1509 private static readonly TheoryData CopyAndTransformData = - new TheoryData() + new() { { 20, 10, 20, 10 }, { 20, 5, 20, 4 }, @@ -102,8 +102,8 @@ public partial class MemoryGroupTests : MemoryGroupTestsBase int[] data0 = { 1, 2, 3, 4 }; int[] data1 = { 5, 6, 7, 8 }; int[] data2 = { 9, 10 }; - using TestMemoryManager mgr0 = new TestMemoryManager(data0); - using TestMemoryManager mgr1 = new TestMemoryManager(data1); + using TestMemoryManager mgr0 = new(data0); + using TestMemoryManager mgr1 = new(data1); using MemoryGroup group = MemoryGroup.Wrap(mgr0.Memory, mgr1.Memory, data2); @@ -124,7 +124,7 @@ public partial class MemoryGroupTests : MemoryGroupTestsBase } } - public static TheoryData GetBoundedSlice_SuccessData = new TheoryData() + public static TheoryData GetBoundedSlice_SuccessData = new() { { 300, 100, 110, 80 }, { 300, 100, 100, 100 }, @@ -153,7 +153,7 @@ public partial class MemoryGroupTests : MemoryGroupTestsBase } } - public static TheoryData GetBoundedSlice_ErrorData = new TheoryData() + public static TheoryData GetBoundedSlice_ErrorData = new() { { 300, 100, -1, 91 }, { 300, 100, 110, 91 }, diff --git a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTestsBase.cs b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTestsBase.cs index 56e2e95fe..0eaebbfef 100644 --- a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTestsBase.cs +++ b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTestsBase.cs @@ -7,7 +7,7 @@ namespace SixLabors.ImageSharp.Tests.Memory.DiscontiguousBuffers; public abstract class MemoryGroupTestsBase { - internal readonly TestMemoryAllocator MemoryAllocator = new TestMemoryAllocator(); + internal readonly TestMemoryAllocator MemoryAllocator = new(); /// /// Create a group, either uninitialized or filled with incrementing numbers starting with 1. diff --git a/tests/ImageSharp.Tests/Memory/TestStructs.cs b/tests/ImageSharp.Tests/Memory/TestStructs.cs index 0fd823ee5..bb6a07ec9 100644 --- a/tests/ImageSharp.Tests/Memory/TestStructs.cs +++ b/tests/ImageSharp.Tests/Memory/TestStructs.cs @@ -22,7 +22,7 @@ public static class TestStructs Foo[] result = new Foo[size]; for (int i = 0; i < size; i++) { - result[i] = new(i + 1, i + 1); + result[i] = new Foo(i + 1, i + 1); } return result; @@ -73,7 +73,7 @@ public static class TestStructs AlignedFoo[] result = new AlignedFoo[size]; for (int i = 0; i < size; i++) { - result[i] = new(i + 1, i + 1); + result[i] = new AlignedFoo(i + 1, i + 1); } return result; diff --git a/tests/ImageSharp.Tests/MemoryAllocatorValidator.cs b/tests/ImageSharp.Tests/MemoryAllocatorValidator.cs index a19b82e64..395dfd455 100644 --- a/tests/ImageSharp.Tests/MemoryAllocatorValidator.cs +++ b/tests/ImageSharp.Tests/MemoryAllocatorValidator.cs @@ -38,7 +38,7 @@ public static class MemoryAllocatorValidator public static TestMemoryDiagnostics MonitorAllocations() { - TestMemoryDiagnostics diag = new TestMemoryDiagnostics(); + TestMemoryDiagnostics diag = new(); LocalInstance.Value = diag; return diag; } diff --git a/tests/ImageSharp.Tests/Metadata/ImageFrameMetadataTests.cs b/tests/ImageSharp.Tests/Metadata/ImageFrameMetadataTests.cs index 2a78b74be..6d35517ac 100644 --- a/tests/ImageSharp.Tests/Metadata/ImageFrameMetadataTests.cs +++ b/tests/ImageSharp.Tests/Metadata/ImageFrameMetadataTests.cs @@ -48,7 +48,7 @@ public class ImageFrameMetadataTests XmpProfile xmpProfile = new(Array.Empty()); IccProfile iccProfile = new() { - Header = new() + Header = new IccProfileHeader { CmmType = "Unittest" } diff --git a/tests/ImageSharp.Tests/Metadata/ImageMetadataTests.cs b/tests/ImageSharp.Tests/Metadata/ImageMetadataTests.cs index 78290db63..ae02c3d57 100644 --- a/tests/ImageSharp.Tests/Metadata/ImageMetadataTests.cs +++ b/tests/ImageSharp.Tests/Metadata/ImageMetadataTests.cs @@ -36,7 +36,7 @@ public class ImageMetadataTests { ImageMetadata metaData = new() { - ExifProfile = new(), + ExifProfile = new ExifProfile(), HorizontalResolution = 4, VerticalResolution = 2 }; @@ -86,8 +86,8 @@ public class ImageMetadataTests public void SyncProfiles() { ExifProfile exifProfile = new(); - exifProfile.SetValue(ExifTag.XResolution, new(200)); - exifProfile.SetValue(ExifTag.YResolution, new(300)); + exifProfile.SetValue(ExifTag.XResolution, new Rational(200)); + exifProfile.SetValue(ExifTag.YResolution, new Rational(300)); using Image image = new(1, 1); image.Metadata.ExifProfile = exifProfile; diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/CICP/CicpProfileTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/CICP/CicpProfileTests.cs index ab4d8a0d1..ff8b034c5 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/CICP/CicpProfileTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/CICP/CicpProfileTests.cs @@ -25,10 +25,10 @@ public class CicpProfileTests public void WritingPng_PreservesCicpProfile() { // arrange - using Image image = new Image(1, 1); + using Image image = new(1, 1); CicpProfile original = CreateCicpProfile(); image.Metadata.CicpProfile = original; - PngEncoder encoder = new PngEncoder(); + PngEncoder encoder = new(); // act using Image reloadedImage = WriteAndRead(image, encoder); @@ -49,7 +49,7 @@ public class CicpProfileTests private static CicpProfile CreateCicpProfile() { - CicpProfile profile = new CicpProfile() + CicpProfile profile = new() { ColorPrimaries = CicpColorPrimaries.ItuRBt2020_2, TransferCharacteristics = CicpTransferCharacteristics.SmpteSt2084, @@ -70,7 +70,7 @@ public class CicpProfileTests private static Image WriteAndRead(Image image, IImageEncoder encoder) { - using (MemoryStream memStream = new MemoryStream()) + using (MemoryStream memStream = new()) { image.Save(memStream, encoder); image.Dispose(); diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifProfileTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifProfileTests.cs index 1f8b80b40..6c499f40c 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifProfileTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifProfileTests.cs @@ -63,7 +63,7 @@ public class ExifProfileTests Assert.Null(image.Metadata.ExifProfile); const string expected = "Dirk Lemstra"; - image.Metadata.ExifProfile = new(); + image.Metadata.ExifProfile = new ExifProfile(); image.Metadata.ExifProfile.SetValue(ExifTag.Copyright, expected); image = WriteAndRead(image, imageFormat); @@ -125,7 +125,7 @@ public class ExifProfileTests ExifProfile profile = GetExifProfile(); - profile.SetValue(ExifTag.ExposureTime, new(exposureTime)); + profile.SetValue(ExifTag.ExposureTime, new Rational(exposureTime)); Image image = new(1, 1); image.Metadata.ExifProfile = profile; @@ -142,7 +142,7 @@ public class ExifProfileTests memStream.Position = 0; profile = GetExifProfile(); - profile.SetValue(ExifTag.ExposureTime, new(exposureTime, true)); + profile.SetValue(ExifTag.ExposureTime, new Rational(exposureTime, true)); image.Metadata.ExifProfile = profile; image = WriteAndRead(image, imageFormat); @@ -164,26 +164,26 @@ public class ExifProfileTests public void ReadWriteInfinity(TestImageWriteFormat imageFormat) { Image image = TestFile.Create(TestImages.Jpeg.Baseline.Floorplan).CreateRgba32Image(); - image.Metadata.ExifProfile.SetValue(ExifTag.ExposureBiasValue, new(double.PositiveInfinity)); + image.Metadata.ExifProfile.SetValue(ExifTag.ExposureBiasValue, new SignedRational(double.PositiveInfinity)); image = WriteAndReadJpeg(image); IExifValue value = image.Metadata.ExifProfile.GetValue(ExifTag.ExposureBiasValue); Assert.NotNull(value); - Assert.Equal(new(double.PositiveInfinity), value.Value); + Assert.Equal(new SignedRational(double.PositiveInfinity), value.Value); - image.Metadata.ExifProfile.SetValue(ExifTag.ExposureBiasValue, new(double.NegativeInfinity)); + image.Metadata.ExifProfile.SetValue(ExifTag.ExposureBiasValue, new SignedRational(double.NegativeInfinity)); image = WriteAndRead(image, imageFormat); value = image.Metadata.ExifProfile.GetValue(ExifTag.ExposureBiasValue); Assert.NotNull(value); - Assert.Equal(new(double.NegativeInfinity), value.Value); + Assert.Equal(new SignedRational(double.NegativeInfinity), value.Value); - image.Metadata.ExifProfile.SetValue(ExifTag.FlashEnergy, new(double.NegativeInfinity)); + image.Metadata.ExifProfile.SetValue(ExifTag.FlashEnergy, new Rational(double.NegativeInfinity)); image = WriteAndRead(image, imageFormat); IExifValue value2 = image.Metadata.ExifProfile.GetValue(ExifTag.FlashEnergy); Assert.NotNull(value2); - Assert.Equal(new(double.PositiveInfinity), value2.Value); + Assert.Equal(new Rational(double.PositiveInfinity), value2.Value); image.Dispose(); } @@ -209,20 +209,20 @@ public class ExifProfileTests Assert.True(software.TrySetValue(15)); Assert.False(software.TrySetValue(15F)); - image.Metadata.ExifProfile.SetValue(ExifTag.ShutterSpeedValue, new(75.55)); + image.Metadata.ExifProfile.SetValue(ExifTag.ShutterSpeedValue, new SignedRational(75.55)); IExifValue shutterSpeed = image.Metadata.ExifProfile.GetValue(ExifTag.ShutterSpeedValue); - Assert.Equal(new(7555, 100), shutterSpeed.Value); + Assert.Equal(new SignedRational(7555, 100), shutterSpeed.Value); Assert.False(shutterSpeed.TrySetValue(75)); - image.Metadata.ExifProfile.SetValue(ExifTag.XResolution, new(150.0)); + image.Metadata.ExifProfile.SetValue(ExifTag.XResolution, new Rational(150.0)); // We also need to change this value because this overrides XResolution when the image is written. image.Metadata.HorizontalResolution = 150.0; IExifValue xResolution = image.Metadata.ExifProfile.GetValue(ExifTag.XResolution); - Assert.Equal(new(150, 1), xResolution.Value); + Assert.Equal(new Rational(150, 1), xResolution.Value); Assert.False(xResolution.TrySetValue("ImageSharp")); @@ -251,10 +251,10 @@ public class ExifProfileTests Assert.Equal("15", software.Value); shutterSpeed = image.Metadata.ExifProfile.GetValue(ExifTag.ShutterSpeedValue); - Assert.Equal(new(75.55), shutterSpeed.Value); + Assert.Equal(new SignedRational(75.55), shutterSpeed.Value); xResolution = image.Metadata.ExifProfile.GetValue(ExifTag.XResolution); - Assert.Equal(new(150.0), xResolution.Value); + Assert.Equal(new Rational(150.0), xResolution.Value); referenceBlackWhite = image.Metadata.ExifProfile.GetValue(ExifTag.ReferenceBlackWhite, false); Assert.Null(referenceBlackWhite); @@ -309,8 +309,8 @@ public class ExifProfileTests public void Syncs() { ExifProfile exifProfile = new(); - exifProfile.SetValue(ExifTag.XResolution, new(200)); - exifProfile.SetValue(ExifTag.YResolution, new(300)); + exifProfile.SetValue(ExifTag.XResolution, new Rational(200)); + exifProfile.SetValue(ExifTag.YResolution, new Rational(300)); ImageMetadata metaData = new() { @@ -568,7 +568,7 @@ public class ExifProfileTests private static Image WriteAndReadWebp(Image image, WebpFileFormatType fileFormat) { using MemoryStream memStream = new(); - image.SaveAsWebp(memStream, new() { FileFormat = fileFormat }); + image.SaveAsWebp(memStream, new WebpEncoder { FileFormat = fileFormat }); image.Dispose(); memStream.Position = 0; @@ -593,7 +593,7 @@ public class ExifProfileTests Assert.Equal("Windows Photo Editor 10.0.10011.16384", software.Value); IExifValue xResolution = profile.GetValue(ExifTag.XResolution); - Assert.Equal(new(300.0), xResolution.Value); + Assert.Equal(new Rational(300.0), xResolution.Value); IExifValue xDimension = profile.GetValue(ExifTag.PixelXDimension); Assert.Equal(2338U, xDimension.Value); diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifReaderTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifReaderTests.cs index dcdc5f0f3..983ff4493 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifReaderTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifReaderTests.cs @@ -11,7 +11,7 @@ public class ExifReaderTests [Fact] public void Read_DataIsEmpty_ReturnsEmptyCollection() { - ExifReader reader = new ExifReader(Array.Empty()); + ExifReader reader = new(Array.Empty()); IList result = reader.ReadValues(); @@ -21,7 +21,7 @@ public class ExifReaderTests [Fact] public void Read_DataIsMinimal_ReturnsEmptyCollection() { - ExifReader reader = new ExifReader(new byte[] { 69, 120, 105, 102, 0, 0 }); + ExifReader reader = new(new byte[] { 69, 120, 105, 102, 0, 0 }); IList result = reader.ReadValues(); diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifTagDescriptionAttributeTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifTagDescriptionAttributeTests.cs index 4ba259f39..3f13afa6f 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifTagDescriptionAttributeTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifTagDescriptionAttributeTests.cs @@ -12,7 +12,7 @@ public class ExifTagDescriptionAttributeTests [Fact] public void TestExifTag() { - ExifProfile exifProfile = new ExifProfile(); + ExifProfile exifProfile = new(); exifProfile.SetValue(ExifTag.ResolutionUnit, (ushort)1); IExifValue value = exifProfile.GetValue(ExifTag.ResolutionUnit); diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/Values/ExifValuesTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/Values/ExifValuesTests.cs index bf6018c65..cb006ba29 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/Values/ExifValuesTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/Values/ExifValuesTests.cs @@ -9,14 +9,14 @@ namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.Exif.Values; [Trait("Profile", "Exif")] public class ExifValuesTests { - public static TheoryData ByteTags => new TheoryData + public static TheoryData ByteTags => new() { { ExifTag.FaxProfile }, { ExifTag.ModeNumber }, { ExifTag.GPSAltitudeRef } }; - public static TheoryData ByteArrayTags => new TheoryData + public static TheoryData ByteArrayTags => new() { { ExifTag.ClipPath }, { ExifTag.VersionYear }, @@ -26,7 +26,7 @@ public class ExifValuesTests { ExifTag.GPSVersionID }, }; - public static TheoryData DoubleArrayTags => new TheoryData + public static TheoryData DoubleArrayTags => new() { { ExifTag.PixelScale }, { ExifTag.IntergraphMatrix }, @@ -34,7 +34,7 @@ public class ExifValuesTests { ExifTag.ModelTransform } }; - public static TheoryData LongTags => new TheoryData + public static TheoryData LongTags => new() { { ExifTag.SubfileType }, { ExifTag.SubIFDOffset }, @@ -59,7 +59,7 @@ public class ExifValuesTests { ExifTag.ImageNumber }, }; - public static TheoryData LongArrayTags => new TheoryData + public static TheoryData LongArrayTags => new() { { ExifTag.FreeOffsets }, { ExifTag.FreeByteCounts }, @@ -73,7 +73,7 @@ public class ExifValuesTests { ExifTag.IntergraphRegisters } }; - public static TheoryData NumberTags => new TheoryData + public static TheoryData NumberTags => new() { { ExifTag.ImageWidth }, { ExifTag.ImageLength }, @@ -85,7 +85,7 @@ public class ExifValuesTests { ExifTag.PixelYDimension } }; - public static TheoryData NumberArrayTags => new TheoryData + public static TheoryData NumberArrayTags => new() { { ExifTag.StripOffsets }, { ExifTag.StripByteCounts }, @@ -94,7 +94,7 @@ public class ExifValuesTests { ExifTag.ImageLayer } }; - public static TheoryData RationalTags => new TheoryData + public static TheoryData RationalTags => new() { { ExifTag.XPosition }, { ExifTag.YPosition }, @@ -131,7 +131,7 @@ public class ExifValuesTests { ExifTag.GPSHPositioningError }, }; - public static TheoryData RationalArrayTags => new TheoryData + public static TheoryData RationalArrayTags => new() { { ExifTag.WhitePoint }, { ExifTag.PrimaryChromaticities }, @@ -145,7 +145,7 @@ public class ExifValuesTests { ExifTag.LensSpecification } }; - public static TheoryData ShortTags => new TheoryData + public static TheoryData ShortTags => new() { { ExifTag.OldSubfileType }, { ExifTag.Compression }, @@ -196,7 +196,7 @@ public class ExifValuesTests { ExifTag.GPSDifferential } }; - public static TheoryData ShortArrayTags => new TheoryData + public static TheoryData ShortArrayTags => new() { { ExifTag.BitsPerSample }, { ExifTag.MinSampleValue }, @@ -220,7 +220,7 @@ public class ExifValuesTests { ExifTag.SubjectLocation } }; - public static TheoryData SignedRationalTags => new TheoryData + public static TheoryData SignedRationalTags => new() { { ExifTag.ShutterSpeedValue }, { ExifTag.BrightnessValue }, @@ -230,17 +230,17 @@ public class ExifValuesTests { ExifTag.CameraElevationAngle } }; - public static TheoryData SignedRationalArrayTags => new TheoryData + public static TheoryData SignedRationalArrayTags => new() { { ExifTag.Decode } }; - public static TheoryData SignedShortArrayTags => new TheoryData + public static TheoryData SignedShortArrayTags => new() { { ExifTag.TimeZoneOffset } }; - public static TheoryData StringTags => new TheoryData + public static TheoryData StringTags => new() { { ExifTag.ImageDescription }, { ExifTag.Make }, @@ -298,13 +298,13 @@ public class ExifValuesTests { ExifTag.GPSDateStamp }, }; - public static TheoryData UndefinedTags => new TheoryData + public static TheoryData UndefinedTags => new() { { ExifTag.FileSource }, { ExifTag.SceneType } }; - public static TheoryData UndefinedArrayTags => new TheoryData + public static TheoryData UndefinedArrayTags => new() { { ExifTag.JPEGTables }, { ExifTag.OECF }, @@ -320,14 +320,14 @@ public class ExifValuesTests { ExifTag.ImageSourceData }, }; - public static TheoryData EncodedStringTags => new TheoryData + public static TheoryData EncodedStringTags => new() { { ExifTag.UserComment }, { ExifTag.GPSProcessingMethod }, { ExifTag.GPSAreaInformation } }; - public static TheoryData Ucs2StringTags => new TheoryData + public static TheoryData Ucs2StringTags => new() { { ExifTag.XPTitle }, { ExifTag.XPComment }, @@ -481,7 +481,7 @@ public class ExifValuesTests [MemberData(nameof(RationalTags))] public void ExifRationalTests(ExifTag tag) { - Rational expected = new Rational(21, 42); + Rational expected = new(21, 42); ExifValue value = ExifValues.Create(tag); Assert.False(value.TrySetValue(expected.ToString())); @@ -540,7 +540,7 @@ public class ExifValuesTests [MemberData(nameof(SignedRationalTags))] public void ExifSignedRationalTests(ExifTag tag) { - SignedRational expected = new SignedRational(21, 42); + SignedRational expected = new(21, 42); ExifValue value = ExifValues.Create(tag); Assert.False(value.TrySetValue(expected.ToString())); @@ -633,7 +633,7 @@ public class ExifValuesTests Assert.Equal(ExifEncodedStringHelpers.CharacterCodeBytesLength, ExifEncodedStringHelpers.GetCodeBytes(charCode).Length); const string expectedText = "test string"; - EncodedString expected = new EncodedString(charCode, expectedText); + EncodedString expected = new(charCode, expectedText); ExifValue value = ExifValues.Create(tag); Assert.False(value.TrySetValue(123)); diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderCurvesTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderCurvesTests.cs index 9f089f482..86c6a5e9f 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderCurvesTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderCurvesTests.cs @@ -77,6 +77,6 @@ public class IccDataReaderCurvesTests private static IccDataReader CreateReader(byte[] data) { - return new(data); + return new IccDataReader(data); } } diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderLutTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderLutTests.cs index 817832807..a686d4487 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderLutTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderLutTests.cs @@ -77,6 +77,6 @@ public class IccDataReaderLutTests private static IccDataReader CreateReader(byte[] data) { - return new(data); + return new IccDataReader(data); } } diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderMultiProcessElementTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderMultiProcessElementTests.cs index 030cf0df4..930665a07 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderMultiProcessElementTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderMultiProcessElementTests.cs @@ -55,6 +55,6 @@ public class IccDataReaderMultiProcessElementTests private static IccDataReader CreateReader(byte[] data) { - return new(data); + return new IccDataReader(data); } } diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderNonPrimitivesTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderNonPrimitivesTests.cs index f4f89d11d..ee0464bb2 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderNonPrimitivesTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderNonPrimitivesTests.cs @@ -122,6 +122,6 @@ public class IccDataReaderNonPrimitivesTests private static IccDataReader CreateReader(byte[] data) { - return new(data); + return new IccDataReader(data); } } diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderPrimitivesTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderPrimitivesTests.cs index 77e334a49..9c5be4c67 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderPrimitivesTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderPrimitivesTests.cs @@ -82,6 +82,6 @@ public class IccDataReaderPrimitivesTests private static IccDataReader CreateReader(byte[] data) { - return new(data); + return new IccDataReader(data); } } diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderTagDataEntryTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderTagDataEntryTests.cs index 735a6abf7..e0cfa6543 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderTagDataEntryTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderTagDataEntryTests.cs @@ -442,6 +442,6 @@ public class IccDataReaderTagDataEntryTests private static IccDataReader CreateReader(byte[] data) { - return new(data); + return new IccDataReader(data); } } diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterCurvesTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterCurvesTests.cs index f6ac8517d..79578f1ad 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterCurvesTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterCurvesTests.cs @@ -81,5 +81,5 @@ public class IccDataWriterCurvesTests Assert.Equal(expected, output); } - private static IccDataWriter CreateWriter() => new IccDataWriter(); + private static IccDataWriter CreateWriter() => new(); } diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterLutTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterLutTests.cs index 8f696e99d..27db7e4e6 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterLutTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterLutTests.cs @@ -81,5 +81,5 @@ public class IccDataWriterLutTests Assert.Equal(expected, output); } - private static IccDataWriter CreateWriter() => new IccDataWriter(); + private static IccDataWriter CreateWriter() => new(); } diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccProfileTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccProfileTests.cs index 79a8fb263..27ce0ffa8 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccProfileTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccProfileTests.cs @@ -34,7 +34,7 @@ public class IccProfileTests [MemberData(nameof(IccTestDataProfiles.ProfileValidityTestData), MemberType = typeof(IccTestDataProfiles))] public void CheckIsValid_WithProfiles_ReturnsValidity(byte[] data, bool expected) { - IccProfile profile = new IccProfile(data); + IccProfile profile = new(data); bool result = profile.CheckIsValid(); diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccWriterTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccWriterTests.cs index ffc4ed2eb..71c58c25d 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccWriterTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccWriterTests.cs @@ -12,7 +12,7 @@ public class IccWriterTests [Fact] public void WriteProfile_NoEntries() { - IccProfile profile = new IccProfile + IccProfile profile = new() { Header = IccTestDataProfiles.HeaderRandomWrite }; diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/Various/IccProfileIdTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/Various/IccProfileIdTests.cs index e56f7f182..5af672c21 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/Various/IccProfileIdTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/Various/IccProfileIdTests.cs @@ -19,7 +19,7 @@ public class IccProfileIdTests [Fact] public void SetIsTrueWhenNonDefaultValue() { - IccProfileId id = new IccProfileId(1, 2, 3, 4); + IccProfileId id = new(1, 2, 3, 4); Assert.True(id.IsSet); diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/IPTC/IptcProfileTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/IPTC/IptcProfileTests.cs index 36df7da0c..c64fcab58 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/IPTC/IptcProfileTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/IPTC/IptcProfileTests.cs @@ -78,7 +78,7 @@ public class IptcProfileTests { // arrange IptcProfile profile = new(); - DateTimeOffset datetime = new(new(1994, 3, 17)); + DateTimeOffset datetime = new(new DateTime(1994, 3, 17)); // act profile.SetDateTimeValue(tag, datetime); @@ -228,7 +228,7 @@ public class IptcProfileTests { // arrange using Image image = new(1, 1); - image.Metadata.IptcProfile = new(); + image.Metadata.IptcProfile = new IptcProfile(); const string expectedCaptionWriter = "unittest"; const string expectedCaption = "test"; image.Metadata.IptcProfile.SetValue(IptcTag.CaptionWriter, expectedCaptionWriter); @@ -380,7 +380,7 @@ public class IptcProfileTests private static void ContainsIptcValue(List values, IptcTag tag, string value) { Assert.True(values.Any(val => val.Tag == tag), $"Missing iptc tag {tag}"); - Assert.True(values.Contains(new(tag, System.Text.Encoding.UTF8.GetBytes(value), false)), $"expected iptc value '{value}' was not found for tag '{tag}'"); + Assert.True(values.Contains(new IptcValue(tag, System.Text.Encoding.UTF8.GetBytes(value), false)), $"expected iptc value '{value}' was not found for tag '{tag}'"); } private static Image WriteAndReadJpeg(Image image) diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/XMP/XmpProfileTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/XMP/XmpProfileTests.cs index 1c253bbbe..e121d24f9 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/XMP/XmpProfileTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/XMP/XmpProfileTests.cs @@ -111,10 +111,10 @@ public class XmpProfileTests public void WritingGif_PreservesXmpProfile() { // arrange - using Image image = new Image(1, 1); + using Image image = new(1, 1); XmpProfile original = CreateMinimalXmlProfile(); image.Metadata.XmpProfile = original; - GifEncoder encoder = new GifEncoder(); + GifEncoder encoder = new(); // act using Image reloadedImage = WriteAndRead(image, encoder); @@ -129,10 +129,10 @@ public class XmpProfileTests public void WritingJpeg_PreservesXmpProfile() { // arrange - using Image image = new Image(1, 1); + using Image image = new(1, 1); XmpProfile original = CreateMinimalXmlProfile(); image.Metadata.XmpProfile = original; - JpegEncoder encoder = new JpegEncoder(); + JpegEncoder encoder = new(); // act using Image reloadedImage = WriteAndRead(image, encoder); @@ -150,7 +150,7 @@ public class XmpProfileTests TestImageProvider provider = TestImageProvider.File(TestImages.Jpeg.Baseline.ExtendedXmp); using Image image = await provider.GetImageAsync(JpegDecoder.Instance); XmpProfile original = image.Metadata.XmpProfile; - JpegEncoder encoder = new JpegEncoder(); + JpegEncoder encoder = new(); // act using Image reloadedImage = WriteAndRead(image, encoder); @@ -165,10 +165,10 @@ public class XmpProfileTests public void WritingPng_PreservesXmpProfile() { // arrange - using Image image = new Image(1, 1); + using Image image = new(1, 1); XmpProfile original = CreateMinimalXmlProfile(); image.Metadata.XmpProfile = original; - PngEncoder encoder = new PngEncoder(); + PngEncoder encoder = new(); // act using Image reloadedImage = WriteAndRead(image, encoder); @@ -183,10 +183,10 @@ public class XmpProfileTests public void WritingTiff_PreservesXmpProfile() { // arrange - using Image image = new Image(1, 1); + using Image image = new(1, 1); XmpProfile original = CreateMinimalXmlProfile(); image.Frames.RootFrame.Metadata.XmpProfile = original; - TiffEncoder encoder = new TiffEncoder(); + TiffEncoder encoder = new(); // act using Image reloadedImage = WriteAndRead(image, encoder); @@ -201,10 +201,10 @@ public class XmpProfileTests public void WritingWebp_PreservesXmpProfile() { // arrange - using Image image = new Image(1, 1); + using Image image = new(1, 1); XmpProfile original = CreateMinimalXmlProfile(); image.Metadata.XmpProfile = original; - WebpEncoder encoder = new WebpEncoder(); + WebpEncoder encoder = new(); // act using Image reloadedImage = WriteAndRead(image, encoder); @@ -228,13 +228,13 @@ public class XmpProfileTests { string content = $" "; byte[] data = Encoding.UTF8.GetBytes(content); - XmpProfile profile = new XmpProfile(data); + XmpProfile profile = new(data); return profile; } private static Image WriteAndRead(Image image, IImageEncoder encoder) { - using (MemoryStream memStream = new MemoryStream()) + using (MemoryStream memStream = new()) { image.Save(memStream, encoder); image.Dispose(); diff --git a/tests/ImageSharp.Tests/Numerics/RationalTests.cs b/tests/ImageSharp.Tests/Numerics/RationalTests.cs index 9e7e3b7a0..f9cefaddd 100644 --- a/tests/ImageSharp.Tests/Numerics/RationalTests.cs +++ b/tests/ImageSharp.Tests/Numerics/RationalTests.cs @@ -70,19 +70,19 @@ public class RationalTests Assert.Equal(7U, rational.Numerator); Assert.Equal(55U, rational.Denominator); - rational = new(755, 100); + rational = new Rational(755, 100); Assert.Equal(151U, rational.Numerator); Assert.Equal(20U, rational.Denominator); - rational = new(755, 100, false); + rational = new Rational(755, 100, false); Assert.Equal(755U, rational.Numerator); Assert.Equal(100U, rational.Denominator); - rational = new(-7.55); + rational = new Rational(-7.55); Assert.Equal(151U, rational.Numerator); Assert.Equal(20U, rational.Denominator); - rational = new(7); + rational = new Rational(7); Assert.Equal(7U, rational.Numerator); Assert.Equal(1U, rational.Denominator); } @@ -101,7 +101,7 @@ public class RationalTests Rational rational = new(0, 0); Assert.Equal(double.NaN, rational.ToDouble()); - rational = new(2, 0); + rational = new Rational(2, 0); Assert.Equal(double.PositiveInfinity, rational.ToDouble()); } @@ -111,19 +111,19 @@ public class RationalTests Rational rational = new(0, 0); Assert.Equal("[ Indeterminate ]", rational.ToString()); - rational = new(double.PositiveInfinity); + rational = new Rational(double.PositiveInfinity); Assert.Equal("[ PositiveInfinity ]", rational.ToString()); - rational = new(double.NegativeInfinity); + rational = new Rational(double.NegativeInfinity); Assert.Equal("[ PositiveInfinity ]", rational.ToString()); - rational = new(0, 1); + rational = new Rational(0, 1); Assert.Equal("0", rational.ToString()); - rational = new(2, 1); + rational = new Rational(2, 1); Assert.Equal("2", rational.ToString()); - rational = new(1, 2); + rational = new Rational(1, 2); Assert.Equal("1/2", rational.ToString()); } } diff --git a/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs b/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs index 275ba4d5f..f194484c4 100644 --- a/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs +++ b/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs @@ -51,23 +51,23 @@ public class SignedRationalTests Assert.Equal(7, rational.Numerator); Assert.Equal(-55, rational.Denominator); - rational = new(-755, 100); + rational = new SignedRational(-755, 100); Assert.Equal(-151, rational.Numerator); Assert.Equal(20, rational.Denominator); - rational = new(-755, -100, false); + rational = new SignedRational(-755, -100, false); Assert.Equal(-755, rational.Numerator); Assert.Equal(-100, rational.Denominator); - rational = new(-151, -20); + rational = new SignedRational(-151, -20); Assert.Equal(-151, rational.Numerator); Assert.Equal(-20, rational.Denominator); - rational = new(-7.55); + rational = new SignedRational(-7.55); Assert.Equal(-151, rational.Numerator); Assert.Equal(20, rational.Denominator); - rational = new(7); + rational = new SignedRational(7); Assert.Equal(7, rational.Numerator); Assert.Equal(1, rational.Denominator); } @@ -86,10 +86,10 @@ public class SignedRationalTests SignedRational rational = new(0, 0); Assert.Equal(double.NaN, rational.ToDouble()); - rational = new(2, 0); + rational = new SignedRational(2, 0); Assert.Equal(double.PositiveInfinity, rational.ToDouble()); - rational = new(-2, 0); + rational = new SignedRational(-2, 0); Assert.Equal(double.NegativeInfinity, rational.ToDouble()); } @@ -99,19 +99,19 @@ public class SignedRationalTests SignedRational rational = new(0, 0); Assert.Equal("[ Indeterminate ]", rational.ToString()); - rational = new(double.PositiveInfinity); + rational = new SignedRational(double.PositiveInfinity); Assert.Equal("[ PositiveInfinity ]", rational.ToString()); - rational = new(double.NegativeInfinity); + rational = new SignedRational(double.NegativeInfinity); Assert.Equal("[ NegativeInfinity ]", rational.ToString()); - rational = new(0, 1); + rational = new SignedRational(0, 1); Assert.Equal("0", rational.ToString()); - rational = new(2, 1); + rational = new SignedRational(2, 1); Assert.Equal("2", rational.ToString()); - rational = new(1, 2); + rational = new SignedRational(1, 2); Assert.Equal("1/2", rational.ToString()); } } diff --git a/tests/ImageSharp.Tests/PixelFormats/A8Tests.cs b/tests/ImageSharp.Tests/PixelFormats/A8Tests.cs index 4b348b88f..4b4e84b4b 100644 --- a/tests/ImageSharp.Tests/PixelFormats/A8Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/A8Tests.cs @@ -101,7 +101,7 @@ public class A8Tests const byte expected = byte.MaxValue; // act - A8 alpha = A8.FromBgra5551(new(0.0f, 0.0f, 0.0f, 1.0f)); + A8 alpha = A8.FromBgra5551(new Bgra5551(0.0f, 0.0f, 0.0f, 1.0f)); // assert Assert.Equal(expected, alpha.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/Abgr32Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Abgr32Tests.cs index 415650321..98fdce5db 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Abgr32Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Abgr32Tests.cs @@ -96,7 +96,7 @@ public class Abgr32Tests [Fact] public void FromRgba32() { - Abgr32 abgr = Abgr32.FromRgba32(new(1, 2, 3, 4)); + Abgr32 abgr = Abgr32.FromRgba32(new Rgba32(1, 2, 3, 4)); Assert.Equal(1, abgr.R); Assert.Equal(2, abgr.G); @@ -136,7 +136,7 @@ public class Abgr32Tests const uint expected = uint.MaxValue; // act - Abgr32 abgr = Abgr32.FromBgra5551(new(1f, 1f, 1f, 1f)); + Abgr32 abgr = Abgr32.FromBgra5551(new Bgra5551(1f, 1f, 1f, 1f)); // assert Assert.Equal(expected, abgr.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/Argb32Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Argb32Tests.cs index 8e05c5ca0..bcaf9265a 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Argb32Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Argb32Tests.cs @@ -128,7 +128,7 @@ public class Argb32Tests const uint expected = uint.MaxValue; // act - Argb32 argb = Argb32.FromBgra5551(new(1f, 1f, 1f, 1f)); + Argb32 argb = Argb32.FromBgra5551(new Bgra5551(1f, 1f, 1f, 1f)); // assert Assert.Equal(expected, argb.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/Bgr24Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Bgr24Tests.cs index a7e4a08f0..362e20bba 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Bgr24Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Bgr24Tests.cs @@ -80,7 +80,7 @@ public class Bgr24Tests [Fact] public void FromRgba32() { - Bgr24 rgb = Bgr24.FromRgba32(new(1, 2, 3, 4)); + Bgr24 rgb = Bgr24.FromRgba32(new Rgba32(1, 2, 3, 4)); Assert.Equal(1, rgb.R); Assert.Equal(2, rgb.G); @@ -115,7 +115,7 @@ public class Bgr24Tests public void Bgr24_FromBgra5551() { // act - Bgr24 bgr = Bgr24.FromBgra5551(new(1f, 1f, 1f, 1f)); + Bgr24 bgr = Bgr24.FromBgra5551(new Bgra5551(1f, 1f, 1f, 1f)); // assert Assert.Equal(255, bgr.R); diff --git a/tests/ImageSharp.Tests/PixelFormats/Bgr565Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Bgr565Tests.cs index f74660731..3c4a10423 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Bgr565Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Bgr565Tests.cs @@ -17,8 +17,8 @@ public class Bgr565Tests public void AreEqual() { Bgr565 color1 = new(0.0f, 0.0f, 0.0f); - Bgr565 color2 = new(new(0.0f)); - Bgr565 color3 = new(new(1.0f, 0.0f, 1.0f)); + Bgr565 color2 = new(new Vector3(0.0f)); + Bgr565 color3 = new(new Vector3(1.0f, 0.0f, 1.0f)); Bgr565 color4 = new(1.0f, 0.0f, 1.0f); Assert.Equal(color1, color2); @@ -32,8 +32,8 @@ public class Bgr565Tests public void AreNotEqual() { Bgr565 color1 = new(0.0f, 0.0f, 0.0f); - Bgr565 color2 = new(new(1.0f)); - Bgr565 color3 = new(new(1.0f, 0.0f, 0.0f)); + Bgr565 color2 = new(new Vector3(1.0f)); + Bgr565 color3 = new(new Vector3(1.0f, 0.0f, 0.0f)); Bgr565 color4 = new(1.0f, 1.0f, 0.0f); Assert.NotEqual(color1, color2); @@ -101,7 +101,7 @@ public class Bgr565Tests const ushort expected = ushort.MaxValue; // act - Bgr565 bgr = Bgr565.FromBgra5551(new(1.0f, 1.0f, 1.0f, 1.0f)); + Bgr565 bgr = Bgr565.FromBgra5551(new Bgra5551(1.0f, 1.0f, 1.0f, 1.0f)); // assert Assert.Equal(expected, bgr.PackedValue); @@ -115,8 +115,8 @@ public class Bgr565Tests const ushort expected2 = ushort.MaxValue; // act - Bgr565 bgr1 = Bgr565.FromArgb32(new(1.0f, 1.0f, 1.0f, 1.0f)); - Bgr565 bgr2 = Bgr565.FromArgb32(new(1.0f, 1.0f, 1.0f, 0.0f)); + Bgr565 bgr1 = Bgr565.FromArgb32(new Argb32(1.0f, 1.0f, 1.0f, 1.0f)); + Bgr565 bgr2 = Bgr565.FromArgb32(new Argb32(1.0f, 1.0f, 1.0f, 0.0f)); // assert Assert.Equal(expected1, bgr1.PackedValue); @@ -131,8 +131,8 @@ public class Bgr565Tests const ushort expected2 = ushort.MaxValue; // act - Bgr565 bgr1 = Bgr565.FromRgba32(new(1.0f, 1.0f, 1.0f, 1.0f)); - Bgr565 bgr2 = Bgr565.FromRgba32(new(1.0f, 1.0f, 1.0f, 0.0f)); + Bgr565 bgr1 = Bgr565.FromRgba32(new Rgba32(1.0f, 1.0f, 1.0f, 1.0f)); + Bgr565 bgr2 = Bgr565.FromRgba32(new Rgba32(1.0f, 1.0f, 1.0f, 0.0f)); // assert Assert.Equal(expected1, bgr1.PackedValue); @@ -159,7 +159,7 @@ public class Bgr565Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgr565 bgr = Bgr565.FromRgb48(new(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); + Bgr565 bgr = Bgr565.FromRgb48(new Rgb48(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, bgr.PackedValue); @@ -172,7 +172,7 @@ public class Bgr565Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgr565 bgr = Bgr565.FromRgba64(new(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); + Bgr565 bgr = Bgr565.FromRgba64(new Rgba64(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, bgr.PackedValue); @@ -185,7 +185,7 @@ public class Bgr565Tests const ushort expected = ushort.MaxValue; // act - Bgr565 bgr = Bgr565.FromBgr24(new(byte.MaxValue, byte.MaxValue, byte.MaxValue)); + Bgr565 bgr = Bgr565.FromBgr24(new Bgr24(byte.MaxValue, byte.MaxValue, byte.MaxValue)); // assert Assert.Equal(expected, bgr.PackedValue); @@ -198,7 +198,7 @@ public class Bgr565Tests const ushort expected = ushort.MaxValue; // act - Bgr565 bgr = Bgr565.FromRgb24(new(byte.MaxValue, byte.MaxValue, byte.MaxValue)); + Bgr565 bgr = Bgr565.FromRgb24(new Rgb24(byte.MaxValue, byte.MaxValue, byte.MaxValue)); // assert Assert.Equal(expected, bgr.PackedValue); @@ -211,7 +211,7 @@ public class Bgr565Tests const ushort expected = ushort.MaxValue; // act - Bgr565 bgr = Bgr565.FromL8(new(byte.MaxValue)); + Bgr565 bgr = Bgr565.FromL8(new L8(byte.MaxValue)); // assert Assert.Equal(expected, bgr.PackedValue); @@ -224,7 +224,7 @@ public class Bgr565Tests const ushort expected = ushort.MaxValue; // act - Bgr565 bgr = Bgr565.FromL16(new(ushort.MaxValue)); + Bgr565 bgr = Bgr565.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expected, bgr.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/Bgra32Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Bgra32Tests.cs index d0150c808..277975896 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Bgra32Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Bgra32Tests.cs @@ -96,7 +96,7 @@ public class Bgra32Tests [Fact] public void FromRgba32() { - Bgra32 bgra = Bgra32.FromRgba32(new(1, 2, 3, 4)); + Bgra32 bgra = Bgra32.FromRgba32(new Rgba32(1, 2, 3, 4)); Assert.Equal(1, bgra.R); Assert.Equal(2, bgra.G); @@ -136,7 +136,7 @@ public class Bgra32Tests const uint expected = uint.MaxValue; // act - Bgra32 bgra = Bgra32.FromBgra5551(new(1.0f, 1.0f, 1.0f, 1.0f)); + Bgra32 bgra = Bgra32.FromBgra5551(new Bgra5551(1.0f, 1.0f, 1.0f, 1.0f)); // assert Assert.Equal(expected, bgra.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/Bgra4444Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Bgra4444Tests.cs index 166a06940..5d20b5cf1 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Bgra4444Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Bgra4444Tests.cs @@ -17,8 +17,8 @@ public class Bgra4444Tests public void AreEqual() { Bgra4444 color1 = new(0.0f, 0.0f, 0.0f, 0.0f); - Bgra4444 color2 = new(new(0.0f)); - Bgra4444 color3 = new(new(1.0f, 0.0f, 1.0f, 1.0f)); + Bgra4444 color2 = new(new Vector4(0.0f)); + Bgra4444 color3 = new(new Vector4(1.0f, 0.0f, 1.0f, 1.0f)); Bgra4444 color4 = new(1.0f, 0.0f, 1.0f, 1.0f); Assert.Equal(color1, color2); @@ -32,8 +32,8 @@ public class Bgra4444Tests public void AreNotEqual() { Bgra4444 color1 = new(0.0f, 0.0f, 0.0f, 0.0f); - Bgra4444 color2 = new(new(1.0f)); - Bgra4444 color3 = new(new(1.0f, 0.0f, 0.0f, 1.0f)); + Bgra4444 color2 = new(new Vector4(1.0f)); + Bgra4444 color3 = new(new Vector4(1.0f, 0.0f, 0.0f, 1.0f)); Bgra4444 color4 = new(1.0f, 1.0f, 0.0f, 1.0f); Assert.NotEqual(color1, color2); @@ -114,7 +114,7 @@ public class Bgra4444Tests const ushort expected = ushort.MaxValue; // act - Bgra4444 pixel = Bgra4444.FromBgra5551(new(1.0f, 1.0f, 1.0f, 1.0f)); + Bgra4444 pixel = Bgra4444.FromBgra5551(new Bgra5551(1.0f, 1.0f, 1.0f, 1.0f)); // assert Assert.Equal(expected, pixel.PackedValue); @@ -127,7 +127,7 @@ public class Bgra4444Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgra4444 pixel = Bgra4444.FromArgb32(new(255, 255, 255, 255)); + Bgra4444 pixel = Bgra4444.FromArgb32(new Argb32(255, 255, 255, 255)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -141,8 +141,8 @@ public class Bgra4444Tests const ushort expectedPackedValue2 = 0xFF0F; // act - Bgra4444 bgra1 = Bgra4444.FromRgba32(new(255, 255, 255, 255)); - Bgra4444 bgra2 = Bgra4444.FromRgba32(new(255, 0, 255, 255)); + Bgra4444 bgra1 = Bgra4444.FromRgba32(new Rgba32(255, 255, 255, 255)); + Bgra4444 bgra2 = Bgra4444.FromRgba32(new Rgba32(255, 0, 255, 255)); // assert Assert.Equal(expectedPackedValue1, bgra1.PackedValue); @@ -156,7 +156,7 @@ public class Bgra4444Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgra4444 pixel = Bgra4444.FromRgb48(new(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); + Bgra4444 pixel = Bgra4444.FromRgb48(new Rgb48(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -169,7 +169,7 @@ public class Bgra4444Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgra4444 pixel = Bgra4444.FromRgba64(new(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); + Bgra4444 pixel = Bgra4444.FromRgba64(new Rgba64(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -182,7 +182,7 @@ public class Bgra4444Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgra4444 pixel = Bgra4444.FromL16(new(ushort.MaxValue)); + Bgra4444 pixel = Bgra4444.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -195,7 +195,7 @@ public class Bgra4444Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgra4444 pixel = Bgra4444.FromL8(new(byte.MaxValue)); + Bgra4444 pixel = Bgra4444.FromL8(new L8(byte.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -208,7 +208,7 @@ public class Bgra4444Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgra4444 pixel = Bgra4444.FromBgr24(new(byte.MaxValue, byte.MaxValue, byte.MaxValue)); + Bgra4444 pixel = Bgra4444.FromBgr24(new Bgr24(byte.MaxValue, byte.MaxValue, byte.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -221,7 +221,7 @@ public class Bgra4444Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgra4444 pixel = Bgra4444.FromRgb24(new(byte.MaxValue, byte.MaxValue, byte.MaxValue)); + Bgra4444 pixel = Bgra4444.FromRgb24(new Rgb24(byte.MaxValue, byte.MaxValue, byte.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/Bgra5551Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Bgra5551Tests.cs index a19f0e9a1..38f809e49 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Bgra5551Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Bgra5551Tests.cs @@ -17,8 +17,8 @@ public class Bgra5551Tests public void AreEqual() { Bgra5551 color1 = new(0.0f, 0.0f, 0.0f, 0.0f); - Bgra5551 color2 = new(new(0.0f)); - Bgra5551 color3 = new(new(1f, 0.0f, 0.0f, 1f)); + Bgra5551 color2 = new(new Vector4(0.0f)); + Bgra5551 color3 = new(new Vector4(1f, 0.0f, 0.0f, 1f)); Bgra5551 color4 = new(1f, 0.0f, 0.0f, 1f); Assert.Equal(color1, color2); @@ -32,8 +32,8 @@ public class Bgra5551Tests public void AreNotEqual() { Bgra5551 color1 = new(0.0f, 0.0f, 0.0f, 0.0f); - Bgra5551 color2 = new(new(1f)); - Bgra5551 color3 = new(new(1f, 0.0f, 0.0f, 1f)); + Bgra5551 color2 = new(new Vector4(1f)); + Bgra5551 color3 = new(new Vector4(1f, 0.0f, 0.0f, 1f)); Bgra5551 color4 = new(1f, 1f, 0.0f, 1f); Assert.NotEqual(color1, color2); @@ -134,8 +134,8 @@ public class Bgra5551Tests const ushort expectedPackedValue2 = 0xFC1F; // act - Bgra5551 bgra1 = Bgra5551.FromRgba32(new(255, 255, 255, 255)); - Bgra5551 bgra2 = Bgra5551.FromRgba32(new(255, 0, 255, 255)); + Bgra5551 bgra1 = Bgra5551.FromRgba32(new Rgba32(255, 255, 255, 255)); + Bgra5551 bgra2 = Bgra5551.FromRgba32(new Rgba32(255, 0, 255, 255)); // assert Assert.Equal(expectedPackedValue1, bgra1.PackedValue); @@ -150,8 +150,8 @@ public class Bgra5551Tests const ushort expectedPackedValue2 = 0xFC1F; // act - Bgra5551 bgra1 = Bgra5551.FromBgra32(new(255, 255, 255, 255)); - Bgra5551 bgra2 = Bgra5551.FromBgra32(new(255, 0, 255, 255)); + Bgra5551 bgra1 = Bgra5551.FromBgra32(new Bgra32(255, 255, 255, 255)); + Bgra5551 bgra2 = Bgra5551.FromBgra32(new Bgra32(255, 0, 255, 255)); // assert Assert.Equal(expectedPackedValue1, bgra1.PackedValue); @@ -165,7 +165,7 @@ public class Bgra5551Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgra5551 pixel = Bgra5551.FromArgb32(new(255, 255, 255, 255)); + Bgra5551 pixel = Bgra5551.FromArgb32(new Argb32(255, 255, 255, 255)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -178,7 +178,7 @@ public class Bgra5551Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgra5551 pixel = Bgra5551.FromRgb48(new(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); + Bgra5551 pixel = Bgra5551.FromRgb48(new Rgb48(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -191,7 +191,7 @@ public class Bgra5551Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgra5551 pixel = Bgra5551.FromRgba64(new(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); + Bgra5551 pixel = Bgra5551.FromRgba64(new Rgba64(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -204,7 +204,7 @@ public class Bgra5551Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgra5551 pixel = Bgra5551.FromL16(new(ushort.MaxValue)); + Bgra5551 pixel = Bgra5551.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -217,7 +217,7 @@ public class Bgra5551Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgra5551 pixel = Bgra5551.FromL8(new(byte.MaxValue)); + Bgra5551 pixel = Bgra5551.FromL8(new L8(byte.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -230,7 +230,7 @@ public class Bgra5551Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgra5551 pixel = Bgra5551.FromBgr24(new(byte.MaxValue, byte.MaxValue, byte.MaxValue)); + Bgra5551 pixel = Bgra5551.FromBgr24(new Bgr24(byte.MaxValue, byte.MaxValue, byte.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -243,7 +243,7 @@ public class Bgra5551Tests const ushort expectedPackedValue = ushort.MaxValue; // act - Bgra5551 pixel = Bgra5551.FromRgb24(new(byte.MaxValue, byte.MaxValue, byte.MaxValue)); + Bgra5551 pixel = Bgra5551.FromRgb24(new Rgb24(byte.MaxValue, byte.MaxValue, byte.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/Byte4Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Byte4Tests.cs index 51c7ec4db..e73d64640 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Byte4Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Byte4Tests.cs @@ -17,8 +17,8 @@ public class Byte4Tests public void AreEqual() { Byte4 color1 = new(0f, 0f, 0f, 0f); - Byte4 color2 = new(new(0f)); - Byte4 color3 = new(new(1f, 0f, 1f, 1f)); + Byte4 color2 = new(new Vector4(0f)); + Byte4 color3 = new(new Vector4(1f, 0f, 1f, 1f)); Byte4 color4 = new(1f, 0f, 1f, 1f); Assert.Equal(color1, color2); @@ -32,8 +32,8 @@ public class Byte4Tests public void AreNotEqual() { Byte4 color1 = new(0f, 0f, 0f, 0f); - Byte4 color2 = new(new(1f)); - Byte4 color3 = new(new(1f, 0f, 0f, 1f)); + Byte4 color2 = new(new Vector4(1f)); + Byte4 color3 = new(new Vector4(1f, 0f, 0f, 1f)); Byte4 color4 = new(1f, 1f, 0f, 1f); Assert.NotEqual(color1, color2); @@ -111,7 +111,7 @@ public class Byte4Tests const uint expectedPackedValue = uint.MaxValue; // act - Byte4 pixel = Byte4.FromArgb32(new(255, 255, 255, 255)); + Byte4 pixel = Byte4.FromArgb32(new Argb32(255, 255, 255, 255)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -124,7 +124,7 @@ public class Byte4Tests const uint expectedPackedValue = uint.MaxValue; // act - Byte4 pixel = Byte4.FromBgr24(new(byte.MaxValue, byte.MaxValue, byte.MaxValue)); + Byte4 pixel = Byte4.FromBgr24(new Bgr24(byte.MaxValue, byte.MaxValue, byte.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -137,7 +137,7 @@ public class Byte4Tests const uint expectedPackedValue = uint.MaxValue; // act - Byte4 pixel = Byte4.FromL8(new(byte.MaxValue)); + Byte4 pixel = Byte4.FromL8(new L8(byte.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -150,7 +150,7 @@ public class Byte4Tests const uint expectedPackedValue = uint.MaxValue; // act - Byte4 pixel = Byte4.FromL16(new(ushort.MaxValue)); + Byte4 pixel = Byte4.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -163,7 +163,7 @@ public class Byte4Tests const uint expectedPackedValue = uint.MaxValue; // act - Byte4 pixel = Byte4.FromRgb24(new(byte.MaxValue, byte.MaxValue, byte.MaxValue)); + Byte4 pixel = Byte4.FromRgb24(new Rgb24(byte.MaxValue, byte.MaxValue, byte.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -176,7 +176,7 @@ public class Byte4Tests const uint expected = 0xFFFFFFFF; // act - Byte4 pixel = Byte4.FromBgra5551(new(1f, 1f, 1f, 1f)); + Byte4 pixel = Byte4.FromBgra5551(new Bgra5551(1f, 1f, 1f, 1f)); // assert Assert.Equal(expected, pixel.PackedValue); @@ -189,7 +189,7 @@ public class Byte4Tests const uint expectedPackedValue1 = uint.MaxValue; // act - Byte4 pixel = Byte4.FromRgba32(new(255, 255, 255, 255)); + Byte4 pixel = Byte4.FromRgba32(new Rgba32(255, 255, 255, 255)); // assert Assert.Equal(expectedPackedValue1, pixel.PackedValue); @@ -202,7 +202,7 @@ public class Byte4Tests const uint expectedPackedValue = uint.MaxValue; // act - Byte4 pixel = Byte4.FromRgb48(new(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); + Byte4 pixel = Byte4.FromRgb48(new Rgb48(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); @@ -215,7 +215,7 @@ public class Byte4Tests const uint expectedPackedValue = uint.MaxValue; // act - Byte4 pixel = Byte4.FromRgba64(new(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); + Byte4 pixel = Byte4.FromRgba64(new Rgba64(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, pixel.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/HalfVector2Tests.cs b/tests/ImageSharp.Tests/PixelFormats/HalfVector2Tests.cs index d723aac47..c5a89df1e 100644 --- a/tests/ImageSharp.Tests/PixelFormats/HalfVector2Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/HalfVector2Tests.cs @@ -76,7 +76,7 @@ public class HalfVector2Tests public void HalfVector2_FromBgra5551() { // act - HalfVector2 pixel = HalfVector2.FromBgra5551(new(1f, 1f, 1f, 1f)); + HalfVector2 pixel = HalfVector2.FromBgra5551(new Bgra5551(1f, 1f, 1f, 1f)); // assert Vector4 actual = pixel.ToScaledVector4(); diff --git a/tests/ImageSharp.Tests/PixelFormats/HalfVector4Tests.cs b/tests/ImageSharp.Tests/PixelFormats/HalfVector4Tests.cs index 571711800..16c78a23d 100644 --- a/tests/ImageSharp.Tests/PixelFormats/HalfVector4Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/HalfVector4Tests.cs @@ -73,7 +73,7 @@ public class HalfVector4Tests Vector4 expected = Vector4.One; // act - HalfVector4 pixel = HalfVector4.FromBgra5551(new(1.0f, 1.0f, 1.0f, 1.0f)); + HalfVector4 pixel = HalfVector4.FromBgra5551(new Bgra5551(1.0f, 1.0f, 1.0f, 1.0f)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); diff --git a/tests/ImageSharp.Tests/PixelFormats/L16Tests.cs b/tests/ImageSharp.Tests/PixelFormats/L16Tests.cs index 5631bbc7e..7f0a4217c 100644 --- a/tests/ImageSharp.Tests/PixelFormats/L16Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/L16Tests.cs @@ -115,7 +115,7 @@ public class L16Tests ushort expected = ColorNumerics.Get16BitBT709Luminance(scaledRgb, scaledRgb, scaledRgb); // Act - L16 pixel = L16.FromRgba32(new(rgb, rgb, rgb)); + L16 pixel = L16.FromRgba32(new Rgba32(rgb, rgb, rgb)); ushort actual = pixel.PackedValue; // Assert @@ -149,7 +149,7 @@ public class L16Tests const ushort expected = ushort.MaxValue; // act - L16 pixel = L16.FromBgra5551(new(1.0f, 1.0f, 1.0f, 1.0f)); + L16 pixel = L16.FromBgra5551(new Bgra5551(1.0f, 1.0f, 1.0f, 1.0f)); // assert Assert.Equal(expected, pixel.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/L8Tests.cs b/tests/ImageSharp.Tests/PixelFormats/L8Tests.cs index b1c94c754..1ca865ef4 100644 --- a/tests/ImageSharp.Tests/PixelFormats/L8Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/L8Tests.cs @@ -114,7 +114,7 @@ public class L8Tests byte expected = ColorNumerics.Get8BitBT709Luminance(rgb, rgb, rgb); // Act - L8 pixel = L8.FromRgba32(new(rgb, rgb, rgb)); + L8 pixel = L8.FromRgba32(new Rgba32(rgb, rgb, rgb)); byte actual = pixel.PackedValue; // Assert @@ -145,7 +145,7 @@ public class L8Tests const byte expected = byte.MaxValue; // act - L8 grey = L8.FromBgra5551(new(1f, 1f, 1f, 1f)); + L8 grey = L8.FromBgra5551(new Bgra5551(1f, 1f, 1f, 1f)); // assert Assert.Equal(expected, grey.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/La16Tests.cs b/tests/ImageSharp.Tests/PixelFormats/La16Tests.cs index d82afdff1..f6cbfc442 100644 --- a/tests/ImageSharp.Tests/PixelFormats/La16Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/La16Tests.cs @@ -116,7 +116,7 @@ public class La16Tests byte expected = ColorNumerics.Get8BitBT709Luminance(rgb, rgb, rgb); // Act - La16 gray = La16.FromRgba32(new(rgb, rgb, rgb)); + La16 gray = La16.FromRgba32(new Rgba32(rgb, rgb, rgb)); byte actual = gray.L; // Assert @@ -148,7 +148,7 @@ public class La16Tests const byte expected = byte.MaxValue; // act - La16 grey = La16.FromBgra5551(new(1.0f, 1.0f, 1.0f, 1.0f)); + La16 grey = La16.FromBgra5551(new Bgra5551(1.0f, 1.0f, 1.0f, 1.0f)); // assert Assert.Equal(expected, grey.L); diff --git a/tests/ImageSharp.Tests/PixelFormats/La32Tests.cs b/tests/ImageSharp.Tests/PixelFormats/La32Tests.cs index 571aa3fd0..fd5556d3b 100644 --- a/tests/ImageSharp.Tests/PixelFormats/La32Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/La32Tests.cs @@ -119,7 +119,7 @@ public class La32Tests ushort expected = ColorNumerics.Get16BitBT709Luminance(scaledRgb, scaledRgb, scaledRgb); // Act - La32 pixel = La32.FromRgba32(new(rgb, rgb, rgb)); + La32 pixel = La32.FromRgba32(new Rgba32(rgb, rgb, rgb)); ushort actual = pixel.L; // Assert @@ -154,7 +154,7 @@ public class La32Tests const ushort expected = ushort.MaxValue; // act - La32 pixel = La32.FromBgra5551(new(1f, 1f, 1f, 1f)); + La32 pixel = La32.FromBgra5551(new Bgra5551(1f, 1f, 1f, 1f)); // assert Assert.Equal(expected, pixel.L); diff --git a/tests/ImageSharp.Tests/PixelFormats/NormalizedByte2Tests.cs b/tests/ImageSharp.Tests/PixelFormats/NormalizedByte2Tests.cs index c6a14518a..ffbddb139 100644 --- a/tests/ImageSharp.Tests/PixelFormats/NormalizedByte2Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/NormalizedByte2Tests.cs @@ -32,8 +32,8 @@ public class NormalizedByte2Tests [Fact] public void NormalizedByte2_ToVector4() { - Assert.Equal(new(1, 1, 0, 1), new NormalizedByte2(Vector2.One).ToVector4()); - Assert.Equal(new(0, 0, 0, 1), new NormalizedByte2(Vector2.Zero).ToVector4()); + Assert.Equal(new Vector4(1, 1, 0, 1), new NormalizedByte2(Vector2.One).ToVector4()); + Assert.Equal(new Vector4(0, 0, 0, 1), new NormalizedByte2(Vector2.Zero).ToVector4()); } [Fact] @@ -74,7 +74,7 @@ public class NormalizedByte2Tests Vector4 expected = new(1, 1, 0, 1); // act - NormalizedByte2 pixel = NormalizedByte2.FromBgra5551(new(1f, 1f, 1f, 1f)); + NormalizedByte2 pixel = NormalizedByte2.FromBgra5551(new Bgra5551(1f, 1f, 1f, 1f)); // assert Assert.Equal(expected, pixel.ToVector4()); diff --git a/tests/ImageSharp.Tests/PixelFormats/NormalizedByte4Tests.cs b/tests/ImageSharp.Tests/PixelFormats/NormalizedByte4Tests.cs index 40d81cad6..5a025f6c4 100644 --- a/tests/ImageSharp.Tests/PixelFormats/NormalizedByte4Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/NormalizedByte4Tests.cs @@ -17,8 +17,8 @@ public class NormalizedByte4Tests public void AreEqual() { NormalizedByte4 color1 = new(0.0f, 0.0f, 0.0f, 0.0f); - NormalizedByte4 color2 = new(new(0.0f)); - NormalizedByte4 color3 = new(new(1f, 0.0f, 1f, 1f)); + NormalizedByte4 color2 = new(new Vector4(0.0f)); + NormalizedByte4 color3 = new(new Vector4(1f, 0.0f, 1f, 1f)); NormalizedByte4 color4 = new(1f, 0.0f, 1f, 1f); Assert.Equal(color1, color2); @@ -32,8 +32,8 @@ public class NormalizedByte4Tests public void AreNotEqual() { NormalizedByte4 color1 = new(0.0f, 0.0f, 0.0f, 0.0f); - NormalizedByte4 color2 = new(new(1f)); - NormalizedByte4 color3 = new(new(1f, 0.0f, 0.0f, 1f)); + NormalizedByte4 color2 = new(new Vector4(1f)); + NormalizedByte4 color3 = new(new Vector4(1f, 0.0f, 0.0f, 1f)); NormalizedByte4 color4 = new(1f, 1f, 0.0f, 1f); Assert.NotEqual(color1, color2); @@ -98,7 +98,7 @@ public class NormalizedByte4Tests Vector4 expected = Vector4.One; // act - NormalizedByte4 pixel = NormalizedByte4.FromArgb32(new(255, 255, 255, 255)); + NormalizedByte4 pixel = NormalizedByte4.FromArgb32(new Argb32(255, 255, 255, 255)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); @@ -111,7 +111,7 @@ public class NormalizedByte4Tests Vector4 expected = Vector4.One; // act - NormalizedByte4 pixel = NormalizedByte4.FromBgr24(new(byte.MaxValue, byte.MaxValue, byte.MaxValue)); + NormalizedByte4 pixel = NormalizedByte4.FromBgr24(new Bgr24(byte.MaxValue, byte.MaxValue, byte.MaxValue)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); @@ -124,7 +124,7 @@ public class NormalizedByte4Tests Vector4 expected = Vector4.One; // act - NormalizedByte4 pixel = NormalizedByte4.FromL8(new(byte.MaxValue)); + NormalizedByte4 pixel = NormalizedByte4.FromL8(new L8(byte.MaxValue)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); @@ -137,7 +137,7 @@ public class NormalizedByte4Tests Vector4 expected = Vector4.One; // act - NormalizedByte4 pixel = NormalizedByte4.FromL16(new(ushort.MaxValue)); + NormalizedByte4 pixel = NormalizedByte4.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); @@ -150,7 +150,7 @@ public class NormalizedByte4Tests Vector4 expected = Vector4.One; // act - NormalizedByte4 pixel = NormalizedByte4.FromRgb24(new(byte.MaxValue, byte.MaxValue, byte.MaxValue)); + NormalizedByte4 pixel = NormalizedByte4.FromRgb24(new Rgb24(byte.MaxValue, byte.MaxValue, byte.MaxValue)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); @@ -163,7 +163,7 @@ public class NormalizedByte4Tests Vector4 expected = Vector4.One; // act - NormalizedByte4 pixel = NormalizedByte4.FromRgba32(new(255, 255, 255, 255)); + NormalizedByte4 pixel = NormalizedByte4.FromRgba32(new Rgba32(255, 255, 255, 255)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); @@ -176,7 +176,7 @@ public class NormalizedByte4Tests Vector4 expected = Vector4.One; // act - NormalizedByte4 pixel = NormalizedByte4.FromBgra5551(new(1f, 1f, 1f, 1f)); + NormalizedByte4 pixel = NormalizedByte4.FromBgra5551(new Bgra5551(1f, 1f, 1f, 1f)); // assert Assert.Equal(expected, pixel.ToVector4()); @@ -189,7 +189,7 @@ public class NormalizedByte4Tests Vector4 expected = Vector4.One; // act - NormalizedByte4 pixel = NormalizedByte4.FromRgb48(new(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); + NormalizedByte4 pixel = NormalizedByte4.FromRgb48(new Rgb48(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); @@ -202,7 +202,7 @@ public class NormalizedByte4Tests Vector4 expected = Vector4.One; // act - NormalizedByte4 pixel = NormalizedByte4.FromRgba64(new(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); + NormalizedByte4 pixel = NormalizedByte4.FromRgba64(new Rgba64(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); diff --git a/tests/ImageSharp.Tests/PixelFormats/NormalizedShort2Tests.cs b/tests/ImageSharp.Tests/PixelFormats/NormalizedShort2Tests.cs index f153f6aea..be7b39052 100644 --- a/tests/ImageSharp.Tests/PixelFormats/NormalizedShort2Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/NormalizedShort2Tests.cs @@ -36,8 +36,8 @@ public class NormalizedShort2Tests [Fact] public void NormalizedShort2_ToVector4() { - Assert.Equal(new(1, 1, 0, 1), new NormalizedShort2(Vector2.One).ToVector4()); - Assert.Equal(new(0, 0, 0, 1), new NormalizedShort2(Vector2.Zero).ToVector4()); + Assert.Equal(new Vector4(1, 1, 0, 1), new NormalizedShort2(Vector2.One).ToVector4()); + Assert.Equal(new Vector4(0, 0, 0, 1), new NormalizedShort2(Vector2.Zero).ToVector4()); } [Fact] @@ -78,7 +78,7 @@ public class NormalizedShort2Tests Vector4 expected = new(1, 1, 0, 1); // act - NormalizedShort2 normalizedShort2 = NormalizedShort2.FromBgra5551(new(1f, 1f, 1f, 1f)); + NormalizedShort2 normalizedShort2 = NormalizedShort2.FromBgra5551(new Bgra5551(1f, 1f, 1f, 1f)); // assert Assert.Equal(expected, normalizedShort2.ToVector4()); diff --git a/tests/ImageSharp.Tests/PixelFormats/NormalizedShort4Tests.cs b/tests/ImageSharp.Tests/PixelFormats/NormalizedShort4Tests.cs index cf0c3e819..281ae7ee5 100644 --- a/tests/ImageSharp.Tests/PixelFormats/NormalizedShort4Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/NormalizedShort4Tests.cs @@ -17,8 +17,8 @@ public class NormalizedShort4Tests public void AreEqual() { NormalizedShort4 color1 = new(0.0f, 0.0f, 0.0f, 0.0f); - NormalizedShort4 color2 = new(new(0.0f)); - NormalizedShort4 color3 = new(new(1f, 0.0f, 1f, 1f)); + NormalizedShort4 color2 = new(new Vector4(0.0f)); + NormalizedShort4 color3 = new(new Vector4(1f, 0.0f, 1f, 1f)); NormalizedShort4 color4 = new(1f, 0.0f, 1f, 1f); Assert.Equal(color1, color2); @@ -32,8 +32,8 @@ public class NormalizedShort4Tests public void AreNotEqual() { NormalizedShort4 color1 = new(0.0f, 0.0f, 0.0f, 0.0f); - NormalizedShort4 color2 = new(new(1f)); - NormalizedShort4 color3 = new(new(1f, 0.0f, 0.0f, 1f)); + NormalizedShort4 color2 = new(new Vector4(1f)); + NormalizedShort4 color3 = new(new Vector4(1f, 0.0f, 0.0f, 1f)); NormalizedShort4 color4 = new(1f, 1f, 0.0f, 1f); Assert.NotEqual(color1, color2); @@ -99,7 +99,7 @@ public class NormalizedShort4Tests Vector4 expected = Vector4.One; // act - NormalizedShort4 pixel = NormalizedShort4.FromArgb32(new(255, 255, 255, 255)); + NormalizedShort4 pixel = NormalizedShort4.FromArgb32(new Argb32(255, 255, 255, 255)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); @@ -112,7 +112,7 @@ public class NormalizedShort4Tests Vector4 expected = Vector4.One; // act - NormalizedShort4 pixel = NormalizedShort4.FromBgr24(new(byte.MaxValue, byte.MaxValue, byte.MaxValue)); + NormalizedShort4 pixel = NormalizedShort4.FromBgr24(new Bgr24(byte.MaxValue, byte.MaxValue, byte.MaxValue)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); @@ -125,7 +125,7 @@ public class NormalizedShort4Tests Vector4 expected = Vector4.One; // act - NormalizedShort4 pixel = NormalizedShort4.FromL8(new(byte.MaxValue)); + NormalizedShort4 pixel = NormalizedShort4.FromL8(new L8(byte.MaxValue)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); @@ -138,7 +138,7 @@ public class NormalizedShort4Tests Vector4 expected = Vector4.One; // act - NormalizedShort4 pixel = NormalizedShort4.FromL16(new(ushort.MaxValue)); + NormalizedShort4 pixel = NormalizedShort4.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); @@ -151,7 +151,7 @@ public class NormalizedShort4Tests Vector4 expected = Vector4.One; // act - NormalizedShort4 pixel = NormalizedShort4.FromRgb24(new(byte.MaxValue, byte.MaxValue, byte.MaxValue)); + NormalizedShort4 pixel = NormalizedShort4.FromRgb24(new Rgb24(byte.MaxValue, byte.MaxValue, byte.MaxValue)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); @@ -164,7 +164,7 @@ public class NormalizedShort4Tests Vector4 expected = Vector4.One; // act - NormalizedShort4 pixel = NormalizedShort4.FromRgba32(new(255, 255, 255, 255)); + NormalizedShort4 pixel = NormalizedShort4.FromRgba32(new Rgba32(255, 255, 255, 255)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); @@ -177,7 +177,7 @@ public class NormalizedShort4Tests Vector4 expected = Vector4.One; // act - NormalizedShort4 pixel = NormalizedShort4.FromRgb48(new(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); + NormalizedShort4 pixel = NormalizedShort4.FromRgb48(new Rgb48(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); @@ -190,7 +190,7 @@ public class NormalizedShort4Tests Vector4 expected = Vector4.One; // act - NormalizedShort4 pixel = NormalizedShort4.FromRgba64(new(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); + NormalizedShort4 pixel = NormalizedShort4.FromRgba64(new Rgba64(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); // assert Assert.Equal(expected, pixel.ToScaledVector4()); @@ -216,7 +216,7 @@ public class NormalizedShort4Tests Vector4 expected = Vector4.One; // act - NormalizedShort4 normalizedShort4 = NormalizedShort4.FromBgra5551(new(1f, 1f, 1f, 1f)); + NormalizedShort4 normalizedShort4 = NormalizedShort4.FromBgra5551(new Bgra5551(1f, 1f, 1f, 1f)); // assert Assert.Equal(expected, normalizedShort4.ToVector4()); diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelBlenderTests.cs b/tests/ImageSharp.Tests/PixelFormats/PixelBlenderTests.cs index 2e66115b0..924e94d92 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelBlenderTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelBlenderTests.cs @@ -44,14 +44,14 @@ public class PixelBlenderTests public static TheoryData ColorBlendingExpectedResults = new() { { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.Normal, Color.MidnightBlue.ToPixel() }, - { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.Screen, new(0xFFEEE7FF) }, - { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.HardLight, new(0xFFC62D32) }, - { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.Overlay, new(0xFFDDCEFF) }, - { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.Darken, new(0xFF701919) }, - { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.Lighten, new(0xFFE1E4FF) }, - { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.Add, new(0xFFFFFDFF) }, - { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.Subtract, new(0xFF71CBE6) }, - { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.Multiply, new(0xFF631619) }, + { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.Screen, new Rgba32(0xFFEEE7FF) }, + { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.HardLight, new Rgba32(0xFFC62D32) }, + { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.Overlay, new Rgba32(0xFFDDCEFF) }, + { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.Darken, new Rgba32(0xFF701919) }, + { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.Lighten, new Rgba32(0xFFE1E4FF) }, + { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.Add, new Rgba32(0xFFFFFDFF) }, + { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.Subtract, new Rgba32(0xFF71CBE6) }, + { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelColorBlendingMode.Multiply, new Rgba32(0xFF631619) }, }; [Theory] @@ -67,17 +67,17 @@ public class PixelBlenderTests public static TheoryData AlphaCompositionExpectedResults = new() { - { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.Clear, new(0) }, - { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.Xor, new(0) }, + { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.Clear, new Rgba32(0) }, + { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.Xor, new Rgba32(0) }, { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.Dest, Color.MistyRose.ToPixel() }, { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.DestAtop, Color.MistyRose.ToPixel() }, { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.DestIn, Color.MistyRose.ToPixel() }, - { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.DestOut, new(0) }, + { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.DestOut, new Rgba32(0) }, { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.DestOver, Color.MistyRose.ToPixel() }, { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.Src, Color.MidnightBlue.ToPixel() }, { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.SrcAtop, Color.MidnightBlue.ToPixel() }, { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.SrcIn, Color.MidnightBlue.ToPixel() }, - { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.SrcOut, new(0) }, + { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.SrcOut, new Rgba32(0) }, { Color.MistyRose.ToPixel(), Color.MidnightBlue.ToPixel(), 1, PixelAlphaCompositionMode.SrcOver, Color.MidnightBlue.ToPixel() }, }; diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs index 908625e17..976a272eb 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs @@ -16,8 +16,8 @@ public class PorterDuffFunctionsTests public static TheoryData NormalBlendFunctionData { get; } = new() { - { new(1, 1, 1, 1), new(1, 1, 1, 1), 1, new(1, 1, 1, 1) }, - { new(1, 1, 1, 1), new(0, 0, 0, .8f), .5f, new(0.6f, 0.6f, 0.6f, 1) } + { new TestVector4(1, 1, 1, 1), new TestVector4(1, 1, 1, 1), 1, new TestVector4(1, 1, 1, 1) }, + { new TestVector4(1, 1, 1, 1), new TestVector4(0, 0, 0, .8f), .5f, new TestVector4(0.6f, 0.6f, 0.6f, 1) } }; [Theory] @@ -47,9 +47,9 @@ public class PorterDuffFunctionsTests public static TheoryData MultiplyFunctionData { get; } = new() { - { new(1, 1, 1, 1), new(1, 1, 1, 1), 1, new(1, 1, 1, 1) }, - { new(1, 1, 1, 1), new(0, 0, 0, .8f), .5f, new(0.6f, 0.6f, 0.6f, 1) }, - { new(0.9f, 0.9f, 0.9f, 0.9f), new(0.4f, 0.4f, 0.4f, 0.4f), .5f, new(0.7834783f, 0.7834783f, 0.7834783f, 0.92f) } + { new TestVector4(1, 1, 1, 1), new TestVector4(1, 1, 1, 1), 1, new TestVector4(1, 1, 1, 1) }, + { new TestVector4(1, 1, 1, 1), new TestVector4(0, 0, 0, .8f), .5f, new TestVector4(0.6f, 0.6f, 0.6f, 1) }, + { new TestVector4(0.9f, 0.9f, 0.9f, 0.9f), new TestVector4(0.4f, 0.4f, 0.4f, 0.4f), .5f, new TestVector4(0.7834783f, 0.7834783f, 0.7834783f, 0.92f) } }; [Theory] @@ -79,9 +79,9 @@ public class PorterDuffFunctionsTests public static TheoryData AddFunctionData { get; } = new() { - { new(1, 1, 1, 1), new(1, 1, 1, 1), 1, new(1, 1, 1, 1) }, - { new(1, 1, 1, 1), new(0, 0, 0, .8f), .5f, new(1, 1, 1, 1) }, - { new(0.2f, 0.2f, 0.2f, 0.3f), new(0.3f, 0.3f, 0.3f, 0.2f), .5f, new(0.24324325f, 0.24324325f, 0.24324325f, .37f) } + { new TestVector4(1, 1, 1, 1), new TestVector4(1, 1, 1, 1), 1, new TestVector4(1, 1, 1, 1) }, + { new TestVector4(1, 1, 1, 1), new TestVector4(0, 0, 0, .8f), .5f, new TestVector4(1, 1, 1, 1) }, + { new TestVector4(0.2f, 0.2f, 0.2f, 0.3f), new TestVector4(0.3f, 0.3f, 0.3f, 0.2f), .5f, new TestVector4(0.24324325f, 0.24324325f, 0.24324325f, .37f) } }; [Theory] @@ -111,9 +111,9 @@ public class PorterDuffFunctionsTests public static TheoryData SubtractFunctionData { get; } = new() { - { new(1, 1, 1, 1), new(1, 1, 1, 1), 1, new(0, 0, 0, 1) }, - { new(1, 1, 1, 1), new(0, 0, 0, .8f), .5f, new(1, 1, 1, 1f) }, - { new(0.2f, 0.2f, 0.2f, 0.3f), new(0.3f, 0.3f, 0.3f, 0.2f), .5f, new(.2027027f, .2027027f, .2027027f, .37f) } + { new TestVector4(1, 1, 1, 1), new TestVector4(1, 1, 1, 1), 1, new TestVector4(0, 0, 0, 1) }, + { new TestVector4(1, 1, 1, 1), new TestVector4(0, 0, 0, .8f), .5f, new TestVector4(1, 1, 1, 1f) }, + { new TestVector4(0.2f, 0.2f, 0.2f, 0.3f), new TestVector4(0.3f, 0.3f, 0.3f, 0.2f), .5f, new TestVector4(.2027027f, .2027027f, .2027027f, .37f) } }; [Theory] @@ -143,9 +143,9 @@ public class PorterDuffFunctionsTests public static TheoryData ScreenFunctionData { get; } = new() { - { new(1, 1, 1, 1), new(1, 1, 1, 1), 1, new(1, 1, 1, 1) }, - { new(1, 1, 1, 1), new(0, 0, 0, .8f), .5f, new(1, 1, 1, 1f) }, - { new(0.2f, 0.2f, 0.2f, 0.3f), new(0.3f, 0.3f, 0.3f, 0.2f), .5f, new(.2383784f, .2383784f, .2383784f, .37f) } + { new TestVector4(1, 1, 1, 1), new TestVector4(1, 1, 1, 1), 1, new TestVector4(1, 1, 1, 1) }, + { new TestVector4(1, 1, 1, 1), new TestVector4(0, 0, 0, .8f), .5f, new TestVector4(1, 1, 1, 1f) }, + { new TestVector4(0.2f, 0.2f, 0.2f, 0.3f), new TestVector4(0.3f, 0.3f, 0.3f, 0.2f), .5f, new TestVector4(.2383784f, .2383784f, .2383784f, .37f) } }; [Theory] @@ -175,9 +175,9 @@ public class PorterDuffFunctionsTests public static TheoryData DarkenFunctionData { get; } = new() { - { new(1, 1, 1, 1), new(1, 1, 1, 1), 1, new(1, 1, 1, 1) }, - { new(1, 1, 1, 1), new(0, 0, 0, .8f), .5f, new(.6f, .6f, .6f, 1f) }, - { new(0.2f, 0.2f, 0.2f, 0.3f), new(0.3f, 0.3f, 0.3f, 0.2f), .5f, new(.2189189f, .2189189f, .2189189f, .37f) } + { new TestVector4(1, 1, 1, 1), new TestVector4(1, 1, 1, 1), 1, new TestVector4(1, 1, 1, 1) }, + { new TestVector4(1, 1, 1, 1), new TestVector4(0, 0, 0, .8f), .5f, new TestVector4(.6f, .6f, .6f, 1f) }, + { new TestVector4(0.2f, 0.2f, 0.2f, 0.3f), new TestVector4(0.3f, 0.3f, 0.3f, 0.2f), .5f, new TestVector4(.2189189f, .2189189f, .2189189f, .37f) } }; [Theory] @@ -207,9 +207,9 @@ public class PorterDuffFunctionsTests public static TheoryData LightenFunctionData { get; } = new() { - { new(1, 1, 1, 1), new(1, 1, 1, 1), 1, new(1, 1, 1, 1) }, - { new(1, 1, 1, 1), new(0, 0, 0, .8f), .5f, new(1, 1, 1, 1f) }, - { new(0.2f, 0.2f, 0.2f, 0.3f), new(0.3f, 0.3f, 0.3f, 0.2f), .5f, new(.227027f, .227027f, .227027f, .37f) }, + { new TestVector4(1, 1, 1, 1), new TestVector4(1, 1, 1, 1), 1, new TestVector4(1, 1, 1, 1) }, + { new TestVector4(1, 1, 1, 1), new TestVector4(0, 0, 0, .8f), .5f, new TestVector4(1, 1, 1, 1f) }, + { new TestVector4(0.2f, 0.2f, 0.2f, 0.3f), new TestVector4(0.3f, 0.3f, 0.3f, 0.2f), .5f, new TestVector4(.227027f, .227027f, .227027f, .37f) }, }; [Theory] @@ -239,9 +239,9 @@ public class PorterDuffFunctionsTests public static TheoryData OverlayFunctionData { get; } = new() { - { new(1, 1, 1, 1), new(1, 1, 1, 1), 1, new(1, 1, 1, 1) }, - { new(1, 1, 1, 1), new(0, 0, 0, .8f), .5f, new(1, 1, 1, 1f) }, - { new(0.2f, 0.2f, 0.2f, 0.3f), new(0.3f, 0.3f, 0.3f, 0.2f), .5f, new(.2124324f, .2124324f, .2124324f, .37f) }, + { new TestVector4(1, 1, 1, 1), new TestVector4(1, 1, 1, 1), 1, new TestVector4(1, 1, 1, 1) }, + { new TestVector4(1, 1, 1, 1), new TestVector4(0, 0, 0, .8f), .5f, new TestVector4(1, 1, 1, 1f) }, + { new TestVector4(0.2f, 0.2f, 0.2f, 0.3f), new TestVector4(0.3f, 0.3f, 0.3f, 0.2f), .5f, new TestVector4(.2124324f, .2124324f, .2124324f, .37f) }, }; [Theory] @@ -271,9 +271,9 @@ public class PorterDuffFunctionsTests public static TheoryData HardLightFunctionData { get; } = new() { - { new(1, 1, 1, 1), new(1, 1, 1, 1), 1, new(1, 1, 1, 1) }, - { new(1, 1, 1, 1), new(0, 0, 0, .8f), .5f, new(0.6f, 0.6f, 0.6f, 1f) }, - { new(0.2f, 0.2f, 0.2f, 0.3f), new(0.3f, 0.3f, 0.3f, 0.2f), .5f, new(.2124324f, .2124324f, .2124324f, .37f) }, + { new TestVector4(1, 1, 1, 1), new TestVector4(1, 1, 1, 1), 1, new TestVector4(1, 1, 1, 1) }, + { new TestVector4(1, 1, 1, 1), new TestVector4(0, 0, 0, .8f), .5f, new TestVector4(0.6f, 0.6f, 0.6f, 1f) }, + { new TestVector4(0.2f, 0.2f, 0.2f, 0.3f), new TestVector4(0.3f, 0.3f, 0.3f, 0.2f), .5f, new TestVector4(.2124324f, .2124324f, .2124324f, .37f) }, }; [Theory] diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTestsTPixel.cs b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTestsTPixel.cs index 4c15fda31..2c97cbde0 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTestsTPixel.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTestsTPixel.cs @@ -12,7 +12,7 @@ public class PorterDuffFunctionsTestsTPixel private static Span AsSpan(T value) where T : struct { - return new(new[] { value }); + return new Span(new[] { value }); } public static TheoryData NormalBlendFunctionData = new() diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs b/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs index 6d5013cde..32b62fc03 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs @@ -117,7 +117,7 @@ public abstract class PixelOperationsTests : MeasureFixture const byte alpha = byte.MinValue; const byte noAlpha = byte.MaxValue; - TPixel pixel = TPixel.FromRgba32(new(0, 0, 0, alpha)); + TPixel pixel = TPixel.FromRgba32(new Rgba32(0, 0, 0, alpha)); Rgba32 dest = pixel.ToRgba32(); @@ -480,7 +480,7 @@ public abstract class PixelOperationsTests : MeasureFixture { int i4 = i * 4; - expected[i] = TPixel.FromArgb32(new(source[i4 + 1], source[i4 + 2], source[i4 + 3], source[i4 + 0])); + expected[i] = TPixel.FromArgb32(new Argb32(source[i4 + 1], source[i4 + 2], source[i4 + 3], source[i4 + 0])); } TestOperation( @@ -524,7 +524,7 @@ public abstract class PixelOperationsTests : MeasureFixture { int i3 = i * 3; - expected[i] = TPixel.FromBgr24(new(source[i3 + 2], source[i3 + 1], source[i3])); + expected[i] = TPixel.FromBgr24(new Bgr24(source[i3 + 2], source[i3 + 1], source[i3])); } TestOperation( @@ -566,7 +566,7 @@ public abstract class PixelOperationsTests : MeasureFixture { int i4 = i * 4; - expected[i] = TPixel.FromBgra32(new(source[i4 + 2], source[i4 + 1], source[i4 + 0], source[i4 + 3])); + expected[i] = TPixel.FromBgra32(new Bgra32(source[i4 + 2], source[i4 + 1], source[i4 + 0], source[i4 + 3])); } TestOperation( @@ -609,7 +609,7 @@ public abstract class PixelOperationsTests : MeasureFixture { int i4 = i * 4; - expected[i] = TPixel.FromAbgr32(new(source[i4 + 3], source[i4 + 2], source[i4 + 1], source[i4 + 0])); + expected[i] = TPixel.FromAbgr32(new Abgr32(source[i4 + 3], source[i4 + 2], source[i4 + 1], source[i4 + 0])); } TestOperation( @@ -863,7 +863,7 @@ public abstract class PixelOperationsTests : MeasureFixture { int i3 = i * 3; - expected[i] = TPixel.FromRgb24(new(source[i3 + 0], source[i3 + 1], source[i3 + 2])); + expected[i] = TPixel.FromRgb24(new Rgb24(source[i3 + 0], source[i3 + 1], source[i3 + 2])); } TestOperation( @@ -905,7 +905,7 @@ public abstract class PixelOperationsTests : MeasureFixture { int i4 = i * 4; - expected[i] = TPixel.FromRgba32(new(source[i4 + 0], source[i4 + 1], source[i4 + 2], source[i4 + 3])); + expected[i] = TPixel.FromRgba32(new Rgba32(source[i4 + 0], source[i4 + 1], source[i4 + 2], source[i4 + 3])); } TestOperation( diff --git a/tests/ImageSharp.Tests/PixelFormats/Rg32Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Rg32Tests.cs index c4e2fc7a2..b2790469a 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Rg32Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Rg32Tests.cs @@ -69,7 +69,7 @@ public class Rg32Tests const uint expected = 0xFFFFFFFF; // act - Rg32 rg32 = Rg32.FromBgra5551(new(1f, 1f, 1f, 1f)); + Rg32 rg32 = Rg32.FromBgra5551(new Bgra5551(1f, 1f, 1f, 1f)); // assert Assert.Equal(expected, rg32.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/Rgb24Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Rgb24Tests.cs index 22c977dcc..6364378c1 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Rgb24Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Rgb24Tests.cs @@ -68,7 +68,7 @@ public class Rgb24Tests [Fact] public void FromRgba32() { - Rgb24 rgb = Rgb24.FromRgba32(new(1, 2, 3, 4)); + Rgb24 rgb = Rgb24.FromRgba32(new Rgba32(1, 2, 3, 4)); Assert.Equal(1, rgb.R); Assert.Equal(2, rgb.G); @@ -117,7 +117,7 @@ public class Rgb24Tests public void Rgb24_FromBgra5551() { // act - Rgb24 rgb = Rgb24.FromBgra5551(new(1.0f, 1.0f, 1.0f, 1.0f)); + Rgb24 rgb = Rgb24.FromBgra5551(new Bgra5551(1.0f, 1.0f, 1.0f, 1.0f)); // assert Assert.Equal(255, rgb.R); diff --git a/tests/ImageSharp.Tests/PixelFormats/Rgb48Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Rgb48Tests.cs index cf8e2e7e9..764627ee3 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Rgb48Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Rgb48Tests.cs @@ -65,7 +65,7 @@ public class Rgb48Tests const ushort expected = ushort.MaxValue; // act - Rgb48 rgb = Rgb48.FromBgra5551(new(1f, 1f, 1f, 1f)); + Rgb48 rgb = Rgb48.FromBgra5551(new Bgra5551(1f, 1f, 1f, 1f)); // assert Assert.Equal(expected, rgb.R); diff --git a/tests/ImageSharp.Tests/PixelFormats/Rgba1010102Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Rgba1010102Tests.cs index c342d0aa3..79a1aefc9 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Rgba1010102Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Rgba1010102Tests.cs @@ -17,8 +17,8 @@ public class Rgba1010102Tests public void AreEqual() { Rgba1010102 color1 = new(0.0f, 0.0f, 0.0f, 0.0f); - Rgba1010102 color2 = new(new(0.0f)); - Rgba1010102 color3 = new(new(1f, 0.0f, 1f, 1f)); + Rgba1010102 color2 = new(new Vector4(0.0f)); + Rgba1010102 color3 = new(new Vector4(1f, 0.0f, 1f, 1f)); Rgba1010102 color4 = new(1f, 0.0f, 1f, 1f); Assert.Equal(color1, color2); @@ -32,8 +32,8 @@ public class Rgba1010102Tests public void AreNotEqual() { Rgba1010102 color1 = new(0.0f, 0.0f, 0.0f, 0.0f); - Rgba1010102 color2 = new(new(1f)); - Rgba1010102 color3 = new(new(1f, 0.0f, 0.0f, 1f)); + Rgba1010102 color2 = new(new Vector4(1f)); + Rgba1010102 color3 = new(new Vector4(1f, 0.0f, 0.0f, 1f)); Rgba1010102 color4 = new(1f, 1f, 0.0f, 1f); Assert.NotEqual(color1, color2); @@ -101,7 +101,7 @@ public class Rgba1010102Tests const uint expected = 0xFFFFFFFF; // act - Rgba1010102 rgba = Rgba1010102.FromBgra5551(new(1f, 1f, 1f, 1f)); + Rgba1010102 rgba = Rgba1010102.FromBgra5551(new Bgra5551(1f, 1f, 1f, 1f)); // assert Assert.Equal(expected, rgba.PackedValue); @@ -114,7 +114,7 @@ public class Rgba1010102Tests const uint expectedPackedValue = uint.MaxValue; // act - Rgba1010102 rgba = Rgba1010102.FromArgb32(new(255, 255, 255, 255)); + Rgba1010102 rgba = Rgba1010102.FromArgb32(new Argb32(255, 255, 255, 255)); // assert Assert.Equal(expectedPackedValue, rgba.PackedValue); @@ -128,8 +128,8 @@ public class Rgba1010102Tests const uint expectedPackedValue2 = 0xFFF003FF; // act - Rgba1010102 rgba1 = Rgba1010102.FromRgba32(new(255, 255, 255, 255)); - Rgba1010102 rgba2 = Rgba1010102.FromRgba32(new(255, 0, 255, 255)); + Rgba1010102 rgba1 = Rgba1010102.FromRgba32(new Rgba32(255, 255, 255, 255)); + Rgba1010102 rgba2 = Rgba1010102.FromRgba32(new Rgba32(255, 0, 255, 255)); // assert Assert.Equal(expectedPackedValue1, rgba1.PackedValue); @@ -143,7 +143,7 @@ public class Rgba1010102Tests const uint expectedPackedValue = uint.MaxValue; // act - Rgba1010102 rgba = Rgba1010102.FromBgr24(new(byte.MaxValue, byte.MaxValue, byte.MaxValue)); + Rgba1010102 rgba = Rgba1010102.FromBgr24(new Bgr24(byte.MaxValue, byte.MaxValue, byte.MaxValue)); // assert Assert.Equal(expectedPackedValue, rgba.PackedValue); @@ -156,7 +156,7 @@ public class Rgba1010102Tests const uint expectedPackedValue = uint.MaxValue; // act - Rgba1010102 rgba = Rgba1010102.FromL8(new(byte.MaxValue)); + Rgba1010102 rgba = Rgba1010102.FromL8(new L8(byte.MaxValue)); // assert Assert.Equal(expectedPackedValue, rgba.PackedValue); @@ -169,7 +169,7 @@ public class Rgba1010102Tests const uint expectedPackedValue = uint.MaxValue; // act - Rgba1010102 rgba = Rgba1010102.FromL16(new(ushort.MaxValue)); + Rgba1010102 rgba = Rgba1010102.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, rgba.PackedValue); @@ -182,7 +182,7 @@ public class Rgba1010102Tests const uint expectedPackedValue = uint.MaxValue; // act - Rgba1010102 rgba = Rgba1010102.FromRgb24(new(byte.MaxValue, byte.MaxValue, byte.MaxValue)); + Rgba1010102 rgba = Rgba1010102.FromRgb24(new Rgb24(byte.MaxValue, byte.MaxValue, byte.MaxValue)); // assert Assert.Equal(expectedPackedValue, rgba.PackedValue); @@ -195,7 +195,7 @@ public class Rgba1010102Tests const uint expectedPackedValue = uint.MaxValue; // act - Rgba1010102 rgba = Rgba1010102.FromRgb48(new(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); + Rgba1010102 rgba = Rgba1010102.FromRgb48(new Rgb48(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, rgba.PackedValue); @@ -208,7 +208,7 @@ public class Rgba1010102Tests const uint expectedPackedValue = uint.MaxValue; // act - Rgba1010102 rgba = Rgba1010102.FromRgba64(new(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); + Rgba1010102 rgba = Rgba1010102.FromRgba64(new Rgba64(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, rgba.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/Rgba32Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Rgba32Tests.cs index fafee5d3c..6d56185ec 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Rgba32Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Rgba32Tests.cs @@ -286,7 +286,7 @@ public class Rgba32Tests const uint expected = 0xFFFFFFFF; // act - Rgba32 rgb = Rgba32.FromBgra5551(new(1f, 1f, 1f, 1f)); + Rgba32 rgb = Rgba32.FromBgra5551(new Bgra5551(1f, 1f, 1f, 1f)); // assert Assert.Equal(expected, rgb.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/Rgba64Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Rgba64Tests.cs index e962b41fe..694d0ace1 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Rgba64Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Rgba64Tests.cs @@ -106,7 +106,7 @@ public class Rgba64Tests const ushort expected = ushort.MaxValue; // act - Rgba64 rgba = Rgba64.FromBgra5551(new(1.0f, 1.0f, 1.0f, 1.0f)); + Rgba64 rgba = Rgba64.FromBgra5551(new Bgra5551(1.0f, 1.0f, 1.0f, 1.0f)); // assert Assert.Equal(expected, rgba.R); diff --git a/tests/ImageSharp.Tests/PixelFormats/RgbaVectorTests.cs b/tests/ImageSharp.Tests/PixelFormats/RgbaVectorTests.cs index daafabaa3..5273482ef 100644 --- a/tests/ImageSharp.Tests/PixelFormats/RgbaVectorTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/RgbaVectorTests.cs @@ -150,7 +150,7 @@ public class RgbaVectorTests Vector4 expected = Vector4.One; // act - RgbaVector rgb = RgbaVector.FromBgra5551(new(1.0f, 1.0f, 1.0f, 1.0f)); + RgbaVector rgb = RgbaVector.FromBgra5551(new Bgra5551(1.0f, 1.0f, 1.0f, 1.0f)); // assert Assert.Equal(expected, rgb.ToScaledVector4()); @@ -163,7 +163,7 @@ public class RgbaVectorTests Vector4 expected = Vector4.One; // act - RgbaVector rgba = RgbaVector.FromL16(new(ushort.MaxValue)); + RgbaVector rgba = RgbaVector.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expected, rgba.ToScaledVector4()); @@ -176,7 +176,7 @@ public class RgbaVectorTests Vector4 expected = Vector4.One; // act - RgbaVector rgba = RgbaVector.FromL8(new(byte.MaxValue)); + RgbaVector rgba = RgbaVector.FromL8(new L8(byte.MaxValue)); // assert Assert.Equal(expected, rgba.ToScaledVector4()); diff --git a/tests/ImageSharp.Tests/PixelFormats/Short2Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Short2Tests.cs index a9942220c..f23da0c7a 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Short2Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Short2Tests.cs @@ -36,9 +36,9 @@ public class Short2Tests [Fact] public void Short2_ToVector4() { - Assert.Equal(new(0x7FFF, 0x7FFF, 0, 1), new Short2(Vector2.One * 0x7FFF).ToVector4()); - Assert.Equal(new(0, 0, 0, 1), new Short2(Vector2.Zero).ToVector4()); - Assert.Equal(new(-0x8000, -0x8000, 0, 1), new Short2(Vector2.One * -0x8000).ToVector4()); + Assert.Equal(new Vector4(0x7FFF, 0x7FFF, 0, 1), new Short2(Vector2.One * 0x7FFF).ToVector4()); + Assert.Equal(new Vector4(0, 0, 0, 1), new Short2(Vector2.Zero).ToVector4()); + Assert.Equal(new Vector4(-0x8000, -0x8000, 0, 1), new Short2(Vector2.One * -0x8000).ToVector4()); } [Fact] @@ -140,7 +140,7 @@ public class Short2Tests public void Short2_FromBgra5551() { // act - Short2 short2 = Short2.FromBgra5551(new(1.0f, 1.0f, 1.0f, 1.0f)); + Short2 short2 = Short2.FromBgra5551(new Bgra5551(1.0f, 1.0f, 1.0f, 1.0f)); // assert Vector4 actual = short2.ToScaledVector4(); diff --git a/tests/ImageSharp.Tests/PixelFormats/Short4Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Short4Tests.cs index fd25f5086..819ff0e1e 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Short4Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Short4Tests.cs @@ -190,7 +190,7 @@ public class Short4Tests Vector4 expected = Vector4.One; // act - Short4 short4 = Short4.FromBgra5551(new(1.0f, 1.0f, 1.0f, 1.0f)); + Short4 short4 = Short4.FromBgra5551(new Bgra5551(1.0f, 1.0f, 1.0f, 1.0f)); // assert Assert.Equal(expected, short4.ToScaledVector4()); diff --git a/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs b/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs index e5162e23d..f83ebc53c 100644 --- a/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs +++ b/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs @@ -43,7 +43,7 @@ public class DenseMatrixTests Assert.True(dense.Rows == FloydSteinbergMatrix.GetLength(0)); Assert.Equal(3, dense.Columns); Assert.Equal(2, dense.Rows); - Assert.Equal(new(3, 2), dense.Size); + Assert.Equal(new Size(3, 2), dense.Size); } [Fact] diff --git a/tests/ImageSharp.Tests/Primitives/PointFTests.cs b/tests/ImageSharp.Tests/Primitives/PointFTests.cs index 772d8bd2d..8b574daf0 100644 --- a/tests/ImageSharp.Tests/Primitives/PointFTests.cs +++ b/tests/ImageSharp.Tests/Primitives/PointFTests.cs @@ -130,7 +130,7 @@ public class PointFTests Matrix3x2 matrix = Matrix3x2Extensions.CreateSkewDegrees(45, 45, PointF.Empty); PointF pout = PointF.Transform(p, matrix); - Assert.Equal(new(30, 30), pout); + Assert.Equal(new PointF(30, 30), pout); } [Theory] diff --git a/tests/ImageSharp.Tests/Primitives/PointTests.cs b/tests/ImageSharp.Tests/Primitives/PointTests.cs index 8ade95eb1..3ad2a83b3 100644 --- a/tests/ImageSharp.Tests/Primitives/PointTests.cs +++ b/tests/ImageSharp.Tests/Primitives/PointTests.cs @@ -76,7 +76,7 @@ public class PointTests public void PointFConversionTest(int x, int y) { PointF p = new Point(x, y); - Assert.Equal(new(x, y), p); + Assert.Equal(new PointF(x, y), p); } [Theory] @@ -87,7 +87,7 @@ public class PointTests public void SizeConversionTest(int x, int y) { Size sz = (Size)new Point(x, y); - Assert.Equal(new(x, y), sz); + Assert.Equal(new Size(x, y), sz); } [Theory] @@ -102,8 +102,8 @@ public class PointTests unchecked { - addExpected = new(x + y, y + x); - subExpected = new(x - y, y - x); + addExpected = new Point(x + y, y + x); + subExpected = new Point(x - y, y - x); } Assert.Equal(addExpected, p + s); @@ -124,9 +124,9 @@ public class PointTests unchecked { - pCeiling = new((int)MathF.Ceiling(x), (int)MathF.Ceiling(y)); - pTruncate = new((int)x, (int)y); - pRound = new((int)MathF.Round(x), (int)MathF.Round(y)); + pCeiling = new Point((int)MathF.Ceiling(x), (int)MathF.Ceiling(y)); + pTruncate = new Point((int)x, (int)y); + pRound = new Point((int)MathF.Round(x), (int)MathF.Round(y)); } Assert.Equal(pCeiling, Point.Ceiling(pf)); @@ -161,7 +161,7 @@ public class PointTests Point pout = Point.Transform(p, matrix); - Assert.Equal(new(-3, 21), pout); + Assert.Equal(new Point(-3, 21), pout); } [Fact] @@ -171,7 +171,7 @@ public class PointTests Matrix3x2 matrix = Matrix3x2Extensions.CreateSkewDegrees(45, 45, Point.Empty); Point pout = Point.Transform(p, matrix); - Assert.Equal(new(30, 30), pout); + Assert.Equal(new Point(30, 30), pout); } [Theory] diff --git a/tests/ImageSharp.Tests/Primitives/RectangleFTests.cs b/tests/ImageSharp.Tests/Primitives/RectangleFTests.cs index 0e8bf4f34..4122daaa5 100644 --- a/tests/ImageSharp.Tests/Primitives/RectangleFTests.cs +++ b/tests/ImageSharp.Tests/Primitives/RectangleFTests.cs @@ -23,10 +23,10 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void NonDefaultConstructorTest(float x, float y, float width, float height) { - RectangleF rect1 = new RectangleF(x, y, width, height); - PointF p = new PointF(x, y); - SizeF s = new SizeF(width, height); - RectangleF rect2 = new RectangleF(p, s); + RectangleF rect1 = new(x, y, width, height); + PointF p = new(x, y); + SizeF s = new(width, height); + RectangleF rect2 = new(p, s); Assert.Equal(rect1, rect2); } @@ -38,7 +38,7 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void FromLTRBTest(float left, float top, float right, float bottom) { - RectangleF expected = new RectangleF(left, top, right - left, bottom - top); + RectangleF expected = new(left, top, right - left, bottom - top); RectangleF actual = RectangleF.FromLTRB(left, top, right, bottom); Assert.Equal(expected, actual); @@ -51,9 +51,9 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void DimensionsTest(float x, float y, float width, float height) { - RectangleF rect = new RectangleF(x, y, width, height); - PointF p = new PointF(x, y); - SizeF s = new SizeF(width, height); + RectangleF rect = new(x, y, width, height); + PointF p = new(x, y); + SizeF s = new(width, height); Assert.Equal(p, rect.Location); Assert.Equal(s, rect.Size); @@ -84,8 +84,8 @@ public class RectangleFTests [InlineData(float.MaxValue, float.MinValue)] public void LocationSetTest(float x, float y) { - PointF point = new PointF(x, y); - RectangleF rect = new RectangleF(10, 10, 10, 10) { Location = point }; + PointF point = new(x, y); + RectangleF rect = new(10, 10, 10, 10) { Location = point }; Assert.Equal(point, rect.Location); Assert.Equal(point.X, rect.X); Assert.Equal(point.Y, rect.Y); @@ -96,8 +96,8 @@ public class RectangleFTests [InlineData(float.MaxValue, float.MinValue)] public void SizeSetTest(float x, float y) { - SizeF size = new SizeF(x, y); - RectangleF rect = new RectangleF(10, 10, 10, 10) { Size = size }; + SizeF size = new(x, y); + RectangleF rect = new(10, 10, 10, 10) { Size = size }; Assert.Equal(size, rect.Size); Assert.Equal(size.Width, rect.Width); Assert.Equal(size.Height, rect.Height); @@ -109,8 +109,8 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void EqualityTest(float x, float y, float width, float height) { - RectangleF rect1 = new RectangleF(x, y, width, height); - RectangleF rect2 = new RectangleF(width, height, x, y); + RectangleF rect1 = new(x, y, width, height); + RectangleF rect2 = new(width, height, x, y); Assert.True(rect1 != rect2); Assert.False(rect1 == rect2); @@ -121,7 +121,7 @@ public class RectangleFTests [Fact] public void EqualityTestNotRectangleF() { - RectangleF rectangle = new RectangleF(0, 0, 0, 0); + RectangleF rectangle = new(0, 0, 0, 0); Assert.False(rectangle.Equals(null)); Assert.False(rectangle.Equals(0)); @@ -137,8 +137,8 @@ public class RectangleFTests [Fact] public void GetHashCodeTest() { - RectangleF rect1 = new RectangleF(10, 10, 10, 10); - RectangleF rect2 = new RectangleF(10, 10, 10, 10); + RectangleF rect1 = new(10, 10, 10, 10); + RectangleF rect2 = new(10, 10, 10, 10); Assert.Equal(rect1.GetHashCode(), rect2.GetHashCode()); Assert.NotEqual(rect1.GetHashCode(), new RectangleF(20, 10, 10, 10).GetHashCode()); Assert.NotEqual(rect1.GetHashCode(), new RectangleF(10, 20, 10, 10).GetHashCode()); @@ -151,11 +151,11 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void ContainsTest(float x, float y, float width, float height) { - RectangleF rect = new RectangleF(x, y, width, height); + RectangleF rect = new(x, y, width, height); float x1 = (x + width) / 2; float y1 = (y + height) / 2; - PointF p = new PointF(x1, y1); - RectangleF r = new RectangleF(x1, y1, width / 2, height / 2); + PointF p = new(x1, y1); + RectangleF r = new(x1, y1, width / 2, height / 2); Assert.False(rect.Contains(x1, y1)); Assert.False(rect.Contains(p)); @@ -168,13 +168,13 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void InflateTest(float x, float y, float width, float height) { - RectangleF rect = new RectangleF(x, y, width, height); - RectangleF inflatedRect = new RectangleF(x - width, y - height, width + (2 * width), height + (2 * height)); + RectangleF rect = new(x, y, width, height); + RectangleF inflatedRect = new(x - width, y - height, width + (2 * width), height + (2 * height)); rect.Inflate(width, height); Assert.Equal(inflatedRect, rect); - SizeF s = new SizeF(x, y); + SizeF s = new(x, y); inflatedRect = RectangleF.Inflate(rect, x, y); rect.Inflate(s); @@ -186,8 +186,8 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void IntersectTest(float x, float y, float width, float height) { - RectangleF rect1 = new RectangleF(x, y, width, height); - RectangleF rect2 = new RectangleF(y, x, width, height); + RectangleF rect1 = new(x, y, width, height); + RectangleF rect2 = new(y, x, width, height); RectangleF expectedRect = RectangleF.Intersect(rect1, rect2); rect1.Intersect(rect2); Assert.Equal(expectedRect, rect1); @@ -197,9 +197,9 @@ public class RectangleFTests [Fact] public void IntersectIntersectingRectsTest() { - RectangleF rect1 = new RectangleF(0, 0, 5, 5); - RectangleF rect2 = new RectangleF(1, 1, 3, 3); - RectangleF expected = new RectangleF(1, 1, 3, 3); + RectangleF rect1 = new(0, 0, 5, 5); + RectangleF rect2 = new(1, 1, 3, 3); + RectangleF expected = new(1, 1, 3, 3); Assert.Equal(expected, RectangleF.Intersect(rect1, rect2)); } @@ -211,15 +211,15 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void UnionTest(float x, float y, float width, float height) { - RectangleF a = new RectangleF(x, y, width, height); - RectangleF b = new RectangleF(width, height, x, y); + RectangleF a = new(x, y, width, height); + RectangleF b = new(width, height, x, y); float x1 = Math.Min(a.X, b.X); float x2 = Math.Max(a.X + a.Width, b.X + b.Width); float y1 = Math.Min(a.Y, b.Y); float y2 = Math.Max(a.Y + a.Height, b.Y + b.Height); - RectangleF expectedRectangle = new RectangleF(x1, y1, x2 - x1, y2 - y1); + RectangleF expectedRectangle = new(x1, y1, x2 - x1, y2 - y1); Assert.Equal(expectedRectangle, RectangleF.Union(a, b)); } @@ -231,9 +231,9 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void OffsetTest(float x, float y, float width, float height) { - RectangleF r1 = new RectangleF(x, y, width, height); - RectangleF expectedRect = new RectangleF(x + width, y + height, width, height); - PointF p = new PointF(width, height); + RectangleF r1 = new(x, y, width, height); + RectangleF expectedRect = new(x + width, y + height, width, height); + PointF p = new(width, height); r1.Offset(p); Assert.Equal(expectedRect, r1); @@ -246,7 +246,7 @@ public class RectangleFTests [Fact] public void ToStringTest() { - RectangleF r = new RectangleF(5, 5.1F, 1.3F, 1); + RectangleF r = new(5, 5.1F, 1.3F, 1); Assert.Equal(string.Format(CultureInfo.CurrentCulture, "RectangleF [ X={0}, Y={1}, Width={2}, Height={3} ]", r.X, r.Y, r.Width, r.Height), r.ToString()); } @@ -270,7 +270,7 @@ public class RectangleFTests [InlineData(0, 0, 0, 0)] public void DeconstructTest(float x, float y, float width, float height) { - RectangleF r = new RectangleF(x, y, width, height); + RectangleF r = new(x, y, width, height); (float dx, float dy, float dw, float dh) = r; diff --git a/tests/ImageSharp.Tests/Primitives/RectangleTests.cs b/tests/ImageSharp.Tests/Primitives/RectangleTests.cs index 2a4d64147..2800852af 100644 --- a/tests/ImageSharp.Tests/Primitives/RectangleTests.cs +++ b/tests/ImageSharp.Tests/Primitives/RectangleTests.cs @@ -24,7 +24,7 @@ public class RectangleTests public void NonDefaultConstructorTest(int x, int y, int width, int height) { Rectangle rect1 = new(x, y, width, height); - Rectangle rect2 = new(new(x, y), new(width, height)); + Rectangle rect2 = new(new Point(x, y), new Size(width, height)); Assert.Equal(rect1, rect2); } @@ -69,8 +69,8 @@ public class RectangleTests public void DimensionsTest(int x, int y, int width, int height) { Rectangle rect = new(x, y, width, height); - Assert.Equal(new(x, y), rect.Location); - Assert.Equal(new(width, height), rect.Size); + Assert.Equal(new Point(x, y), rect.Location); + Assert.Equal(new Size(width, height), rect.Size); Assert.Equal(x, rect.X); Assert.Equal(y, rect.Y); @@ -171,15 +171,15 @@ public class RectangleTests unchecked { - rCeiling = new( + rCeiling = new Rectangle( (int)Math.Ceiling(x), (int)Math.Ceiling(y), (int)Math.Ceiling(width), (int)Math.Ceiling(height)); - rTruncate = new((int)x, (int)y, (int)width, (int)height); + rTruncate = new Rectangle((int)x, (int)y, (int)width, (int)height); - rRound = new( + rRound = new Rectangle( (int)Math.Round(x), (int)Math.Round(y), (int)Math.Round(width), @@ -214,7 +214,7 @@ public class RectangleTests Rectangle inflatedRect, rect = new(x, y, width, height); unchecked { - inflatedRect = new(x - width, y - height, width + (2 * width), height + (2 * height)); + inflatedRect = new Rectangle(x - width, y - height, width + (2 * width), height + (2 * height)); } Assert.Equal(inflatedRect, Rectangle.Inflate(rect, width, height)); @@ -225,7 +225,7 @@ public class RectangleTests Size s = new(x, y); unchecked { - inflatedRect = new(rect.X - x, rect.Y - y, rect.Width + (2 * x), rect.Height + (2 * y)); + inflatedRect = new Rectangle(rect.X - x, rect.Y - y, rect.Width + (2 * x), rect.Height + (2 * y)); } rect.Inflate(s); diff --git a/tests/ImageSharp.Tests/Primitives/SizeFTests.cs b/tests/ImageSharp.Tests/Primitives/SizeFTests.cs index 246f21b1e..2893a7c71 100644 --- a/tests/ImageSharp.Tests/Primitives/SizeFTests.cs +++ b/tests/ImageSharp.Tests/Primitives/SizeFTests.cs @@ -25,8 +25,8 @@ public class SizeFTests SizeF s2 = new(s1); Assert.Equal(s1, s2); - Assert.Equal(s1, new(p1)); - Assert.Equal(s2, new(p1)); + Assert.Equal(s1, new SizeF(p1)); + Assert.Equal(s2, new SizeF(p1)); Assert.Equal(width, s1.Width); Assert.Equal(height, s1.Height); @@ -136,7 +136,7 @@ public class SizeFTests PointF p1 = (PointF)s1; Size s2 = new(unchecked((int)width), unchecked((int)height)); - Assert.Equal(new(width, height), p1); + Assert.Equal(new PointF(width, height), p1); Assert.Equal(p1, (PointF)s1); Assert.Equal(s2, (Size)s1); } @@ -175,7 +175,7 @@ public class SizeFTests SizeF sz1 = new(dimension, dimension); SizeF mulExpected; - mulExpected = new(dimension * multiplier, dimension * multiplier); + mulExpected = new SizeF(dimension * multiplier, dimension * multiplier); Assert.Equal(mulExpected, sz1 * multiplier); Assert.Equal(mulExpected, multiplier * sz1); @@ -188,7 +188,7 @@ public class SizeFTests SizeF sz1 = new(width, height); SizeF mulExpected; - mulExpected = new(width * multiplier, height * multiplier); + mulExpected = new SizeF(width * multiplier, height * multiplier); Assert.Equal(mulExpected, sz1 * multiplier); Assert.Equal(mulExpected, multiplier * sz1); diff --git a/tests/ImageSharp.Tests/Primitives/SizeTests.cs b/tests/ImageSharp.Tests/Primitives/SizeTests.cs index 6b366e183..63320796a 100644 --- a/tests/ImageSharp.Tests/Primitives/SizeTests.cs +++ b/tests/ImageSharp.Tests/Primitives/SizeTests.cs @@ -72,7 +72,7 @@ public class SizeTests public void PointFConversionTest(int width, int height) { SizeF sz = new Size(width, height); - Assert.Equal(new(width, height), sz); + Assert.Equal(new SizeF(width, height), sz); } [Theory] @@ -83,7 +83,7 @@ public class SizeTests public void SizeConversionTest(int width, int height) { Point sz = (Point)new Size(width, height); - Assert.Equal(new(width, height), sz); + Assert.Equal(new Point(width, height), sz); } [Theory] @@ -99,8 +99,8 @@ public class SizeTests unchecked { - addExpected = new(width + height, height + width); - subExpected = new(width - height, height - width); + addExpected = new Size(width + height, height + width); + subExpected = new Size(width - height, height - width); } Assert.Equal(addExpected, sz1 + sz2); @@ -121,9 +121,9 @@ public class SizeTests unchecked { - pCeiling = new((int)MathF.Ceiling(width), (int)MathF.Ceiling(height)); - pTruncate = new((int)width, (int)height); - pRound = new((int)MathF.Round(width), (int)MathF.Round(height)); + pCeiling = new Size((int)MathF.Ceiling(width), (int)MathF.Ceiling(height)); + pTruncate = new Size((int)width, (int)height); + pRound = new Size((int)MathF.Round(width), (int)MathF.Round(height)); } Assert.Equal(pCeiling, Size.Ceiling(szF)); @@ -211,7 +211,7 @@ public class SizeTests unchecked { - mulExpected = new(dimension * multiplier, dimension * multiplier); + mulExpected = new Size(dimension * multiplier, dimension * multiplier); } Assert.Equal(mulExpected, sz1 * multiplier); @@ -227,7 +227,7 @@ public class SizeTests unchecked { - mulExpected = new(width * multiplier, height * multiplier); + mulExpected = new Size(width * multiplier, height * multiplier); } Assert.Equal(mulExpected, sz1 * multiplier); @@ -261,7 +261,7 @@ public class SizeTests Size sz1 = new(dimension, dimension); SizeF mulExpected; - mulExpected = new(dimension * multiplier, dimension * multiplier); + mulExpected = new SizeF(dimension * multiplier, dimension * multiplier); Assert.Equal(mulExpected, sz1 * multiplier); Assert.Equal(mulExpected, multiplier * sz1); @@ -274,7 +274,7 @@ public class SizeTests Size sz1 = new(width, height); SizeF mulExpected; - mulExpected = new(width * multiplier, height * multiplier); + mulExpected = new SizeF(width * multiplier, height * multiplier); Assert.Equal(mulExpected, sz1 * multiplier); Assert.Equal(mulExpected, multiplier * sz1); @@ -308,7 +308,7 @@ public class SizeTests Size size = new(dimension, dimension); Size expected; - expected = new(dimension / divisor, dimension / divisor); + expected = new Size(dimension / divisor, dimension / divisor); Assert.Equal(expected, size / divisor); } @@ -320,7 +320,7 @@ public class SizeTests Size size = new(width, height); Size expected; - expected = new(width / divisor, height / divisor); + expected = new Size(width / divisor, height / divisor); Assert.Equal(expected, size / divisor); } @@ -344,7 +344,7 @@ public class SizeTests SizeF size = new(dimension, dimension); SizeF expected; - expected = new(dimension / divisor, dimension / divisor); + expected = new SizeF(dimension / divisor, dimension / divisor); Assert.Equal(expected, size / divisor); } @@ -355,7 +355,7 @@ public class SizeTests SizeF size = new(width, height); SizeF expected; - expected = new(width / divisor, height / divisor); + expected = new SizeF(width / divisor, height / divisor); Assert.Equal(expected, size / divisor); } diff --git a/tests/ImageSharp.Tests/Processing/BaseImageOperationsExtensionTest.cs b/tests/ImageSharp.Tests/Processing/BaseImageOperationsExtensionTest.cs index 1b8388eba..5e5887c92 100644 --- a/tests/ImageSharp.Tests/Processing/BaseImageOperationsExtensionTest.cs +++ b/tests/ImageSharp.Tests/Processing/BaseImageOperationsExtensionTest.cs @@ -18,10 +18,10 @@ public abstract class BaseImageOperationsExtensionTest : IDisposable public BaseImageOperationsExtensionTest() { - this.options = new() { Antialias = false }; - this.source = new(91 + 324, 123 + 56); - this.rect = new(91, 123, 324, 56); // make this random? - this.internalOperations = new(this.source.Configuration, this.source, false); + this.options = new GraphicsOptions { Antialias = false }; + this.source = new Image(91 + 324, 123 + 56); + this.rect = new Rectangle(91, 123, 324, 56); // make this random? + this.internalOperations = new FakeImageOperationsProvider.FakeImageOperations(this.source.Configuration, this.source, false); this.internalOperations.SetGraphicsOptions(this.options); this.operations = this.internalOperations; } diff --git a/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs b/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs index c7eb95953..32b8bf276 100644 --- a/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs +++ b/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs @@ -10,14 +10,14 @@ public class OrderedDitherFactoryTests { #pragma warning disable SA1025 // Code should not contain multiple whitespace in a row - private static readonly DenseMatrix Expected2x2Matrix = new DenseMatrix( + private static readonly DenseMatrix Expected2x2Matrix = new( new uint[2, 2] { { 0, 2 }, { 3, 1 } }); - private static readonly DenseMatrix Expected3x3Matrix = new DenseMatrix( + private static readonly DenseMatrix Expected3x3Matrix = new( new uint[3, 3] { { 0, 5, 2 }, @@ -25,7 +25,7 @@ public class OrderedDitherFactoryTests { 3, 6, 1 } }); - private static readonly DenseMatrix Expected4x4Matrix = new DenseMatrix( + private static readonly DenseMatrix Expected4x4Matrix = new( new uint[4, 4] { { 0, 8, 2, 10 }, @@ -34,7 +34,7 @@ public class OrderedDitherFactoryTests { 15, 7, 13, 5 } }); - private static readonly DenseMatrix Expected8x8Matrix = new DenseMatrix( + private static readonly DenseMatrix Expected8x8Matrix = new( new uint[8, 8] { { 0, 32, 8, 40, 2, 34, 10, 42 }, diff --git a/tests/ImageSharp.Tests/Processing/Convolution/KernelSamplingMapTest.cs b/tests/ImageSharp.Tests/Processing/Convolution/KernelSamplingMapTest.cs index 2cf1c744d..d90ccee41 100644 --- a/tests/ImageSharp.Tests/Processing/Convolution/KernelSamplingMapTest.cs +++ b/tests/ImageSharp.Tests/Processing/Convolution/KernelSamplingMapTest.cs @@ -11,8 +11,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel5Image7x7RepeatBorder() { - Size kernelSize = new Size(5, 5); - Rectangle bounds = new Rectangle(0, 0, 7, 7); + Size kernelSize = new(5, 5); + Rectangle bounds = new(0, 0, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Repeat; int[] expected = { @@ -30,8 +30,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel5Image7x7BounceBorder() { - Size kernelSize = new Size(5, 5); - Rectangle bounds = new Rectangle(0, 0, 7, 7); + Size kernelSize = new(5, 5); + Rectangle bounds = new(0, 0, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Bounce; int[] expected = { @@ -49,8 +49,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel5Image7x7MirrorBorder() { - Size kernelSize = new Size(5, 5); - Rectangle bounds = new Rectangle(0, 0, 7, 7); + Size kernelSize = new(5, 5); + Rectangle bounds = new(0, 0, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Mirror; int[] expected = { @@ -68,8 +68,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel5Image7x7WrapBorder() { - Size kernelSize = new Size(5, 5); - Rectangle bounds = new Rectangle(0, 0, 7, 7); + Size kernelSize = new(5, 5); + Rectangle bounds = new(0, 0, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Wrap; int[] expected = { @@ -87,8 +87,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel5Image9x9BounceBorder() { - Size kernelSize = new Size(5, 5); - Rectangle bounds = new Rectangle(1, 1, 9, 9); + Size kernelSize = new(5, 5); + Rectangle bounds = new(1, 1, 9, 9); BorderWrappingMode mode = BorderWrappingMode.Bounce; int[] expected = { @@ -108,8 +108,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel5Image9x9MirrorBorder() { - Size kernelSize = new Size(5, 5); - Rectangle bounds = new Rectangle(1, 1, 9, 9); + Size kernelSize = new(5, 5); + Rectangle bounds = new(1, 1, 9, 9); BorderWrappingMode mode = BorderWrappingMode.Mirror; int[] expected = { @@ -129,8 +129,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel5Image9x9WrapBorder() { - Size kernelSize = new Size(5, 5); - Rectangle bounds = new Rectangle(1, 1, 9, 9); + Size kernelSize = new(5, 5); + Rectangle bounds = new(1, 1, 9, 9); BorderWrappingMode mode = BorderWrappingMode.Wrap; int[] expected = { @@ -150,8 +150,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel5Image7x7RepeatBorderTile() { - Size kernelSize = new Size(5, 5); - Rectangle bounds = new Rectangle(2, 2, 7, 7); + Size kernelSize = new(5, 5); + Rectangle bounds = new(2, 2, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Repeat; int[] expected = { @@ -169,8 +169,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel5Image7x7BounceBorderTile() { - Size kernelSize = new Size(5, 5); - Rectangle bounds = new Rectangle(2, 2, 7, 7); + Size kernelSize = new(5, 5); + Rectangle bounds = new(2, 2, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Bounce; int[] expected = { @@ -188,8 +188,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel5Image7x7MirrorBorderTile() { - Size kernelSize = new Size(5, 5); - Rectangle bounds = new Rectangle(2, 2, 7, 7); + Size kernelSize = new(5, 5); + Rectangle bounds = new(2, 2, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Mirror; int[] expected = { @@ -207,8 +207,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel5Image7x7WrapBorderTile() { - Size kernelSize = new Size(5, 5); - Rectangle bounds = new Rectangle(2, 2, 7, 7); + Size kernelSize = new(5, 5); + Rectangle bounds = new(2, 2, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Wrap; int[] expected = { @@ -226,8 +226,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel3Image7x7RepeatBorder() { - Size kernelSize = new Size(3, 3); - Rectangle bounds = new Rectangle(0, 0, 7, 7); + Size kernelSize = new(3, 3); + Rectangle bounds = new(0, 0, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Repeat; int[] expected = { @@ -245,8 +245,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel3Image7x7BounceBorder() { - Size kernelSize = new Size(3, 3); - Rectangle bounds = new Rectangle(0, 0, 7, 7); + Size kernelSize = new(3, 3); + Rectangle bounds = new(0, 0, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Bounce; int[] expected = { @@ -264,8 +264,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel3Image7x7MirrorBorder() { - Size kernelSize = new Size(3, 3); - Rectangle bounds = new Rectangle(0, 0, 7, 7); + Size kernelSize = new(3, 3); + Rectangle bounds = new(0, 0, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Mirror; int[] expected = { @@ -283,8 +283,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel3Image7x7WrapBorder() { - Size kernelSize = new Size(3, 3); - Rectangle bounds = new Rectangle(0, 0, 7, 7); + Size kernelSize = new(3, 3); + Rectangle bounds = new(0, 0, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Wrap; int[] expected = { @@ -302,8 +302,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel3Image7x7RepeatBorderTile() { - Size kernelSize = new Size(3, 3); - Rectangle bounds = new Rectangle(2, 2, 7, 7); + Size kernelSize = new(3, 3); + Rectangle bounds = new(2, 2, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Repeat; int[] expected = { @@ -321,8 +321,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel3Image7BounceBorderTile() { - Size kernelSize = new Size(3, 3); - Rectangle bounds = new Rectangle(2, 2, 7, 7); + Size kernelSize = new(3, 3); + Rectangle bounds = new(2, 2, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Bounce; int[] expected = { @@ -340,8 +340,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel3Image7MirrorBorderTile() { - Size kernelSize = new Size(3, 3); - Rectangle bounds = new Rectangle(2, 2, 7, 7); + Size kernelSize = new(3, 3); + Rectangle bounds = new(2, 2, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Mirror; int[] expected = { @@ -359,8 +359,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel3Image7x7WrapBorderTile() { - Size kernelSize = new Size(3, 3); - Rectangle bounds = new Rectangle(2, 2, 7, 7); + Size kernelSize = new(3, 3); + Rectangle bounds = new(2, 2, 7, 7); BorderWrappingMode mode = BorderWrappingMode.Wrap; int[] expected = { @@ -378,8 +378,8 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel3Image7x5WrapBorderTile() { - Size kernelSize = new Size(3, 3); - Rectangle bounds = new Rectangle(2, 2, 7, 5); + Size kernelSize = new(3, 3); + Rectangle bounds = new(2, 2, 7, 5); BorderWrappingMode mode = BorderWrappingMode.Wrap; int[] xExpected = { @@ -405,7 +405,7 @@ public class KernelSamplingMapTest private void AssertOffsets(Size kernelSize, Rectangle bounds, BorderWrappingMode xBorderMode, BorderWrappingMode yBorderMode, int[] xExpected, int[] yExpected) { // Arrange - KernelSamplingMap map = new KernelSamplingMap(Configuration.Default.MemoryAllocator); + KernelSamplingMap map = new(Configuration.Default.MemoryAllocator); // Act map.BuildSamplingOffsetMap(kernelSize.Height, kernelSize.Width, bounds, xBorderMode, yBorderMode); diff --git a/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs b/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs index 800cb06ac..6c6fa6b2b 100644 --- a/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs +++ b/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs @@ -7,9 +7,9 @@ namespace SixLabors.ImageSharp.Tests.Processing.Convolution.Processors; public class LaplacianKernelFactoryTests { - private static readonly ApproximateFloatComparer ApproximateComparer = new ApproximateFloatComparer(0.0001F); + private static readonly ApproximateFloatComparer ApproximateComparer = new(0.0001F); - private static readonly DenseMatrix Expected3x3Matrix = new DenseMatrix( + private static readonly DenseMatrix Expected3x3Matrix = new( new float[,] { { -1, -1, -1 }, @@ -17,7 +17,7 @@ public class LaplacianKernelFactoryTests { -1, -1, -1 } }); - private static readonly DenseMatrix Expected5x5Matrix = new DenseMatrix( + private static readonly DenseMatrix Expected5x5Matrix = new( new float[,] { { -1, -1, -1, -1, -1 }, diff --git a/tests/ImageSharp.Tests/Processing/FakeImageOperationsProvider.cs b/tests/ImageSharp.Tests/Processing/FakeImageOperationsProvider.cs index 8b2411bf2..703a64333 100644 --- a/tests/ImageSharp.Tests/Processing/FakeImageOperationsProvider.cs +++ b/tests/ImageSharp.Tests/Processing/FakeImageOperationsProvider.cs @@ -69,7 +69,7 @@ internal class FakeImageOperationsProvider : IImageProcessingContextFactory public IImageProcessingContext ApplyProcessor(IImageProcessor processor, Rectangle rectangle) { - this.Applied.Add(new() + this.Applied.Add(new AppliedOperation { Rectangle = rectangle, NonGenericProcessor = processor @@ -79,7 +79,7 @@ internal class FakeImageOperationsProvider : IImageProcessingContextFactory public IImageProcessingContext ApplyProcessor(IImageProcessor processor) { - this.Applied.Add(new() + this.Applied.Add(new AppliedOperation { NonGenericProcessor = processor }); diff --git a/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs b/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs index 9cfc3a3f0..135212400 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs @@ -35,24 +35,24 @@ public class BrightnessTest : BaseImageOperationsExtensionTest rgbImage.Mutate(x => x.ApplyProcessor(new BrightnessProcessor(2))); - Assert.Equal(new(0, 0, 0), rgbImage[0, 0]); + Assert.Equal(new Rgb24(0, 0, 0), rgbImage[0, 0]); - rgbImage = new(Configuration.Default, 100, 100, new Rgb24(10, 10, 10)); + rgbImage = new Image(Configuration.Default, 100, 100, new Rgb24(10, 10, 10)); rgbImage.Mutate(x => x.ApplyProcessor(new BrightnessProcessor(2))); - Assert.Equal(new(20, 20, 20), rgbImage[0, 0]); + Assert.Equal(new Rgb24(20, 20, 20), rgbImage[0, 0]); Image halfSingleImage = new(Configuration.Default, 100, 100, new HalfSingle(-1)); halfSingleImage.Mutate(x => x.ApplyProcessor(new BrightnessProcessor(2))); - Assert.Equal(new(-1), halfSingleImage[0, 0]); + Assert.Equal(new HalfSingle(-1), halfSingleImage[0, 0]); - halfSingleImage = new(Configuration.Default, 100, 100, new HalfSingle(-0.5f)); + halfSingleImage = new Image(Configuration.Default, 100, 100, new HalfSingle(-0.5f)); halfSingleImage.Mutate(x => x.ApplyProcessor(new BrightnessProcessor(2))); - Assert.Equal(new(0), halfSingleImage[0, 0]); + Assert.Equal(new HalfSingle(0), halfSingleImage[0, 0]); } } diff --git a/tests/ImageSharp.Tests/Processing/ImageOperationTests.cs b/tests/ImageSharp.Tests/Processing/ImageOperationTests.cs index d53dc74b9..09fbcdc70 100644 --- a/tests/ImageSharp.Tests/Processing/ImageOperationTests.cs +++ b/tests/ImageSharp.Tests/Processing/ImageOperationTests.cs @@ -22,13 +22,13 @@ public class ImageOperationTests : IDisposable public ImageOperationTests() { - this.provider = new(); + this.provider = new FakeImageOperationsProvider(); Mock processorMock = new(); this.processorDefinition = processorMock.Object; - this.image = new( - new() + this.image = new Image( + new Configuration { ImageOperationsProvider = this.provider }, diff --git a/tests/ImageSharp.Tests/Processing/ImageProcessingContextTests.cs b/tests/ImageSharp.Tests/Processing/ImageProcessingContextTests.cs index 06eb90005..e39d8075b 100644 --- a/tests/ImageSharp.Tests/Processing/ImageProcessingContextTests.cs +++ b/tests/ImageSharp.Tests/Processing/ImageProcessingContextTests.cs @@ -27,10 +27,10 @@ public class ImageProcessingContextTests : IDisposable public ImageProcessingContextTests() { - this.processorDefinition = new(); - this.cloningProcessorDefinition = new(); - this.regularProcessorImpl = new(); - this.cloningProcessorImpl = new(); + this.processorDefinition = new Mock(); + this.cloningProcessorDefinition = new Mock(); + this.regularProcessorImpl = new Mock>(); + this.cloningProcessorImpl = new Mock>(); } // bool throwException, bool useBounds diff --git a/tests/ImageSharp.Tests/Processing/Normalization/HistogramEqualizationTests.cs b/tests/ImageSharp.Tests/Processing/Normalization/HistogramEqualizationTests.cs index e37cd5db1..5c5fd20e4 100644 --- a/tests/ImageSharp.Tests/Processing/Normalization/HistogramEqualizationTests.cs +++ b/tests/ImageSharp.Tests/Processing/Normalization/HistogramEqualizationTests.cs @@ -39,7 +39,7 @@ public class HistogramEqualizationTests for (int x = 0; x < 8; x++) { byte luminance = pixels[(y * 8) + x]; - image[x, y] = new(luminance, luminance, luminance); + image[x, y] = new Rgba32(luminance, luminance, luminance); } } @@ -56,7 +56,7 @@ public class HistogramEqualizationTests }; // Act - image.Mutate(x => x.HistogramEqualization(new() + image.Mutate(x => x.HistogramEqualization(new HistogramEqualizationOptions { LuminanceLevels = luminanceLevels, Method = HistogramEqualizationMethod.Global diff --git a/tests/ImageSharp.Tests/Processing/Normalization/MagickCompareTests.cs b/tests/ImageSharp.Tests/Processing/Normalization/MagickCompareTests.cs index 50c177cc0..2b609a9b2 100644 --- a/tests/ImageSharp.Tests/Processing/Normalization/MagickCompareTests.cs +++ b/tests/ImageSharp.Tests/Processing/Normalization/MagickCompareTests.cs @@ -49,7 +49,7 @@ public class MagickCompareTests ?? throw new InvalidOperationException("CompareToMagick() works only with file providers!"); TestFile testFile = TestFile.Create(path); - return new(testFile.FullPath, FileMode.Open); + return new FileStream(testFile.FullPath, FileMode.Open); } private static Image ConvertImageFromMagick(MagickImage magickImage) diff --git a/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs b/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs index be9263334..c7881597a 100644 --- a/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs +++ b/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs @@ -45,7 +45,7 @@ public class GlowTest : BaseImageOperationsExtensionTest [Fact] public void Glow_Rect_GlowProcessorWithDefaultValues() { - Rectangle rect = new Rectangle(12, 123, 43, 65); + Rectangle rect = new(12, 123, 43, 65); this.operations.Glow(rect); GlowProcessor p = this.Verify(rect); diff --git a/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs b/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs index 14dcc7438..e222c566f 100644 --- a/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs +++ b/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs @@ -48,7 +48,7 @@ public class VignetteTest : BaseImageOperationsExtensionTest [Fact] public void Vignette_Rect_VignetteProcessorWithDefaultValues() { - Rectangle rect = new Rectangle(12, 123, 43, 65); + Rectangle rect = new(12, 123, 43, 65); this.operations.Vignette(rect); VignetteProcessor p = this.Verify(rect); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs index 18f62c171..64dd7a866 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs @@ -17,7 +17,7 @@ public class BinaryDitherTests TestImages.Png.CalliphoraPartial, TestImages.Png.Bike }; - public static readonly TheoryData OrderedDitherers = new TheoryData + public static readonly TheoryData OrderedDitherers = new() { { "Bayer8x8", KnownDitherings.Bayer8x8 }, { "Bayer4x4", KnownDitherings.Bayer4x4 }, @@ -25,7 +25,7 @@ public class BinaryDitherTests { "Bayer2x2", KnownDitherings.Bayer2x2 } }; - public static readonly TheoryData ErrorDiffusers = new TheoryData + public static readonly TheoryData ErrorDiffusers = new() { { "Atkinson", KnownDitherings.Atkinson }, { "Burks", KnownDitherings.Burks }, @@ -102,7 +102,7 @@ public class BinaryDitherTests using (Image source = provider.GetImage()) using (Image image = source.Clone()) { - Rectangle bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2); + Rectangle bounds = new(10, 10, image.Width / 2, image.Height / 2); image.Mutate(x => x.BinaryDither(DefaultDitherer, bounds)); image.DebugSave(provider); @@ -119,7 +119,7 @@ public class BinaryDitherTests using (Image source = provider.GetImage()) using (Image image = source.Clone()) { - Rectangle bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2); + Rectangle bounds = new(10, 10, image.Width / 2, image.Height / 2); image.Mutate(x => x.BinaryDither(DefaultErrorDiffuser, bounds)); image.DebugSave(provider); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs index a94c75975..9c63d0f7c 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs @@ -12,8 +12,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization; public class BinaryThresholdTest { public static readonly TheoryData BinaryThresholdValues - = new TheoryData - { + = new() + { .25F, .75F }; @@ -46,7 +46,7 @@ public class BinaryThresholdTest using (Image source = provider.GetImage()) using (Image image = source.Clone()) { - Rectangle bounds = new Rectangle(image.Width / 8, image.Height / 8, 6 * image.Width / 8, 6 * image.Width / 8); + Rectangle bounds = new(image.Width / 8, image.Height / 8, 6 * image.Width / 8, 6 * image.Width / 8); image.Mutate(x => x.BinaryThreshold(value, bounds)); image.DebugSave(provider, value); @@ -76,7 +76,7 @@ public class BinaryThresholdTest using (Image source = provider.GetImage()) using (Image image = source.Clone()) { - Rectangle bounds = new Rectangle(image.Width / 8, image.Height / 8, 6 * image.Width / 8, 6 * image.Width / 8); + Rectangle bounds = new(image.Width / 8, image.Height / 8, 6 * image.Width / 8, 6 * image.Width / 8); image.Mutate(x => x.BinaryThreshold(value, BinaryThresholdMode.Saturation, bounds)); image.DebugSave(provider, value); @@ -114,7 +114,7 @@ public class BinaryThresholdTest using (Image source = provider.GetImage()) using (Image image = source.Clone()) { - Rectangle bounds = new Rectangle(image.Width / 8, image.Height / 8, 6 * image.Width / 8, 6 * image.Width / 8); + Rectangle bounds = new(image.Width / 8, image.Height / 8, 6 * image.Width / 8, 6 * image.Width / 8); image.Mutate(x => x.BinaryThreshold(value, BinaryThresholdMode.MaxChroma, bounds)); image.DebugSave(provider, value); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/Basic1ParameterConvolutionTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/Basic1ParameterConvolutionTests.cs index 13ddf85c1..455aa48ae 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/Basic1ParameterConvolutionTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/Basic1ParameterConvolutionTests.cs @@ -12,7 +12,7 @@ public abstract class Basic1ParameterConvolutionTests { private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.05F); - public static readonly TheoryData Values = new TheoryData { 3, 5 }; + public static readonly TheoryData Values = new() { 3, 5 }; public static readonly string[] InputImages = { diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs index 9c1ffbbef..f045c981e 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs @@ -108,9 +108,9 @@ public class BokehBlurTest public static readonly TheoryData BokehBlurValues = new() { - new() { Radius = 8, Components = 1, Gamma = 1 }, - new() { Radius = 16, Components = 1, Gamma = 3 }, - new() { Radius = 16, Components = 2, Gamma = 3 } + new BokehBlurInfo { Radius = 8, Components = 1, Gamma = 1 }, + new BokehBlurInfo { Radius = 16, Components = 1, Gamma = 3 }, + new BokehBlurInfo { Radius = 16, Components = 2, Gamma = 3 } }; public static readonly string[] TestFiles = diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/ConvolutionTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/ConvolutionTests.cs index 0cb56b732..468965f1e 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/ConvolutionTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/ConvolutionTests.cs @@ -12,7 +12,7 @@ public class ConvolutionTests { private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.05F); - public static readonly TheoryData> Values = new TheoryData> + public static readonly TheoryData> Values = new() { // Sharpening kernel. new float[,] diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs index 2da74377a..04344e130 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs @@ -22,16 +22,16 @@ public class DetectEdgesTest public const PixelTypes CommonNonDefaultPixelTypes = PixelTypes.Rgba32 | PixelTypes.Bgra32 | PixelTypes.RgbaVector; public static readonly TheoryData DetectEdgesFilters - = new TheoryData - { + = new() + { { KnownEdgeDetectorKernels.Laplacian3x3, nameof(KnownEdgeDetectorKernels.Laplacian3x3) }, { KnownEdgeDetectorKernels.Laplacian5x5, nameof(KnownEdgeDetectorKernels.Laplacian5x5) }, { KnownEdgeDetectorKernels.LaplacianOfGaussian, nameof(KnownEdgeDetectorKernels.LaplacianOfGaussian) }, }; public static readonly TheoryData DetectEdges2DFilters - = new TheoryData - { + = new() + { { KnownEdgeDetectorKernels.Kayyali, nameof(KnownEdgeDetectorKernels.Kayyali) }, { KnownEdgeDetectorKernels.Prewitt, nameof(KnownEdgeDetectorKernels.Prewitt) }, { KnownEdgeDetectorKernels.RobertsCross, nameof(KnownEdgeDetectorKernels.RobertsCross) }, @@ -40,8 +40,8 @@ public class DetectEdgesTest }; public static readonly TheoryData DetectEdgesCompassFilters - = new TheoryData - { + = new() + { { KnownEdgeDetectorKernels.Kirsch, nameof(KnownEdgeDetectorKernels.Kirsch) }, { KnownEdgeDetectorKernels.Robinson, nameof(KnownEdgeDetectorKernels.Robinson) }, }; @@ -55,7 +55,7 @@ public class DetectEdgesTest ctx => { Size size = ctx.GetCurrentSize(); - Rectangle bounds = new Rectangle(10, 10, size.Width / 2, size.Height / 2); + Rectangle bounds = new(10, 10, size.Width / 2, size.Height / 2); ctx.DetectEdges(bounds); }, comparer: OpaqueComparer, @@ -158,7 +158,7 @@ public class DetectEdgesTest { using (Image image = provider.GetImage()) { - Rectangle bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2); + Rectangle bounds = new(10, 10, image.Width / 2, image.Height / 2); image.Mutate(x => x.DetectEdges(bounds)); image.DebugSave(provider); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs index 9e47f54cc..3cc965334 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs @@ -17,7 +17,7 @@ public class DitherTests public static readonly string[] CommonTestImages = { TestImages.Png.CalliphoraPartial, TestImages.Png.Bike }; public static readonly TheoryData ErrorDiffusers - = new TheoryData + = new() { { KnownDitherings.Atkinson, nameof(KnownDitherings.Atkinson) }, { KnownDitherings.Burks, nameof(KnownDitherings.Burks) }, @@ -31,7 +31,7 @@ public class DitherTests }; public static readonly TheoryData OrderedDitherers - = new TheoryData + = new() { { KnownDitherings.Bayer2x2, nameof(KnownDitherings.Bayer2x2) }, { KnownDitherings.Bayer4x4, nameof(KnownDitherings.Bayer4x4) }, @@ -41,7 +41,7 @@ public class DitherTests }; public static readonly TheoryData DefaultInstanceDitherers - = new TheoryData + = new() { default(ErrorDither), default(OrderedDither) @@ -186,7 +186,7 @@ public class DitherTests { void Command() { - using Image image = new Image(10, 10); + using Image image = new(10, 10); image.Mutate(x => x.Dither(dither)); } diff --git a/tests/ImageSharp.Tests/Processing/Processors/Effects/OilPaintTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Effects/OilPaintTest.cs index 06d3850a4..f3d8fd63a 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Effects/OilPaintTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Effects/OilPaintTest.cs @@ -49,7 +49,7 @@ public class OilPaintTest [Fact] public void Issue2518_PixelComponentOutsideOfRange_ThrowsImageProcessingException() { - using Image image = new(10, 10, new(1, 1, 100)); + using Image image = new(10, 10, new RgbaVector(1, 1, 100)); Assert.Throws(() => image.Mutate(ctx => ctx.OilPaint())); } } diff --git a/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelShaderTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelShaderTest.cs index 963394e7d..b88ab37fe 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelShaderTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelShaderTest.cs @@ -24,7 +24,7 @@ public class PixelShaderTest { Vector4 v4 = span[i]; float avg = (v4.X + v4.Y + v4.Z) / 3f; - span[i] = new(avg); + span[i] = new Vector4(avg); } }), appendPixelTypeToFileName: false); @@ -43,7 +43,7 @@ public class PixelShaderTest { Vector4 v4 = span[i]; float avg = (v4.X + v4.Y + v4.Z) / 3f; - span[i] = new(avg); + span[i] = new Vector4(avg); } }, rect)); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelateTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelateTest.cs index 29b952403..fff7ba018 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelateTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelateTest.cs @@ -10,7 +10,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects; [GroupOutput("Effects")] public class PixelateTest { - public static readonly TheoryData PixelateValues = new TheoryData { 4, 8 }; + public static readonly TheoryData PixelateValues = new() { 4, 8 }; [Theory] [WithFile(TestImages.Png.Ducky, nameof(PixelateValues), PixelTypes.Rgba32)] diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/BrightnessTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/BrightnessTest.cs index 7da96d13d..4663aa868 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/BrightnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/BrightnessTest.cs @@ -14,7 +14,7 @@ public class BrightnessTest private readonly ImageComparer imageComparer = ImageComparer.Tolerant(0.007F); public static readonly TheoryData BrightnessValues - = new TheoryData + = new() { .5F, 1.5F diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs index 0727a5b97..1f2afb97f 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs @@ -14,7 +14,7 @@ public class ColorBlindnessTest private readonly ImageComparer imageComparer = ImageComparer.Tolerant(0.03F); public static readonly TheoryData ColorBlindnessFilters - = new TheoryData + = new() { ColorBlindnessMode.Achromatomaly, ColorBlindnessMode.Achromatopsia, diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/ContrastTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/ContrastTest.cs index 5e2a7f55d..6ff10bbd8 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/ContrastTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/ContrastTest.cs @@ -11,7 +11,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters; public class ContrastTest { public static readonly TheoryData ContrastValues - = new TheoryData + = new() { .5F, 1.5F diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/GrayscaleTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/GrayscaleTest.cs index 50a262152..15ef7f7c3 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/GrayscaleTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/GrayscaleTest.cs @@ -11,7 +11,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters; public class GrayscaleTest { public static readonly TheoryData GrayscaleModeTypes - = new TheoryData + = new() { GrayscaleMode.Bt601, GrayscaleMode.Bt709 diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/HueTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/HueTest.cs index 65ac4245d..1838cc33d 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/HueTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/HueTest.cs @@ -11,7 +11,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters; public class HueTest { public static readonly TheoryData HueValues - = new TheoryData + = new() { 180, -180 diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/LightnessTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/LightnessTest.cs index 39e69aa4a..49e2c8546 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/LightnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/LightnessTest.cs @@ -14,7 +14,7 @@ public class LightnessTest private readonly ImageComparer imageComparer = ImageComparer.Tolerant(0.007F); public static readonly TheoryData LightnessValues - = new TheoryData + = new() { .5F, 1.5F diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/OpacityTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/OpacityTest.cs index 10ddf3a47..8a1bbfe3f 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/OpacityTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/OpacityTest.cs @@ -11,7 +11,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters; public class OpacityTest { public static readonly TheoryData AlphaValues - = new TheoryData + = new() { 20 / 100F, 80 / 100F diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/SaturateTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/SaturateTest.cs index 8632d4625..642c79819 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/SaturateTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/SaturateTest.cs @@ -11,7 +11,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters; public class SaturateTest { public static readonly TheoryData SaturationValues - = new TheoryData + = new() { .5F, 1.5F, diff --git a/tests/ImageSharp.Tests/Processing/Processors/Quantization/OctreeQuantizerTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Quantization/OctreeQuantizerTests.cs index cabfe3059..c9f3daf0f 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Quantization/OctreeQuantizerTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Quantization/OctreeQuantizerTests.cs @@ -19,18 +19,18 @@ public class OctreeQuantizerTests Assert.Equal(expected.MaxColors, quantizer.Options.MaxColors); Assert.Equal(QuantizerConstants.DefaultDither, quantizer.Options.Dither); - expected = new() { Dither = null }; - quantizer = new(expected); + expected = new QuantizerOptions { Dither = null }; + quantizer = new OctreeQuantizer(expected); Assert.Equal(QuantizerConstants.MaxColors, quantizer.Options.MaxColors); Assert.Null(quantizer.Options.Dither); - expected = new() { Dither = KnownDitherings.Atkinson }; - quantizer = new(expected); + expected = new QuantizerOptions { Dither = KnownDitherings.Atkinson }; + quantizer = new OctreeQuantizer(expected); Assert.Equal(QuantizerConstants.MaxColors, quantizer.Options.MaxColors); Assert.Equal(KnownDitherings.Atkinson, quantizer.Options.Dither); - expected = new() { Dither = KnownDitherings.Atkinson, MaxColors = 0 }; - quantizer = new(expected); + expected = new QuantizerOptions { Dither = KnownDitherings.Atkinson, MaxColors = 0 }; + quantizer = new OctreeQuantizer(expected); Assert.Equal(QuantizerConstants.MinColors, quantizer.Options.MaxColors); Assert.Equal(KnownDitherings.Atkinson, quantizer.Options.Dither); } @@ -46,14 +46,14 @@ public class OctreeQuantizerTests Assert.Equal(QuantizerConstants.DefaultDither, frameQuantizer.Options.Dither); frameQuantizer.Dispose(); - quantizer = new(new() { Dither = null }); + quantizer = new OctreeQuantizer(new QuantizerOptions { Dither = null }); frameQuantizer = quantizer.CreatePixelSpecificQuantizer(Configuration.Default); Assert.NotNull(frameQuantizer); Assert.Null(frameQuantizer.Options.Dither); frameQuantizer.Dispose(); - quantizer = new(new() { Dither = KnownDitherings.Atkinson }); + quantizer = new OctreeQuantizer(new QuantizerOptions { Dither = KnownDitherings.Atkinson }); frameQuantizer = quantizer.CreatePixelSpecificQuantizer(Configuration.Default); Assert.NotNull(frameQuantizer); Assert.Equal(KnownDitherings.Atkinson, frameQuantizer.Options.Dither); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Quantization/PaletteQuantizerTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Quantization/PaletteQuantizerTests.cs index ed9254605..d58a5280d 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Quantization/PaletteQuantizerTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Quantization/PaletteQuantizerTests.cs @@ -21,18 +21,18 @@ public class PaletteQuantizerTests Assert.Equal(expected.MaxColors, quantizer.Options.MaxColors); Assert.Equal(QuantizerConstants.DefaultDither, quantizer.Options.Dither); - expected = new() { Dither = null }; - quantizer = new(Palette, expected); + expected = new QuantizerOptions { Dither = null }; + quantizer = new PaletteQuantizer(Palette, expected); Assert.Equal(QuantizerConstants.MaxColors, quantizer.Options.MaxColors); Assert.Null(quantizer.Options.Dither); - expected = new() { Dither = KnownDitherings.Atkinson }; - quantizer = new(Palette, expected); + expected = new QuantizerOptions { Dither = KnownDitherings.Atkinson }; + quantizer = new PaletteQuantizer(Palette, expected); Assert.Equal(QuantizerConstants.MaxColors, quantizer.Options.MaxColors); Assert.Equal(KnownDitherings.Atkinson, quantizer.Options.Dither); - expected = new() { Dither = KnownDitherings.Atkinson, MaxColors = 0 }; - quantizer = new(Palette, expected); + expected = new QuantizerOptions { Dither = KnownDitherings.Atkinson, MaxColors = 0 }; + quantizer = new PaletteQuantizer(Palette, expected); Assert.Equal(QuantizerConstants.MinColors, quantizer.Options.MaxColors); Assert.Equal(KnownDitherings.Atkinson, quantizer.Options.Dither); } @@ -48,14 +48,14 @@ public class PaletteQuantizerTests Assert.Equal(QuantizerConstants.DefaultDither, frameQuantizer.Options.Dither); frameQuantizer.Dispose(); - quantizer = new(Palette, new() { Dither = null }); + quantizer = new PaletteQuantizer(Palette, new QuantizerOptions { Dither = null }); frameQuantizer = quantizer.CreatePixelSpecificQuantizer(Configuration.Default); Assert.NotNull(frameQuantizer); Assert.Null(frameQuantizer.Options.Dither); frameQuantizer.Dispose(); - quantizer = new(Palette, new() { Dither = KnownDitherings.Atkinson }); + quantizer = new PaletteQuantizer(Palette, new QuantizerOptions { Dither = KnownDitherings.Atkinson }); frameQuantizer = quantizer.CreatePixelSpecificQuantizer(Configuration.Default); Assert.NotNull(frameQuantizer); Assert.Equal(KnownDitherings.Atkinson, frameQuantizer.Options.Dither); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Quantization/WuQuantizerTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Quantization/WuQuantizerTests.cs index 6e43fe252..2d270b2a4 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Quantization/WuQuantizerTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Quantization/WuQuantizerTests.cs @@ -19,18 +19,18 @@ public class WuQuantizerTests Assert.Equal(expected.MaxColors, quantizer.Options.MaxColors); Assert.Equal(QuantizerConstants.DefaultDither, quantizer.Options.Dither); - expected = new() { Dither = null }; - quantizer = new(expected); + expected = new QuantizerOptions { Dither = null }; + quantizer = new WuQuantizer(expected); Assert.Equal(QuantizerConstants.MaxColors, quantizer.Options.MaxColors); Assert.Null(quantizer.Options.Dither); - expected = new() { Dither = KnownDitherings.Atkinson }; - quantizer = new(expected); + expected = new QuantizerOptions { Dither = KnownDitherings.Atkinson }; + quantizer = new WuQuantizer(expected); Assert.Equal(QuantizerConstants.MaxColors, quantizer.Options.MaxColors); Assert.Equal(KnownDitherings.Atkinson, quantizer.Options.Dither); - expected = new() { Dither = KnownDitherings.Atkinson, MaxColors = 0 }; - quantizer = new(expected); + expected = new QuantizerOptions { Dither = KnownDitherings.Atkinson, MaxColors = 0 }; + quantizer = new WuQuantizer(expected); Assert.Equal(QuantizerConstants.MinColors, quantizer.Options.MaxColors); Assert.Equal(KnownDitherings.Atkinson, quantizer.Options.Dither); } @@ -46,14 +46,14 @@ public class WuQuantizerTests Assert.Equal(QuantizerConstants.DefaultDither, frameQuantizer.Options.Dither); frameQuantizer.Dispose(); - quantizer = new(new() { Dither = null }); + quantizer = new WuQuantizer(new QuantizerOptions { Dither = null }); frameQuantizer = quantizer.CreatePixelSpecificQuantizer(Configuration.Default); Assert.NotNull(frameQuantizer); Assert.Null(frameQuantizer.Options.Dither); frameQuantizer.Dispose(); - quantizer = new(new() { Dither = KnownDitherings.Atkinson }); + quantizer = new WuQuantizer(new QuantizerOptions { Dither = KnownDitherings.Atkinson }); frameQuantizer = quantizer.CreatePixelSpecificQuantizer(Configuration.Default); Assert.NotNull(frameQuantizer); Assert.Equal(KnownDitherings.Atkinson, frameQuantizer.Options.Dither); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/AffineTransformTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/AffineTransformTests.cs index 34a8b1e58..a7855e23a 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/AffineTransformTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/AffineTransformTests.cs @@ -213,7 +213,7 @@ public class AffineTransformTests public void Issue1911() { using Image image = new(100, 100); - image.Mutate(x => x = x.Transform(new(0, 0, 99, 100), Matrix3x2.Identity, new(99, 100), KnownResamplers.Lanczos2)); + image.Mutate(x => x = x.Transform(new Rectangle(0, 0, 99, 100), Matrix3x2.Identity, new Size(99, 100), KnownResamplers.Lanczos2)); Assert.Equal(99, image.Width); Assert.Equal(100, image.Height); @@ -227,7 +227,7 @@ public class AffineTransformTests using Image image = provider.GetImage(); AffineTransformBuilder builder = - new AffineTransformBuilder().AppendRotationDegrees(270, new(3.5f, 3.5f)); + new AffineTransformBuilder().AppendRotationDegrees(270, new Vector2(3.5f, 3.5f)); image.Mutate(x => x.BackgroundColor(Color.Red)); image.Mutate(x => x = x.Transform(builder)); @@ -246,7 +246,7 @@ public class AffineTransformTests Matrix3x2 m = Matrix3x2.Identity; Rectangle r = new(25, 25, 50, 50); - image.Mutate(x => x.Transform(r, m, new(100, 100), KnownResamplers.Bicubic)); + image.Mutate(x => x.Transform(r, m, new Size(100, 100), KnownResamplers.Bicubic)); image.DebugSave(provider); image.CompareToReferenceOutput(ValidatorComparer, provider); } @@ -260,9 +260,9 @@ public class AffineTransformTests { using Image image = provider.GetImage(); - Matrix3x2 m = Matrix3x2.CreateRotation(radians, new(50, 50)); + Matrix3x2 m = Matrix3x2.CreateRotation(radians, new Vector2(50, 50)); Rectangle r = new(25, 25, 50, 50); - image.Mutate(x => x.Transform(r, m, new(100, 100), KnownResamplers.Bicubic)); + image.Mutate(x => x.Transform(r, m, new Size(100, 100), KnownResamplers.Bicubic)); image.DebugSave(provider, testOutputDetails: radians); image.CompareToReferenceOutput(ValidatorComparer, provider, testOutputDetails: radians); } diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs index 21e218d4c..984e3bc75 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs @@ -44,7 +44,7 @@ public class AutoOrientTests where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - image.Metadata.ExifProfile = new(); + image.Metadata.ExifProfile = new ExifProfile(); image.Metadata.ExifProfile.SetValue(ExifTag.Orientation, orientation); image.Mutate(x => x.AutoOrient()); @@ -79,7 +79,7 @@ public class AutoOrientTests using Image image = provider.GetImage(); using Image reference = image.Clone(); - image.Metadata.ExifProfile = new(bytes); + image.Metadata.ExifProfile = new ExifProfile(bytes); image.Mutate(x => x.AutoOrient()); image.DebugSave(provider, $"{dataType}-{orientationCode}", appendPixelTypeToFileName: false); ImageComparer.Exact.VerifySimilarity(image, reference); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs index 619610cc2..f4a0aeb0c 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs @@ -17,7 +17,7 @@ public class CropTest public void Crop(TestImageProvider provider, int x, int y, int w, int h) where TPixel : unmanaged, IPixel { - Rectangle rect = new Rectangle(x, y, w, h); + Rectangle rect = new(x, y, w, h); FormattableString info = $"X{x}Y{y}.W{w}H{h}"; provider.RunValidatingProcessorTest( ctx => ctx.Crop(rect), diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/EntropyCropTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/EntropyCropTest.cs index d587bc7e0..3e986f0cb 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/EntropyCropTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/EntropyCropTest.cs @@ -10,7 +10,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms; [GroupOutput("Transforms")] public class EntropyCropTest { - public static readonly TheoryData EntropyCropValues = new TheoryData { .25F, .75F }; + public static readonly TheoryData EntropyCropValues = new() { .25F, .75F }; public static readonly string[] InputImages = { diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/FlipTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/FlipTests.cs index 717582274..5c545147e 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/FlipTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/FlipTests.cs @@ -12,8 +12,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms; public class FlipTests { public static readonly TheoryData FlipValues = - new TheoryData - { + new() + { FlipMode.None, FlipMode.Vertical, FlipMode.Horizontal, diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeHelperTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeHelperTests.cs index 96e7702d8..e3e7118c0 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeHelperTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeHelperTests.cs @@ -39,14 +39,14 @@ public class ResizeHelperTests (Size size, Rectangle rectangle) = ResizeHelper.CalculateTargetLocationAndBounds( sourceSize, - new() + new ResizeOptions { Mode = ResizeMode.Min, Size = target }); Assert.Equal(sourceSize, size); - Assert.Equal(new(0, 0, sourceSize.Width, sourceSize.Height), rectangle); + Assert.Equal(new Rectangle(0, 0, sourceSize.Width, sourceSize.Height), rectangle); } [Fact] @@ -60,7 +60,7 @@ public class ResizeHelperTests (Size size, Rectangle rectangle) = ResizeHelper.CalculateTargetLocationAndBounds( sourceSize, - new() + new ResizeOptions { Mode = ResizeMode.Max, Size = target @@ -81,7 +81,7 @@ public class ResizeHelperTests (Size size, Rectangle rectangle) = ResizeHelper.CalculateTargetLocationAndBounds( sourceSize, - new() + new ResizeOptions { Mode = ResizeMode.Crop, Size = target @@ -102,7 +102,7 @@ public class ResizeHelperTests (Size size, Rectangle rectangle) = ResizeHelper.CalculateTargetLocationAndBounds( sourceSize, - new() + new ResizeOptions { Mode = ResizeMode.BoxPad, Size = target @@ -123,7 +123,7 @@ public class ResizeHelperTests (Size size, Rectangle rectangle) = ResizeHelper.CalculateTargetLocationAndBounds( sourceSize, - new() + new ResizeOptions { Mode = ResizeMode.Pad, Size = target @@ -144,7 +144,7 @@ public class ResizeHelperTests (Size size, Rectangle rectangle) = ResizeHelper.CalculateTargetLocationAndBounds( sourceSize, - new() + new ResizeOptions { Mode = ResizeMode.Stretch, Size = target diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.ReferenceKernelMap.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.ReferenceKernelMap.cs index 2c897588e..1a4610bf6 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.ReferenceKernelMap.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.ReferenceKernelMap.cs @@ -80,10 +80,10 @@ public partial class ResizeKernelMapTests float[] floatVals = values.Select(v => (float)v).ToArray(); - result.Add(new(left, floatVals)); + result.Add(new ReferenceKernel(left, floatVals)); } - return new(result.ToArray()); + return new ReferenceKernelMap(result.ToArray()); } } @@ -103,7 +103,7 @@ public partial class ResizeKernelMapTests public static implicit operator ReferenceKernel(ResizeKernel orig) { - return new(orig.StartIndex, orig.Values.ToArray()); + return new ReferenceKernel(orig.StartIndex, orig.Values.ToArray()); } } } diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs index f1309f331..d6990782b 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs @@ -22,8 +22,8 @@ public partial class ResizeKernelMapTests /// resamplerName, srcSize, destSize /// public static readonly TheoryData KernelMapData - = new TheoryData - { + = new() + { { KnownResamplers.Bicubic, 15, 10 }, { KnownResamplers.Bicubic, 10, 15 }, { KnownResamplers.Bicubic, 20, 20 }, @@ -124,7 +124,7 @@ public partial class ResizeKernelMapTests this.Output.WriteLine($"Expected KernelMap:\n{PrintKernelMap(referenceMap)}\n"); this.Output.WriteLine($"Actual KernelMap:\n{PrintKernelMap(kernelMap)}\n"); #endif - ApproximateFloatComparer comparer = new ApproximateFloatComparer(1e-6f); + ApproximateFloatComparer comparer = new(1e-6f); for (int i = 0; i < kernelMap.DestinationLength; i++) { @@ -163,7 +163,7 @@ public partial class ResizeKernelMapTests Func getDestinationSize, Func getKernel) { - StringBuilder bld = new StringBuilder(); + StringBuilder bld = new(); if (kernelMap is ResizeKernelMap actualMap) { @@ -193,7 +193,7 @@ public partial class ResizeKernelMapTests private static TheoryData GenerateImageResizeData() { - TheoryData result = new TheoryData(); + TheoryData result = new(); string[] resamplerNames = TestUtils.GetAllResamplerNames(false); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs index b4cf08975..859634e37 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs @@ -346,7 +346,7 @@ public class ResizeTests "invalid dimensional input for Resize_WorksWithAllResamplers!"); } - newSize = new(specificDestWidth.Value, specificDestHeight.Value); + newSize = new SizeF(specificDestWidth.Value, specificDestHeight.Value); destSizeInfo = $"{newSize.Width}x{newSize.Height}"; } @@ -439,7 +439,7 @@ public class ResizeTests using Image image = provider.GetImage(); ResizeOptions options = new() { - Size = new(image.Width + 200, image.Height + 200), + Size = new Size(image.Width + 200, image.Height + 200), Mode = ResizeMode.BoxPad, PadColor = Color.HotPink }; @@ -456,7 +456,7 @@ public class ResizeTests where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - ResizeOptions options = new() { Size = new(image.Width, image.Height / 2) }; + ResizeOptions options = new() { Size = new Size(image.Width, image.Height / 2) }; image.Mutate(x => x.Resize(options)); @@ -470,7 +470,7 @@ public class ResizeTests where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - ResizeOptions options = new() { Size = new(image.Width / 2, image.Height) }; + ResizeOptions options = new() { Size = new Size(image.Width / 2, image.Height) }; image.Mutate(x => x.Resize(options)); @@ -486,7 +486,7 @@ public class ResizeTests using Image image = provider.GetImage(); ResizeOptions options = new() { - Size = new(480, 600), + Size = new Size(480, 600), Mode = ResizeMode.Crop }; @@ -502,7 +502,7 @@ public class ResizeTests where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - ResizeOptions options = new() { Size = new(300, 300), Mode = ResizeMode.Max }; + ResizeOptions options = new() { Size = new Size(300, 300), Mode = ResizeMode.Max }; image.Mutate(x => x.Resize(options)); @@ -518,7 +518,7 @@ public class ResizeTests using Image image = provider.GetImage(); ResizeOptions options = new() { - Size = new((int)Math.Round(image.Width * .75F), (int)Math.Round(image.Height * .95F)), + Size = new Size((int)Math.Round(image.Width * .75F), (int)Math.Round(image.Height * .95F)), Mode = ResizeMode.Min }; @@ -536,7 +536,7 @@ public class ResizeTests using Image image = provider.GetImage(); ResizeOptions options = new() { - Size = new(image.Width + 200, image.Height), + Size = new Size(image.Width + 200, image.Height), Mode = ResizeMode.Pad, PadColor = Color.Lavender }; @@ -555,7 +555,7 @@ public class ResizeTests using Image image = provider.GetImage(); ResizeOptions options = new() { - Size = new(image.Width / 2, image.Height), + Size = new Size(image.Width / 2, image.Height), Mode = ResizeMode.Stretch }; diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs index 55d26974a..cc3ea0322 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs @@ -12,8 +12,8 @@ public class RotateFlipTests public static readonly string[] FlipFiles = { TestImages.Bmp.F }; public static readonly TheoryData RotateFlipValues - = new TheoryData - { + = new() + { { RotateMode.None, FlipMode.Vertical }, { RotateMode.None, FlipMode.Horizontal }, { RotateMode.Rotate90, FlipMode.None }, diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateTests.cs index b150da1d8..7c3a97a44 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateTests.cs @@ -11,14 +11,14 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms; public class RotateTests { public static readonly TheoryData RotateAngles - = new TheoryData - { + = new() + { 50, -50, 170, -170 }; public static readonly TheoryData RotateEnumValues - = new TheoryData - { + = new() + { RotateMode.None, RotateMode.Rotate90, RotateMode.Rotate180, diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTests.cs index 1e217ae24..30dec4685 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTests.cs @@ -33,8 +33,8 @@ public class SkewTests nameof(KnownResamplers.Welch), }; - public static readonly TheoryData SkewValues = new TheoryData - { + public static readonly TheoryData SkewValues = new() + { { 20, 10 }, { -20, -10 } }; diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/SwizzleTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/SwizzleTests.cs index b831b0a6c..dee698db0 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/SwizzleTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/SwizzleTests.cs @@ -16,7 +16,7 @@ public class SwizzleTests { public InvertXAndYSwizzler(Size sourceSize) { - this.DestinationSize = new(sourceSize.Height, sourceSize.Width); + this.DestinationSize = new Size(sourceSize.Height, sourceSize.Width); } public Size DestinationSize { get; } @@ -34,7 +34,7 @@ public class SwizzleTests using Image expectedImage = provider.GetImage(); using Image image = provider.GetImage(); - image.Mutate(ctx => ctx.Swizzle(new InvertXAndYSwizzler(new(image.Width, image.Height)))); + image.Mutate(ctx => ctx.Swizzle(new InvertXAndYSwizzler(new Size(image.Width, image.Height)))); image.DebugSave( provider, @@ -42,7 +42,7 @@ public class SwizzleTests appendPixelTypeToFileName: false, appendSourceFileOrDescription: true); - image.Mutate(ctx => ctx.Swizzle(new InvertXAndYSwizzler(new(image.Width, image.Height)))); + image.Mutate(ctx => ctx.Swizzle(new InvertXAndYSwizzler(new Size(image.Width, image.Height)))); image.DebugSave( provider, diff --git a/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformBuilderTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformBuilderTests.cs index 4b1ca92dd..232571d4d 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformBuilderTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformBuilderTests.cs @@ -8,8 +8,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms; public class AffineTransformBuilderTests : TransformBuilderTestBase { - protected override AffineTransformBuilder CreateBuilder() - => new AffineTransformBuilder(); + protected override AffineTransformBuilder CreateBuilder() => new(); protected override void AppendRotationDegrees(AffineTransformBuilder builder, float degrees) => builder.AppendRotationDegrees(degrees); diff --git a/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs b/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs index 6e35fca29..c56df3152 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs @@ -17,7 +17,7 @@ public class CropTest : BaseImageOperationsExtensionTest this.operations.Crop(width, height); CropProcessor processor = this.Verify(); - Assert.Equal(new(0, 0, width, height), processor.CropRectangle); + Assert.Equal(new Rectangle(0, 0, width, height), processor.CropRectangle); } [Theory] diff --git a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformBuilderTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformBuilderTests.cs index 7d0c0dc58..a0380033f 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformBuilderTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformBuilderTests.cs @@ -9,8 +9,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms; [Trait("Category", "Processors")] public class ProjectiveTransformBuilderTests : TransformBuilderTestBase { - protected override ProjectiveTransformBuilder CreateBuilder() - => new ProjectiveTransformBuilder(); + protected override ProjectiveTransformBuilder CreateBuilder() => new(); protected override void AppendRotationDegrees(ProjectiveTransformBuilder builder, float degrees) => builder.AppendRotationDegrees(degrees); diff --git a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs index 0eb32dff7..6ba04f79a 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs @@ -57,10 +57,10 @@ public class ProjectiveTransformTests public static readonly TheoryData QuadDistortionData = new() { - { new(0, 0), new(150, 0), new(150, 150), new(0, 150) }, // source == destination - { new(25, 50), new(210, 25), new(140, 210), new(15, 125) }, // Distortion - { new(-50, -50), new(200, -50), new(200, 200), new(-50, 200) }, // Scaling - { new(150, 0), new(150, 150), new(0, 150), new(0, 0) }, // Rotation + { new PointF(0, 0), new PointF(150, 0), new PointF(150, 150), new PointF(0, 150) }, // source == destination + { new PointF(25, 50), new PointF(210, 25), new PointF(140, 210), new PointF(15, 125) }, // Distortion + { new PointF(-50, -50), new PointF(200, -50), new PointF(200, 200), new PointF(-50, 200) }, // Scaling + { new PointF(150, 0), new PointF(150, 150), new PointF(0, 150), new PointF(0, 0) }, // Rotation }; public ProjectiveTransformTests(ITestOutputHelper output) => this.Output = output; @@ -175,7 +175,7 @@ public class ProjectiveTransformTests public void Issue1911() { using Image image = new(100, 100); - image.Mutate(x => x = x.Transform(new(0, 0, 99, 100), Matrix4x4.Identity, new(99, 100), KnownResamplers.Lanczos2)); + image.Mutate(x => x = x.Transform(new Rectangle(0, 0, 99, 100), Matrix4x4.Identity, new Size(99, 100), KnownResamplers.Lanczos2)); Assert.Equal(99, image.Width); Assert.Equal(100, image.Height); @@ -190,7 +190,7 @@ public class ProjectiveTransformTests Matrix4x4 m = Matrix4x4.Identity; Rectangle r = new(25, 25, 50, 50); - image.Mutate(x => x.Transform(r, m, new(100, 100), KnownResamplers.Bicubic)); + image.Mutate(x => x.Transform(r, m, new Size(100, 100), KnownResamplers.Bicubic)); image.DebugSave(provider); image.CompareToReferenceOutput(ValidatorComparer, provider); } @@ -204,9 +204,9 @@ public class ProjectiveTransformTests { using Image image = provider.GetImage(); - Matrix4x4 m = Matrix4x4.CreateRotationX(radians, new(50, 50, 1F)) * Matrix4x4.CreateRotationY(radians, new(50, 50, 1F)); + Matrix4x4 m = Matrix4x4.CreateRotationX(radians, new Vector3(50, 50, 1F)) * Matrix4x4.CreateRotationY(radians, new Vector3(50, 50, 1F)); Rectangle r = new(25, 25, 50, 50); - image.Mutate(x => x.Transform(r, m, new(100, 100), KnownResamplers.Bicubic)); + image.Mutate(x => x.Transform(r, m, new Size(100, 100), KnownResamplers.Bicubic)); image.DebugSave(provider, testOutputDetails: radians); image.CompareToReferenceOutput(ValidatorComparer, provider, testOutputDetails: radians); } @@ -246,7 +246,7 @@ public class ProjectiveTransformTests if (property is null) { - throw new($"No resampler named {name}"); + throw new Exception($"No resampler named {name}"); } return (IResampler)property.GetValue(null); diff --git a/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs index d38658bbd..1d445b980 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs @@ -66,7 +66,7 @@ public class ResizeTests : BaseImageOperationsExtensionTest ResizeOptions resizeOptions = new() { - Size = new(width, height), + Size = new Size(width, height), Sampler = sampler, Compand = compand, Mode = mode diff --git a/tests/ImageSharp.Tests/Processing/Transforms/SwizzleTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/SwizzleTests.cs index a4f4f152b..8475ce5ab 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/SwizzleTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/SwizzleTests.cs @@ -13,7 +13,7 @@ public class SwizzleTests : BaseImageOperationsExtensionTest { public InvertXAndYSwizzler(Size sourceSize) { - this.DestinationSize = new(sourceSize.Height, sourceSize.Width); + this.DestinationSize = new Size(sourceSize.Height, sourceSize.Width); } public Size DestinationSize { get; } @@ -27,7 +27,7 @@ public class SwizzleTests : BaseImageOperationsExtensionTest int width = 5; int height = 10; - this.operations.Swizzle(new InvertXAndYSwizzler(new(width, height))); + this.operations.Swizzle(new InvertXAndYSwizzler(new Size(width, height))); SwizzleProcessor processor = this.Verify>(); Assert.Equal(processor.Swizzler.DestinationSize.Width, height); diff --git a/tests/ImageSharp.Tests/Processing/Transforms/TransformBuilderTestBase.cs b/tests/ImageSharp.Tests/Processing/Transforms/TransformBuilderTestBase.cs index cdc49e2a3..5caf071ac 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/TransformBuilderTestBase.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/TransformBuilderTestBase.cs @@ -17,9 +17,9 @@ public abstract class TransformBuilderTestBase { // scale, translate, source, expectedDest { Vector2.One, Vector2.Zero, Vector2.Zero, Vector2.Zero }, - { Vector2.One, Vector2.Zero, new(10, 20), new(10, 20) }, - { Vector2.One, new(3, 1), new(10, 20), new(13, 21) }, - { new(2, 0.5f), new(3, 1), new(10, 20), new(23, 11) }, + { Vector2.One, Vector2.Zero, new Vector2(10, 20), new Vector2(10, 20) }, + { Vector2.One, new Vector2(3, 1), new Vector2(10, 20), new Vector2(13, 21) }, + { new Vector2(2, 0.5f), new Vector2(3, 1), new Vector2(10, 20), new Vector2(23, 11) }, }; [Theory] @@ -32,10 +32,10 @@ public abstract class TransformBuilderTestBase Size size = new(123, 321); TBuilder builder = this.CreateBuilder(); - this.AppendScale(builder, new(scale)); + this.AppendScale(builder, new SizeF(scale)); this.AppendTranslation(builder, translate); - Vector2 actualDest = this.Execute(builder, new(Point.Empty, size), source); + Vector2 actualDest = this.Execute(builder, new Rectangle(Point.Empty, size), source); Assert.True(Comparer.Equals(expectedDest, actualDest)); } @@ -44,8 +44,8 @@ public abstract class TransformBuilderTestBase { // translate, scale, source, expectedDest { Vector2.Zero, Vector2.One, Vector2.Zero, Vector2.Zero }, - { Vector2.Zero, Vector2.One, new(10, 20), new(10, 20) }, - { new(3, 1), new(2, 0.5f), new(10, 20), new(26, 10.5f) }, + { Vector2.Zero, Vector2.One, new Vector2(10, 20), new Vector2(10, 20) }, + { new Vector2(3, 1), new Vector2(2, 0.5f), new Vector2(10, 20), new Vector2(26, 10.5f) }, }; [Theory] @@ -59,9 +59,9 @@ public abstract class TransformBuilderTestBase TBuilder builder = this.CreateBuilder(); this.AppendTranslation(builder, translate); - this.AppendScale(builder, new(scale)); + this.AppendScale(builder, new SizeF(scale)); - Vector2 actualDest = this.Execute(builder, new(Point.Empty, size), source); + Vector2 actualDest = this.Execute(builder, new Rectangle(Point.Empty, size), source); Assert.Equal(expectedDest, actualDest, Comparer); } @@ -73,7 +73,7 @@ public abstract class TransformBuilderTestBase Rectangle rectangle = new(locationX, locationY, 10, 10); TBuilder builder = this.CreateBuilder(); - this.AppendScale(builder, new(2, 2)); + this.AppendScale(builder, new SizeF(2, 2)); Vector2 actual = this.Execute(builder, rectangle, Vector2.One); Vector2 expected = new Vector2(-locationX + 1, -locationY + 1) * 2; @@ -102,7 +102,7 @@ public abstract class TransformBuilderTestBase Vector2 position = new(x, y); Vector2 expected = Vector2.Transform(position, matrix); - Vector2 actual = this.Execute(builder, new(Point.Empty, size), position); + Vector2 actual = this.Execute(builder, new Rectangle(Point.Empty, size), position); Assert.Equal(actual, expected, Comparer); } @@ -130,7 +130,7 @@ public abstract class TransformBuilderTestBase Vector2 position = new(x, y); Vector2 expected = Vector2.Transform(position, matrix); - Vector2 actual = this.Execute(builder, new(Point.Empty, size), position); + Vector2 actual = this.Execute(builder, new Rectangle(Point.Empty, size), position); Assert.Equal(actual, expected, Comparer); } @@ -156,7 +156,7 @@ public abstract class TransformBuilderTestBase Vector2 position = new(x, y); Vector2 expected = Vector2.Transform(position, matrix); - Vector2 actual = this.Execute(builder, new(Point.Empty, size), position); + Vector2 actual = this.Execute(builder, new Rectangle(Point.Empty, size), position); Assert.Equal(actual, expected, Comparer); } @@ -184,7 +184,7 @@ public abstract class TransformBuilderTestBase Vector2 position = new(x, y); Vector2 expected = Vector2.Transform(position, matrix); - Vector2 actual = this.Execute(builder, new(Point.Empty, size), position); + Vector2 actual = this.Execute(builder, new Rectangle(Point.Empty, size), position); Assert.Equal(actual, expected, Comparer); } @@ -201,21 +201,21 @@ public abstract class TransformBuilderTestBase // Forwards this.AppendRotationRadians(b1, pi); this.AppendSkewRadians(b1, pi, pi); - this.AppendScale(b1, new(2, 0.5f)); - this.AppendRotationRadians(b1, pi / 2, new(-0.5f, -0.1f)); - this.AppendSkewRadians(b1, pi, pi / 2, new(-0.5f, -0.1f)); - this.AppendTranslation(b1, new(123, 321)); + this.AppendScale(b1, new SizeF(2, 0.5f)); + this.AppendRotationRadians(b1, pi / 2, new Vector2(-0.5f, -0.1f)); + this.AppendSkewRadians(b1, pi, pi / 2, new Vector2(-0.5f, -0.1f)); + this.AppendTranslation(b1, new PointF(123, 321)); // Backwards - this.PrependTranslation(b2, new(123, 321)); - this.PrependSkewRadians(b2, pi, pi / 2, new(-0.5f, -0.1f)); - this.PrependRotationRadians(b2, pi / 2, new(-0.5f, -0.1f)); - this.PrependScale(b2, new(2, 0.5f)); + this.PrependTranslation(b2, new PointF(123, 321)); + this.PrependSkewRadians(b2, pi, pi / 2, new Vector2(-0.5f, -0.1f)); + this.PrependRotationRadians(b2, pi / 2, new Vector2(-0.5f, -0.1f)); + this.PrependScale(b2, new SizeF(2, 0.5f)); this.PrependSkewRadians(b2, pi, pi); this.PrependRotationRadians(b2, pi); - Vector2 p1 = this.Execute(b1, rectangle, new(32, 65)); - Vector2 p2 = this.Execute(b2, rectangle, new(32, 65)); + Vector2 p1 = this.Execute(b1, rectangle, new Vector2(32, 65)); + Vector2 p2 = this.Execute(b2, rectangle, new Vector2(32, 65)); Assert.Equal(p1, p2, Comparer); } @@ -232,7 +232,7 @@ public abstract class TransformBuilderTestBase () => { TBuilder builder = this.CreateBuilder(); - this.Execute(builder, new(Point.Empty, size), Vector2.Zero); + this.Execute(builder, new Rectangle(Point.Empty, size), Vector2.Zero); }); } @@ -244,7 +244,7 @@ public abstract class TransformBuilderTestBase { TBuilder builder = this.CreateBuilder(); this.AppendSkewDegrees(builder, 45, 45); - this.Execute(builder, new(0, 0, 150, 150), Vector2.Zero); + this.Execute(builder, new Rectangle(0, 0, 150, 150), Vector2.Zero); }); } diff --git a/tests/ImageSharp.Tests/ProfilingBenchmarks/LoadResizeSaveProfilingBenchmarks.cs b/tests/ImageSharp.Tests/ProfilingBenchmarks/LoadResizeSaveProfilingBenchmarks.cs index fa3fcec41..209dd361e 100644 --- a/tests/ImageSharp.Tests/ProfilingBenchmarks/LoadResizeSaveProfilingBenchmarks.cs +++ b/tests/ImageSharp.Tests/ProfilingBenchmarks/LoadResizeSaveProfilingBenchmarks.cs @@ -28,7 +28,7 @@ public class LoadResizeSaveProfilingBenchmarks : MeasureFixture byte[] imageBytes = TestFile.Create(imagePath).Bytes; - using MemoryStream ms = new MemoryStream(); + using MemoryStream ms = new(); this.Measure( 30, () => diff --git a/tests/ImageSharp.Tests/ProfilingBenchmarks/ResizeProfilingBenchmarks.cs b/tests/ImageSharp.Tests/ProfilingBenchmarks/ResizeProfilingBenchmarks.cs index df531ae4c..bab11b0f9 100644 --- a/tests/ImageSharp.Tests/ProfilingBenchmarks/ResizeProfilingBenchmarks.cs +++ b/tests/ImageSharp.Tests/ProfilingBenchmarks/ResizeProfilingBenchmarks.cs @@ -28,7 +28,7 @@ public class ResizeProfilingBenchmarks : MeasureFixture this.ExecutionCount, () => { - using (Image image = new Image(this.configuration, width, height)) + using (Image image = new(this.configuration, width, height)) { image.Mutate(x => x.Resize(width / 5, height / 5)); } diff --git a/tests/ImageSharp.Tests/Quantization/QuantizedImageTests.cs b/tests/ImageSharp.Tests/Quantization/QuantizedImageTests.cs index 18bcbffae..75c096b1f 100644 --- a/tests/ImageSharp.Tests/Quantization/QuantizedImageTests.cs +++ b/tests/ImageSharp.Tests/Quantization/QuantizedImageTests.cs @@ -106,7 +106,7 @@ public class QuantizedImageTests { using Image image = provider.GetImage(); OctreeQuantizer octreeQuantizer = new(); - IQuantizer quantizer = octreeQuantizer.CreatePixelSpecificQuantizer(Configuration.Default, new() { MaxColors = 128 }); + IQuantizer quantizer = octreeQuantizer.CreatePixelSpecificQuantizer(Configuration.Default, new QuantizerOptions { MaxColors = 128 }); ImageFrame frame = image.Frames[0]; quantizer.BuildPaletteAndQuantizeFrame(frame, frame.Bounds); } diff --git a/tests/ImageSharp.Tests/Quantization/WuQuantizerTests.cs b/tests/ImageSharp.Tests/Quantization/WuQuantizerTests.cs index d6960d778..28a7c49e5 100644 --- a/tests/ImageSharp.Tests/Quantization/WuQuantizerTests.cs +++ b/tests/ImageSharp.Tests/Quantization/WuQuantizerTests.cs @@ -12,7 +12,7 @@ public class WuQuantizerTests public void SinglePixelOpaque() { Configuration config = Configuration.Default; - WuQuantizer quantizer = new(new() { Dither = null }); + WuQuantizer quantizer = new(new QuantizerOptions { Dither = null }); using Image image = new(config, 1, 1, Color.Black.ToPixel()); ImageFrame frame = image.Frames.RootFrame; @@ -32,7 +32,7 @@ public class WuQuantizerTests public void SinglePixelTransparent() { Configuration config = Configuration.Default; - WuQuantizer quantizer = new(new() { Dither = null }); + WuQuantizer quantizer = new(new QuantizerOptions { Dither = null }); using Image image = new(config, 1, 1, default(Rgba32)); ImageFrame frame = image.Frames.RootFrame; @@ -49,19 +49,19 @@ public class WuQuantizerTests } [Fact] - public void GrayScale() => TestScale(c => new(c, c, c, 128)); + public void GrayScale() => TestScale(c => new Rgba32(c, c, c, 128)); [Fact] - public void RedScale() => TestScale(c => new(c, 0, 0, 128)); + public void RedScale() => TestScale(c => new Rgba32(c, 0, 0, 128)); [Fact] - public void GreenScale() => TestScale(c => new(0, c, 0, 128)); + public void GreenScale() => TestScale(c => new Rgba32(0, c, 0, 128)); [Fact] - public void BlueScale() => TestScale(c => new(0, 0, c, 128)); + public void BlueScale() => TestScale(c => new Rgba32(0, 0, c, 128)); [Fact] - public void AlphaScale() => TestScale(c => new(0, 0, 0, c)); + public void AlphaScale() => TestScale(c => new Rgba32(0, 0, 0, c)); [Fact] public void Palette256() @@ -75,11 +75,11 @@ public class WuQuantizerTests byte b = (byte)(((i / 16) % 4) * 85); byte a = (byte)((i / 64) * 85); - image[0, i] = new(r, g, b, a); + image[0, i] = new Rgba32(r, g, b, a); } Configuration config = Configuration.Default; - WuQuantizer quantizer = new(new() { Dither = null, TransparencyThreshold = 0 }); + WuQuantizer quantizer = new(new QuantizerOptions { Dither = null, TransparencyThreshold = 0 }); ImageFrame frame = image.Frames.RootFrame; @@ -125,7 +125,7 @@ public class WuQuantizerTests // See https://github.com/SixLabors/ImageSharp/issues/866 using Image image = provider.GetImage(); Configuration config = Configuration.Default; - WuQuantizer quantizer = new(new() { Dither = null }); + WuQuantizer quantizer = new(new QuantizerOptions { Dither = null }); ImageFrame frame = image.Frames.RootFrame; using IQuantizer frameQuantizer = quantizer.CreatePixelSpecificQuantizer(config); @@ -152,7 +152,7 @@ public class WuQuantizerTests } Configuration config = Configuration.Default; - WuQuantizer quantizer = new(new() { Dither = null, TransparencyThreshold = 0 }); + WuQuantizer quantizer = new(new QuantizerOptions { Dither = null, TransparencyThreshold = 0 }); ImageFrame frame = image.Frames.RootFrame; using (IQuantizer frameQuantizer = quantizer.CreatePixelSpecificQuantizer(config)) diff --git a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLutEntry.cs b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLutEntry.cs index 094ba7626..40f54ea74 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLutEntry.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLutEntry.cs @@ -52,7 +52,7 @@ public class IccConversionDataLutEntry values[i] = 0.1f + (i / (float)length); } - return new(values); + return new IccLut(values); } private static IccLut CreateIdentityLut(float min, float max) => new([min, max]); diff --git a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMultiProcessElement.cs b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMultiProcessElement.cs index 57618b957..f79666e3e 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMultiProcessElement.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMultiProcessElement.cs @@ -49,13 +49,13 @@ public class IccConversionDataMultiProcessElement private static IccCurveSetProcessElement Create1DSingleCurveSet(IccCurveSegment segment) { IccOneDimensionalCurve curve = new(new float[0], new[] { segment }); - return new(new[] { curve }); + return new IccCurveSetProcessElement(new[] { curve }); } private static IccCurveSetProcessElement Create1DMultiCurveSet(float[] breakPoints, params IccCurveSegment[] segments) { IccOneDimensionalCurve curve = new(breakPoints, segments); - return new(new[] { curve }); + return new IccCurveSetProcessElement(new[] { curve }); } public static object[][] MpeCurveConversionTestData = diff --git a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataTrc.cs b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataTrc.cs index cf7a99b63..6cd99367a 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataTrc.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataTrc.cs @@ -12,11 +12,11 @@ public static class IccConversionDataTrc internal static IccCurveTagDataEntry Gamma2Curve = new(2); internal static IccCurveTagDataEntry LutCurve = new(new float[] { 0, 0.7f, 1 }); - internal static IccParametricCurveTagDataEntry ParamCurve1 = new(new(2.2f)); - internal static IccParametricCurveTagDataEntry ParamCurve2 = new(new(2.2f, 1.5f, -0.5f)); - internal static IccParametricCurveTagDataEntry ParamCurve3 = new(new(2.2f, 1.5f, -0.5f, 0.3f)); - internal static IccParametricCurveTagDataEntry ParamCurve4 = new(new(2.4f, 1 / 1.055f, 0.055f / 1.055f, 1 / 12.92f, 0.04045f)); - internal static IccParametricCurveTagDataEntry ParamCurve5 = new(new(2.2f, 0.7f, 0.2f, 0.3f, 0.1f, 0.5f, 0.2f)); + internal static IccParametricCurveTagDataEntry ParamCurve1 = new(new IccParametricCurve(2.2f)); + internal static IccParametricCurveTagDataEntry ParamCurve2 = new(new IccParametricCurve(2.2f, 1.5f, -0.5f)); + internal static IccParametricCurveTagDataEntry ParamCurve3 = new(new IccParametricCurve(2.2f, 1.5f, -0.5f, 0.3f)); + internal static IccParametricCurveTagDataEntry ParamCurve4 = new(new IccParametricCurve(2.4f, 1 / 1.055f, 0.055f / 1.055f, 1 / 12.92f, 0.04045f)); + internal static IccParametricCurveTagDataEntry ParamCurve5 = new(new IccParametricCurve(2.2f, 0.7f, 0.2f, 0.3f, 0.1f, 0.5f, 0.2f)); public static object[][] TrcArrayConversionTestData { get; } = { diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataLut.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataLut.cs index c47f6357b..2bd47e449 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataLut.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataLut.cs @@ -18,7 +18,7 @@ internal static class IccTestDataLut result[i] = i / 255f; } - return new(result); + return new IccLut(result); } private static byte[] CreateLut8() diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataProfiles.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataProfiles.cs index a31f1d05f..7441bede8 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataProfiles.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataProfiles.cs @@ -23,7 +23,7 @@ internal static class IccTestDataProfiles public static readonly IccProfileHeader HeaderRandomWrite = CreateHeaderRandomValue( 562, // should be overwritten - new(1, 2, 3, 4), // should be overwritten + new IccProfileId(1, 2, 3, 4), // should be overwritten "ijkl"); // should be overwritten to "acsp" public static readonly IccProfileHeader HeaderRandomRead = CreateHeaderRandomValue(132, HeaderRandomIdValue, "acsp"); @@ -34,7 +34,7 @@ internal static class IccTestDataProfiles { Class = IccProfileClass.DisplayDevice, CmmType = "abcd", - CreationDate = new(1990, 11, 26, 7, 21, 42), + CreationDate = new DateTime(1990, 11, 26, 7, 21, 42), CreatorSignature = "dcba", DataColorSpace = IccColorSpaceType.Rgb, DeviceAttributes = IccDeviceAttribute.ChromaBlackWhite | IccDeviceAttribute.OpacityTransparent, @@ -43,12 +43,12 @@ internal static class IccTestDataProfiles FileSignature = "acsp", Flags = IccProfileFlag.Embedded | IccProfileFlag.Independent, Id = id, - PcsIlluminant = new(4, 5, 6), + PcsIlluminant = new Vector3(4, 5, 6), PrimaryPlatformSignature = IccPrimaryPlatformType.MicrosoftCorporation, ProfileConnectionSpace = IccColorSpaceType.CieXyz, RenderingIntent = IccRenderingIntent.AbsoluteColorimetric, Size = size, - Version = new(4, 3, 0), + Version = new IccVersion(4, 3, 0), }; public static byte[] CreateHeaderRandomArray(uint size, uint nrOfEntries, byte[] profileId) => ArrayHelper.Concat( diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataTagDataEntry.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataTagDataEntry.cs index 7e5294f85..a83dc3575 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataTagDataEntry.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataTagDataEntry.cs @@ -339,7 +339,7 @@ internal static class IccTestDataTagDataEntry { try { - culture = new(language); + culture = new CultureInfo(language); } catch (CultureNotFoundException) { @@ -350,7 +350,7 @@ internal static class IccTestDataTagDataEntry { try { - culture = new($"{language}-{country}"); + culture = new CultureInfo($"{language}-{country}"); } catch (CultureNotFoundException) { @@ -358,7 +358,7 @@ internal static class IccTestDataTagDataEntry } } - return new(culture, text); + return new IccLocalizedString(culture, text); } private static readonly IccLocalizedString[] LocalizedStringRandArrEnUsDeDe = new[] diff --git a/tests/ImageSharp.Tests/TestFile.cs b/tests/ImageSharp.Tests/TestFile.cs index 01c5fdae3..1177152c0 100644 --- a/tests/ImageSharp.Tests/TestFile.cs +++ b/tests/ImageSharp.Tests/TestFile.cs @@ -79,7 +79,7 @@ public sealed class TestFile /// The . /// public static TestFile Create(string file) - => Cache.GetOrAdd(file, (string fileName) => new(GetInputFileFullPath(fileName))); + => Cache.GetOrAdd(file, (string fileName) => new TestFile(GetInputFileFullPath(fileName))); /// /// Gets the file name. @@ -117,7 +117,7 @@ public sealed class TestFile /// The . /// public Image CreateRgba32Image(IImageDecoder decoder) - => this.CreateRgba32Image(decoder, new()); + => this.CreateRgba32Image(decoder, new DecoderOptions()); /// /// Creates a new image. diff --git a/tests/ImageSharp.Tests/TestFontUtilities.cs b/tests/ImageSharp.Tests/TestFontUtilities.cs index 32cac0b05..d575489be 100644 --- a/tests/ImageSharp.Tests/TestFontUtilities.cs +++ b/tests/ImageSharp.Tests/TestFontUtilities.cs @@ -59,7 +59,7 @@ public static class TestFontUtilities return directory; } - throw new($"Unable to find Fonts directory at any of these locations [{string.Join(", ", directories)}]"); + throw new Exception($"Unable to find Fonts directory at any of these locations [{string.Join(", ", directories)}]"); } /// diff --git a/tests/ImageSharp.Tests/TestFormat.cs b/tests/ImageSharp.Tests/TestFormat.cs index 8b2a9a9be..92b74cde1 100644 --- a/tests/ImageSharp.Tests/TestFormat.cs +++ b/tests/ImageSharp.Tests/TestFormat.cs @@ -24,8 +24,8 @@ public class TestFormat : IImageFormatConfigurationModule, IImageFormat public TestFormat() { - this.Encoder = new(this); - this.Decoder = new(this); + this.Encoder = new TestEncoder(this); + this.Decoder = new TestDecoder(this); } public List DecodeCalls { get; } = new(); @@ -205,7 +205,7 @@ public class TestFormat : IImageFormatConfigurationModule, IImageFormat { using Image image = this.Decode(this.CreateDefaultSpecializedOptions(options), stream, cancellationToken); ImageMetadata metadata = image.Metadata; - return new(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) + return new ImageInfo(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) { PixelType = metadata.GetDecodedPixelTypeInfo() }; @@ -220,7 +220,7 @@ public class TestFormat : IImageFormatConfigurationModule, IImageFormat using MemoryStream ms = new(); stream.CopyTo(ms, configuration.StreamProcessingBufferSize); byte[] marker = ms.ToArray().Skip(this.testFormat.header.Length).ToArray(); - this.testFormat.DecodeCalls.Add(new() + this.testFormat.DecodeCalls.Add(new DecodeOperation { Marker = marker, Config = configuration, diff --git a/tests/ImageSharp.Tests/TestUtilities/ByteBuffer.cs b/tests/ImageSharp.Tests/TestUtilities/ByteBuffer.cs index 45e1425c7..548354450 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ByteBuffer.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ByteBuffer.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; public class ByteBuffer { - private readonly List bytes = new List(); + private readonly List bytes = new(); private readonly bool isLittleEndian; public ByteBuffer(bool isLittleEndian) diff --git a/tests/ImageSharp.Tests/TestUtilities/EofHitCounter.cs b/tests/ImageSharp.Tests/TestUtilities/EofHitCounter.cs index 45a5ab5f5..c5ffdd648 100644 --- a/tests/ImageSharp.Tests/TestUtilities/EofHitCounter.cs +++ b/tests/ImageSharp.Tests/TestUtilities/EofHitCounter.cs @@ -31,7 +31,7 @@ internal class EofHitCounter : IDisposable { BufferedReadStream stream = new(Configuration.Default, new MemoryStream(imageData)); Image image = Image.Load(stream); - return new(stream, image); + return new EofHitCounter(stream, image); } public static EofHitCounter RunDecoder(byte[] imageData, T decoder, TO options) @@ -40,7 +40,7 @@ internal class EofHitCounter : IDisposable { BufferedReadStream stream = new(options.GeneralOptions.Configuration, new MemoryStream(imageData)); Image image = decoder.Decode(options, stream); - return new(stream, image); + return new EofHitCounter(stream, image); } public void Dispose() diff --git a/tests/ImageSharp.Tests/TestUtilities/FeatureTesting/FeatureTestRunner.cs b/tests/ImageSharp.Tests/TestUtilities/FeatureTesting/FeatureTestRunner.cs index a02ea399f..63126dcbc 100644 --- a/tests/ImageSharp.Tests/TestUtilities/FeatureTesting/FeatureTestRunner.cs +++ b/tests/ImageSharp.Tests/TestUtilities/FeatureTesting/FeatureTestRunner.cs @@ -67,7 +67,7 @@ public static class FeatureTestRunner RemoteExecutor.Invoke( action, - new() + new RemoteInvokeOptions { StartInfo = processStartInfo }) @@ -109,7 +109,7 @@ public static class FeatureTestRunner RemoteExecutor.Invoke( action, intrinsic.Key.ToString(), - new() + new RemoteInvokeOptions { StartInfo = processStartInfo }) @@ -153,7 +153,7 @@ public static class FeatureTestRunner RemoteExecutor.Invoke( action, BasicSerializer.Serialize(serializable), - new() + new RemoteInvokeOptions { StartInfo = processStartInfo }) @@ -198,7 +198,7 @@ public static class FeatureTestRunner action, BasicSerializer.Serialize(serializable), intrinsic.Key.ToString(), - new() + new RemoteInvokeOptions { StartInfo = processStartInfo }) @@ -247,7 +247,7 @@ public static class FeatureTestRunner action, BasicSerializer.Serialize(arg1), BasicSerializer.Serialize(arg2), - new() + new RemoteInvokeOptions { StartInfo = processStartInfo }) @@ -294,7 +294,7 @@ public static class FeatureTestRunner action, BasicSerializer.Serialize(arg1), arg2, - new() + new RemoteInvokeOptions { StartInfo = processStartInfo }) @@ -338,7 +338,7 @@ public static class FeatureTestRunner RemoteExecutor.Invoke( action, serializable.ToString(), - new() + new RemoteInvokeOptions { StartInfo = processStartInfo }) @@ -385,7 +385,7 @@ public static class FeatureTestRunner action, arg0.ToString(), arg1.ToString(), - new() + new RemoteInvokeOptions { StartInfo = processStartInfo }) diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs index 12f8ef773..1d35a6200 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs @@ -46,12 +46,12 @@ public class ExactImageComparer : ImageComparer if (aPixel != bPixel) { - PixelDifference diff = new(new(x, y), aPixel, bPixel); + PixelDifference diff = new(new Point(x, y), aPixel, bPixel); differences.Add(diff); } } } - return new(index, expected, actual, differences); + return new ImageSimilarityReport(index, expected, actual, differences); } } diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparer.cs b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparer.cs index dee12915b..c8e11e69c 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparer.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparer.cs @@ -159,7 +159,7 @@ public static class ImageComparerExtensions if (outsideChanges.Any()) { - cleanedReports.Add(new(r.Index, r.ExpectedImage, r.ActualImage, outsideChanges, null)); + cleanedReports.Add(new ImageSimilarityReport(r.Index, r.ExpectedImage, r.ActualImage, outsideChanges, null)); } } diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparingUtils.cs b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparingUtils.cs index 410ada05a..05f65cfbb 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparingUtils.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparingUtils.cs @@ -19,7 +19,7 @@ public static class ImageComparingUtils ?? throw new InvalidOperationException("CompareToOriginal() works only with file providers!"); TestFile testFile = TestFile.Create(path); - using Image magickImage = DecodeWithMagick(new(testFile.FullPath)); + using Image magickImage = DecodeWithMagick(new FileInfo(testFile.FullPath)); if (useExactComparer) { ImageComparer.Exact.VerifySimilarity(magickImage, image); diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs index 8c72bbf54..1594258e0 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs @@ -61,7 +61,7 @@ public class ImageSimilarityReport private string PrintDifference() { - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new(); if (this.TotalNormalizedDifference.HasValue) { sb.AppendLine(); @@ -103,7 +103,7 @@ public class ImageSimilarityReport : ImageSimilarityReport } public static ImageSimilarityReport Empty => - new ImageSimilarityReport(0, null, null, Enumerable.Empty(), 0f); + new(0, null, null, Enumerable.Empty(), 0f); public new ImageFrame ExpectedImage => (ImageFrame)base.ExpectedImage; diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs index 004c26a8f..c9f13ca2f 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs @@ -89,7 +89,7 @@ public class TolerantImageComparer : ImageComparer if (d > this.PerPixelManhattanThreshold) { - PixelDifference diff = new(new(x, y), aBuffer[x], bBuffer[x]); + PixelDifference diff = new(new Point(x, y), aBuffer[x], bBuffer[x]); differences.Add(diff); totalDifference += d; @@ -102,7 +102,7 @@ public class TolerantImageComparer : ImageComparer if (normalizedDifference > this.ImageThreshold) { - return new(index, expected, actual, differences, normalizedDifference); + return new ImageSimilarityReport(index, expected, actual, differences, normalizedDifference); } else { diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BasicTestPatternProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BasicTestPatternProvider.cs index d861d293b..813ed505d 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BasicTestPatternProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BasicTestPatternProvider.cs @@ -78,6 +78,6 @@ public abstract partial class TestImageProvider : IXunitSerializable return x < midX ? BottomLeftColor : BottomRightColor; } - private static TPixel GetBottomRightColor() => TPixel.FromScaledVector4(new(1f, 0f, 1f, 0.5f)); + private static TPixel GetBottomRightColor() => TPixel.FromScaledVector4(new Vector4(1f, 0f, 1f, 0.5f)); } } diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs index 5a31707bf..c8c3e09c3 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs @@ -33,7 +33,7 @@ public abstract partial class TestImageProvider : IXunitSerializable protected int Width { get; private set; } - public override Image GetImage() => new Image(this.Configuration, this.Width, this.Height); + public override Image GetImage() => new(this.Configuration, this.Width, this.Height); public override void Deserialize(IXunitSerializationInfo info) { diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs index caa54feae..3f6e78a34 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs @@ -32,7 +32,7 @@ public abstract partial class TestImageProvider : IXunitSerializable ISpecializedDecoderOptions specialized) { Type customType = customDecoder?.GetType(); - this.commonValues = new( + this.commonValues = new Tuple( pixelType, filePath, customType); diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs index 88ebd6c7f..ab624126b 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs @@ -88,10 +88,10 @@ public abstract partial class TestImageProvider : ITestImageProvider, IX public abstract Image GetImage(); public Image GetImage(IImageDecoder decoder) - => this.GetImage(decoder, new()); + => this.GetImage(decoder, new DecoderOptions()); public Task> GetImageAsync(IImageDecoder decoder) - => this.GetImageAsync(decoder, new()); + => this.GetImageAsync(decoder, new DecoderOptions()); public virtual Image GetImage(IImageDecoder decoder, DecoderOptions options) => throw new NotSupportedException($"Decoder specific GetImage() is not supported with {this.GetType().Name}!"); @@ -152,7 +152,7 @@ public abstract partial class TestImageProvider : ITestImageProvider, IX this.MethodName = methodName; this.OutputSubfolderName = outputSubfolderName; - this.Utility = new() + this.Utility = new ImagingTestCaseUtility { SourceFileOrDescription = this.SourceFileOrDescription, PixelTypeName = this.PixelType.ToString() diff --git a/tests/ImageSharp.Tests/TestUtilities/MeasureFixture.cs b/tests/ImageSharp.Tests/TestUtilities/MeasureFixture.cs index b5fad3929..81f16cf6b 100644 --- a/tests/ImageSharp.Tests/TestUtilities/MeasureFixture.cs +++ b/tests/ImageSharp.Tests/TestUtilities/MeasureFixture.cs @@ -60,7 +60,7 @@ public class MeasureGuard : IDisposable { private readonly string operation; - private readonly Stopwatch stopwatch = new Stopwatch(); + private readonly Stopwatch stopwatch = new(); public MeasureGuard(ITestOutputHelper output, string operation) { diff --git a/tests/ImageSharp.Tests/TestUtilities/PausedMemoryStream.cs b/tests/ImageSharp.Tests/TestUtilities/PausedMemoryStream.cs index 049fda727..d1149dd00 100644 --- a/tests/ImageSharp.Tests/TestUtilities/PausedMemoryStream.cs +++ b/tests/ImageSharp.Tests/TestUtilities/PausedMemoryStream.cs @@ -92,9 +92,9 @@ public class PausedMemoryStream : MemoryStream, IPausedStream try { int bytesRead; - while ((bytesRead = await this.ReadAsync(new(buffer), cancellationToken).ConfigureAwait(false)) != 0) + while ((bytesRead = await this.ReadAsync(new Memory(buffer), cancellationToken).ConfigureAwait(false)) != 0) { - await destination.WriteAsync(new(buffer, 0, bytesRead), cancellationToken).ConfigureAwait(false); + await destination.WriteAsync(new ReadOnlyMemory(buffer, 0, bytesRead), cancellationToken).ConfigureAwait(false); } } finally diff --git a/tests/ImageSharp.Tests/TestUtilities/PausedStream.cs b/tests/ImageSharp.Tests/TestUtilities/PausedStream.cs index 54aa77be2..42ed6b0d5 100644 --- a/tests/ImageSharp.Tests/TestUtilities/PausedStream.cs +++ b/tests/ImageSharp.Tests/TestUtilities/PausedStream.cs @@ -94,9 +94,9 @@ public class PausedStream : Stream, IPausedStream try { int bytesRead; - while ((bytesRead = await this.ReadAsync(new(buffer), cancellationToken).ConfigureAwait(false)) != 0) + while ((bytesRead = await this.ReadAsync(new Memory(buffer), cancellationToken).ConfigureAwait(false)) != 0) { - await destination.WriteAsync(new(buffer, 0, bytesRead), cancellationToken).ConfigureAwait(false); + await destination.WriteAsync(new ReadOnlyMemory(buffer, 0, bytesRead), cancellationToken).ConfigureAwait(false); } } finally diff --git a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/MagickReferenceDecoder.cs b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/MagickReferenceDecoder.cs index bdc78f3f5..862d4b64d 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/MagickReferenceDecoder.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/MagickReferenceDecoder.cs @@ -32,15 +32,15 @@ public class MagickReferenceDecoder : ImageDecoder this.validate = validate; } - public static MagickReferenceDecoder Png { get; } = new MagickReferenceDecoder(PngFormat.Instance); + public static MagickReferenceDecoder Png { get; } = new(PngFormat.Instance); - public static MagickReferenceDecoder Bmp { get; } = new MagickReferenceDecoder(BmpFormat.Instance); + public static MagickReferenceDecoder Bmp { get; } = new(BmpFormat.Instance); - public static MagickReferenceDecoder Jpeg { get; } = new MagickReferenceDecoder(JpegFormat.Instance); + public static MagickReferenceDecoder Jpeg { get; } = new(JpegFormat.Instance); - public static MagickReferenceDecoder Tiff { get; } = new MagickReferenceDecoder(TiffFormat.Instance); + public static MagickReferenceDecoder Tiff { get; } = new(TiffFormat.Instance); - public static MagickReferenceDecoder WebP { get; } = new MagickReferenceDecoder(WebpFormat.Instance); + public static MagickReferenceDecoder WebP { get; } = new(WebpFormat.Instance); protected override Image Decode(DecoderOptions options, Stream stream, CancellationToken cancellationToken) { @@ -103,7 +103,7 @@ public class MagickReferenceDecoder : ImageDecoder } } - return ReferenceCodecUtilities.EnsureDecodedMetadata(new(configuration, metadata, framesList), this.imageFormat); + return ReferenceCodecUtilities.EnsureDecodedMetadata(new Image(configuration, metadata, framesList), this.imageFormat); } protected override Image Decode(DecoderOptions options, Stream stream, CancellationToken cancellationToken) @@ -113,7 +113,7 @@ public class MagickReferenceDecoder : ImageDecoder { using Image image = this.Decode(options, stream, cancellationToken); ImageMetadata metadata = image.Metadata; - return new(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) + return new ImageInfo(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) { PixelType = metadata.GetDecodedPixelTypeInfo() }; diff --git a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs index 78014b7af..84be9e3a9 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs @@ -27,7 +27,7 @@ public static class SystemDrawingBridge int w = bmp.Width; int h = bmp.Height; - System.Drawing.Rectangle fullRect = new System.Drawing.Rectangle(0, 0, w, h); + System.Drawing.Rectangle fullRect = new(0, 0, w, h); if (bmp.PixelFormat != PixelFormat.Format32bppArgb) { @@ -37,7 +37,7 @@ public static class SystemDrawingBridge } BitmapData data = bmp.LockBits(fullRect, ImageLockMode.ReadWrite, bmp.PixelFormat); - Image image = new Image(w, h); + Image image = new(w, h); try { byte* sourcePtrBase = (byte*)data.Scan0; @@ -86,7 +86,7 @@ public static class SystemDrawingBridge int w = bmp.Width; int h = bmp.Height; - System.Drawing.Rectangle fullRect = new System.Drawing.Rectangle(0, 0, w, h); + System.Drawing.Rectangle fullRect = new(0, 0, w, h); if (bmp.PixelFormat != PixelFormat.Format24bppRgb) { @@ -96,7 +96,7 @@ public static class SystemDrawingBridge } BitmapData data = bmp.LockBits(fullRect, ImageLockMode.ReadWrite, bmp.PixelFormat); - Image image = new Image(w, h); + Image image = new(w, h); try { byte* sourcePtrBase = (byte*)data.Scan0; @@ -138,8 +138,8 @@ public static class SystemDrawingBridge int w = image.Width; int h = image.Height; - Bitmap resultBitmap = new Bitmap(w, h, PixelFormat.Format32bppArgb); - System.Drawing.Rectangle fullRect = new System.Drawing.Rectangle(0, 0, w, h); + Bitmap resultBitmap = new(w, h, PixelFormat.Format32bppArgb); + System.Drawing.Rectangle fullRect = new(0, 0, w, h); BitmapData data = resultBitmap.LockBits(fullRect, ImageLockMode.ReadWrite, resultBitmap.PixelFormat); try { diff --git a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs index 14a655823..fce2da05f 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs @@ -18,15 +18,15 @@ public class SystemDrawingReferenceDecoder : ImageDecoder public SystemDrawingReferenceDecoder(IImageFormat imageFormat) => this.imageFormat = imageFormat; - public static SystemDrawingReferenceDecoder Png { get; } = new SystemDrawingReferenceDecoder(PngFormat.Instance); + public static SystemDrawingReferenceDecoder Png { get; } = new(PngFormat.Instance); - public static SystemDrawingReferenceDecoder Bmp { get; } = new SystemDrawingReferenceDecoder(BmpFormat.Instance); + public static SystemDrawingReferenceDecoder Bmp { get; } = new(BmpFormat.Instance); protected override ImageInfo Identify(DecoderOptions options, Stream stream, CancellationToken cancellationToken) { using Image image = this.Decode(options, stream, cancellationToken); ImageMetadata metadata = image.Metadata; - return new(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) + return new ImageInfo(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) { PixelType = metadata.GetDecodedPixelTypeInfo() }; diff --git a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs index 0789ab263..f9769b891 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs @@ -15,9 +15,9 @@ public class SystemDrawingReferenceEncoder : IImageEncoder public SystemDrawingReferenceEncoder(ImageFormat imageFormat) => this.imageFormat = imageFormat; - public static SystemDrawingReferenceEncoder Png { get; } = new SystemDrawingReferenceEncoder(ImageFormat.Png); + public static SystemDrawingReferenceEncoder Png { get; } = new(ImageFormat.Png); - public static SystemDrawingReferenceEncoder Bmp { get; } = new SystemDrawingReferenceEncoder(ImageFormat.Bmp); + public static SystemDrawingReferenceEncoder Bmp { get; } = new(ImageFormat.Bmp); public bool SkipMetadata { get; init; } diff --git a/tests/ImageSharp.Tests/TestUtilities/SixLaborsXunitTestFramework.cs b/tests/ImageSharp.Tests/TestUtilities/SixLaborsXunitTestFramework.cs index 873d5bfde..d8b0ff785 100644 --- a/tests/ImageSharp.Tests/TestUtilities/SixLaborsXunitTestFramework.cs +++ b/tests/ImageSharp.Tests/TestUtilities/SixLaborsXunitTestFramework.cs @@ -18,7 +18,7 @@ public class SixLaborsXunitTestFramework : XunitTestFramework public SixLaborsXunitTestFramework(IMessageSink messageSink) : base(messageSink) { - DiagnosticMessage message = new DiagnosticMessage(HostEnvironmentInfo.GetInformation()); + DiagnosticMessage message = new(HostEnvironmentInfo.GetInformation()); messageSink.OnMessage(message); } } diff --git a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs index aa94ce469..8eed0a1c1 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs @@ -198,7 +198,7 @@ public static partial class TestEnvironment "Microsoft SDKs", "Windows"); - FileInfo corFlagsFile = Find(new(windowsSdksDir), "CorFlags.exe"); + FileInfo corFlagsFile = Find(new DirectoryInfo(windowsSdksDir), "CorFlags.exe"); string remoteExecutorPath = Path.Combine(TestAssemblyFile.DirectoryName, "Microsoft.DotNet.RemoteExecutor.exe"); @@ -230,7 +230,7 @@ public static partial class TestEnvironment if (proc.ExitCode != 0) { - throw new( + throw new Exception( $@"Failed to run {si.FileName} {si.Arguments}:\n STDOUT: {standardOutput}\n STDERR: {standardError}"); } diff --git a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs index 6a5f7f892..994aa670c 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs @@ -774,7 +774,7 @@ public static class TestImageExtensions { TestMemoryAllocator allocator = new(); provider.Configuration.MemoryAllocator = allocator; - return new(allocator, Unsafe.SizeOf()); + return new AllocatorBufferCapacityConfigurator(allocator, Unsafe.SizeOf()); } private class MakeOpaqueProcessor : IImageProcessor diff --git a/tests/ImageSharp.Tests/TestUtilities/TestMemoryAllocator.cs b/tests/ImageSharp.Tests/TestUtilities/TestMemoryAllocator.cs index 6ef2c1824..a0ff4a466 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestMemoryAllocator.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestMemoryAllocator.cs @@ -33,8 +33,8 @@ internal class TestMemoryAllocator : MemoryAllocator public void EnableNonThreadSafeLogging() { - this.allocationLog = new(); - this.returnLog = new(); + this.allocationLog = new List(); + this.returnLog = new List(); } public override IMemoryOwner Allocate(int length, AllocationOptions options = AllocationOptions.None) @@ -61,7 +61,7 @@ internal class TestMemoryAllocator : MemoryAllocator private void Return(BasicArrayBuffer buffer) where T : struct { - this.returnLog?.Add(new(buffer.Array.GetHashCode())); + this.returnLog?.Add(new ReturnRequest(buffer.Array.GetHashCode())); } public struct AllocationRequest @@ -83,7 +83,7 @@ internal class TestMemoryAllocator : MemoryAllocator { Type type = typeof(T); int elementSize = Marshal.SizeOf(type); - return new(type, allocationOptions, length, length * elementSize, buffer.GetHashCode()); + return new AllocationRequest(type, allocationOptions, length, length * elementSize, buffer.GetHashCode()); } public Type ElementType { get; } @@ -150,7 +150,7 @@ internal class TestMemoryAllocator : MemoryAllocator } void* ptr = (void*)this.pinHandle.AddrOfPinnedObject(); - return new(ptr, pinnable: this); + return new MemoryHandle(ptr, pinnable: this); } public override void Unpin() diff --git a/tests/ImageSharp.Tests/TestUtilities/TestMemoryManager.cs b/tests/ImageSharp.Tests/TestUtilities/TestMemoryManager.cs index 2604aa1de..7f25fd5aa 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestMemoryManager.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestMemoryManager.cs @@ -36,7 +36,7 @@ public class TestMemoryManager : MemoryManager { T[] pixelArray = new T[copyThisBuffer.Length]; copyThisBuffer.CopyTo(pixelArray); - return new(pixelArray); + return new TestMemoryManager(pixelArray); } protected override void Dispose(bool disposing) diff --git a/tests/ImageSharp.Tests/TestUtilities/TestPixel.cs b/tests/ImageSharp.Tests/TestUtilities/TestPixel.cs index 42b2b2a25..f0344e2b9 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestPixel.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestPixel.cs @@ -35,7 +35,7 @@ public class TestPixel : IXunitSerializable public float Alpha { get; set; } - public TPixel AsPixel() => TPixel.FromScaledVector4(new(this.Red, this.Green, this.Blue, this.Alpha)); + public TPixel AsPixel() => TPixel.FromScaledVector4(new Vector4(this.Red, this.Green, this.Blue, this.Alpha)); internal Span AsSpan() => new([this.AsPixel()]); diff --git a/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs b/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs index 39c8c4c94..fbdfb9d61 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs @@ -69,7 +69,7 @@ public static class TestUtils Span row = accessor.GetRowSpan(y); for (int x = 0; x < row.Length; x++) { - row[x] = new(expected[cnt++], expected[cnt++]); + row[x] = new La16(expected[cnt++], expected[cnt++]); } } }); @@ -393,7 +393,7 @@ public static class TestUtils if (property is null) { - throw new($"No dither named '{name}"); + throw new Exception($"No dither named '{name}"); } return (IDither)property.GetValue(null); diff --git a/tests/ImageSharp.Tests/TestUtilities/TestVector4.cs b/tests/ImageSharp.Tests/TestUtilities/TestVector4.cs index 4130d89da..350333965 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestVector4.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestVector4.cs @@ -35,7 +35,7 @@ public class TestVector4 : IXunitSerializable public Vector4 AsVector() { - return new(this.X, this.Y, this.Z, this.W); + return new Vector4(this.X, this.Y, this.Z, this.W); } public void Deserialize(IXunitSerializationInfo info) diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/BasicSerializerTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/BasicSerializerTests.cs index f4944992a..1b5b43f03 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/BasicSerializerTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/BasicSerializerTests.cs @@ -51,7 +51,7 @@ public class BasicSerializerTests [Fact] public void SerializeDeserialize_ShouldPreserveValues() { - DerivedObj obj = new DerivedObj() { Length = 123.1, Name = "Lol123!", Lives = 7, Strength = 4.8 }; + DerivedObj obj = new() { Length = 123.1, Name = "Lol123!", Lives = 7, Strength = 4.8 }; string str = BasicSerializer.Serialize(obj); BaseObj mirrorBase = BasicSerializer.Deserialize(str); diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs index 649c626a1..349dd258e 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs @@ -72,7 +72,7 @@ public class ImageComparerTests () => comparer.VerifySimilarity(image, clone)); PixelDifference diff = ex.Reports.Single().Differences.Single(); - Assert.Equal(new(3, 1), diff.Position); + Assert.Equal(new Point(3, 1), diff.Position); } } } @@ -131,7 +131,7 @@ public class ImageComparerTests IEnumerable reports = ImageComparer.Exact.CompareImages(image, clone); PixelDifference difference = reports.Single().Differences.Single(); - Assert.Equal(new(42, 43), difference.Position); + Assert.Equal(new Point(42, 43), difference.Position); } } } diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/ReferenceDecoderBenchmarks.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/ReferenceDecoderBenchmarks.cs index 90e726194..4329a6be3 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/ReferenceDecoderBenchmarks.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/ReferenceDecoderBenchmarks.cs @@ -76,7 +76,7 @@ public class ReferenceDecoderBenchmarks private void BenchmarkDecoderImpl(IEnumerable testFiles, IImageDecoder decoder, string info, int times = DefaultExecutionCount) { - MeasureFixture measure = new MeasureFixture(this.Output); + MeasureFixture measure = new(this.Output); measure.Measure( times, () => diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/SemaphoreReadMemoryStreamTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/SemaphoreReadMemoryStreamTests.cs index e080bda9b..f0a5f4eb4 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/SemaphoreReadMemoryStreamTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/SemaphoreReadMemoryStreamTests.cs @@ -5,8 +5,8 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.Tests; public class SemaphoreReadMemoryStreamTests { - private readonly SemaphoreSlim continueSemaphore = new SemaphoreSlim(0); - private readonly SemaphoreSlim notifyWaitPositionReachedSemaphore = new SemaphoreSlim(0); + private readonly SemaphoreSlim continueSemaphore = new(0); + private readonly SemaphoreSlim notifyWaitPositionReachedSemaphore = new(0); private readonly byte[] buffer = new byte[128]; [Fact] diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/SystemDrawingReferenceCodecTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/SystemDrawingReferenceCodecTests.cs index 4a88cfb1b..555041890 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/SystemDrawingReferenceCodecTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/SystemDrawingReferenceCodecTests.cs @@ -36,7 +36,7 @@ public class SystemDrawingReferenceCodecTests { string path = TestFile.GetInputFileFullPath(TestImages.Png.Splash); - using Bitmap sdBitmap = new System.Drawing.Bitmap(path); + using Bitmap sdBitmap = new(path); using Image image = SystemDrawingBridge.From32bppArgbSystemDrawingBitmap(sdBitmap); image.DebugSave(dummyProvider); } @@ -50,7 +50,7 @@ public class SystemDrawingReferenceCodecTests sourceImage.Mutate(c => c.MakeOpaque()); } - PngEncoder encoder = new PngEncoder { ColorType = pngColorType }; + PngEncoder encoder = new() { ColorType = pngColorType }; return provider.Utility.SaveTestOutputFile(sourceImage, "png", encoder); } @@ -66,7 +66,7 @@ public class SystemDrawingReferenceCodecTests string path = SavePng(provider, PngColorType.RgbWithAlpha); - using Bitmap sdBitmap = new System.Drawing.Bitmap(path); + using Bitmap sdBitmap = new(path); using Image original = provider.GetImage(); using Image resaved = SystemDrawingBridge.From32bppArgbSystemDrawingBitmap(sdBitmap); ImageComparer comparer = ImageComparer.Exact; @@ -81,7 +81,7 @@ public class SystemDrawingReferenceCodecTests string path = SavePng(provider, PngColorType.Rgb); using Image original = provider.GetImage(); - using Bitmap sdBitmap = new System.Drawing.Bitmap(path); + using Bitmap sdBitmap = new(path); using Image resaved = SystemDrawingBridge.From24bppRgbSystemDrawingBitmap(sdBitmap); ImageComparer comparer = ImageComparer.Exact; comparer.VerifySimilarity(original, resaved); diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs index f33811206..72ed27e8e 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs @@ -368,7 +368,7 @@ public class TestImageProviderTests { using Image image = this.Decode(this.CreateDefaultSpecializedOptions(options), stream, cancellationToken); ImageMetadata metadata = image.Metadata; - return new(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) + return new ImageInfo(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) { PixelType = metadata.GetDecodedPixelTypeInfo() }; @@ -415,7 +415,7 @@ public class TestImageProviderTests { using Image image = this.Decode(this.CreateDefaultSpecializedOptions(options), stream, cancellationToken); ImageMetadata metadata = image.Metadata; - return new(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) + return new ImageInfo(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) { PixelType = metadata.GetDecodedPixelTypeInfo() }; diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs index 520f40e72..46fb7159e 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs @@ -83,7 +83,7 @@ public class TestUtilityExtensionsTests PixelTypes pt, IEnumerable> pixelTypesExp) { - Assert.Contains(new(pt, typeof(T)), pixelTypesExp); + Assert.Contains(new KeyValuePair(pt, typeof(T)), pixelTypesExp); } [Fact]