* Remove all remaining Win32 codepaths from the mono codebase. All of this
code now implicitly assumes that it will be run on a Unix platform.
* Consolidate the rest of the gdipFunctions.cs file into Gdip.cs and
GdipNative.Unix.cs
* Consolidate the GraphicsUnit and ImageType enumerations -- they were
duplicated.
* Remove the mono Status enum and use the Windows constants instead in all
Unix code.
* Move all files into the regular directory structure. Suffix them with
".Unix" and ".Windows" when there are collisions.
Commit migrated from https://github.com/dotnet/corefx/commit/98a954b18bc3facbfd19ae35481788c738f6ae62
* CoreCLR does not support DllMap, which makes the PInvoke declarations used
by mono's libgdiplus-based System.Drawing implementation problematic. The
name of the shared library differs by platorm, and cannot be loaded by a
single static name "gdiplus" everywhere. To work around this, all relevant
function imports have been rewritten using a manual process.
* (lib)gdiplus itself is first loaded using the relevant OS facilities (dlopen/
LoadLibrary).
* Each function pointer used by the library is then loaded lazily when it is
first used. The function pointer is obtained using the relevant OS facilities
(dlsym/GetProcAddress), and a managed delegate is then stored using
Marshal.GetDelegateForFunctionPointer.
* Because the two codebases (Windows and Unix) are not fully consolidated,
neither are the function import declarations. Some functions imports are
duplicated between the GdiplusNative.Windows and GdiplusNative.Unix source
files. These need to be duplicated because the .NET Framework and mono
implementations chose different parameter marshalling patterns, and huge
chunks of code would need to be modified in order to reconcile this. As we
consolidate the Windows and Unix implementations, we can remove this
duplication and maintain a single canonical import declaration for each
native function that is used. For classes that have already been consolidated,
we have shared function imports declared in GdiplusNative.cs (no OS suffix).
* Test code has been updated to detect whether libgdiplus is available using a
similar pattern. Tests will be skipped if libgdiplus cannot be loaded (by any
name). On Windows, GDI+ is assumed to be supported unless the operating system
is Windows Nano Server, in which case the tests are skipped, as before.
Commit migrated from https://github.com/dotnet/corefx/commit/1f253001baeedbfb4a70d66cd5e4b417c012bbb2
This change adds a new library, System.Drawing.Common, which supports a
large subset of the System.Drawing API. It is a direct port of the code
from the .NET Framework codebase. The code has been cleaned, formatted,
and sanitized to match the code style of corefx, but is otherwise very
similar to the .NET Framework version. There are a few key differences:
* TypeConverter's have been omitted for now. If we want to add these to
.NET Core, we should add them to the TypeConverter library, rather than
System.Drawing.Common itself.
* Some parts of the library do not respond to "System Events", because
they are not yet implemented in .NET Core. This means that fonts and
colors will not automatically update when the system defaults change,
as they do in .NET Framework. The code is still there, but behind the
feature flag "FEATURE_SYSTEM_EVENTS".
* Various attributes have been removed from the codebase, because they are
no longer applicable. Examples:
* Designer-related attributes (DefaultProperty, DefaultEvent, Editor,
etc.)
* CAS-related attributes. CAS-related method calls (Security demands and
asserts) have also been removed.
There is still further cleanup that can be done in order to match the
style and structure of corefx. For example, the Interop code should be
reorganized to match other BCL libraries.
NOTE: This implementation will only work on Windows, and not in UWP. This
is a strictly compatibility-driven feature. Any changes made to it should
not significantly diverge from the .NET Framework implementation.
Libraries should only take a dependency on System.Drawing.Common if they
are relying on legacy components from .NET Framework; newly-written code
and features should rely on modern alternatives.
Commit migrated from https://github.com/dotnet/corefx/commit/4d34be89f3812919306f1003fa6c035c9caf8970