diff --git a/src/AppKit/NSImage.cs b/src/AppKit/NSImage.cs index 7bb76bb803e5..248542d3407e 100644 --- a/src/AppKit/NSImage.cs +++ b/src/AppKit/NSImage.cs @@ -88,6 +88,14 @@ public static NSImage FromStream (System.IO.Stream stream) } } + public NSImage (string fileName, bool lazy) + { + if (lazy) + Handle = InitByReferencingFile (fileName); + else + Handle = InitWithContentsOfFile (fileName); + } + public NSImage (NSData data, bool ignoresOrientation) { if (ignoresOrientation) { diff --git a/src/appkit.cs b/src/appkit.cs index 3b9e5e0cd558..17d3a640218a 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -8183,8 +8183,6 @@ public partial interface NSImage : NSCoding, NSCopying, NSSecureCoding, NSPasteb [Export ("initWithContentsOfURL:")] IntPtr Constructor (NSUrl url); - //[Export ("initByReferencingFile:")] - //IntPtr Constructor (string fileName); //[Export ("initByReferencingURL:")] //IntPtr Constructor (NSUrl url); @@ -8192,6 +8190,12 @@ public partial interface NSImage : NSCoding, NSCopying, NSSecureCoding, NSPasteb //[Export ("initWithIconRef:")] //IntPtr Constructor (IconRef iconRef); + [Sealed, Export ("initWithContentsOfFile:"), Internal] + IntPtr InitWithContentsOfFile (string fileName); + + [Export ("initByReferencingFile:"), Internal] + IntPtr InitByReferencingFile (string name); + [Export ("initWithPasteboard:")] IntPtr Constructor (NSPasteboard pasteboard);