| René Nyffenegger's collection of things on the web | |
|
René Nyffenegger on Oracle - Most wanted - Feedback
|
Script-fu example 05: Drawing lines with different brush spacings | ||
|
Creates a 250x250 picture and draws some lines into it. The look of the lines is varied
by changing the brushes spacing with gimp-brush-set-spacing.
ex_05.scm
(define (ex_05)
(let* (
(my_image (car (gimp-image-new 250 250 RGB )))
(my_layer (car (gimp-layer-new my_image 250 250 RGB-IMAGE "my layer" 0 NORMAL)))
(line_points_1 (cons-array 4 'double)) ; line_points: Array of 4 doubles
(line_points_2 (cons-array 4 'double)) ; line_points: Array of 4 doubles
(line_points_3 (cons-array 4 'double)) ; line_points: Array of 4 doubles
(line_points_4 (cons-array 4 'double)) ; line_points: Array of 4 doubles
(line_points_5 (cons-array 4 'double)) ; line_points: Array of 4 doubles
)
(aset line_points_1 0 25) ; x1
(aset line_points_1 1 25) ; y1
(aset line_points_1 2 225) ; x2
(aset line_points_1 3 25) ; y2
(aset line_points_2 0 25) ; x1
(aset line_points_2 1 75) ; y1
(aset line_points_2 2 225) ; x2
(aset line_points_2 3 75) ; y2
(aset line_points_3 0 25) ; x1
(aset line_points_3 1 125) ; y1
(aset line_points_3 2 225) ; x2
(aset line_points_3 3 125) ; y2
(aset line_points_4 0 25) ; x1
(aset line_points_4 1 175) ; y1
(aset line_points_4 2 225) ; x2
(aset line_points_4 3 175) ; y2
(aset line_points_5 0 25) ; x1
(aset line_points_5 1 225) ; y1
(aset line_points_5 2 225) ; x2
(aset line_points_5 3 225) ; y2
(gimp-image-add-layer my_image my_layer 0)
(gimp-context-set-background '(255 255 255))
(gimp-context-set-foreground '(000 000 000))
(gimp-drawable-fill my_layer BACKGROUND-FILL)
(gimp-brushes-set-brush "Circle (11)")
(gimp-brush-set-spacing "Circle (11)" 1)
(gimp-pencil my_layer 4 line_points_1)
(gimp-brush-set-spacing "Circle (11)" 50)
(gimp-pencil my_layer 4 line_points_2)
(gimp-brush-set-spacing "Circle (11)" 100)
(gimp-pencil my_layer 4 line_points_3)
(gimp-brush-set-spacing "Circle (11)" 500)
(gimp-pencil my_layer 4 line_points_4)
(gimp-brush-set-spacing "Circle (11)" 1000)
(gimp-pencil my_layer 4 line_points_5)
(gimp-file-save RUN-NONINTERACTIVE my_image my_layer "c:\\temp\\ex_05.jpg" "")
)
)
c:\> start gimp-2.2.exe -d -i -b "(ex_05)" "(gimp-quit 0)"
See also other examples
|