Questions tagged [nsimage]

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

681 questions
3
votes
1 answer

How do I draw a NSImage onto a NSView?

I'm pretty new to drawing images in general with Objective C. I have done image drawing in iPhone development, but now I want to do so on a Mac. In short, what is the Mac equivalent of the iPhone code below? - (void) drawRect: (CGRect) rect { …
Scsm326
  • 70
  • 1
  • 7
3
votes
1 answer

NSImageView with high-resolution image causes extreme slowdown when resizing the window

I am creating a simple photo filter app for OS X and I am displaying a photo on an NSImageView (actually two photos on top of each other with two NSImageViews, but the question still applies for a single view too). Everything works super, but when I…
Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389
3
votes
1 answer

NSImage leaking?

So I'm trying to duplicate the SourceView example in my app. I can generate the source list perfectly, fine. I can also expand the containers, and everything is displayed fine. However, when I select an item in the list, the app crashes with an…
rcapote
  • 1,034
  • 7
  • 19
3
votes
1 answer

NSImage imageNamed: for Mac Mini returns small icon instead of high-res

When using NSImage's imageNamed: method to get the icon for the current computer, if I'm running on a Mac Mini, then I get a low resolution image. If I run the same code from my MacBook, then I get a high-res icon like I'd expect. My code is as…
adam.wulf
  • 2,149
  • 20
  • 27
3
votes
0 answers

Too many pixels in my NSBitmapImageRep when drawing into an NSImage

I am trying to create an NSImage that is exactly 200 x 300 pixels large from the contents of another NSImage. I'm not just scaling, but taking it from a chunk of a much larger image. The resulting image looks just like the pixels I want. However,…
John A. Vink
  • 301
  • 1
  • 3
  • 15
3
votes
2 answers

MonoMac: Best way to convert Bitmap to NSImage

Since MonoMac doesnt have own class Bitmap, i need the best ways to convert image from Bitmap to NSImage. Current my way is: byte[] bytes = SomeFuncReturnsBytesofBitmap(); NSData imageData = NSData.FromArray(bytes); NSImage image = new…
Alexander
  • 431
  • 2
  • 5
  • 19
3
votes
1 answer

Perplexing indexing bug creating an NSImage from an array of bytes

I'm creating an NSImage from scratch in my code. To start I allocate an array of bytes: pixels = malloc( (int)( size.width * size.height) * 4 * 8 * sizeof(unsigned char)); I then attempt to create a test image, that should contain a gradient going…
slayton
  • 20,123
  • 10
  • 60
  • 89
3
votes
2 answers

Working with multi-page images in an NSImage

I'm working on an image viewer application (OSX) and currently it can load and view images, but I need to be able to view multi-page PDFs and TIFFs. I'll have next/previous page buttons, etc. Now, with PDF, I expect to use an NSPDFImageRep. This…
Brian Postow
  • 11,709
  • 17
  • 81
  • 125
3
votes
1 answer

Image Compression libraries for Objective-C

OK, this is what I need : Lossy and/or Lossless compression (all options are going to be considered, although Lossless compression will be favoured) PNG and JPG files support Cocoa-friendly code and easy integration I've used OptiPNG in the past…
Dr.Kameleon
  • 22,532
  • 20
  • 115
  • 223
3
votes
1 answer

How to create a ICNS icon programmatically?

OK this is what I want : Take some NSImages Add them to an ICNS file Save it This is what I've done so far (purely as a test) : - (CGImageRef)refFromImage:(NSImage*)img { CGImageSourceRef source; source =…
Dr.Kameleon
  • 22,532
  • 20
  • 115
  • 223
3
votes
1 answer

Rendering NSView to image: cacheDisplayInRect draws transparent areas differently from usual drawRect call

Greetings! I have a problem and Googling brought no results... I implemented the drawRect method for my NSView (subclass) to draw some shadows and semi-transparent fills. Everything looks great! But now I need to create an NSImage from my NSView…
UJey
  • 1,442
  • 11
  • 15
3
votes
3 answers

NSCursor images on a retina display

I am trying to modify the default I-beam cursor image. I'm using [[[NSCursor IBeamCursor] image] representations], passing each one through a CIFilter and adding it to a new image. However, the resulting cursor looks as though it is rendering the…
jtbandes
  • 115,675
  • 35
  • 233
  • 266
3
votes
0 answers

How do I avoid interpolation artifacts when drawing NSImage into a different size rect?

My end goal is to fill an arbitrarily sized rectangle with an NSImage. I want to: Fill the entire rectangle Preserve the aspect ratio of the image Show as much as possible of the image while maintaining 1) and 2) When not all the image can be…
Ben Dolman
  • 3,165
  • 3
  • 25
  • 25
2
votes
1 answer

Using layer backed NSView as NSDockTile contentView

Is there a way to use layer backed NSView as the contentView of a NSDockTile? Tried all sorts of tricks, but all I get is transparent area. Also tried going different route and get an image out of the CALayer and use that for [NSApp…
Tom
  • 1,522
  • 9
  • 10
2
votes
2 answers

Inspect an NSImage reference while debugging?

Is there a feature in Xcode that allow you to inspect NSImage references while debugging? Similar to how webkit inspector let you inspect image references in webpages. Failing that, what's the easiest way to debug while working with NSIMages?
Tony
  • 36,591
  • 10
  • 48
  • 83