Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;==============================================================================
- ; MITCHI Sprite Outliner
- ;------------------------------------------------------------------------------
- ; FU_spr_outline_mitchi.scm
- ; Script-FU version: 1.0b
- ; By: //mitchi.exe
- ; Site: azurecosmos.wordpress.com
- ; Last modified on: Feb. 7, 2012
- ; Tested on GIMP-2.6+
- ;------------------------------------------------------------------------------
- ; Description:
- ; This gimp script creates a black outline to the sprite easily. The current
- ; version does not work well with bounded sprites as well as autotiles.
- ;------------------------------------------------------------------------------
- (define (FU-spr-outline-mitchi image drawable trans-check mode outline)
- ; start an undo group
- (gimp-context-push)
- (gimp-image-undo-group-start image)
- ; if background is transparent, copy layer
- (let ((bg-layer (car (gimp-layer-copy drawable 1))))
- (gimp-drawable-set-name bg-layer "Background")
- (gimp-image-add-layer image bg-layer -1)
- ; fill bg-layer with foreground
- (gimp-context-set-foreground '(0 222 156))
- (gimp-edit-fill bg-layer 0)
- ;place layer at bottom, then merge down
- (gimp-image-lower-layer-to-bottom image bg-layer)
- (gimp-image-merge-visible-layers image 2)
- (define new-bg-layer (car (gimp-image-merge-visible-layers image 2)))
- ; create a layer
- (define out-layer (car (gimp-layer-copy new-bg-layer 1)))
- (gimp-drawable-set-name out-layer "OUTLINE")
- (gimp-image-add-layer image out-layer -1)
- (cond ((= mode TRUE) (begin (gimp-layer-set-mode out-layer 5))))
- ; remove background
- (gimp-by-color-select out-layer
- (car (gimp-image-pick-color image out-layer 1 1 FALSE FALSE 1)) 0 0 FALSE FALSE 0 FALSE )
- (gimp-edit-fill out-layer 3)
- (gimp-edit-clear out-layer)
- (cond ((= trans-check TRUE) (begin (gimp-edit-clear new-bg-layer))))
- (gimp-selection-invert image)
- ;process outline layer
- (gimp-edit-fill out-layer 2)
- (gimp-invert out-layer)
- (gimp-selection-shrink image 1)
- (gimp-edit-clear out-layer)
- (gimp-layer-set-opacity out-layer outline)
- ; select none
- (gimp-selection-none image)
- ;copy visible then paste as layer
- (gimp-edit-copy-visible image)
- (let* ((copy-layer (car (gimp-image-get-active-drawable image))))
- (gimp-floating-sel-to-layer (car (gimp-edit-paste copy-layer 1))))
- ;remove processed layers
- (gimp-image-remove-layer image out-layer)
- (gimp-image-remove-layer image new-bg-layer)
- ;finish the undo group
- (gimp-image-undo-group-end image)
- ;update image window
- (gimp-context-pop)
- (gimp-displays-flush)))
- (script-fu-register "FU-spr-outline-mitchi"
- "<Image>/Script-Fu/Mitchi/Sprite Outliner v1.0..."
- "Gives a black outline to the sprite"
- "//mitchi.exe"
- "AZURECOSMOS.wordpress.com"
- "Feb. 8, 2012"
- "RGB*"
- SF-IMAGE "Image" 0
- SF-DRAWABLE "Drawable" 0
- SF-TOGGLE "Work with transparent image" FALSE
- SF-TOGGLE "Overlay Mode" FALSE
- SF-ADJUSTMENT "Outline opacity" '(100 0 100 1 1 0 0)
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement