The Flying Meat Wiki : AcornAddBlackBorderPlugin

HomePage :: Categories :: PageIndex :: RecentChanges :: Login/Register
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.

GrayBorder.py
# 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
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.3
Page was generated in 0.0492 seconds