2006-12-09 21:33:38 +00:00
|
|
|
; GIMP - The GNU Image Manipulation Program
|
2005-09-25 21:31:18 +00:00
|
|
|
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
2006-10-16 01:08:54 +00:00
|
|
|
;
|
2005-09-25 21:31:18 +00:00
|
|
|
; script-fu-paste-as-pattern
|
|
|
|
; Based on select-to-pattern by Cameron Gregory, http://www.flamingtext.com/
|
|
|
|
;
|
2009-01-17 22:28:01 +00:00
|
|
|
; This program is free software: you can redistribute it and/or modify
|
2005-09-25 21:31:18 +00:00
|
|
|
; it under the terms of the GNU General Public License as published by
|
2009-01-17 22:28:01 +00:00
|
|
|
; the Free Software Foundation; either version 3 of the License, or
|
2005-09-25 21:31:18 +00:00
|
|
|
; (at your option) any later version.
|
2006-10-16 01:08:54 +00:00
|
|
|
;
|
2005-09-25 21:31:18 +00:00
|
|
|
; 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.
|
2006-10-16 01:08:54 +00:00
|
|
|
;
|
2005-09-25 21:31:18 +00:00
|
|
|
; You should have received a copy of the GNU General Public License
|
2018-07-11 23:27:07 +02:00
|
|
|
; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2005-09-25 21:31:18 +00:00
|
|
|
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
(define (script-fu-paste-as-pattern name filename)
|
2016-09-20 20:23:04 +02:00
|
|
|
(let* ((pattern-image (car (gimp-edit-paste-as-new-image)))
|
2007-05-06 04:42:51 +00:00
|
|
|
(pattern-draw 0)
|
|
|
|
(path 0))
|
2005-09-25 21:31:18 +00:00
|
|
|
|
2007-05-06 04:42:51 +00:00
|
|
|
(if (= TRUE (car (gimp-image-is-valid pattern-image)))
|
|
|
|
(begin
|
|
|
|
(set! pattern-draw (car (gimp-image-get-active-drawable pattern-image)))
|
|
|
|
(set! path (string-append gimp-directory
|
|
|
|
"/patterns/"
|
|
|
|
filename
|
|
|
|
(number->string pattern-image)
|
|
|
|
".pat"))
|
2021-05-13 09:09:26 -04:00
|
|
|
|
2007-05-06 04:42:51 +00:00
|
|
|
(file-pat-save RUN-NONINTERACTIVE
|
2021-05-13 09:09:26 -04:00
|
|
|
pattern-image pattern-draw path
|
2007-05-06 04:42:51 +00:00
|
|
|
name)
|
2021-05-13 09:09:26 -04:00
|
|
|
|
2007-05-06 04:42:51 +00:00
|
|
|
(gimp-image-delete pattern-image)
|
2021-05-13 09:09:26 -04:00
|
|
|
|
2007-05-06 04:42:51 +00:00
|
|
|
(gimp-patterns-refresh)
|
|
|
|
(gimp-context-set-pattern name)
|
|
|
|
)
|
|
|
|
(gimp-message _"There is no image data in the clipboard to paste.")
|
|
|
|
)
|
2006-10-29 05:18:44 +00:00
|
|
|
)
|
2006-10-16 01:08:54 +00:00
|
|
|
)
|
|
|
|
|
2006-10-23 05:15:40 +00:00
|
|
|
(script-fu-register "script-fu-paste-as-pattern"
|
2006-10-16 01:08:54 +00:00
|
|
|
_"New _Pattern..."
|
|
|
|
_"Paste the clipboard contents into a new pattern"
|
|
|
|
"Michael Natterer <mitch@gimp.org>"
|
|
|
|
"Michael Natterer"
|
|
|
|
"2005-09-25"
|
|
|
|
""
|
Missing mnemonics on several dialogs
paste as brush, paste as pattern, select to new brush, select to new pattern
fill selection outline, fill path, stroke selection, distort, rounded rectangle
indexed color conversion, merge visible layers, new guide, new guide (by percent)
image properties, newsprint, fractal explorer, sample colorize, new layer
metadata editor (just a button), spyroplus (only common buttons)
2019-09-05 12:44:17 +00:00
|
|
|
SF-STRING _"_Pattern name" "My Pattern"
|
|
|
|
SF-STRING _"_File name" "mypattern"
|
2006-10-16 01:08:54 +00:00
|
|
|
)
|
2005-09-25 21:31:18 +00:00
|
|
|
|
|
|
|
(script-fu-menu-register "script-fu-paste-as-pattern"
|
2006-10-16 01:08:54 +00:00
|
|
|
"<Image>/Edit/Paste as")
|