Questions tagged [nsimage]

on Mac OS X, an NSImage object is a high-level class for manipulating image data

681 questions
0
votes
1 answer

NSBundles loaded during runtime don't give resource paths

i'm programming an app with cocoa that installs additional NSBundles during runtime. But i can't get any resources out of it. That's the code so far: -(void)load { NSString *appSupportSubpath = [[NSBundle mainBundle] builtInPlugInsPath]; …
thomasguenzel
  • 670
  • 7
  • 25
0
votes
2 answers

Object-C draw text with BORDER on NSImage

i need to draw text with border on NSImage. I do something like this: [image lockFocus]; [@"Hello" drawAtPoint:NSZeroPoint withAttributes:myAttr]; [image unlockFocus]; All work, but i need to draw text with white color and with 4 pixels thick black…
Pioz
  • 6,051
  • 4
  • 48
  • 67
0
votes
1 answer

Get NSImage from CIFilter "CIRadialGradient"

I have to generate an image like the one in Apples Doc at CIRadialGradient found here: I tried many ways and ended with: +(NSImage*)radialGradientWithR0:(float)r0 r1:(float)r1 c0:(NSColor*)c0 c1:(NSColor*)c1 imageDimensionPx:(int)imageDimension { …
Felix
  • 63
  • 5
0
votes
1 answer

Cocoa NsView doesn't show the image

I am stuck with a problem I can not solve. I'm trying to show a small avatar in my app. I created an NSView class, then add in interface builder a Custom View, and link it to the class. It gives me no errors, but it doesn't diplay the image! This…
phcaze
  • 1,707
  • 5
  • 27
  • 58
0
votes
1 answer

Clip to image mask with Cocoa

I'm trying to implement a tabbar similar to the ones in XCode 4: I could implement a simple tab control with custom images, but I'd like to apply that inner shadow effect programmatically. I'd like to supply simple icons only using one color…
DrummerB
  • 39,814
  • 12
  • 105
  • 142
0
votes
1 answer

how to make a Grid of NSImages?

What is the easiest way to make a grid of 4 by 5 NSimages on an NSWindow? I am trying to use an NSTableView with Image cells but I can't seem to have more than 1 per column
Maxwell Dergosits
  • 297
  • 1
  • 4
  • 12
0
votes
1 answer

Loading an online GIF image into NSImageView

I can't seem to get an online GIF image to load into an NSImageView. Please see my code below and offer some comments to remedy this. #import @interface ImageFromUrl : NSObject @property (strong) NSString…
wigging
  • 8,492
  • 12
  • 75
  • 117
-1
votes
1 answer

Extremely weird image retaining behavior of a NSImageView

I've narrowed down the problem to this: // newImage is passed from elsewhere NSLog(@"retain count first : %lu", [newImage retainCount]); img = newImage; [imgView setImage:newImage]; NSLog(@"retain count next : %lu", [newImage retainCount]); [imgView…
houbysoft
  • 32,532
  • 24
  • 103
  • 156
-1
votes
1 answer

@available function decorator not working on macOS

The following function converts the pages of a pdf document into NSImages. @available(macOS 13.0, *) func convertPDFPagesToImages(pdfDoc: PDFDocument)-> [NSImage] { let pageCount = pdfDoc.pageCount var images: [NSImage] = [] for…
domi852
  • 497
  • 1
  • 4
  • 13
-1
votes
1 answer

Swift Cocoa - How to load system image "NSCaution" into NSImageView?

I'm trying to load the system image called NSCaution programmatically. I can easily load it with Interface Builder since it's one of the displayed options for NSImageView: However, the following code does not work. It always sets img to nil: let…
fsctl
  • 161
  • 8
-1
votes
1 answer

Looking for simple example to write text into a NSImage using Cocoa

NSImage *myNewIconImage=[[NSImage imageNamed:@"FanImage"] copy]; [myNewIconImage lockFocus]; [@"15" drawAtPoint:NSZeroPoint withAttributes:nil]; [myNewIconImage unlockFocus]; [myNewIconImage setTemplate:YES]; [[NSApplication…
JeremyLaurenson
  • 979
  • 2
  • 11
  • 23
-1
votes
1 answer

Drawing Text on NSImage is Slow - How to improve performance?

I use the following code to draw a text on an NSImage func drawText(image :NSImage) ->NSImage { let text = textdata let font = NSFont(name:String(combo_font.stringValue), size: 50) let imageRect = CGRect(x: 0, y: 0,…
techno
  • 6,100
  • 16
  • 86
  • 192
-1
votes
1 answer

My code NSimage( ) works fine in Swift 3 but it does not work in Swift 5

My code is to display image.jpg in a window. That was written in Swift 3. Recently, I updated to Swift 4 with Xcode 10.2 . It doesn't work at all. I also rewrote it in Swift 5. It still doesn't work. I had to download the old Xcode 10 in order to…
N4A
  • 1
  • 5
-1
votes
2 answers

Extracting bitmap data from an NSImage in python

I'm constructing wx.MemoryDC using the data from the NSImage, but the resulting code is very sluggish. It seems to me that TIFFRepresentation -> ImageFromStream step is the one that slows things down. Is there any way to avoid this step (all this…
Dmitry Chichkov
  • 602
  • 5
  • 12
-1
votes
1 answer

Border around the image within an NSImageView

I have an NSImageView which contains an image. Is there a simple way to draw a border around just the image (which might be smaller than the NSImageView), and not the entire NSImageView?
Anshuman Sharma
  • 417
  • 2
  • 11
1 2 3
45
46