Consolidate the Image class, fix bug (dotnet/corefx#40181)
authorFrederik Carlier <frederik.carlier@quamotion.mobi>
Wed, 14 Aug 2019 18:11:21 +0000 (20:11 +0200)
committerSantiago Fernandez Madero <safern@microsoft.com>
Wed, 14 Aug 2019 18:11:21 +0000 (11:11 -0700)
commitc3872f9ff9d8e86759932473016de28ebe142a11
treedd688e30a7885867dbc6fd006014c954e18c03a4
parentff68a2b6161bb3963ff779770ba06b67e986c8a9
Consolidate the Image class, fix bug (dotnet/corefx#40181)

* Add new values for Encoder, EncoderParameterValueType

* Support encoder parameters of type ValueTypePointer

* Fix an overflow error when reading EncoderParameters

* Add unit tests

* Consolidate the Image class

Share the following methods across Windows & Unix:
- FromFile
- GetEncoderParameterList
- GetPixelFormatSize
- IsAlphaPixelFormat

* Fix P/Invoke declaration

* Fix compliation on NetFX

* Skip test on NetFX

* Fix typo

* Always skip GetEncoderParameterList_ReturnsExpected on netFX

* Remove new API

* Revert changes which require an API change

* Suppress failing test

* Image: Consolidate CreateImageObject
Metafile: Consolidate initialization from native handle

* Throw SkipTestException instead of silently skipping the test

* Enable some on Unix which rely on consolidated code

* Add missing using statement

* Get SkipTestException right

Commit migrated from https://github.com/dotnet/corefx/commit/31a04af352c0046b21b2ccdf5b409203a43fae1f
12 files changed:
src/libraries/System.Drawing.Common/ref/System.Drawing.Common.cs
src/libraries/System.Drawing.Common/src/System/Drawing/GdiplusNative.Unix.cs
src/libraries/System.Drawing.Common/src/System/Drawing/GdiplusNative.Windows.cs
src/libraries/System.Drawing.Common/src/System/Drawing/GdiplusNative.cs
src/libraries/System.Drawing.Common/src/System/Drawing/Image.Unix.cs
src/libraries/System.Drawing.Common/src/System/Drawing/Image.Windows.cs
src/libraries/System.Drawing.Common/src/System/Drawing/Image.cs
src/libraries/System.Drawing.Common/src/System/Drawing/Imaging/EncoderParameters.cs
src/libraries/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.Unix.cs
src/libraries/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.Windows.cs
src/libraries/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.cs
src/libraries/System.Drawing.Common/tests/ImageTests.cs