Files
gimp/plug-ins/script-fu/scripts/test/ts-helloworld.scm
lloyd konneker 96e02122b8 ScriptFu: plugins: port to script-fu-register-regular
Ported all supported/shipped Scheme plugins in the repo
that formerly called script-fu-register.
No test plugins were ported.

The plugins now use the new dialog, GimpProcedureDialog.

These are the plugins that are not filters i.e. not GimpImageProcedure,
which were ported earlier to script-fu-register-filter.

The test plugin Demo>Sphere demonstrates that while script-fu-register
is now deprecated, it still works, showing the old dialog.

Misc bug fix to prior commits.

Misc porting of same plugins to v3 binding of PDB return values.

Misc fixes: invalid default font names, and deprecated PDB calls.
2024-09-27 14:35:50 +00:00

67 lines
2.2 KiB
Scheme

#!/usr/bin/env gimp-script-fu-interpreter-3.0
; "Hello, World" Test v1.00 February 29, 2004
; by Kevin Cozens <kcozens@interlog.com>
;
; Creates an image with the text "Hello, World!"
; This was the first TinyScheme based script ever created and run for the
; 2.x version of GIMP.
; GIMP - The GNU Image Manipulation Program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
;
; 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 3 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, see <https://www.gnu.org/licenses/>.
;
; Tiny-Fu first successfully ran this script at 2:07am on March 6, 2004.
(define (script-fu-helloworld text font size color)
(script-fu-use-v3)
(let* (
(width 10)
(height 10)
(img (gimp-image-new width height RGB))
(text-layer)
)
(gimp-context-push)
(gimp-image-undo-disable img)
(gimp-context-set-foreground color)
(set! text-layer (gimp-text-font img -1 0 0 text 10 TRUE size font))
(set! width (gimp-drawable-get-width text-layer))
(set! height (gimp-drawable-get-height text-layer))
(gimp-image-resize img width height 0 0)
(gimp-image-undo-enable img)
(gimp-display-new img)
(gimp-context-pop)
)
)
(script-fu-register-regular "script-fu-helloworld"
"_Hello World..."
"Creates an image of a text string."
"Kevin Cozens <kcozens@interlog.com>"
"February 29, 2004"
SF-STRING "Text string" "Hello, World!"
SF-FONT "Font" "Sans-serif"
SF-ADJUSTMENT "Font size (pixels)" '(100 2 1000 1 10 0 1)
SF-COLOR "Color" '(0 0 0)
)
(script-fu-menu-register "script-fu-helloworld"
"<Image>/Filters/Development/Demos")