Commit Graph
9 Commits
Author SHA1 Message Date
Eric Mellino d033bfe602 Consolidate more code in the "System.Drawing" namespace.
* 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
2017-09-19 13:23:59 -07:00
Eric Mellino c28c8a5a58 Move Unix Printing types into regular folder structure.
Commit migrated from https://github.com/dotnet/corefx/commit/04efcad64f3731801eeabe10661c430ae51aa42a
2017-09-11 15:38:05 -07:00
Eric Mellino f03a598ea9 Move Unix Icon into regular folder structure.
Also, remove its ISerializable implementation, as required.


Commit migrated from https://github.com/dotnet/corefx/commit/21173b47621d5519f45a0a1546bcb38f4feb33c1
2017-08-31 15:35:45 -07:00
Eric St. John b2dae07f2b Update VS configurations
Commit migrated from https://github.com/dotnet/corefx/commit/238bf3302817a910fac3968f4ac826424294ab0c
2017-08-29 08:49:24 -07:00
Eric Mellino a9a9d668de Add a netcoreapp2.0 configuration for System.Drawing.Common.
Commit migrated from https://github.com/dotnet/corefx/commit/c7093a57a3bc813f76ec90adc9454750b1447733
2017-08-01 13:12:39 -07:00
Eric Mellino 38ffe5d08d Use manually-loaded functions in Unix System.Drawing.Common.
* 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
2017-07-26 12:56:36 -07:00
Eric Mellino d35f5ae9b4 Update VS configurations in System.Drawings projects/solutions.
Commit migrated from https://github.com/dotnet/corefx/commit/49861ac3dfa84b4c41ce69c5742ea8dc134558d6
2017-06-13 14:40:13 -07:00
Hugh Bellamy cc374d681f Add empty test project for System.Drawing.Common (dotnet/corefx#20802)
Commit migrated from https://github.com/dotnet/corefx/commit/659fb5aeb35d870451513141165ea8a276c93401
2017-06-08 15:26:04 -07:00
Eric Mellino 05e65650d9 Add support for System.Drawing on Windows.
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
2017-06-01 13:08:44 -07:00