; guidegridadd.scm --- Add a grid of guides to your image ; Author: Branko Collin ; Created: 29 August 2001 ; Version: 0.1 ; Keywords: GIMP, guides, grid ; Version 0.1a by Raymond Ostertag : Changed menu entry ; ; Copyright (C) 2001 Branko Collin ; ; 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. ; ; Copyright (C) 2001 Branko Collin ; ; This script makes a grid of guides in the selected GIMP image ; window. It has basically the same functionality as Seth Burgess' ; Perl-fu script, although it was mostly clean-room coded. ; ; Thanks go to Brendon Humphrey who, in his Perl-fu Remove Guides ; script, showed a trick to refresh the image window. (define (script-fu-guide-grid-add img drawable x_off y_off x_jump y_jump clear) ; how about setting up some variables? (let* ((width (car (gimp-image-width img))) (height (car (gimp-image-height img))) (curr-guide 0) (xpos x_off) (ypos y_off) (max 0)) (gimp-undo-push-group-start img) ; clear all currently avaiable guides? (set! curr-guide (car (gimp-image-find-next-guide img 0))) (if (= clear 1) ( begin (while (> curr-guide 0) (gimp-image-delete-guide img curr-guide) (set! curr-guide (car (gimp-image-find-next-guide img 0))) ) ; refresh display trick (gimp-selection-all img) (gimp-selection-none img))) ; loop so that horizontal guides get built (set! max height) (if (> y_jump 0) (while (< ypos max) (gimp-image-add-hguide img ypos) (set! ypos (+ ypos y_jump)))) ; loop so that vertical guides get built (set! max width) (if (> x_jump 0) (while (< xpos max) (gimp-image-add-vguide img xpos) (set! xpos (+ xpos x_jump)))) (gimp-selection-none img) (gimp-undo-push-group-end img) (gimp-displays-flush))) (script-fu-register "script-fu-guide-grid-add" _"/Script-Fu/Guides/Grid of Guides..." _"Makes or removes a grid of guides. Offset indicates the row or column that the first grid line should begin in, Spacing the amount of lines or columns the next guide should be." "Branko Collin" "Branko Collin" _"August 2001" "RGB* GRAY* INDEXED*" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-ADJUSTMENT _"Offset X" '(1 1 256 1 10 0 1) SF-ADJUSTMENT _"Offset Y" '(1 1 256 1 10 0 1) SF-ADJUSTMENT _"Spacing X" '(10 0 256 1 10 0 1) SF-ADJUSTMENT _"Spacing Y" '(10 0 256 1 10 0 1) SF-TOGGLE _"Clear existing guides" 0) ;;; guidegridadd.scm ends here