The Flying Meat Wiki : AcornAddBlackBorderPlugin

HomePage :: Categories :: PageIndex :: RecentChanges :: Login/Register
Most recent edit on 2008-01-21 15:42:54 by GusMueller [updated to use doc stuff.]

Additions:
# Just copy this file to:
# ~/Library/Application Support/Acorn/Plug-Ins/.
# and away you go!
ACScriptMenuTitle = "Add Black Border"
NSColor = objc.lookUpClass('NSColor')
NSBezierPath = objc.lookUpClass('NSBezierPath')
doc = NSDocumentController.sharedDocumentController().currentDocument()
NSColor.blackColor().set()
path = NSBezierPath.bezierPathWithRect_(NSMakeRect(.5, .5, doc.canvasSize().width - 1, doc.canvasSize().height - 1))

Deletions:
from AppKit import *
ACScriptMenuTitle = "Add Gray Border"
NSColor.grayColor().set()
path = NSBezierPath.bezierPathWithRect_(NSMakeRect(.5, .5, nsimg.size().width - 1,
nsimg.size().height - 1))



Edited on 2007-11-15 13:05:43 by GusMueller

Deletions:
liactrocelt



Edited on 2007-11-15 10:53:36 by BoliaLeltl

Additions:
liactrocelt



Edited on 2007-11-12 10:13:32 by GusMueller

Deletions:
bovarlac4



Edited on 2007-11-11 09:40:17 by TrsitRacro

Additions:
bovarlac4



Edited on 2007-11-10 18:14:45 by GusMueller

Deletions:
darvarric



Edited on 2007-11-10 15:50:41 by MonacElchi

Additions:
darvarric



Edited on 2007-09-11 18:33:43 by GusMueller

Additions:
Back to AcornPlugins



Edited on 2007-09-11 18:32:43 by GusMueller

Additions:
%%(python;GrayBorder.py)

Deletions:
%%(Python;0;GrayBorder.py)



Edited on 2007-09-11 18:30:41 by GusMueller

Additions:
%%(Python;0;GrayBorder.py)

Deletions:
%%(Python)



Oldest known version of this page was edited on 2007-09-11 18:29:16 by GusMueller []
Page view:
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.

import objc
from Foundation import *
from AppKit import *

ACScriptSuperMenuTitle = None
ACScriptMenuTitle = "Add Gray Border"

CIImage = objc.lookUpClass('CIImage')

def main(image):
	
	nsimg = image.NSImage()
	nsimg.lockFocus()
	NSColor.grayColor().set()
	path = NSBezierPath.bezierPathWithRect_(NSMakeRect(.5, .5, nsimg.size().width - 1,
	                                                   nsimg.size().height - 1))
	path.stroke()
	nsimg.unlockFocus()
	return CIImage.imageWithData_(nsimg.TIFFRepresentation())
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.3
Page was generated in 0.0891 seconds