
Here is my color wheel script. This will generate a full color wheel and hue bars. The number of hue bars can be specified in the script options.
----
(define ( SupaColorWheel Colorbars )
;makes a new image and layer 1024x1024
(define img (car (gimp-image-new 1024 1024 0)))
(define baselayer (car(gimp-layer-new img 1024 1024 0 "layer 1" 100 0)))
(gimp-image-add-layer img baselayer -1)
;set up variables and constants
(define i 0)
(define j 0)
(define numrots 765)
(define numbars Colorbars)
(define barrot (/ 6.28318531 numbars))
(define barHuerot (/ 200 numbars))
;set base colors
(gimp-context-set-background '(255 255 255))
(gimp-context-set-foreground '(255 0 0))
;vv this loop draws the wheel.
(set! i 0)
(while (< i numrots)
;make new layer for color slice
(define colorlayer (car(gimp-layer-new img 3 256 0 "layer 1" 100 0)))
(gimp-image-add-layer img colorlayer -1)
;add red to white gradiant
(gimp-edit-blend colorlayer 3 0 0 100 0 0 FALSE FALSE 1 0 TRUE 256 0 256 256)
;change hue to angle
(gimp-hue-saturation colorlayer 0 (- (* 0.2614379085 i) 100) 0 0)
;move and rotate layer into position
(gimp-layer-translate colorlayer 512 256)
(gimp-drawable-transform-rotate colorlayer (* 0.008213314118 i) FALSE 512 512 0 2 TRUE 3 0)
;mergelayers
(gimp-image-merge-visible-layers img 2)
(set! i (+ i 1))
)
(set! j 0)
;reset colors to red and cyan so they are opposites
(gimp-context-set-background '(255 0 0))
(gimp-context-set-foreground '(0 255 255))
;vv draw bars
(while (< j numbars)
;make new layer for color bar
(define colorlayer (car(gimp-layer-new img 15 256 0 "layer 1" 100 0)))
(gimp-image-add-layer img colorlayer -1)
;add red and cyan gradiant
(gimp-edit-blend colorlayer 3 0 0 100 0 0 FALSE FALSE 1 0 TRUE 256 0 256 256)
;change hue to angle
(gimp-hue-saturation colorlayer 0 (- (* barHuerot j) 100) 0 0)
;move and rotate layer to position
(gimp-layer-translate colorlayer 512 0)
(gimp-drawable-transform-rotate colorlayer (* barrot j) FALSE 512 512 0 2 TRUE 3 0)
;flatten
(gimp-image-merge-visible-layers img 2)
(set! j (+ j 1))
)
(gimp-display-new img)
)
;register script
(script-fu-register
"SupaColorWheel" ;function name
"Supa ColorWheel" ;menu label
"Makes a Supa Color Wheel" ;description
"Eric Geusz" ;author
"copyright 2010" ;copyright notice
"FEB 23th 2010" ;date created
""
;lets player pick number of bars
SF-ADJUSTMENT "Colorbars" '(12 3 96 1 1 0 0) ;passes the number of sections to gimp
)
(script-fu-menu-register "SupaColorWheel" "<Image>Filters/IFDM/205")
----
No comments:
Post a Comment