manicwave

Surf the wave

Links for 2009-09-18

Permalink

module OSX class CIImage def save(target, format = OSX::NSJPEGFileType, properties = nil) bitmapRep = OSX::NSBitmapImageRep.alloc.initWithCIImage(self) blob = bitmapRep.representationUsingType_properties(format, properties) blob.writeToFile_atomically(target, false) end

def cgimage OSX::NSBitmapImageRep.alloc.initWithCIImage(self).CGImage() end

def self.from(filepath) raise Errno::ENOENT, "No such file or directory -

{filepath}" unless File.exists?(filepath)

OSX::CIImage.imageWithContentsOfURL(OSX::NSURL.fileURLWithPath(filepath)) end end end

(tags: ruby cocoa quartz)

(tags: acorn scripting jstalk cocoa)

(tags: iphone acorn jstalk screenshot productivity)