//
// Copyright (C) 2003 Ximian, Inc. (http://www.ximian.com)
//
-// Copyright (C) 2004 Novell, Inc. (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-using System;
+
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.ComponentModel;
using System.Runtime.InteropServices;
+using System.Security.Permissions;
using System.Text;
namespace System.Drawing
{
Status status = GDIPlus.GdipFlush (nativeObject, intention);
GDIPlus.CheckStatus (status);
- if (GDIPlus.UseQuartzDrawable)
+ if (GDIPlus.UseQuartzDrawable || GDIPlus.UseCocoaDrawable)
Carbon.CGContextSynchronize (GDIPlus.Display);
}
}
[EditorBrowsable (EditorBrowsableState.Advanced)]
+ [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
public static Graphics FromHdcInternal (IntPtr hdc)
{
GDIPlus.Display = hdc;
{
IntPtr graphics;
+ if (GDIPlus.UseCocoaDrawable) {
+ CarbonContext cgContext = Carbon.GetCGContextForNSView (hwnd);
+ GDIPlus.GdipCreateFromQuartz_macosx (cgContext.ctx, cgContext.width, cgContext.height, out graphics);
+
+ GDIPlus.Display = cgContext.ctx;
+ return new Graphics (graphics);
+ }
if (GDIPlus.UseQuartzDrawable) {
CarbonContext cgContext = Carbon.GetCGContextForView (hwnd);
GDIPlus.GdipCreateFromQuartz_macosx (cgContext.ctx, cgContext.width, cgContext.height, out graphics);
return new Graphics (graphics);
}
-
- [MonoTODO]
+
[EditorBrowsable (EditorBrowsableState.Advanced)]
+ [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
public static Graphics FromHwndInternal (IntPtr hwnd)
{
- throw new NotImplementedException ();
+ return FromHwnd (hwnd);
}
public static Graphics FromImage (Image image)
{
IntPtr graphics;
- if (image == null) throw new ArgumentException ();
+ if (image == null)
+ throw new ArgumentNullException ();
Status status = GDIPlus.GdipGetImageGraphicsContext (image.nativeObject, out graphics);
GDIPlus.CheckStatus (status);
throw new NotImplementedException ();
}
- [MonoTODO]
[EditorBrowsable (EditorBrowsableState.Advanced)]
public IntPtr GetHdc ()
{
- return nativeObject;
+ IntPtr hdc;
+ GDIPlus.CheckStatus (GDIPlus.GdipGetDC (this.nativeObject, out hdc));
+ return hdc;
}
[MonoTODO]
[EditorBrowsable (EditorBrowsableState.Advanced)]
+ [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
public void ReleaseHdcInternal (IntPtr hdc)
{
throw new NotImplementedException ();