https://github.com/samrocketman/libgimp.js
Goals: write plugins in JavaScript for GIMP.
https://github.com/samrocketman/libgimp.js
Last synced: 4 months ago
JSON representation
Goals: write plugins in JavaScript for GIMP.
- Host: GitHub
- URL: https://github.com/samrocketman/libgimp.js
- Owner: samrocketman
- License: other
- Created: 2015-09-16T22:28:42.000Z (almost 11 years ago)
- Default Branch: main
- Last Pushed: 2020-10-18T07:13:33.000Z (over 5 years ago)
- Last Synced: 2025-02-24T08:13:34.359Z (over 1 year ago)
- Language: Groff
- Size: 367 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README
- Changelog: ChangeLog
- License: COPYING
- Authors: AUTHORS
Awesome Lists containing this project
README
CIS 399: Libgimp
Javascript engine for GIMP
===================================================================
This repository contains our (Scott Freeman & Pratyusha Gupta) attempt at establishing a basic format for the Javascript plug-in development environment suggested by the GIMP community for the 2011 Google Summer of Code (http://wiki.gimp.org/wiki/Hacking:GSoC/2011/Ideas#Support_writing_JavaScript_plug-ins).
The vast majority of our files are in order to allow autobuild to occur. The actual terminal code is located in src/main.c. We had difficulty allowing automake to work due to issues with internationalizing using the tools provided. After reaching out to the community via IRC and attempting to contact the original authors (the template code is 11 years old), we were unable to resolve the issue. Thus, to build the code, please type ./configure and then make && make install as seperate commands.
Main.c has the following functionality:
static void query (void);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static void js_fu_submit (GtkWidget *widget,
GtkTextBuffer *buffer);
Query is the initalization function that sets up the basic parameters for the plugin. This includes, but is not limited to, the title, authors, add-on name, add-on type, parameters, etc.
The run function is called when the plug-in is loaded. This sets up our Gtk Widget. Specifically, our Gtk is set up as follows:
- A new dialog is created
- A box is packed into the dialog
- A scrolled window is backed into the box
- A text buffer and textbox are backed into the box
- A button is packed into the box
- There is a signal redirection from the button into js_fu_submit
The js_fu_submit command is called when the submit button is pressed. This method does the following:
- Creates a new file called main.js
- Execs a new instance of bash to run a script called script.js (described below), which executes our GObject Introspection
- The script first makes the js-greeter.c files, which contains the code for generating a simple GObject namespace.
- The namespace has an instance variable greetee and one one greet() method, which prints out "Hello, " + greetee.
- Then, Gjs takes our namespace and generates a JavaScript library that can be used
- The program also outputs a .gir file, which contains an XML representation of the Js namespace we created
- The script then takes in our generated JS file and generates a greeter binary, which will print out the message when run