Bug 7773 - Improve System.Drawing sharing between MonoTouch, Mono for Android
Summary: Improve System.Drawing sharing between MonoTouch, Mono for Android
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Drawing ()
Version: 2.10.x
Hardware: PC Mac OS
: --- enhancement
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-10-10 09:11 UTC by Timm
Modified: 2012-10-10 11:19 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 7773 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Timm 2012-10-10 09:11:12 UTC
I am unable to use System.Drawing.* classes in my portable class library project.

I would think making the basic data structures available should be possible.
Comment 1 Jonathan Pryor 2012-10-10 10:35:45 UTC
How are you defining "basic data structures"?

The only "basic data structures" currently included in both MonoTouch & Mono for Android are:

    Point
    PointF
    Rectangle
    RectangleF
    Size
    SizeF

See also:
    http://androidapi.xamarin.com/?link=N%3aSystem.Drawing
    http://iosapi.xamarin.com/?link=N%3aSystem.Drawing

Currently, the above are in Mono.Android.dll and monotouch.dll.

Now, answer this honestly: would a PCL System.Drawing assembly containing ONLY the above types be at all useful? I'm not sure that it would.

Finally, System.Drawing is not part of the PCL, at least as far as I can determine reading:

    http://msdn.microsoft.com/en-us/library/gg597391.aspx

Reading the above MSDN page, it sounds like nothing UI-related is in the PCL:

> the Portable Class Library project doesn't contain any UI components
> because of behavioral differences between the UIs of different devices.

Silverlight doesn't support System.Drawing:

    http://msdn.microsoft.com/en-us/library/cc838194(VS.95).aspx

Thus, any PCL System.Drawing would be restricted to MonoTouch & Mono for Android. That _might_ be useful, but given the small number of types that are supported, is there really any point?
Comment 2 Timm 2012-10-10 10:52:14 UTC
Thanks for the detailed answer.

Use case I was measuring something in MonoTouch and got a Size and then request something of that size from my PCL.

Of course it is not a big deal to convert to a custom size class for me, and probably worth the tradeoff since a sparsely implemented System.Drawing might confuse more people (or worse diverging from the MS spec).

Another option for me would be to just copy the corresponding classes from the Mono project.

But I agree that sticking to the convention is very important here, so WONTFIX?
Comment 3 Jonathan Pryor 2012-10-10 11:19:14 UTC
As a "proper" PCL assembly? WONTFIX: it'll require Microsoft support, which I think is unlikely.

However, that doesn't mean that we can't improve System.Drawing interop between MonoTouch and Mono for Android. This won't necessarily be _easy_, but it's certainly _plausible_, and could be a handy feature. This would likely involve rewriting System.Drawing atop the native APIs.