• 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: I need float resolution bitmap data from a JPG using CIImage or similar helper
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I need float resolution bitmap data from a JPG using CIImage or similar helper


  • Subject: Re: I need float resolution bitmap data from a JPG using CIImage or similar helper
  • From: Jens Alfke <email@hidden>
  • Date: Tue, 1 Jun 2010 11:15:04 -0700

On May 31, 2010, at 5:40 PM, Robert Lorentz wrote:

> CGContextRef context = CGBitmapContextCreate(rawData, width, height, bitsPerComponent, bytesPerRow, colorSpace, kCGBitmapFloatComponents);
>
> CGColorSpaceRelease(colorSpace);
>
> // draw the CIImage to the 'context'... this is probably the line that's wrong
> [image drawInRect:NSMakeRect(0, 0, width, height) fromRect:[self bounds] operation:NSCompositeSourceIn fraction 1.0];

You created a context, but you never told AppKit to draw into it, so it’s just drawing into whatever the current context is at that moment.

You’ll need to do something like this:
	NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort: context flipped: NO];
	NSGraphicsContext saveGraphicsState];
	[NSGraphicsContext setCurrentContext: nsContext];
	[image drawInRect: ……..];
	[NSGraphicsContext restoreGraphicsState];

I’ve never actually tried doing this, so I’m not certain the above code will work, but it looks as though it should.

—Jens_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >I need float resolution bitmap data from a JPG using CIImage or similar helper (From: Robert Lorentz <email@hidden>)

  • Prev by Date: Zooming UIScrollViews
  • Next by Date: Re: I need float resolution bitmap data from a JPG using CIImage or similar helper
  • Previous by thread: I need float resolution bitmap data from a JPG using CIImage or similar helper
  • Next by thread: Re: I need float resolution bitmap data from a JPG using CIImage or similar helper
  • Index(es):
    • Date
    • Thread