• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSImage get / set Pixels
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage get / set Pixels


  • Subject: Re: NSImage get / set Pixels
  • From: goessly <email@hidden>
  • Date: Fri, 17 Mar 2006 14:05:37 +0100

copy pixel to outputImage from inputImage

obtain the bitmap image reps from the NSImage instances.

Thanks, I'm now able to do so like this:

inputImage = [inputImageView image];
NSBitmapImageRep *inRep = [NSBitmapImageRep imageRepWithData: [inputImage TIFFRepresentation]];


Then, use getPixel:atX:y:
Ok, since getPixel behaved... well, strangely, I used the following instead:

NSColor *fetchColor = [inRep colorAtX:fromthisX y: fromthisY];

Alright, at this point I've got my input data. Now let's consider the output-Image. Since I need a BitmapRep to work on - pixelwise - I initialized one for the output in the following manner:

NSBitmapImageRep *outRep=	[[NSBitmapImageRep alloc]
	initWithBitmapDataPlanes:	NULL
	pixelsWide:					[inputImage size].width
	... and so on...
];

The fetchColor is now supposed to be written to it's hopefully correctly set-up destination:
[outRep setColor:fetchColor atX:col y: row];


Now I'd like the finished image to be displayed, which I attempt via:
[outputImage addRepresentation: outRep];
[outputImageView setImage: outputImage];

But nothing is drawn here - am I missing something?
How can I create an NSImage out of a NSBitmapImageRep, so that it is actually drawn?


Best regards,
goessly
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSImage get / set Pixels
      • From: "John C. Randolph" <email@hidden>
References: 
 >NSImage get / set Pixels (From: goessly <email@hidden>)
 >Re: NSImage get / set Pixels (From: Ricky Sharp <email@hidden>)

  • Prev by Date: RE: QTMovieView and NSView
  • Next by Date: Re: QTMovieView and NSView
  • Previous by thread: Re: NSImage get / set Pixels
  • Next by thread: Re: NSImage get / set Pixels
  • Index(es):
    • Date
    • Thread