GIMP/Programowanie: Różnice pomiędzy wersjami

brak opisu edycji
m (→‎C: link)
Nie podano opisu zmian
*[http://www.home.unix-ag.org/simon/files/script-fu-template.scm Wzorzec nr 1 skryptu]
* wzorzec demo.scm, który nic nie robi:<ref>[http://riceball.com/d/content/gimp-script-fu-notes-jamcam-cleanup-plugins GIMP Script-Fu Notes: JamCam Cleanup Plugins Submitted by johnk ]</ref>
<sourcesyntaxhighlight lang="scheme">
(define (script-fu-demo image
drawable)
(script-fu-menu-register "script-fu-demo"
_"/Script-Fu/Demo")
</syntaxhighlight>
</source>
 
Każdy skrypt '''musi zawierać''':<ref>[http://docs.gimp.org/en/gimp-using-script-fu-tutorial-first-script.html Your First Script-Fu Script - gimp docs]</ref>
Za pomocą funkcji script-fu-register dodajemy tylko etykietę menu <ref>[http://git.gnome.org/browse/gimp/commit/?id=d4120fe1ab54812a805d920e5c5ca695ab60b956 commit d4120fe1ab54812a805d920e5c5ca695ab60b956: Updated all scripts to use script-fu-menu-register and pass just the menu by Kevin Cozens 2004-11-22]</ref>
 
<sourcesyntaxhighlight lang="scheme">
(script-fu-register "script-fu-xach-effect"
_"_Xach-Effect..." ; pass just the menu label in script-fu-register
SF-TOGGLE _"Keep selection" TRUE
)
</syntaxhighlight>
</source>
 
Za pomocą funkcji script-fu-menu-register dodajemy pozycję menu (ang. menu-item) w postaci łańcucha zawierającego pełną ścieżkę i zaczynającego się od:
* <Toolbox>/Xtns/ dla menu głównego:<ref>[http://developer.gimp.org/api/2.0/libgimp/libgimp-gimpplugin.html#gimp-plugin-menu-register gimp-plugin-menu-register at GIMP Library Reference Manual]</ref><ref>[http://imagic.weizmann.ac.il/~dov/gimp/scheme-tut.html A Scheme Tutorial for Gimp Users Updated for Gimp-1.2 by Dov Grobgeld]</ref>
 
<sourcesyntaxhighlight lang="scheme">
(script-fu-menu-register "script-fu-xach-effect"
"<Image>/Filters/Light and Shadow/Shadow")
; the script will be available through the gimp menu that is launched by the right mouse button over an image: the popup image menu
; Such script must also have as their first and second argument a SF-IMAGE and a SF-DRAWABLE.
</syntaxhighlight>
</source>
 
inny przykład:<ref>[http://imagic.weizmann.ac.il/~dov/gimp/scheme-tut.html A Scheme Tutorial for Gimp Users Updated for Gimp-1.2 by Dov Grobgeld]</ref>
<sourcesyntaxhighlight lang="scheme">
(script-fu-menu-register "uni-img"
"<Toolbox>/Xtns/Script-Fu/Tutorials")
; through the gimp menu that is launched by the right mouse button over an image
; Such script must also have as their first and second argument a SF-IMAGE and a SF-DRAWABLE.
</syntaxhighlight>
</source>
 
====Rejestracja skryptu====