Benjamin Jackson
bhjac****@gmail*****
Thu Jan 25 13:14:34 JST 2007
Trying to save an image using the latest stable build: url = NSURL.fileURLWithPath(path) image = CIImage.imageWithContentsOfURL(url) bitmap = NSBitmapImageRep.alloc.initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel( nil, image.extent.size.width, image.extent.size.height, 8, 4, true, false, NSDeviceRGBColorSpace, 0, 0) context = NSGraphicsContext.graphicsContextWithBitmapImageRep bitmap NSGraphicsContext.saveGraphicsState NSGraphicsContext.setCurrentContext context context.CIContext.drawImage_atPoint_fromRect image, CGPoint.new(0,0), image.extent NSGraphicsContext.restoreGraphicsState bitmap.writeToFile_atomically("/Users/bjackson/Desktop/test.bmp", true) /Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby/osx/objc/oc_wrapper.rb:48:in `NSApplicationMain': NSApplicationMain - RBException_OSX::OCMessageSendException - NSBitmapImageRep#writeToFile:atomically: - Can't get Objective-C method signature for selector 'writeToFile:atomically:' of receiver #<OSX::NSBitmapImageRep:0x154f7e class='NSBitmapImageRep' id=0x1151420> (OSX::OCException) Tried using the method with a "hello world" NSString and an empty NSData object, and both compiled without error.