; The GIMP -- an image manipulation program ; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; ; Glass Tile script for GIMP 1.2 ; Copyright (C) 2001 Iccii ; ; -------------------------------------------------------------------- ; version 0.1 by Iccii 2001/11/10 ; - Initial relase ; version 0.1a by Raymond Ostertag ; - Changed menu entry ; -------------------------------------------------------------------- ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; ; -- TODO -- ; * Layer Mask ; * Selection ; * Apply in INDEX nad GRAY image ;; Glass Tile script (define (script-fu-glass-tile img ;; Target Image drawable ;; Target Drawable (Layer) h-step ;; Step Width for glass v-step ;; Step Height for glass ) (let* ( (layer-copy (car (gimp-layer-copy drawable TRUE))) (layer-width (car (gimp-drawable-width layer-copy))) (layer-height (car (gimp-drawable-height layer-copy))) ) (define (horizontal-flip h-current) (let* ((next-h (min (- layer-width h-current) h-step))) (gimp-rect-select img h-current 0 next-h layer-height REPLACE FALSE 0.0) (gimp-flip layer-copy HORIZONTAL) (if (< (+ h-current h-step) layer-width) (horizontal-flip (+ h-current h-step))))) (define (vertival-flip v-current) (let* ((next-v (min (- layer-height v-current) v-step))) (gimp-rect-select img 0 v-current layer-width next-v REPLACE FALSE 0.0) (gimp-flip layer-copy VERTICAL) (if (< (+ v-current v-step) layer-height) (vertival-flip (+ v-current v-step))))) (gimp-undo-push-group-start img) (gimp-selection-none img) (gimp-image-add-layer img layer-copy -1) (if (and (< 0 h-step) (<= h-step layer-width)) (horizontal-flip 0)) (if (and (< 0 v-step) (<= v-step layer-height)) (vertival-flip 0)) (if (or (and (< 0 h-step) (<= h-step layer-width )) (and (< 0 v-step) (<= v-step layer-height))) (gimp-floating-sel-anchor (car (gimp-image-floating-selection img))) (begin (gimp-message "Amount is invalid. Skipped.") (gimp-image-remove-layer img layer-copy))) (gimp-undo-push-group-end img) (gimp-displays-flush) ) ; end of let* ) (script-fu-register "script-fu-glass-tile" "/Script-Fu/Alchemy/Glass Tile..." "Create glass tile image" "Iccii " "Iccii" "2001, Nov" "RGB*, GRAYA, INDEXEDA" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-ADJUSTMENT "Amount of Horizontal" '(8 0 100 1 10 0 1) SF-ADJUSTMENT "Amount of Vertical" '(0 0 100 1 10 0 1) )