### Example Valgrind Output
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/analyze-plug-ins-tutorial.md
Displays a typical initial line of output from Valgrind when it starts analyzing a GIMP plugin. This line confirms that Valgrind's Memcheck tool is active and monitoring for memory errors.
```Valgrind
==464== Memcheck, a memory error detector
```
--------------------------------
### Compiling and Installing GIMP Plug-ins using gimptool-2.0 (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/writing-a-plug-in/1.md
This command demonstrates how to compile and install a GIMP plug-in from a C source file using the `gimptool-2.0` utility. It shows options for installing into a private user directory (`--install`) or a global administrative directory (`--install-admin`). This utility is essential for making plug-ins available to GIMP.
```Shell
gimptool-2.0 --install plugin.c or gimptool-2.0 --install-admin plugin.c
```
--------------------------------
### Compiling and Installing GIMP with Autotools (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/_index.md
After configuring the build, these commands compile the GIMP source code (`make`) and then install the compiled binaries and associated files into the specified `GIMP_PREFIX` directory (`make install`).
```sh
make && make install
```
--------------------------------
### Building and Installing GIMP 2.10 (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/api.md
These commands are used to compile and install GIMP 2.10 after it has been configured. `make` compiles the source code, and `make install` places the compiled binaries and associated files into the directory specified by `$GIMP_PREFIX` during the configuration step.
```sh
make
make install
```
--------------------------------
### Testing GIMP Plugin App Installer (PowerShell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/windows-plugin-packaging.md
Tests the configured .appinstaller file by attempting to install it. This command verifies that the auto-update mechanism is correctly set up and that the application can be installed via the App Installer file.
```shell
Add-AppxPackage -Path *.appinstaller -Appinstaller
```
--------------------------------
### Building GIMP with Meson (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/_index.md
This snippet outlines the standard build process for GIMP using the Meson build system. It involves creating a build directory, configuring the project with Meson, and then compiling and installing using Ninja. The GIMP_PREFIX variable specifies the installation directory.
```sh
mkdir gimp/_build && cd gimp/_build
meson setup .. -Dprefix="${GIMP_PREFIX}"
ninja && ninja install
```
--------------------------------
### Installing GIMP Plugin MSIX Bundle for Testing (PowerShell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/windows-plugin-packaging.md
Installs the packaged MSIX bundle for testing purposes. This command simulates the end-user installation process, allowing developers to verify the package's functionality before distribution. An optional '-AllowUnsigned' flag can be used for unsigned packages.
```shell
Add-AppxPackage -Path *.msixbundle
```
--------------------------------
### Installing Flatpak Runtimes and SDKs
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/Linux.md
This command sequence adds the GNOME Nightly and Flathub Flatpak repositories, then installs the necessary GNOME Platform, GNOME SDK, and LLVM17 extension runtimes for building GIMP. These are prerequisites for the GIMP development environment.
```Shell
flatpak remote-add --user --from gnome https://nightly.gnome.org/gnome-nightly.flatpakrepo
flatpak install --user gnome org.gnome.Platform/${ARCH}/master org.gnome.Sdk/${ARCH}/master
flatpak remote-add --user --from flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install --user flathub org.freedesktop.Sdk.Extension.llvm17
```
--------------------------------
### Building and Installing GIMP - Shell
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/debug/problems_and_solutions.md
This command compiles the GIMP source code and then installs the compiled binaries and libraries to the specified prefix. It's the final step in the build process, making the software available for use.
```Shell
make && make install
```
--------------------------------
### Compiling and Installing GIMP with Flatpak
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/Linux.md
This sequence of commands first creates and navigates into a build directory. Then, it uses `flatpak build` to configure GIMP with Meson, compile it with Ninja, and finally install it into the Flatpak prefix. This completes the GIMP application build process.
```Shell
mkdir _build-${ARCH} && cd _build-${ARCH}
flatpak build "${GIMP_PREFIX}" meson setup .. -Dprefix=/app/ -Dlibdir=/app/lib/
flatpak build "${GIMP_PREFIX}" ninja
flatpak build "${GIMP_PREFIX}" ninja install
```
--------------------------------
### GIMP API Documentation Default Installation Path
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/faq.md
This snippet indicates the standard installation directory for the GIMP API reference documentation. The `$PREFIX` variable represents the installation prefix, which is typically `/usr/local` or `/usr`.
```Shell
$PREFIX/share/doc/
```
--------------------------------
### Installing GIMP 2.99 Unstable Branch Dependencies (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/Windows.md
This `pacman` command initiates the installation of dependencies for the GIMP 2.99 development branch. Users must replace "unstable deps list" with the actual, frequently updated list of dependencies found in the `all-deps-uni.txt` file from the GIMP GitLab repository.
```sh
pacman -S --needed \
git \
base-devel \
${MINGW_PACKAGE_PREFIX}-toolchain \
unstable deps list
```
--------------------------------
### Installing GIMP 2.10 Stable Branch Dependencies (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/Windows.md
This `pacman` command installs all necessary build dependencies for the GIMP 2.10 stable branch within the MSYS2 environment. The `--needed` flag ensures only missing packages are installed, and `${MINGW_PACKAGE_PREFIX}` automatically resolves to the correct toolchain prefix (e.g., `mingw-w64-x86_64`).
```sh
pacman -S --needed \
git \
base-devel \
${MINGW_PACKAGE_PREFIX}-toolchain \
${MINGW_PACKAGE_PREFIX}-asciidoc \
${MINGW_PACKAGE_PREFIX}-drmingw \
${MINGW_PACKAGE_PREFIX}-gexiv2 \
${MINGW_PACKAGE_PREFIX}-gettext-tools \
${MINGW_PACKAGE_PREFIX}-ghostscript \
${MINGW_PACKAGE_PREFIX}-glib-networking \
${MINGW_PACKAGE_PREFIX}-graphviz \
${MINGW_PACKAGE_PREFIX}-gtk2 \
${MINGW_PACKAGE_PREFIX}-gobject-introspection \
${MINGW_PACKAGE_PREFIX}-iso-codes \
${MINGW_PACKAGE_PREFIX}-json-c \
${MINGW_PACKAGE_PREFIX}-json-glib \
${MINGW_PACKAGE_PREFIX}-lcms2 \
${MINGW_PACKAGE_PREFIX}-lensfun \
${MINGW_PACKAGE_PREFIX}-libheif \
${MINGW_PACKAGE_PREFIX}-libraw \
${MINGW_PACKAGE_PREFIX}-libspiro \
${MINGW_PACKAGE_PREFIX}-libwebp \
${MINGW_PACKAGE_PREFIX}-libwmf \
${MINGW_PACKAGE_PREFIX}-meson \
${MINGW_PACKAGE_PREFIX}-mypaint-brushes \
${MINGW_PACKAGE_PREFIX}-openexr \
${MINGW_PACKAGE_PREFIX}-poppler \
${MINGW_PACKAGE_PREFIX}-python2-pygtk \
${MINGW_PACKAGE_PREFIX}-SDL2 \
${MINGW_PACKAGE_PREFIX}-suitesparse \
${MINGW_PACKAGE_PREFIX}-xpm-nox
```
--------------------------------
### Starting GIMP with Plugin Debugging Enabled
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/analyze-plug-ins-tutorial.md
This command starts the GIMP application from the terminal after the GIMP_PLUGIN_DEBUG_WRAP and GIMP_PLUGIN_DEBUG_WRAPPER environment variables have been set. When GIMP launches, any plugins it invokes will be automatically wrapped by the specified debugging tool (e.g., Valgrind), allowing for analysis of their runtime behavior.
```Shell
>gimp
```
--------------------------------
### Building GIMP Documentation Locally (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build-gimp-web.md
This snippet provides the shell commands to clone the GIMP documentation repository, navigate into it, set the desired language, configure the build system, and compile the documentation. It requires `git` and the previously listed DocBook dependencies to be installed.
```Shell
git clone --depth=0 git@gitlab.gnome.org:GNOME/gimp-help.git
cd gimp-help
# Set this variable to your own language. It should correspond to a directory in the "po" source folder.
export LINGUAS=en
./autogen.sh [--without-gimp ALL_LINGUAS="en"]
make
make pdf-local
```
--------------------------------
### Building Babl and GEGL with Meson (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/_index.md
This snippet outlines the standard Meson build process for `babl` (and similarly for `GEGL`). It involves creating an out-of-source build directory, configuring the build with the specified `GIMP_PREFIX`, and then compiling and installing the project using `ninja`.
```sh
mkdir babl/_build && cd babl/_build
meson setup .. -Dprefix="${GIMP_PREFIX}"
ninja && ninja install
```
--------------------------------
### Diagnosing `make install` Failures with Libtool
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/debug/problems_and_solutions.md
This snippet displays the error log from a `make install` command failing due to `libtool`'s inability to install files to a directory not matching the expected prefix. This typically occurs when a previous build used a different installation prefix, leaving conflicting `.la` files.
```sh
make[3]: Entering directory `/home/$your_username/build/gegl-master/operations/core`
/usr/bin/install -c -d /home/$your_username/gimp-install/gimp-feature2/lib/gegl-0.3
for i in clone.la convert-format.la crop.la nop.la; do \
/bin/bash ../../libtool --mode=install /usr/bin/install -c $i /home/$your_username/gimp-install/gimp-feature2/lib/gegl-0.3 ; \
done
libtool: install: error: cannot install `clone.la' to a directory not ending in /home/$your_username/gimp-install/gimp-master/lib/gegl-0.3
libtool: install: error: cannot install `convert-format.la' to a directory not ending in /home/$your_username/gimp-install/gimp-master/lib/gegl-0.3
libtool: install: error: cannot install `crop.la' to a directory not ending in /home/$your_username/gimp-install/gimp-master/lib/gegl-0.3
libtool: install: error: cannot install `nop.la' to a directory not ending in /home/$your_username/gimp-install/gimp-master/lib/gegl-0.3
make[3]: *** [install-exec-local] Error 1
make[3]: Leaving directory `/home/$your_username/build/gegl-master/operations/core`
make[2]: *** [install-am] Error 2
make[2]: Leaving directory `/home/$your_username/build/gegl-master/operations/core`
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/$your_username/build/gegl-master/operations`
make: *** [install-recursive] Error 1
```
--------------------------------
### Starting Headless Gimp ScriptFu Server
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/script-fu/scriptfu-tools.md
This command launches Gimp in a non-graphical (headless) mode and immediately executes a batch command to start the ScriptFu server. The server is configured to listen on `127.0.0.1` (localhost) at port `10008` and log its activity to `/tmp/SFserver.log`.
```Shell
>gimp --no-interface --batch-interpreter=script-fu-eval
--batch="(plug-in-script-fu-server 1 \"127.0.0.1\" 10008 \"/tmp/SFserver.log\" )"
```
--------------------------------
### Fetching Theme Assets with npm/yarn (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/README.md
This snippet navigates into the theme's assets directory and then installs project dependencies using `npm install` (or `yarn install`). This step is required to fetch front-end assets for the Hugo theme.
```sh
$ cd themes/hugo-bootstrap-bare/assets
$ npm install # (or yarn install)
```
--------------------------------
### Installing GIMP Build Dependencies with dnf
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/Linux.md
This command installs all packages required to build the supported GIMP version on Fedora and other distributions using the `dnf` package manager. Note that `builddep` might need to be installed as a `dnf` plugin first.
```Shell
sudo dnf builddep gimp
```
--------------------------------
### Generating GIMP API Documentation (GIMP 2.10)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/faq.md
For GIMP 2.10, this snippet shows how to enable API documentation generation by passing a specific flag to the `configure` script. It also specifies the installation path where the generated GTK-Doc documentation will be located.
```Shell
--enable-gtk-doc
```
```Path
$PREFIX/share/gtk-doc/html
```
--------------------------------
### Starting GDB Server for Remote Debugging (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/debug/debugging-tips.md
This command sequence starts GIMP within a Flatpak environment with a `gdbserver` listening on port 9999. This allows for remote debugging, which is useful when GIMP might grab input devices, preventing direct interaction with the debugger.
```Shell
$ flatpak run --devel --command=bash org.gimp.GIMP//beta
$ gdbserver :9999 /app/bin/gimp-2.99
```
--------------------------------
### Updating Flatpak Runtimes and SDKs
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/Linux.md
This command updates all installed Flatpak applications, runtimes, and SDKs. It should be used if the necessary components are already installed and just need to be brought up to date.
```Shell
flatpak update
```
--------------------------------
### Starting Python 2 ScriptFu Test Client
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/script-fu/scriptfu-tools.md
This command initiates the `servertest.py` client, a Python 2 program for interacting with the ScriptFu server. It defaults to connecting to `localhost` on port `10008` and allows users to input Scheme snippets for execution.
```Shell
python2 gimp/plug-ins/script-fu/server/servertest.py
```
--------------------------------
### Installing gtk-mac-bundler (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/macOS.md
This script checks if 'gtk-mac-bundler' is already present in the user's 'Source' directory. If not, it creates the directory, clones the 'gtk-mac-bundler' repository, navigates into it, and then compiles and installs the bundler, which is necessary for packaging GTK applications on macOS.
```sh
if [ ! -d ~/Source/gtk-mac-bundler ]; then
mkdir -p ~/Source
cd ~/Source
git clone https://gitlab.gnome.org/lukaso/gtk-mac-bundler
cd gtk-mac-bundler
make install
fi
```
--------------------------------
### Installing Xcode Command Line Tools (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/macOS.md
This command installs the essential Xcode Command Line Tools, which are a prerequisite for many development tasks on macOS, including compiling software like GIMP.
```sh
xcode-select --install
```
--------------------------------
### Installing MacPorts (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/macOS.md
This command executes the 'macports0_install.sh' script to install MacPorts, a package management system for macOS. The '--homedirgimpX' argument specifies a custom installation directory, likely related to the GIMP build environment.
```sh
macports0_install.sh --homedirgimpX
```
--------------------------------
### Installing GIMP Build Dependencies with apt
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/Linux.md
This command installs all necessary packages required to build the specific GIMP version supported by Debian-based distributions (e.g., Ubuntu, Linux Mint) using the `apt` package manager. It streamlines the process of setting up the build environment.
```Shell
sudo apt build-dep gimp
```
--------------------------------
### Building GIMP Application with MacPorts (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/macOS.md
This command runs 'macports2_install_gimp.sh', which compiles and installs the GIMP application using the MacPorts environment. This script handles the GIMP source code compilation, linking, and initial installation into the designated build directory.
```sh
macports2_install_gimp.sh
```
--------------------------------
### Example Scheme Snippet for gimp-exec
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/script-fu/scriptfu-tools.md
This Scheme code demonstrates a simple arithmetic operation and a call to `gimp-message`. It's designed to be placed in a file (e.g., `test.scm`) and sent to the ScriptFu server via the `gimp-exec` client, illustrating basic server interaction and side effects.
```Scheme
(+ 2 3)
(gimp-message "test")
```
--------------------------------
### Installing GIMP Flatpak Debug Symbols (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/debug/debugging-tips.md
These commands install debug symbols for GIMP and the GNOME SDK within the Flatpak environment. This is crucial for obtaining detailed stack traces and using debug tools like `gdb` effectively.
```Shell
flatpak install flathub org.gimp.GIMP.Debug
flatpak install flathub org.gnome.Sdk.Debug
```
--------------------------------
### Debugging GIMP with GDB
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/analyze-plug-ins-tutorial.md
This command starts the GIMP application under the control of the GDB debugger. It allows users to debug GIMP itself, setting breakpoints and inspecting its execution flow from the terminal.
```Shell
gdb gimp
```
--------------------------------
### Setting Flatpak Architecture and Install Path
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/Linux.md
These commands set environment variables for building GIMP with Flatpak. `ARCH` specifies the target architecture (e.g., 'x86_64'), and `GIMP_PREFIX` defines the installation path for Flatpak build files, typically within the current working directory.
```Shell
export ARCH="x86_64"
export GIMP_PREFIX="`pwd`/_install-${ARCH}"
```
--------------------------------
### Starting Script-Fu Server Headless on Loopback
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/script-fu/scriptfu-tools.md
This command starts the Script-Fu server in a fully headless mode using `gimp-console-2.99`. It specifies the `plug-in-script-fu-eval` interpreter and executes a batch command to run `plug-in-script-fu-server` on the loopback address (127.0.0.1) at port 10008, logging output to `/tmp/SF.log`. Note that double quotes within the batch command are escaped for shell compatibility.
```Shell
gimp-console-2.99 --batch-interpreter=plug-in-script-fu-eval\n --batch=\"(plug-in-script-fu-server 1 \\\"127.0.0.1\\\" 10008 \\\"/tmp/SF.log\\\" )\"
```
--------------------------------
### GDB Waiting Prompt
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/analyze-plug-ins-tutorial.md
Shows the typical output in the terminal when GDB is waiting for user input after starting the GIMP ScriptFu extension. The `(gdb)` prompt indicates that GDB is ready to accept commands like 'r' (run) or breakpoint settings.
```GDB
...
Reading symbols from /usr/.../script-fu...
(gdb)
```
--------------------------------
### Configuring GIMP 2.10 for Documentation Generation (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/api.md
This command configures the GIMP 2.10 build system to enable the generation of developer documentation. It uses `gtk-doc` to build documentation (`--enable-gtk-doc`) and specifically builds documentation for the GIMP application itself, not just the `libgimp*` libraries (`--enable-gtk-doc-app`). `$GIMP_PREFIX` specifies the installation directory for GIMP.
```sh
configure --prefix=$GIMP_PREFIX --enable-gtk-doc --enable-gtk-doc-app
```
--------------------------------
### Example GDB Command for ScriptFu Debugging
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/analyze-plug-ins-tutorial.md
Illustrates the actual GDB command GIMP spawns internally when debugging the ScriptFu extension. It shows how GIMP passes various arguments to the `script-fu` executable after the `--args` flag.
```GDB
gdb --args /usr/local/lib/gimp/3.0/plug-ins/script-fu/script-fu
-gimp 274 15 14 -run 1
```
--------------------------------
### Configuring GIMP Build with Prefix - Shell
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/debug/problems_and_solutions.md
This command configures the GIMP build system, specifying the installation prefix. For Git users, `autogen.sh` is used to generate the configure script before running it. It sets up the build environment according to the specified installation path.
```Shell
./configure --prefix=$PREFIX
```
```Shell
./autogen.sh --prefix=$PREFIX
```
--------------------------------
### Python ScriptFu Client Initial Prompt
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/script-fu/scriptfu-tools.md
This snippet displays the expected console output when the `servertest.py` client successfully starts. It shows the client's banner, 'Script-Fu-Remote - Testclient', followed by the `>` prompt, indicating readiness for user input.
```Text
Script-Fu-Remote - Testclient
>
```
--------------------------------
### Building GIMP DMG Installer (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/macOS.md
This command runs 'macports4_build_dmg.sh', which creates a Disk Image (DMG) file for the GIMP application. The DMG serves as the installer for macOS, containing the packaged GIMP.app and other necessary files for distribution.
```sh
macports4_build_dmg.sh
```
--------------------------------
### Implementing GIMP Plug-in Core Logic (C)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/writing-a-plug-in/1.md
The `run()` function contains the main execution logic of the GIMP plug-in. It handles input parameters, sets mandatory output values (like plug-in status), and processes the plug-in's functionality. This example demonstrates retrieving the `run_mode` and conditionally displaying a 'Hello, world!' message based on whether the plug-in is run interactively or non-interactively.
```C
static void
run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
/* Setting mandatory output values */
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
/* Getting run_mode - we won't display a dialog if
* we are in NONINTERACTIVE mode */
run_mode = param[0].data.d_int32;
if (run_mode != GIMP_RUN_NONINTERACTIVE)
g_message("Hello, world!\n");
}
```
--------------------------------
### Starting GIMP with Plugin Debugging Enabled
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/debug-plug-ins.md
This command starts GIMP with the GIMP_PLUGIN_DEBUG environment variable set to all,fatal-criticals. This configuration enables backtrace generation for all plugins when a CRITICAL or worse log event occurs, allowing for debugging of plugin termination.
```sh
GIMP_PLUGIN_DEBUG=all,fatal-criticals gimp
```
--------------------------------
### Out-of-Tree GIMP Autotools Build (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/_index.md
This snippet demonstrates how to perform an out-of-tree build for GIMP using Autotools. It involves creating a separate build directory, changing into it, and then invoking the `configure` script from the parent source directory, followed by compilation and installation.
```sh
mkdir _build && cd _build
../configure --prefix=${GIMP_PREFIX} && make && make install
```
--------------------------------
### Configuring GIMP Plugin Auto-Update with App Installer (XML)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/windows-plugin-packaging.md
Defines an App Installer (.appinstaller) file to enable automatic updates for the GIMP plugin. This XML configuration specifies the bundle's name, publisher, version, URI, and update check frequency, ensuring users always have the latest version outside of a store.
```xml
```
--------------------------------
### Starting Script-Fu Text Console with GIMP (Interactive)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/script-fu/scriptfu-tools.md
This command launches the Script-Fu text console using the standard GIMP executable. It uses `--no-interface` to prevent a graphical user interface, `--batch-interpreter=script-fu-eval` to specify the Script-Fu interpreter, and `--batch=-` to read commands interactively from standard input, allowing for direct Scheme/Script-Fu execution.
```Shell
gimp --no-interface --batch-interpreter=script-fu-eval --batch=-
```
--------------------------------
### Serving GIMP Developer Website Locally for Testing (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/README.md
This command starts a local development server for the GIMP developer website using Hugo. It hosts the site on `localhost:1313` by default and provides live reloading, making it ideal for testing changes during development.
```sh
$ hugo serve
```
--------------------------------
### Valgrind Initial Output for ScriptFu Extension
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/analyze-plug-ins-tutorial.md
This terminal output displays the initial message from Valgrind when it starts monitoring the GIMP ScriptFu extension. It indicates that the Memcheck tool, used for detecting memory errors, is active and will report any issues found during execution.
```Shell
==464== Memcheck, a memory error detector
```
--------------------------------
### Locating Generated GIMP 2.10 Documentation (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/api.md
This command navigates to the directory where the HTML-formatted developer documentation for GIMP 2.10 is generated. The documentation is typically found within the `share/gtk-doc/html` subdirectory of the GIMP installation prefix (`$GIMP_PREFIX`). From here, users can open `index.html` for an overview.
```sh
cd $GIMP_PREFIX/share/gtk-doc/html
```
--------------------------------
### Building GIMP with Autotools from Git (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/_index.md
This command is used when building GIMP from a Git checkout (unstable branch `master` or stable branch `gimp-2-10` if using autotools). It executes `autogen.sh`, which generates and runs the `configure` script, setting the installation prefix to `GIMP_PREFIX`.
```sh
./autogen.sh --prefix=${GIMP_PREFIX}
```
--------------------------------
### Converting ScriptFu Closure to String Representation
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/script-fu/scriptfu-messaging.md
This example demonstrates using `any->string` to get the string representation of a Scheme closure, specifically `gimp-message`. The output shows the "sharp constant" representation for a function object.
```Scheme
(any->string gimp-message)
```
```Output
#
```
--------------------------------
### Building GIMP Dependencies with MacPorts (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/macOS.md
This command executes 'macports1_install_packages.sh', a script responsible for installing all necessary GIMP dependencies using MacPorts. This step ensures that all required libraries and tools are available before compiling GIMP itself.
```sh
macports1_install_packages.sh
```
--------------------------------
### Starting Script-Fu Text Console with Headless GIMP
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/script-fu/scriptfu-tools.md
This command initiates the Script-Fu text console using `gimp-console-2.99`, a version of GIMP built without a graphical toolkit. This enables a fully headless operation for interactive Script-Fu sessions directly within a terminal, suitable for server environments or automated tasks.
```Shell
gimp-console-2.99 --batch-interpreter=plug-in-script-fu-eval --batch=-
```
--------------------------------
### Defining a C Function with Aligned Parameters
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/coding_style.md
This example illustrates how to align function parameters in C according to GIMP's style guide. Each parameter is placed on a new line, and their names are left-aligned, considering the presence of pointer asterisks for consistent visual alignment.
```C
void
my_function (some_type_t some_param,
another_type_t *a_pointer_param,
final_type_t final_param)
{
}
```
--------------------------------
### Loading Plug-in into LLDB (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/debug-plug-ins.md
This command loads the screenshot.exe plug-in into the lldb debugger. It specifies the full path to the plug-in executable, typically found within the GIMP installation's lib directory.
```sh
lldb $GIMP_PREFIX/lib/gimp/2.99/plug-ins/screenshot/screenshot.exe
```
--------------------------------
### Invoking a C Function with Long Name (Invalid Style)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/coding_style.md
This example shows an invalid coding style for invoking C functions with long names. Breaking the function name and its arguments onto separate lines is discouraged as it negatively impacts code readability and violates the style guide.
```C
/* invalid */
a_very_long_function_name_with_long_arguments
(argument_the_first, argument_the_second);
```
--------------------------------
### Signing GIMP Plugin MSIX Bundle (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/windows-plugin-packaging.md
Digitally signs the generated MSIX bundle using a specified certificate file and password. This step is crucial for ensuring the integrity and authenticity of the package, allowing it to be installed on systems with strict security policies.
```shell
SignTool sign /fd sha256 /a /f CERT_FILE.pfx /p CERT_PASSWORD _Output\*.msixbundle
```
--------------------------------
### Defining Guides (PROP_GUIDES) in XCF Binary Format
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/standards/xcf.md
This snippet describes the PROP_GUIDES property, which stores the coordinates and orientation of guides in an XCF image. It specifies the type identification, payload length based on the number of guides, and for each guide, its coordinate and orientation (horizontal or vertical). It also mentions historical handling of negative coordinates.
```Binary Format
uint32 18 Type identification
uint32 5*n Five bytes of payload per guide
,--------------- Repeat n times:
| int32 coord Guide coordinate
| byte o Guide orientation; one of
| 1: The guide is horizontal, and coord is a y coordinate
| 2: The guide is vertical, and coord is an x coordinate
(see enum XcfOrientationType in /app/xcf/xcf-private.h)
`--
```
--------------------------------
### Registering Script-Fu Plugin with Arguments
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/script-fu/programmers-reference.md
This example illustrates the `script-fu-register` function call, used to declare a Script-Fu plugin's signature and metadata. It shows how to define an input argument using a triple: an SF- constant for type/widget, a string label for the GUI, and a value (like a list) to define defaults or constraints for the argument.
```Scheme
(script-fu-register "script-fu-test-sphere"
... metadata arguments...
SF-ADJUSTMENT "Radius (in pixels)" (list 100 1 5000 1 10 0 SF-SPINNER)
... more triples, one for each additional argument ...
)
```
--------------------------------
### Running GIMP Directly from Flatpak Build Directory
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/Linux.md
This command allows running the newly built GIMP application directly from the build directory without needing to export or install it into a Flatpak repository. It's ideal for development and testing, requiring the `GIMP_APP_VERSION` to be replaced with the actual version number from `config.h` or the JSON file.
```Shell
# Still in `_build-${ARCH}` folder
flatpak-builder --run "${GIMP_PREFIX}" flatpak/org.gimp.GIMP-nightly.json gimp-GIMP_APP_VERSION
```
--------------------------------
### Setting GIMP Installation Prefix (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/_index.md
This snippet sets the `GIMP_PREFIX` environment variable to a custom installation directory, typically `_install` within the user's home directory. This is recommended to avoid conflicts with system-wide GIMP installations, especially when building from the `master` branch.
```sh
export GIMP_PREFIX=${HOME}/_install
```
--------------------------------
### Generating resources.pri for GIMP Plugin Assets (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/windows-plugin-packaging.md
This shell command uses makepri to generate the resources.pri file, which bundles all necessary assets for the GIMP plugin. It takes the package root folder (PACKAGE_FOLDER), the previously created priconfig.xml file, and specifies the output location for the .pri file. This command must be executed from the uplevel folder due to CLI limitations, and PACKAGE_FOLDER should be replaced with the actual path to the plugin's package directory.
```Shell
makepri new /pr PACKAGE_FOLDER /cf PACKAGE_FOLDER\priconfig.xml /of PACKAGE_FOLDER
```
--------------------------------
### Generating GIMP API Documentation (GIMP 3.0)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/faq.md
This snippet provides the Meson build option required to enable the generation of GIMP API documentation for the `master` branch (GIMP 3.0). After configuration, the documentation can be built using `ninja` and found in the `devel-docs` directory.
```Meson
-Dgi-docgen=enabled
```
```Shell
ninja
```
```Path
devel-docs
```
--------------------------------
### Debugging GIMP Plugin Startup Failures (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/debug/problems_and_solutions.md
This snippet addresses GIMP plugins failing to appear in menus with a "GIMP-WARNING: gimp-2.xx: gimp_wire_read(): error" message, indicating a plugin crash during startup. The solution involves identifying the problematic plugin by starting GIMP with the `--verbose` flag and then removing it. Print statements can be used for further debugging of interpreted plugins.
```sh
gimp --verbose
```
--------------------------------
### Initializing GIMP Blur Dialog (C)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/writing-a-plug-in/3.md
This C function initiates the graphical user interface for the 'My blur' GIMP plug-in. It sets up the basic GIMP UI environment and creates the main dialog window, including placeholders for various GTK+ widgets such as a preview area and a spin button for adjusting the blur radius. The snippet provided is incomplete, showing only the initial setup of the dialog.
```C
static gboolean
blur_dialog (GimpDrawable *drawable)
{
GtkWidget *dialog;
GtkWidget *main_vbox;
GtkWidget *main_hbox;
GtkWidget *preview;
GtkWidget *frame;
GtkWidget *radius_label;
GtkWidget *alignment;
GtkWidget *spinbutton;
GtkObject *spinbutton_adj;
GtkWidget *frame_label;
gboolean run;
gimp_ui_init ("myblur", FALSE);
dialog = gimp_dialog_new ("My blur", "myblur",
NULL, 0,
gimp_standard_help_func, "plug-in-myblur",
```
--------------------------------
### Initializing Memory for Image Rows (C)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/writing-a-plug-in/3.md
This helper function allocates memory for the input and output image tile rows required by the blurring algorithm. It allocates an array of pointers (`row`) to hold `2 * radius + 1` rows, each of `num_bytes` size, and a single `outrow` for the processed output. This setup facilitates efficient access to the pixel neighborhood for blurring.
```C
static void
init_mem (guchar ***row,
guchar **outrow,
gint num_bytes)
{
gint i;
/* Allocate enough memory for row and outrow */
*row = g_new (char *, (2 * radius + 1));
for (i = -radius; i <= radius; i++)
(*row)[i + radius] = g_new (guchar, num_bytes);
*outrow = g_new (guchar, num_bytes);
}
```
--------------------------------
### Initializing Git Submodules for GIMP Developer Website (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/README.md
This command initializes and updates all Git submodules, including the `hugo-bootstrap-bare` theme, ensuring all necessary repository dependencies are pulled. It's a crucial first step for setting up the project locally.
```sh
$ git submodule update --init --recursive
```
--------------------------------
### Checking GEGL Version - Shell
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/debug/problems_and_solutions.md
This command uses `pkg-config` to query the installed version of the `gegl-0.4` library. It's used to verify if the correct development version of GEGL is installed, which is often a dependency for GIMP development builds.
```Shell
pkg-config gegl-0.4 --modversion
```
--------------------------------
### Starting GIMP with Plug-in Debugging Enabled (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/debug-plug-ins.md
This command starts GIMP with debugging enabled for the screenshot.exe plug-in, specifically targeting its 'run' function. It uses the GIMP_PLUGIN_DEBUG environment variable and assumes GIMP_PREFIX is set to the GIMP build path.
```sh
GIMP_PLUGIN_DEBUG=screenshot.exe,run $GIMP_PREFIX/bin/gimp-2.99.exe
```
--------------------------------
### Generating priconfig.xml for GIMP Plugin Assets (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/windows-plugin-packaging.md
This shell command uses the makepri tool from the Windows SDK to create a priconfig.xml file. This configuration file is essential for generating the resources.pri file, which packages application resources like images. The command specifies the output file (priconfig.xml), default qualifiers for language (lang-en-US), and the platform version (10.0.0). This step is a prerequisite for packaging assets for the Microsoft Store version of GIMP.
```Shell
makepri createconfig /cf priconfig.xml /dq lang-en-US /pv 10.0.0
```
--------------------------------
### Configuring Flatpak Build Options
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/Linux.md
This command sets recommended build options for Flatpak, including `--ccache` for faster builds and `--keep-build-dirs` to retain build directories for debugging purposes. `--force-clean` ensures a clean build.
```Shell
export BUILD_OPTIONS="--ccache --keep-build-dirs --force-clean"
```
--------------------------------
### Setting up GDB for ScriptFu Extension Debugging (Bash)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/analyze-plug-ins-tutorial.md
Configures environment variables to wrap the ScriptFu extension with GDB for debugging. `GIMP_PLUGIN_DEBUG_WRAP` specifies the plugin to debug, and `GIMP_PLUGIN_DEBUG_WRAPPER` sets GDB as the debugger, passing `--args` to ensure subsequent arguments are treated as program arguments.
```Bash
export GIMP_PLUGIN_DEBUG_WRAP=script-fu
export GIMP_PLUGIN_DEBUG_WRAPPER="gdb --args"
```
--------------------------------
### Packaging GIMP Plugin MSIX Bundle (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/windows-plugin-packaging.md
Packages a GIMP plugin into an MSIX or MSIX bundle format, suitable for multi-architecture distribution. The 'makeappx pack' command creates individual MSIX packages, and 'makeappx bundle' combines them into a single MSIX bundle.
```shell
makeappx pack /d PACKAGE_FOLDER /p _TempOutput\DEV-NAME.PLUG-IN-NAME-WITHOUT-SYMBOLS-OR-SPACES_MAJOR.MINOR.MICRO.REVISION_MSIX-ARCH.msix
makeappx bundle /bv MAJOR.MINOR.MICRO.REVISION /d _TempOutput /p _Output\DEV-NAME.PLUG-IN-NAME-WITHOUT-SYMBOLS-OR-SPACES_MAJOR.MINOR.MICRO.REVISION_neutral.msixbundle
```
--------------------------------
### Registering GIMP Plug-in Procedure (C)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/writing-a-plug-in/1.md
The `query()` function is responsible for registering the GIMP plug-in with the PDB (Procedure Database) and defining its input arguments. It uses `gimp_install_procedure` to declare the plug-in's name, description, author, copyright, menu path, and supported image types, along with its parameters. `gimp_plugin_menu_register` adds the plug-in to the GIMP menu.
```C
static void
query (void)
{
static GimpParamDef args[] = {
{
GIMP_PDB_INT32,
"run-mode",
"Run mode"
},
{
GIMP_PDB_IMAGE,
"image",
"Input image"
},
{
GIMP_PDB_DRAWABLE,
"drawable",
"Input drawable"
}
};
gimp_install_procedure (
"plug-in-hello",
"Hello, world!",
"Displays \"Hello, world!\" in a dialog",
"David Neary",
"Copyright David Neary",
"2004",
"_Hello world...",
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug-in-hello",
"/Filters/Misc");
}
```
--------------------------------
### Executing GIMP Plug-in with run() in C
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/writing-a-plug-in/2.md
This `run` function serves as the entry point for a GIMP plug-in. It initializes mandatory output values, determines the plug-in's run mode (interactive, non-interactive, or with last values), retrieves the target drawable, and calls the `blur` function to perform the image processing. It also handles progress initialization and drawable detachment.
```C
static void
run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
GimpDrawable *drawable;
/* Setting mandatory output values */
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
/* Getting run_mode - we won't display a dialog if
* we are in NONINTERACTIVE mode */
run_mode = param[0].data.d_int32;
/* Get the specified drawable */
drawable = gimp_drawable_get (param[2].data.d_drawable);
gimp_progress_init ("My Blur...");
/* Let's time blur
*
* GTimer timer = g_timer_new time ();
*/
blur (drawable);
/* g_print ("blur() took %g seconds.\n", g_timer_elapsed (timer));
* g_timer_destroy (timer);
*/
gimp_displays_flush ();
gimp_drawable_detach (drawable);
}
```
--------------------------------
### Fixing Missing GTK Canberra Module (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/debug/problems_and_solutions.md
This snippet addresses the "Gtk-Message: Failed to load module 'canberra-gtk-module'" message in GIMP. The primary cause is the missing `libcanberra-gtk3-module` package, which can be resolved by installing it. For self-built GTK+ installations, the `GTK_PATH` environment variable can be set to direct GTK to system module paths.
```sh
sudo apt-get install libcanberra-gtk3-module
```
```sh
export GTK_PATH=/usr/lib/x86_64-linux-gnu/gtk-3.0/
```
--------------------------------
### Building GIMP Developer Website with Hugo (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/README.md
This command builds the static GIMP developer website using the Hugo static site generator. It compiles all content and templates into a `public` directory, ready for deployment.
```sh
$ hugo
```
--------------------------------
### Defining GIMP Plug-in Information Structure (C)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/writing-a-plug-in/1.md
This C structure, named `PLUG_IN_INFO`, is mandatory for every GIMP plug-in. It defines four function pointers (`init`, `quit`, `query`, `run`) that GIMP calls at specific lifecycle stages of the plug-in. `query` and `run` are mandatory, while `init` and `quit` are optional and can be `NULL`.
```C
GimpPlugInInfo PLUG_IN_INFO = {
init,
quit,
query,
run
};
```
--------------------------------
### XCF Pixel Data Tile Organization Example
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/standards/xcf.md
Illustrates how pixel data is organized into a grid of tiles within the XCF file format. This example shows a 200x150 pixel layer divided into 12 tiles, demonstrating how tiles in the rightmost column and bottommost row can have dimensions less than the standard 64x64 pixels. Tiles are stored in row-major order.
```Text Diagram
+-----------------+-----------------+------------------+-----------------+
| Tile 0: 64 x 64 | Tile 1: 64 x 64 | Tile 2: 64 x 64 | Tile 3: 8 x 64 |
+-----------------+-----------------+------------------+-----------------+
| Tile 4: 64 x 64 | Tile 5: 64 x 64 | Tile 6: 64 x 64 | Tile 7: 8 x 64 |
+-----------------+-----------------+------------------+-----------------+
| Tile 8: 64 x 22 | Tile 9: 64 x 22 | Tile 10: 64 x 22 | Tile 11: 8 x 22 |
+-----------------+-----------------+------------------+-----------------+
```
--------------------------------
### Configuring GIMP Autotools Build from Tarball (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/_index.md
This command is used when building GIMP from a distributed tarball. It directly runs the `configure` script, specifying the custom installation prefix `GIMP_PREFIX`.
```sh
./configure --prefix=${GIMP_PREFIX}
```
--------------------------------
### Managing GIMP Web Testing Branch Content (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/maintainer/release/report.md
This snippet outlines the shell commands for preparing content on the 'gimp-web' module's 'testing' branch. It involves checking out the branch, generating the 'authors.md' file using 'ninja', moving it to the correct location, and then committing and pushing the changes for verification on the testing server.
```Shell
git checkout testing
# Create a news item in content/news/
ninja authors.md
mv authors.md ./content/about/authors.md
git commit -m "Add news and update authors.md for release"
git push
```
--------------------------------
### Avoiding Compacted Code in C
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/coding_style.md
This example shows an invalid code style where whitespace and newlines are eliminated to fit code within an 80-character limit. This practice is discouraged for readability.
```C
/* invalid */
if (condition) foo (); else bar ();
```
--------------------------------
### Structuring Switch Statements in C
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/coding_style.md
This snippet demonstrates the correct formatting for `switch` statements, where the `switch` block opens on a new indentation level, and each `case` starts at the same level as the curly braces, with its own block indented further.
```C
/* valid */
switch (condition)
{
case FOO:
do_foo ();
break;
case BAR:
do_bar ();
break;
}
/* invalid */
switch (condition) {
case FOO: do_foo (); break;
case BAR: do_bar (); break;
}
/* invalid */
switch (condition)
{
case FOO: do_foo ();
break;
case BAR: do_bar ();
break;
}
/* invalid */
switch (condition)
{
case FOO:
do_foo ();
break;
case BAR:
do_bar ();
break;
}
```
--------------------------------
### Horizontal Spacing Conventions in C
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/coding_style.md
Illustrates the rules for horizontal spacing around parentheses and braces in C code. A space is required before an opening parenthesis but never after. Examples show both valid and invalid spacing.
```C
/* valid */
if (condition)
do_my_things ();
/* valid */
switch (condition)
{
}
/* invalid */
if(condition)
do_my_things();
/* invalid */
if ( condition )
do_my_things ( );
```
--------------------------------
### Defining a Basic GIMP Script-Fu Plugin
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/resource/script-fu/programmers-reference.md
This snippet defines a minimal GIMP Script-Fu plugin. It includes the run function `script-fu-basic-plug-in` which simply displays 'hello world', followed by `script-fu-register` to declare plugin metadata and signature, and `script-fu-menu-register` to add it to the GIMP menu. This plugin has no arguments and is intended for older GIMP versions or simpler integrations.
```Scheme
(define (script-fu-basic-plug-in) (gimp-message " hello world "))
(script-fu-register "script-fu-basic-plug-in" "Basic" "test" "me" "free" "2023" "")
(script-fu-menu-register "script-fu-basic-plug-in" "/Fu-plug-in")
```
--------------------------------
### Uninstalling MacPorts GIMP Environment (Shell)
Source: https://github.com/chazmaniandinkle/gimp-web-devel/blob/bruno/release/content/core/setup/build/macOS.md
This command runs 'macports_uninstall.sh', a script to completely remove the MacPorts-based GIMP build environment. It's used when a developer needs to start over from scratch or clean up the build system.
```sh
macports_uninstall.sh
```