• 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
CoreImage and NSImage on 10.6
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CoreImage and NSImage on 10.6


  • Subject: CoreImage and NSImage on 10.6
  • From: RhapSoft <email@hidden>
  • Date: Sat, 29 Aug 2009 01:34:29 +0200

Hi,

I have a very annoying crash/hang on snow leopard 10A432 when converting CIImage to NSImage.
Here is the stack :


#0 0x7fff88588994 in fe_tree_node_simplify
#1 0x7fff885879f4 in fe_tree_refactor_transforms_
#2 0x7fff8858857e in fe_tree_refactor_transforms_
#3 0x7fff885885a3 in fe_tree_refactor_transforms_
#4 0x7fff8858857e in fe_tree_refactor_transforms_
#5 0x7fff885885a3 in fe_tree_refactor_transforms_
#6 0x7fff8858857e in fe_tree_refactor_transforms_
#7 0x7fff88587986 in fe_tree_refactor_transforms
#8 0x7fff885870d9 in fe_tree_prepare_tree_
#9 0x7fff885852ca in fe_tree_render_image
#10 0x7fff88584cab in fe_image_render_
#11 0x7fff885e270b in fe_image_render
#12 0x7fff885e122e in -[CIOpenGLContextImpl renderWithBounds:matrix:function:info:]
#13 0x7fff885e1118 in -[CIContextImpl render:]
#14 0x7fff883d56b2 in cgxcoreimage_instance_render
#15 0x7fff86f49395 in CGXCoreImageInstanceRender
#16 0x7fff835ef27a in ripc_AcquireCoreImage
#17 0x7fff835e4490 in ripc_DrawShading
#18 0x7fff86e61439 in CGContextDrawShading
#19 0x7fff885de687 in -[CICGContextImpl render:]
#20 0x7fff885de25f in -[CIContext drawImage:inRect:fromRect:]
#21 0x7fff88622013 in -[CIContext drawImage:atPoint:fromRect:]
#22 0x100035cce in -[CIImage(IMImagesUtilities) nsImageWithSize:] at IMImagesUtilities.m:643



Is anyone familiar with this issue?

Best Regards.

Romain

The method I use to convert a CIImage to an NSImage :

@implementation CIImage (IMImagesUtilities)

- (NSImage *)nsImageWithSize:(NSSize)size {
if (([self extent].size.width == 0) || ([self extent].size.height == 0))
{
return nil;
}

CIImage * imageToAdd;
//NSCIImageRep * ciImageRep;
NSImage * resultingImage;
NSRect newRect;

if (CGRectIsInfinite([self extent]))
{
newRect = NSMakeRect(0, 0, size.width, size.height);
imageToAdd = [IMImagesUtilities cropImage:self
withRect:newRect];
}
else
{
newRect = [IMImagesUtilities NSRectWithCGRect:[self extent]];
newRect = NSMakeRect(0, 0, newRect.size.width, newRect.size.height);
imageToAdd = self;
}

// Create a new NSBitmapImageRep.
NSBitmapImageRep * theBitMapToBeSaved = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
pixelsWide:newRect.size.width
pixelsHigh:newRect.size.height
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES
isPlanar:NO
colorSpaceName:NSDeviceRGBColorSpace

bytesPerRow:0
bitsPerPixel:0];

// Create an NSGraphicsContext that draws into the NSBitmapImageRep. (This capability is new in Tiger.)
NSGraphicsContext *nsContext = [NSGraphicsContext
graphicsContextWithBitmapImageRep:theBitMapToBeSaved];

// Save the previous graphics context and state, and make our bitmap context current.
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext: nsContext];

// Get a CIContext from the NSGraphicsContext, and use it to draw the CIImage into the NSBitmapImageRep.
[[nsContext CIContext] drawImage:imageToAdd
atPoint:CGPointZero
fromRect:[imageToAdd extent]];

// Restore the previous graphics context and state.
[NSGraphicsContext restoreGraphicsState];


resultingImage = [[NSImage alloc] initWithSize:newRect.size];

[resultingImage addRepresentation:theBitMapToBeSaved];

[theBitMapToBeSaved release];

return [resultingImage autorelease];
}
@end




Best Regards.

Romain Piveteau
Author of LiveQuartz, "Free photo reTOUCHing for Leopard".
Paris, France

email@hidden
http://www.livequartz.com



_______________________________________________

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


  • Prev by Date: Re: Snow Leopard Development Discussion
  • Next by Date: bin2c GUI tool?
  • Previous by thread: Re: Implementing delegates with formal protocols
  • Next by thread: bin2c GUI tool?
  • Index(es):
    • Date
    • Thread