Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions src/AppKit/NSBitmapImageRep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
namespace AppKit {

public partial class NSBitmapImageRep {
static IntPtr selInitForIncrementalLoad = Selector.GetHandle ("initForIncrementalLoad");
static string selInitForIncrementalLoad = "initForIncrementalLoad";

// Do not actually export because NSObjectFlag is not exportable.
// The Objective C method already exists. This is just to allow
Expand All @@ -41,24 +41,21 @@ public partial class NSBitmapImageRep {
private NSBitmapImageRep (NSObjectFlag a, NSObjectFlag b) : base (a)
{
if (IsDirectBinding) {
Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSend (this.Handle, selInitForIncrementalLoad);
InitializeHandle (ObjCRuntime.Messaging.IntPtr_objc_msgSend (this.Handle, Selector.GetHandle (selInitForIncrementalLoad)), selInitForIncrementalLoad);
} else {
Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper (this.SuperHandle, selInitForIncrementalLoad);
InitializeHandle (ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper (this.SuperHandle, Selector.GetHandle (selInitForIncrementalLoad)), selInitForIncrementalLoad);
}
}

/// <param name="storageType">To be added.</param>
/// <summary>To be added.</summary>
/// <returns>To be added.</returns>
/// <remarks>To be added.</remarks>
public NSData RepresentationUsingTypeProperties (NSBitmapImageFileType storageType)
/// <summary>Convert the bitmap to a specific file format.</summary>
/// <param name="storageType">The target filetype for the bitmap image.</param>
/// <returns>An <see cref="NSData" /> with the data of the bitmap stored as the specified file type.</returns>
public NSData? RepresentationUsingTypeProperties (NSBitmapImageFileType storageType)
{
return RepresentationUsingTypeProperties (storageType, null);
return RepresentationUsingTypeProperties (storageType, new NSDictionary ());
}

/// <summary>To be added.</summary>
/// <returns>To be added.</returns>
/// <remarks>To be added.</remarks>
/// <summary>Create a new <see cref="NSBitmapImageRep" /> that for incremental loading.</summary>
public static NSBitmapImageRep IncrementalLoader ()
{
return new NSBitmapImageRep (NSObjectFlag.Empty, NSObjectFlag.Empty);
Expand Down
15 changes: 13 additions & 2 deletions src/appkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2102,6 +2102,7 @@ NativeHandle Constructor (IntPtr planes, nint width, nint height, nint bps, nint
[Export ("imageRepsWithData:")]
NSImageRep [] ImageRepsWithData (NSData data);

[return: NullAllowed]
[Static]
[Export ("imageRepWithData:")]
NSImageRep ImageRepFromData (NSData data);
Expand Down Expand Up @@ -2145,16 +2146,20 @@ NativeHandle Constructor (IntPtr planes, nint width, nint height, nint bps, nint
[Export ("setCompression:factor:")]
void SetCompressionFactor (NSTiffCompression compression, float /* float, not CGFloat */ factor);

[NullAllowed]
[Export ("TIFFRepresentation")]
NSData TiffRepresentation { get; }

[return: NullAllowed]
[Export ("TIFFRepresentationUsingCompression:factor:")]
NSData TiffRepresentationUsingCompressionFactor (NSTiffCompression comp, float /* float, not CGFloat */ factor);

[return: NullAllowed]
[Static]
[Export ("TIFFRepresentationOfImageRepsInArray:")]
NSData ImagesAsTiff (NSImageRep [] imageReps);

[return: NullAllowed]
[Static]
[Export ("TIFFRepresentationOfImageRepsInArray:usingCompression:factor:")]
NSData ImagesAsTiff (NSImageRep [] imageReps, NSTiffCompression comp, float /* float, not CGFloat */ factor);
Expand All @@ -2164,6 +2169,7 @@ NativeHandle Constructor (IntPtr planes, nint width, nint height, nint bps, nint
//[Export ("getTIFFCompressionTypes:count:")]
//void GetTiffCompressionTypes (const NSTIFFCompression list, int numTypes);

[return: NullAllowed]
[Static]
[Export ("localizedNameForTIFFCompressionType:")]
string LocalizedNameForTiffCompressionType (NSTiffCompression compression);
Expand All @@ -2172,14 +2178,15 @@ NativeHandle Constructor (IntPtr planes, nint width, nint height, nint bps, nint
bool CanBeCompressedUsing (NSTiffCompression compression);

[Export ("colorizeByMappingGray:toColor:blackMapping:whiteMapping:")]
void Colorize (nfloat midPoint, NSColor midPointColor, NSColor shadowColor, NSColor lightColor);
void Colorize (nfloat midPoint, [NullAllowed] NSColor midPointColor, [NullAllowed] NSColor shadowColor, [NullAllowed] NSColor lightColor);

[Export ("incrementalLoadFromData:complete:")]
nint IncrementalLoad (NSData data, bool complete);

[Export ("setColor:atX:y:")]
void SetColorAt (NSColor color, nint x, nint y);

[return: NullAllowed]
[Export ("colorAtX:y:")]
NSColor ColorAt (nint x, nint y);

Expand All @@ -2189,20 +2196,24 @@ NativeHandle Constructor (IntPtr planes, nint width, nint height, nint bps, nint
//[Export ("setPixel:atX:y:")]
//void SetPixel (int[] p, int x, int y);

[NullAllowed]
[Export ("CGImage")]
CGImage CGImage { get; }

[Export ("colorSpace")]
NSColorSpace ColorSpace { get; }

[return: NullAllowed]
[Export ("bitmapImageRepByConvertingToColorSpace:renderingIntent:")]
NSBitmapImageRep ConvertingToColorSpace (NSColorSpace targetSpace, NSColorRenderingIntent renderingIntent);

[return: NullAllowed]
[Export ("bitmapImageRepByRetaggingWithColorSpace:")]
NSBitmapImageRep RetaggedWithColorSpace (NSColorSpace newSpace);

[return: NullAllowed]
[Export ("representationUsingType:properties:")]
NSData RepresentationUsingTypeProperties (NSBitmapImageFileType storageType, [NullAllowed] NSDictionary properties);
NSData RepresentationUsingTypeProperties (NSBitmapImageFileType storageType, NSDictionary properties);

/// <summary>To be added.</summary>
/// <value>To be added.</value>
Expand Down
1 change: 0 additions & 1 deletion tests/cecil-tests/SetHandleTest.KnownFailures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace Cecil.Tests {
public partial class SetHandleTest {
static HashSet<string> knownFailuresNobodyCallsHandleSetter = new HashSet<string> {
"AddressBook.ABGroup::.ctor(AddressBook.ABRecord)",
"AppKit.NSBitmapImageRep::.ctor(Foundation.NSObjectFlag,Foundation.NSObjectFlag)",
"AppKit.NSOpenGLPixelFormat::.ctor(AppKit.NSOpenGLPixelFormatAttribute[])",
"AppKit.NSOpenGLPixelFormat::.ctor(System.Object[])",
"CoreFoundation.CFMutableString::.ctor(CoreFoundation.CFString,System.IntPtr)",
Expand Down
19 changes: 3 additions & 16 deletions tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@
!missing-null-allowed! 'AppKit.INSPasteboardWriting AppKit.NSTableViewDataSource::GetPasteboardWriterForRow(AppKit.NSTableView,System.IntPtr)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.INSSharingServiceDelegate AppKit.NSSharingServicePickerDelegate::DelegateForSharingService(AppKit.NSSharingServicePicker,AppKit.NSSharingService)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSAppearance AppKit.NSAppearance::GetAppearance(Foundation.NSString)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSBitmapImageRep AppKit.NSBitmapImageRep::ConvertingToColorSpace(AppKit.NSColorSpace,AppKit.NSColorRenderingIntent)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSBitmapImageRep AppKit.NSBitmapImageRep::RetaggedWithColorSpace(AppKit.NSColorSpace)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSButton AppKit.NSAlert::get_SuppressionButton()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSButton AppKit.NSWindow::StandardWindowButton(AppKit.NSWindowButton)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSButton AppKit.NSWindow::StandardWindowButton(AppKit.NSWindowButton,AppKit.NSWindowStyle)' is missing an [NullAllowed] on return type
Expand All @@ -228,7 +226,6 @@
!missing-null-allowed! 'AppKit.NSCell AppKit.NSTableViewDelegate::GetDataCell(AppKit.NSTableView,AppKit.NSTableColumn,System.IntPtr)' is missing an [NullAllowed] on parameter #1
!missing-null-allowed! 'AppKit.NSCell AppKit.NSTableViewDelegate::GetDataCell(AppKit.NSTableView,AppKit.NSTableColumn,System.IntPtr)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSCell[] AppKit.NSBrowser::SelectedCells()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSColor AppKit.NSBitmapImageRep::ColorAt(System.IntPtr,System.IntPtr)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSColor AppKit.NSBrowserCell::HighlightColorInView(AppKit.NSView)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSColor AppKit.NSColor::BlendedColor(System.Runtime.InteropServices.NFloat,AppKit.NSColor)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSColor AppKit.NSColor::FromCatalogName(System.String,System.String)' is missing an [NullAllowed] on return type
Expand Down Expand Up @@ -295,7 +292,6 @@
!missing-null-allowed! 'AppKit.NSImage AppKit.NSTableView::GetIndicatorImage(AppKit.NSTableColumn)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSImage AppKit.NSWorkspace::IconForFiles(System.String[])' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSImage Foundation.NSBundle::ImageForResource(System.String)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSImageRep AppKit.NSBitmapImageRep::ImageRepFromData(Foundation.NSData)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSImageRep AppKit.NSImage::BestRepresentation(CoreGraphics.CGRect,AppKit.NSGraphicsContext,Foundation.NSDictionary)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSImageRep AppKit.NSImageRep::ImageRepFromFile(System.String)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSImageRep AppKit.NSImageRep::ImageRepFromPasteboard(AppKit.NSPasteboard)' is missing an [NullAllowed] on return type
Expand Down Expand Up @@ -410,7 +406,6 @@
!missing-null-allowed! 'AppKit.NSWindow[] AppKit.NSWindowDelegate::CustomWindowsToEnterFullScreen(AppKit.NSWindow)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSWindow[] AppKit.NSWindowDelegate::CustomWindowsToExitFullScreen(AppKit.NSWindow)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'CoreGraphics.CGColorSpace AppKit.NSColorSpace::get_ColorSpace()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'CoreGraphics.CGImage AppKit.NSBitmapImageRep::get_CGImage()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'CoreGraphics.CGImage AppKit.NSImage::AsCGImage(CoreGraphics.CGRect&,AppKit.NSGraphicsContext,Foundation.NSDictionary)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'CoreGraphics.CGImage AppKit.NSImageRep::AsCGImage(CoreGraphics.CGRect&,AppKit.NSGraphicsContext,Foundation.NSDictionary)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'CoreGraphics.CGPoint AppKit.NSPanGestureRecognizer::TranslationInView(AppKit.NSView)' is missing an [NullAllowed] on parameter #0
Expand All @@ -427,11 +422,6 @@
!missing-null-allowed! 'Foundation.NSAttributedString AppKit.NSHelpManager::Context(Foundation.NSObject)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSAttributedString Foundation.NSBundle::GetContextHelp(System.String)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSBundle AppKit.NSViewController::get_NibBundle()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSData AppKit.NSBitmapImageRep::get_TiffRepresentation()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSData AppKit.NSBitmapImageRep::ImagesAsTiff(AppKit.NSImageRep[])' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSData AppKit.NSBitmapImageRep::ImagesAsTiff(AppKit.NSImageRep[],AppKit.NSTiffCompression,System.Single)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSData AppKit.NSBitmapImageRep::RepresentationUsingTypeProperties(AppKit.NSBitmapImageFileType,Foundation.NSDictionary)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSData AppKit.NSBitmapImageRep::TiffRepresentationUsingCompressionFactor(AppKit.NSTiffCompression,System.Single)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSData AppKit.NSColorSpace::get_ICCProfileData()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSData AppKit.NSDocument::GetAsData(System.String,Foundation.NSError&)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSData AppKit.NSImage::AsTiff(AppKit.NSTiffCompression,System.Single)' is missing an [NullAllowed] on return type
Expand Down Expand Up @@ -576,7 +566,6 @@
!missing-null-allowed! 'System.IntPtr AppKit.NSPopUpButtonCell::IndexOfItemWithTargetandAction(Foundation.NSObject,ObjCRuntime.Selector)' is missing an [NullAllowed] on parameter #1
!missing-null-allowed! 'System.IntPtr AppKit.NSRuleEditorDelegate::NumberOfChildren(AppKit.NSRuleEditor,Foundation.NSObject,AppKit.NSRuleEditorRowType)' is missing an [NullAllowed] on parameter #1
!missing-null-allowed! 'System.IntPtr AppKit.NSSpellChecker::CountWords(System.String,System.String)' is missing an [NullAllowed] on parameter #1
!missing-null-allowed! 'System.String AppKit.NSBitmapImageRep::LocalizedNameForTiffCompressionType(AppKit.NSTiffCompression)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'System.String AppKit.NSBrowser::ColumnTitle(System.IntPtr)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'System.String AppKit.NSBrowserDelegate::ColumnTitle(AppKit.NSBrowser,System.IntPtr)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'System.String AppKit.NSColorList::get_Name()' is missing an [NullAllowed] on return type
Expand Down Expand Up @@ -1017,7 +1006,6 @@
!missing-null-allowed! 'System.Void AppKit.NSWorkspace::RecycleUrls(Foundation.NSArray,AppKit.NSWorkspaceUrlHandler)' is missing an [NullAllowed] on parameter #1
!missing-null-allowed! 'System.Void Foundation.NSFileWrapper::set_Icon(AppKit.NSImage)' is missing an [NullAllowed] on parameter #0

!extra-null-allowed! 'Foundation.NSData AppKit.NSBitmapImageRep::RepresentationUsingTypeProperties(AppKit.NSBitmapImageFileType,Foundation.NSDictionary)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'Foundation.NSData Foundation.NSAttributedString::GetDocFormat(Foundation.NSRange,Foundation.NSDictionary)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'Foundation.NSData Foundation.NSAttributedString::GetRtf(Foundation.NSRange,Foundation.NSDictionary)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'Foundation.NSData Foundation.NSAttributedString::GetRtfd(Foundation.NSRange,Foundation.NSDictionary)' has a extraneous [NullAllowed] on parameter #1
Expand Down Expand Up @@ -1052,9 +1040,6 @@
!missing-null-allowed! 'System.String[] AppKit.NSSpellChecker::CompletionsForPartialWordRange(Foundation.NSRange,System.String,System.String,System.IntPtr)' is missing an [NullAllowed] on parameter #2
!missing-null-allowed! 'System.String[] AppKit.NSSpellChecker::GuessesForWordRange(Foundation.NSRange,System.String,System.String,System.IntPtr)' is missing an [NullAllowed] on parameter #2
!missing-null-allowed! 'System.Void AppKit.NSApplication::DiscardEvents(System.UIntPtr,AppKit.NSEvent)' is missing an [NullAllowed] on parameter #1
!missing-null-allowed! 'System.Void AppKit.NSBitmapImageRep::Colorize(System.Runtime.InteropServices.NFloat,AppKit.NSColor,AppKit.NSColor,AppKit.NSColor)' is missing an [NullAllowed] on parameter #1
!missing-null-allowed! 'System.Void AppKit.NSBitmapImageRep::Colorize(System.Runtime.InteropServices.NFloat,AppKit.NSColor,AppKit.NSColor,AppKit.NSColor)' is missing an [NullAllowed] on parameter #2
!missing-null-allowed! 'System.Void AppKit.NSBitmapImageRep::Colorize(System.Runtime.InteropServices.NFloat,AppKit.NSColor,AppKit.NSColor,AppKit.NSColor)' is missing an [NullAllowed] on parameter #3
!missing-null-allowed! 'System.Void AppKit.NSCell::EditWithFrame(CoreGraphics.CGRect,AppKit.NSView,AppKit.NSText,Foundation.NSObject,AppKit.NSEvent)' is missing an [NullAllowed] on parameter #4
!missing-null-allowed! 'System.Void AppKit.NSDocumentController::ReviewUnsavedDocuments(System.String,System.Boolean,Foundation.NSObject,ObjCRuntime.Selector,System.IntPtr)' is missing an [NullAllowed] on parameter #2
!missing-null-allowed! 'System.Void AppKit.NSDocumentController::ReviewUnsavedDocuments(System.String,System.Boolean,Foundation.NSObject,ObjCRuntime.Selector,System.IntPtr)' is missing an [NullAllowed] on parameter #3
Expand Down Expand Up @@ -1093,10 +1078,12 @@
## 42814697 NSViewLayerContentScaleDelegate defined in header but never used
!missing-protocol! NSViewLayerContentScaleDelegate not bound

## Bound manually because the signature conflicts with the default constructor
!missing-selector! NSBitmapImageRep::initForIncrementalLoad not bound

## recent fox top xtro reported additional missing API (to be reviewed)
!missing-selector! +NSBezierPath::bezierPath not bound
!missing-selector! +NSPDFPanel::panel not bound
!missing-selector! NSBitmapImageRep::initForIncrementalLoad not bound
!missing-selector! NSColor::init not bound
!missing-selector! NSObjectController::defaultFetchRequest not bound
!missing-selector! NSPasteboard::readFileWrapper not bound
Expand Down