Here's an example python plugin that will add a gray border around the current bitmap layer. Just place it in a text file named "
GrayBorder.py" and place it in your ~/Library/Application Support/Acorn/Plug-Ins/ folder, and restart Acorn.
# Just copy this file to:
# ~/Library/Application Support/Acorn/Plug-Ins/.
# and away you go!
import objc
from Foundation import *
ACScriptSuperMenuTitle = None
ACScriptMenuTitle = "Add Black Border"
CIImage = objc.lookUpClass('CIImage')
NSColor = objc.lookUpClass('NSColor')
NSBezierPath = objc.lookUpClass('NSBezierPath')
def main(image):
nsimg = image.NSImage()
doc = NSDocumentController.sharedDocumentController().currentDocument()
nsimg.lockFocus()
NSColor.blackColor().set()
path = NSBezierPath.bezierPathWithRect_(NSMakeRect(.5, .5, doc.canvasSize().width - 1, doc.canvasSize().height - 1))
path.stroke()
nsimg.unlockFocus()
return CIImage.imageWithData_(nsimg.TIFFRepresentation())
Back to
AcornPlugins