Bug 9518 - NSGraphicsContext.CurrentContext.GraphicsPort regression
Summary: NSGraphicsContext.CurrentContext.GraphicsPort regression
Alias: None
Product: MonoMac
Classification: Desktop
Component: Bindings ()
Version: GIT
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Sebastien Pouliot
Depends on:
Reported: 2013-01-12 17:40 UTC by troy-dawson
Modified: 2013-01-24 14:15 UTC (History)
2 users (show)

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description troy-dawson 2013-01-12 17:40:37 UTC
The CoreText arc sample no longer compiles against the TOT monomac-master.

/Users/troy/Projects/monomac-master/samples/CoreTextArcMonoMac/CoreTextArcView.cs(92,78): error CS0029: Cannot implicitly convert type `System.IntPtr' to `MonoMac.CoreGraphics.CGContext'

Offending source line is:

                        CGContext context = NSGraphicsContext.CurrentContext.GraphicsPort;

I'd fix it but don't know how . . .
Comment 1 Sebastien Pouliot 2013-01-15 14:15:31 UTC
You can do:

new GCContext (NSGraphicsContext.CurrentContext.GraphicsPort);

as the `GraphicsPort` is a pointer that is (almost) always a CGContext. I'll look at adding a convenience method and fix the sample.
Comment 2 Sebastien Pouliot 2013-01-24 14:15:59 UTC
Fixed in 58ff027029d43d9a833095ca7cbb715fda965cbb

GraphicsPort will return a CGContext (like before) while a new GraphicsPortHandle will expose the IntPtr handle (in case it's not a CGContext).