Hi,
I have created a method to get an NSImage according to the macoslib and I want to show for
instance the “NSImageNameStatusAvailable” icon/image in the window like the examples from macoslib
but I am unable to draw it correctly into the window - I always get a black rectangle.
However, the size and measurements are correctly drawn but no image with colors ect is shown. I know this since
switching from NSImageNameApplicationIcon to NSImageNameStatusAvailable results in different rectangles sizes
but still black.
Not sure where the problem is but it think the drawing is wrong. I am not expert in MacOS programming
but I am learning steadily.
Could someone help ? Please do not post commercial addons ect.
Declare Function NSClassFromString Lib CocoaLib (aClassName As CFStringRef) As Ptr
Declare Function imageNamed Lib CocoaLib selector "imageNamed:" (class_id As Ptr, name As CFStringRef) As Ptr
Dim iPtr As Ptr = imageNamed(NSClassFromString("NSImage"), "NStatusAvailable")
If iPtr <> Nil Then
Const NSCompositeSourceOver = 2
Dim opacity As Double= 1.0
Dim point As NSPoint
Dim zeroRect As NSRect
point.x = 50
point.y = 50
Declare Sub drawAtPoint Lib CocoaLib selector "drawAtPoint:fromRect:operation:fraction:" (obj_id As Ptr, point As NSPoint, fromRect As NSRect, op As Double, delta As Single)
drawAtPoint(iPtr, point, zeroRect, NSCompositeSourceOver, CType(opacity, Single))
End If