├── .gitignore ├── Makefile ├── README.md ├── freeimage4java-examples ├── pom.xml ├── sample.png └── src │ └── main │ └── java │ └── com │ └── nextbreakpoint │ └── freeimage4java │ └── ConvertImageMain.java ├── freeimage4java-linux ├── dump.sh ├── extract.sh ├── includes.txt ├── libfreeimage.h ├── native │ ├── Dockerfile │ ├── Makefile │ ├── freeimage.patch │ └── scripts │ │ ├── checkout.sh │ │ ├── clean.sh │ │ ├── compile.sh │ │ └── copy.sh ├── output.txt ├── pom.xml ├── source └── src │ └── main │ ├── java │ ├── com │ │ └── nextbreakpoint │ │ │ └── freeimage4java │ │ │ ├── BITMAPINFO.java │ │ │ ├── BITMAPINFOHEADER.java │ │ │ ├── FIBITMAP.java │ │ │ ├── FICOMPLEX.java │ │ │ ├── FIICCPROFILE.java │ │ │ ├── FIMEMORY.java │ │ │ ├── FIMETADATA.java │ │ │ ├── FIMULTIBITMAP.java │ │ │ ├── FIRGB16.java │ │ │ ├── FIRGBA16.java │ │ │ ├── FIRGBAF.java │ │ │ ├── FIRGBF.java │ │ │ ├── FITAG.java │ │ │ ├── FI_CloseProc.java │ │ │ ├── FI_DescriptionProc.java │ │ │ ├── FI_ExtensionListProc.java │ │ │ ├── FI_FormatProc.java │ │ │ ├── FI_InitProc.java │ │ │ ├── FI_LoadProc.java │ │ │ ├── FI_MimeProc.java │ │ │ ├── FI_OpenProc.java │ │ │ ├── FI_PageCapabilityProc.java │ │ │ ├── FI_PageCountProc.java │ │ │ ├── FI_ReadProc.java │ │ │ ├── FI_RegExprProc.java │ │ │ ├── FI_SaveProc.java │ │ │ ├── FI_SeekProc.java │ │ │ ├── FI_SupportsExportBPPProc.java │ │ │ ├── FI_SupportsExportTypeProc.java │ │ │ ├── FI_SupportsICCProfilesProc.java │ │ │ ├── FI_SupportsNoPixelsProc.java │ │ │ ├── FI_TellProc.java │ │ │ ├── FI_ValidateProc.java │ │ │ ├── FI_WriteProc.java │ │ │ ├── FreeImageIO.java │ │ │ ├── FreeImage_OutputMessageFunction.java │ │ │ ├── FreeImage_OutputMessageFunctionStdCall.java │ │ │ ├── Libfreeimage.java │ │ │ ├── Plugin.java │ │ │ ├── RGBQUAD.java │ │ │ ├── RGBTRIPLE.java │ │ │ ├── tagBITMAPINFO.java │ │ │ ├── tagBITMAPINFOHEADER.java │ │ │ ├── tagFICOMPLEX.java │ │ │ ├── tagFIRGB16.java │ │ │ ├── tagFIRGBA16.java │ │ │ ├── tagFIRGBAF.java │ │ │ ├── tagFIRGBF.java │ │ │ ├── tagRGBQUAD.java │ │ │ └── tagRGBTRIPLE.java │ └── module-info.java │ └── resources │ └── META-INF │ ├── FIPL v1.0.txt │ ├── LICENSE.txt │ └── NOTICE.txt ├── freeimage4java-macos ├── dump.sh ├── extract.sh ├── includes.txt ├── libfreeimage.h ├── native │ ├── Makefile │ ├── freeimage.patch │ └── scripts │ │ ├── checkout.sh │ │ ├── clean.sh │ │ ├── compile.sh │ │ └── copy.sh ├── output.txt ├── pom.xml ├── source └── src │ └── main │ ├── java │ ├── com │ │ └── nextbreakpoint │ │ │ └── freeimage4java │ │ │ ├── BITMAPINFO.java │ │ │ ├── BITMAPINFOHEADER.java │ │ │ ├── FIBITMAP.java │ │ │ ├── FICOMPLEX.java │ │ │ ├── FIICCPROFILE.java │ │ │ ├── FIMEMORY.java │ │ │ ├── FIMETADATA.java │ │ │ ├── FIMULTIBITMAP.java │ │ │ ├── FIRGB16.java │ │ │ ├── FIRGBA16.java │ │ │ ├── FIRGBAF.java │ │ │ ├── FIRGBF.java │ │ │ ├── FITAG.java │ │ │ ├── FI_CloseProc.java │ │ │ ├── FI_DescriptionProc.java │ │ │ ├── FI_ExtensionListProc.java │ │ │ ├── FI_FormatProc.java │ │ │ ├── FI_InitProc.java │ │ │ ├── FI_LoadProc.java │ │ │ ├── FI_MimeProc.java │ │ │ ├── FI_OpenProc.java │ │ │ ├── FI_PageCapabilityProc.java │ │ │ ├── FI_PageCountProc.java │ │ │ ├── FI_ReadProc.java │ │ │ ├── FI_RegExprProc.java │ │ │ ├── FI_SaveProc.java │ │ │ ├── FI_SeekProc.java │ │ │ ├── FI_SupportsExportBPPProc.java │ │ │ ├── FI_SupportsExportTypeProc.java │ │ │ ├── FI_SupportsICCProfilesProc.java │ │ │ ├── FI_SupportsNoPixelsProc.java │ │ │ ├── FI_TellProc.java │ │ │ ├── FI_ValidateProc.java │ │ │ ├── FI_WriteProc.java │ │ │ ├── FreeImageIO.java │ │ │ ├── FreeImage_OutputMessageFunction.java │ │ │ ├── FreeImage_OutputMessageFunctionStdCall.java │ │ │ ├── Libfreeimage.java │ │ │ ├── Plugin.java │ │ │ ├── RGBQUAD.java │ │ │ ├── RGBTRIPLE.java │ │ │ ├── tagBITMAPINFO.java │ │ │ ├── tagBITMAPINFOHEADER.java │ │ │ ├── tagFICOMPLEX.java │ │ │ ├── tagFIRGB16.java │ │ │ ├── tagFIRGBA16.java │ │ │ ├── tagFIRGBAF.java │ │ │ ├── tagFIRGBF.java │ │ │ ├── tagRGBQUAD.java │ │ │ └── tagRGBTRIPLE.java │ └── module-info.java │ └── resources │ └── META-INF │ ├── FIPL v1.0.txt │ ├── LICENSE.txt │ └── NOTICE.txt ├── freeimage4java-tests ├── pom.xml ├── sample.png └── src │ └── test │ └── java │ └── com │ └── nextbreakpoint │ └── freeimage4java │ └── FreeImage4JavaTest.java ├── freeimage4java-windows ├── dump.sh ├── extract.sh ├── includes.txt ├── libfreeimage.h ├── native │ ├── Dockerfile │ ├── Makefile │ ├── freeimage.patch │ └── scripts │ │ ├── checkout.sh │ │ ├── clean.sh │ │ ├── compile.sh │ │ └── copy.sh ├── output.txt ├── pom.xml ├── source └── src │ └── main │ ├── java │ ├── com │ │ └── nextbreakpoint │ │ │ └── freeimage4java │ │ │ ├── BITMAPINFO.java │ │ │ ├── BITMAPINFOHEADER.java │ │ │ ├── FIBITMAP.java │ │ │ ├── FICOMPLEX.java │ │ │ ├── FIICCPROFILE.java │ │ │ ├── FIMEMORY.java │ │ │ ├── FIMETADATA.java │ │ │ ├── FIMULTIBITMAP.java │ │ │ ├── FIRGB16.java │ │ │ ├── FIRGBA16.java │ │ │ ├── FIRGBAF.java │ │ │ ├── FIRGBF.java │ │ │ ├── FITAG.java │ │ │ ├── FI_CloseProc.java │ │ │ ├── FI_DescriptionProc.java │ │ │ ├── FI_ExtensionListProc.java │ │ │ ├── FI_FormatProc.java │ │ │ ├── FI_InitProc.java │ │ │ ├── FI_LoadProc.java │ │ │ ├── FI_MimeProc.java │ │ │ ├── FI_OpenProc.java │ │ │ ├── FI_PageCapabilityProc.java │ │ │ ├── FI_PageCountProc.java │ │ │ ├── FI_ReadProc.java │ │ │ ├── FI_RegExprProc.java │ │ │ ├── FI_SaveProc.java │ │ │ ├── FI_SeekProc.java │ │ │ ├── FI_SupportsExportBPPProc.java │ │ │ ├── FI_SupportsExportTypeProc.java │ │ │ ├── FI_SupportsICCProfilesProc.java │ │ │ ├── FI_SupportsNoPixelsProc.java │ │ │ ├── FI_TellProc.java │ │ │ ├── FI_ValidateProc.java │ │ │ ├── FI_WriteProc.java │ │ │ ├── FreeImageIO.java │ │ │ ├── FreeImage_OutputMessageFunction.java │ │ │ ├── FreeImage_OutputMessageFunctionStdCall.java │ │ │ ├── Libfreeimage.java │ │ │ ├── Plugin.java │ │ │ ├── RGBQUAD.java │ │ │ ├── RGBTRIPLE.java │ │ │ ├── tagBITMAPINFO.java │ │ │ ├── tagBITMAPINFOHEADER.java │ │ │ ├── tagFICOMPLEX.java │ │ │ ├── tagFIRGB16.java │ │ │ ├── tagFIRGBA16.java │ │ │ ├── tagFIRGBAF.java │ │ │ ├── tagFIRGBF.java │ │ │ ├── tagRGBQUAD.java │ │ │ └── tagRGBTRIPLE.java │ └── module-info.java │ └── resources │ └── META-INF │ ├── FIPL v1.0.txt │ ├── LICENSE.txt │ └── NOTICE.txt ├── legal ├── FIPL v1.0.txt ├── LICENSE.txt └── NOTICE.txt ├── maven-version-rules.xml └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | /freeimage4java-macos/native/freeimage/ 4 | /freeimage4java-linux/native/freeimage/ 5 | /freeimage4java-windows/native/freeimage/ 6 | /freeimage4java-windows/src/main/resources/freeimage4java.dll 7 | /freeimage4java-linux/src/main/resources/libfreeimage4java.so 8 | /freeimage4java-macos/src/main/resources/libfreeimage4java.dylib 9 | /freeimage4java-examples/output.png 10 | /freeimage4java-tests/test0.png 11 | /freeimage4java-tests/test1.png 12 | /freeimage4java-tests/test2.png 13 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean 2 | clean: 3 | mvn clean 4 | 5 | .PHONY: compile 6 | compile: 7 | mvn compile 8 | 9 | .PHONY: package 10 | package: 11 | mvn package -DskipTests=true 12 | 13 | .PHONY: install 14 | install: 15 | mvn install -DskipTests=true 16 | 17 | .PHONY: extract 18 | extract: 19 | test $(system) 20 | @echo System = $(system) 21 | cd freeimage4java-$(system) && ./extract.sh 22 | 23 | .PHONY: dump 24 | dump: 25 | test $(system) 26 | @echo System = $(system) 27 | cd freeimage4java-$(system) && ./dump.sh 28 | 29 | .PHONY: verify 30 | verify: 31 | test $(system) 32 | @echo System = $(system) 33 | #MAVEN_OPTS="--enable-preview --enable-native-access=ALL-UNNAMED -Djava.library.path=freeimage4java-tests/target/lib -Djextract.trace.downcalls=false -Xlog:library" mvn verify -P$(system); 34 | MAVEN_OPTS="--enable-preview --enable-native-access=ALL-UNNAMED -Djava.library.path=freeimage4java-tests/target/lib -Djextract.trace.downcalls=false $(properties)" mvn verify -P$(system); 35 | 36 | .PHONY: copy-legal 37 | copy-legal: 38 | cp legal/*.txt freeimage4java-macos/src/main/resources/META-INF/ 39 | cp legal/*.txt freeimage4java-linux/src/main/resources/META-INF/ 40 | cp legal/*.txt freeimage4java-windows/src/main/resources/META-INF/ 41 | 42 | .PHONY: dist 43 | dist: 44 | rm -fR dist 45 | mkdir -p dist 46 | cp freeimage4java-macos/target/com.nextbreakpoint.freeimage4java.macos-*.jar dist 47 | cp freeimage4java-linux/target/com.nextbreakpoint.freeimage4java.linux-*.jar dist 48 | cp freeimage4java-windows/target/com.nextbreakpoint.freeimage4java.windows-*.jar dist 49 | 50 | .PHONY: github-release 51 | github-release: 52 | mvn -Dchannel=github clean package de.jutzig:github-release-plugin:release -Dgithub.draft=true 53 | 54 | .PHONY: maven-release 55 | maven-release: 56 | mvn -Dchannel=ossrh clean deploy 57 | 58 | .PHONY: set-version 59 | set-version: 60 | test $(version) 61 | mvn versions:set -DnewVersion=$(version) 62 | mvn versions:commit 63 | -------------------------------------------------------------------------------- /freeimage4java-examples/sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbreakpoint/freeimage4java/4a780b2a064f6d47f954dd7b83139badfff9f1dc/freeimage4java-examples/sample.png -------------------------------------------------------------------------------- /freeimage4java-examples/src/main/java/com/nextbreakpoint/freeimage4java/ConvertImageMain.java: -------------------------------------------------------------------------------- 1 | package com.nextbreakpoint.freeimage4java; 2 | 3 | import java.lang.foreign.Arena; 4 | 5 | import static com.nextbreakpoint.freeimage4java.Libfreeimage.FIF_PNG; 6 | import static com.nextbreakpoint.freeimage4java.Libfreeimage.FreeImage_ConvertToGreyscale; 7 | import static com.nextbreakpoint.freeimage4java.Libfreeimage.FreeImage_Initialise; 8 | import static com.nextbreakpoint.freeimage4java.Libfreeimage.FreeImage_Load; 9 | import static com.nextbreakpoint.freeimage4java.Libfreeimage.FreeImage_Save; 10 | import static com.nextbreakpoint.freeimage4java.Libfreeimage.FreeImage_Unload; 11 | import static com.nextbreakpoint.freeimage4java.Libfreeimage.PNG_DEFAULT; 12 | import static com.nextbreakpoint.freeimage4java.Libfreeimage.TRUE; 13 | import static java.lang.foreign.MemorySegment.NULL; 14 | 15 | class ConvertImageMain { 16 | public static void main(String[] args) { 17 | if (args.length < 2) { 18 | throw new IllegalArgumentException("Invalid arguments"); 19 | } 20 | 21 | final String sourceFileName = args[0]; 22 | final String outputFileName = args[1]; 23 | 24 | System.out.println("Converting image..."); 25 | 26 | System.out.printf("Source file %s%n", sourceFileName); 27 | System.out.printf("Output file %s%n", outputFileName); 28 | 29 | try (var arena = Arena.ofConfined()) { 30 | var pSourceBitmap = NULL; 31 | var pOutputBitmap = NULL; 32 | 33 | try { 34 | FreeImage_Initialise(TRUE()); 35 | 36 | var pInputFileName = arena.allocateFrom(sourceFileName); 37 | var pOutputFileName = arena.allocateFrom(outputFileName); 38 | 39 | pSourceBitmap = FreeImage_Load(FIF_PNG(), pInputFileName, PNG_DEFAULT()); 40 | 41 | pOutputBitmap = FreeImage_ConvertToGreyscale(pSourceBitmap); 42 | 43 | int result = FreeImage_Save(FIF_PNG(), pOutputBitmap, pOutputFileName, PNG_DEFAULT()); 44 | 45 | if (result == TRUE()) { 46 | System.out.println("Image converted"); 47 | } else { 48 | throw new IllegalArgumentException("Failed to process image"); 49 | } 50 | } 51 | finally { 52 | if (!pSourceBitmap.equals(NULL)) { 53 | FreeImage_Unload(pSourceBitmap); 54 | } 55 | 56 | if (!pOutputBitmap.equals(NULL)) { 57 | FreeImage_Unload(pOutputBitmap); 58 | } 59 | } 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /freeimage4java-linux/dump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FREEIMAGE_HOME=$(pwd)/native/freeimage/Dist 4 | 5 | export PATH=$PATH:${JEXTRACT_HOME}/bin 6 | 7 | jextract --dump-includes includes.txt \ 8 | --include-dir "${FREEIMAGE_HOME}" \ 9 | libfreeimage.h -------------------------------------------------------------------------------- /freeimage4java-linux/extract.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FREEIMAGE_HOME=$(pwd)/native/freeimage/Dist 4 | 5 | export PATH=$PATH:${JEXTRACT_HOME}/bin 6 | 7 | jextract @includes.txt \ 8 | --output src/main/java \ 9 | --target-package com.nextbreakpoint.freeimage4java \ 10 | --include-dir "${FREEIMAGE_HOME}" \ 11 | --use-system-load-library \ 12 | --library freeimage4java \ 13 | --header-class-name Libfreeimage \ 14 | libfreeimage.h -------------------------------------------------------------------------------- /freeimage4java-linux/libfreeimage.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /freeimage4java-linux/native/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | RUN apt-get update -y && apt-get -y install git make gcc=4:11.2.0-1ubuntu1 g++=4:11.2.0-1ubuntu1 4 | 5 | WORKDIR /var/native 6 | -------------------------------------------------------------------------------- /freeimage4java-linux/native/Makefile: -------------------------------------------------------------------------------- 1 | INSTALL_PATH := $(CURDIR)/../src/main/resources 2 | 3 | .PHONY: checkout 4 | checkout: 5 | ./scripts/checkout.sh 6 | 7 | .PHONY: configure 8 | configure: 9 | ./scripts/configure.sh 10 | 11 | .PHONY: compile 12 | compile: 13 | ./scripts/compile.sh 14 | 15 | .PHONY: clean 16 | clean: 17 | ./scripts/clean.sh 18 | 19 | .PHONY: install 20 | install: 21 | ./scripts/copy.sh $(INSTALL_PATH) 22 | 23 | .PHONY: all 24 | all: build-lib install 25 | 26 | .PHONY: build-image 27 | build-image: 28 | docker build -t freeimage4java-linux . 29 | 30 | .PHONY: build-lib 31 | build-lib: build-image 32 | docker run --rm -i -v $(CURDIR):/var/native freeimage4java-linux make checkout compile 33 | -------------------------------------------------------------------------------- /freeimage4java-linux/native/freeimage.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Makefile.gnu b/Makefile.gnu 2 | index 92f6358..266a204 100644 3 | --- a/Makefile.gnu 4 | +++ b/Makefile.gnu 5 | @@ -23,7 +23,7 @@ CFLAGS += -DNO_LCMS 6 | # LibJXR 7 | CFLAGS += -DDISABLE_PERF_MEASUREMENT -D__ANSI__ 8 | CFLAGS += $(INCLUDE) 9 | -CXXFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy 10 | +CXXFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy --std=c++14 11 | # LibJXR 12 | CXXFLAGS += -D__ANSI__ 13 | CXXFLAGS += $(INCLUDE) 14 | -------------------------------------------------------------------------------- /freeimage4java-linux/native/scripts/checkout.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | FREEIMAGE_HOME=$(pwd)/freeimage 6 | 7 | if [ ! -d "$FREEIMAGE_HOME" ]; then 8 | git clone https://github.com/nextbreakpoint/FreeImage.git "$FREEIMAGE_HOME" 9 | else 10 | pushd "$FREEIMAGE_HOME" 11 | git fetch 12 | popd 13 | fi 14 | 15 | pushd "$FREEIMAGE_HOME" 16 | git checkout ee5b759719c5d3f8dd62ac0a71129a14cab5b0cd 17 | popd 18 | -------------------------------------------------------------------------------- /freeimage4java-linux/native/scripts/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FREEIMAGE_HOME=$(pwd)/freeimage 6 | 7 | if [ -d "$FREEIMAGE_HOME" ]; then 8 | make -C "$FREEIMAGE_HOME" -f Makefile.gnu clean 9 | fi 10 | -------------------------------------------------------------------------------- /freeimage4java-linux/native/scripts/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FREEIMAGE_HOME=$(pwd)/freeimage 6 | 7 | LIB_TYPE=64 8 | 9 | cd "$FREEIMAGE_HOME" || exit 10 | 11 | git reset --hard 12 | patch -p1 -N < ../freeimage.patch 13 | 14 | make -f Makefile.gnu 15 | 16 | gcc --verbose \ 17 | -o libfreeimage4java.so \ 18 | -shared \ 19 | -m${LIB_TYPE} \ 20 | -Wall \ 21 | -fpic \ 22 | -Wl,--no-undefined \ 23 | -Wl,-Bsymbolic \ 24 | -Wl,--whole-archive \ 25 | libfreeimage.a \ 26 | -Wl,--no-whole-archive \ 27 | -lm \ 28 | -lstdc++ 29 | -------------------------------------------------------------------------------- /freeimage4java-linux/native/scripts/copy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | mkdir -p "$1" && cp freeimage/libfreeimage4java.so "$1" 6 | -------------------------------------------------------------------------------- /freeimage4java-linux/output.txt: -------------------------------------------------------------------------------- 1 | WARNING: Skipping va_list (type is not supported) 2 | WARNING: Skipping __gnuc_va_list (type is not supported) 3 | -------------------------------------------------------------------------------- /freeimage4java-linux/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.nextbreakpoint 6 | com.nextbreakpoint.freeimage4java 7 | 3.18.0-2.2 8 | 9 | com.nextbreakpoint.freeimage4java.linux 10 | jar 11 | FreeImage4Java Linux 12 | FreeImage4Java provides a Java wrapper of FreeImage library 13 | 14 | 15 | 16 | org.apache.maven.plugins 17 | maven-source-plugin 18 | 19 | 20 | attach-sources 21 | 22 | jar 23 | 24 | 25 | 26 | 27 | 28 | org.apache.maven.plugins 29 | maven-javadoc-plugin 30 | 31 | 32 | attach-javadocs 33 | 34 | jar 35 | 36 | 37 | 38 | 39 | 40 | org.apache.maven.plugins 41 | maven-jar-plugin 42 | 43 | 44 | native 45 | package 46 | 47 | jar 48 | 49 | 50 | x86_64 51 | 52 | **/*.so 53 | **/*.txt 54 | 55 | 56 | **/*.class 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /freeimage4java-linux/source: -------------------------------------------------------------------------------- 1 | export JAVA_HOME='/home/parallels/Documents/jdk-22.0.1+8' 2 | export JEXTRACT_HOME='/home/parallels/Documents/jextract-22' 3 | export PATH=$PATH:$JAVA_HOME/bin:$JEXTRACT_HOME/bin 4 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/BITMAPINFO.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagBITMAPINFO { 18 | * BITMAPINFOHEADER bmiHeader; 19 | * RGBQUAD bmiColors[1]; 20 | * } BITMAPINFO 21 | * } 22 | */ 23 | public class BITMAPINFO extends tagBITMAPINFO { 24 | 25 | BITMAPINFO() { 26 | // Should not be called directly 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/BITMAPINFOHEADER.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagBITMAPINFOHEADER { 18 | * DWORD biSize; 19 | * LONG biWidth; 20 | * LONG biHeight; 21 | * WORD biPlanes; 22 | * WORD biBitCount; 23 | * DWORD biCompression; 24 | * DWORD biSizeImage; 25 | * LONG biXPelsPerMeter; 26 | * LONG biYPelsPerMeter; 27 | * DWORD biClrUsed; 28 | * DWORD biClrImportant; 29 | * } BITMAPINFOHEADER 30 | * } 31 | */ 32 | public class BITMAPINFOHEADER extends tagBITMAPINFOHEADER { 33 | 34 | BITMAPINFOHEADER() { 35 | // Should not be called directly 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FICOMPLEX.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagFICOMPLEX { 18 | * double r; 19 | * double i; 20 | * } FICOMPLEX 21 | * } 22 | */ 23 | public class FICOMPLEX extends tagFICOMPLEX { 24 | 25 | FICOMPLEX() { 26 | // Should not be called directly 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FIRGB16.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagFIRGB16 { 18 | * WORD red; 19 | * WORD green; 20 | * WORD blue; 21 | * } FIRGB16 22 | * } 23 | */ 24 | public class FIRGB16 extends tagFIRGB16 { 25 | 26 | FIRGB16() { 27 | // Should not be called directly 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FIRGBA16.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagFIRGBA16 { 18 | * WORD red; 19 | * WORD green; 20 | * WORD blue; 21 | * WORD alpha; 22 | * } FIRGBA16 23 | * } 24 | */ 25 | public class FIRGBA16 extends tagFIRGBA16 { 26 | 27 | FIRGBA16() { 28 | // Should not be called directly 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FIRGBAF.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagFIRGBAF { 18 | * float red; 19 | * float green; 20 | * float blue; 21 | * float alpha; 22 | * } FIRGBAF 23 | * } 24 | */ 25 | public class FIRGBAF extends tagFIRGBAF { 26 | 27 | FIRGBAF() { 28 | // Should not be called directly 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FIRGBF.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagFIRGBF { 18 | * float red; 19 | * float green; 20 | * float blue; 21 | * } FIRGBF 22 | * } 23 | */ 24 | public class FIRGBF extends tagFIRGBF { 25 | 26 | FIRGBF() { 27 | // Should not be called directly 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_CloseProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef void (*FI_CloseProc)(FreeImageIO *, fi_handle, void *) 18 | * } 19 | */ 20 | public class FI_CloseProc { 21 | 22 | FI_CloseProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(MemorySegment io, MemorySegment handle, MemorySegment data); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libfreeimage.C_POINTER, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER 37 | ); 38 | 39 | /** 40 | * The descriptor of this function pointer 41 | */ 42 | public static FunctionDescriptor descriptor() { 43 | return $DESC; 44 | } 45 | 46 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_CloseProc.Function.class, "apply", $DESC); 47 | 48 | /** 49 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 50 | * The lifetime of the returned segment is managed by {@code arena} 51 | */ 52 | public static MemorySegment allocate(FI_CloseProc.Function fi, Arena arena) { 53 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 54 | } 55 | 56 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 57 | 58 | /** 59 | * Invoke the upcall stub {@code funcPtr}, with given parameters 60 | */ 61 | public static void invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle, MemorySegment data) { 62 | try { 63 | DOWN$MH.invokeExact(funcPtr, io, handle, data); 64 | } catch (Throwable ex$) { 65 | throw new AssertionError("should not reach here", ex$); 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_DescriptionProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef const char *(*FI_DescriptionProc)(void) 18 | * } 19 | */ 20 | public class FI_DescriptionProc { 21 | 22 | FI_DescriptionProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_DescriptionProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_DescriptionProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static MemorySegment invoke(MemorySegment funcPtr) { 59 | try { 60 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_ExtensionListProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef const char *(*FI_ExtensionListProc)(void) 18 | * } 19 | */ 20 | public class FI_ExtensionListProc { 21 | 22 | FI_ExtensionListProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_ExtensionListProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_ExtensionListProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static MemorySegment invoke(MemorySegment funcPtr) { 59 | try { 60 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_FormatProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef const char *(*FI_FormatProc)(void) 18 | * } 19 | */ 20 | public class FI_FormatProc { 21 | 22 | FI_FormatProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_FormatProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_FormatProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static MemorySegment invoke(MemorySegment funcPtr) { 59 | try { 60 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_InitProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef void (*FI_InitProc)(Plugin *, int) 18 | * } 19 | */ 20 | public class FI_InitProc { 21 | 22 | FI_InitProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(MemorySegment plugin, int format_id); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libfreeimage.C_POINTER, 35 | Libfreeimage.C_INT 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_InitProc.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FI_InitProc.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static void invoke(MemorySegment funcPtr,MemorySegment plugin, int format_id) { 61 | try { 62 | DOWN$MH.invokeExact(funcPtr, plugin, format_id); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_LoadProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef FIBITMAP *(*FI_LoadProc)(FreeImageIO *, fi_handle, int, int, void *) 18 | * } 19 | */ 20 | public class FI_LoadProc { 21 | 22 | FI_LoadProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(MemorySegment io, MemorySegment handle, int page, int flags, MemorySegment data); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER, 37 | Libfreeimage.C_INT, 38 | Libfreeimage.C_INT, 39 | Libfreeimage.C_POINTER 40 | ); 41 | 42 | /** 43 | * The descriptor of this function pointer 44 | */ 45 | public static FunctionDescriptor descriptor() { 46 | return $DESC; 47 | } 48 | 49 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_LoadProc.Function.class, "apply", $DESC); 50 | 51 | /** 52 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 53 | * The lifetime of the returned segment is managed by {@code arena} 54 | */ 55 | public static MemorySegment allocate(FI_LoadProc.Function fi, Arena arena) { 56 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 57 | } 58 | 59 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 60 | 61 | /** 62 | * Invoke the upcall stub {@code funcPtr}, with given parameters 63 | */ 64 | public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle, int page, int flags, MemorySegment data) { 65 | try { 66 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr, io, handle, page, flags, data); 67 | } catch (Throwable ex$) { 68 | throw new AssertionError("should not reach here", ex$); 69 | } 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_MimeProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef const char *(*FI_MimeProc)(void) 18 | * } 19 | */ 20 | public class FI_MimeProc { 21 | 22 | FI_MimeProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_MimeProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_MimeProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static MemorySegment invoke(MemorySegment funcPtr) { 59 | try { 60 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_OpenProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef void *(*FI_OpenProc)(FreeImageIO *, fi_handle, BOOL) 18 | * } 19 | */ 20 | public class FI_OpenProc { 21 | 22 | FI_OpenProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(MemorySegment io, MemorySegment handle, int read); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER, 37 | Libfreeimage.C_INT 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_OpenProc.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(FI_OpenProc.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle, int read) { 63 | try { 64 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr, io, handle, read); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_PageCapabilityProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (*FI_PageCapabilityProc)(FreeImageIO *, fi_handle, void *) 18 | * } 19 | */ 20 | public class FI_PageCapabilityProc { 21 | 22 | FI_PageCapabilityProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment io, MemorySegment handle, MemorySegment data); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER, 37 | Libfreeimage.C_POINTER 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_PageCapabilityProc.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(FI_PageCapabilityProc.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static int invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle, MemorySegment data) { 63 | try { 64 | return (int) DOWN$MH.invokeExact(funcPtr, io, handle, data); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_PageCountProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (*FI_PageCountProc)(FreeImageIO *, fi_handle, void *) 18 | * } 19 | */ 20 | public class FI_PageCountProc { 21 | 22 | FI_PageCountProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment io, MemorySegment handle, MemorySegment data); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER, 37 | Libfreeimage.C_POINTER 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_PageCountProc.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(FI_PageCountProc.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static int invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle, MemorySegment data) { 63 | try { 64 | return (int) DOWN$MH.invokeExact(funcPtr, io, handle, data); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_ReadProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef unsigned int (*FI_ReadProc)(void *, unsigned int, unsigned int, fi_handle) 18 | * } 19 | */ 20 | public class FI_ReadProc { 21 | 22 | FI_ReadProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment buffer, int size, int count, MemorySegment handle); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_INT, 37 | Libfreeimage.C_INT, 38 | Libfreeimage.C_POINTER 39 | ); 40 | 41 | /** 42 | * The descriptor of this function pointer 43 | */ 44 | public static FunctionDescriptor descriptor() { 45 | return $DESC; 46 | } 47 | 48 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_ReadProc.Function.class, "apply", $DESC); 49 | 50 | /** 51 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 52 | * The lifetime of the returned segment is managed by {@code arena} 53 | */ 54 | public static MemorySegment allocate(FI_ReadProc.Function fi, Arena arena) { 55 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 56 | } 57 | 58 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 59 | 60 | /** 61 | * Invoke the upcall stub {@code funcPtr}, with given parameters 62 | */ 63 | public static int invoke(MemorySegment funcPtr,MemorySegment buffer, int size, int count, MemorySegment handle) { 64 | try { 65 | return (int) DOWN$MH.invokeExact(funcPtr, buffer, size, count, handle); 66 | } catch (Throwable ex$) { 67 | throw new AssertionError("should not reach here", ex$); 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_RegExprProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef const char *(*FI_RegExprProc)(void) 18 | * } 19 | */ 20 | public class FI_RegExprProc { 21 | 22 | FI_RegExprProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_RegExprProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_RegExprProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static MemorySegment invoke(MemorySegment funcPtr) { 59 | try { 60 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_SaveProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_SaveProc)(FreeImageIO *, FIBITMAP *, fi_handle, int, int, void *) 18 | * } 19 | */ 20 | public class FI_SaveProc { 21 | 22 | FI_SaveProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment io, MemorySegment dib, MemorySegment handle, int page, int flags, MemorySegment data); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER, 37 | Libfreeimage.C_POINTER, 38 | Libfreeimage.C_INT, 39 | Libfreeimage.C_INT, 40 | Libfreeimage.C_POINTER 41 | ); 42 | 43 | /** 44 | * The descriptor of this function pointer 45 | */ 46 | public static FunctionDescriptor descriptor() { 47 | return $DESC; 48 | } 49 | 50 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SaveProc.Function.class, "apply", $DESC); 51 | 52 | /** 53 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 54 | * The lifetime of the returned segment is managed by {@code arena} 55 | */ 56 | public static MemorySegment allocate(FI_SaveProc.Function fi, Arena arena) { 57 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 58 | } 59 | 60 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 61 | 62 | /** 63 | * Invoke the upcall stub {@code funcPtr}, with given parameters 64 | */ 65 | public static int invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment dib, MemorySegment handle, int page, int flags, MemorySegment data) { 66 | try { 67 | return (int) DOWN$MH.invokeExact(funcPtr, io, dib, handle, page, flags, data); 68 | } catch (Throwable ex$) { 69 | throw new AssertionError("should not reach here", ex$); 70 | } 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_SeekProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (*FI_SeekProc)(fi_handle, long, int) 18 | * } 19 | */ 20 | public class FI_SeekProc { 21 | 22 | FI_SeekProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment handle, long offset, int origin); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_LONG, 37 | Libfreeimage.C_INT 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SeekProc.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(FI_SeekProc.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static int invoke(MemorySegment funcPtr,MemorySegment handle, long offset, int origin) { 63 | try { 64 | return (int) DOWN$MH.invokeExact(funcPtr, handle, offset, origin); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_SupportsExportBPPProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_SupportsExportBPPProc)(int) 18 | * } 19 | */ 20 | public class FI_SupportsExportBPPProc { 21 | 22 | FI_SupportsExportBPPProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(int bpp); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_INT 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SupportsExportBPPProc.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FI_SupportsExportBPPProc.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static int invoke(MemorySegment funcPtr,int bpp) { 61 | try { 62 | return (int) DOWN$MH.invokeExact(funcPtr, bpp); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_SupportsExportTypeProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_SupportsExportTypeProc)(FREE_IMAGE_TYPE) 18 | * } 19 | */ 20 | public class FI_SupportsExportTypeProc { 21 | 22 | FI_SupportsExportTypeProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(int type); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_INT 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SupportsExportTypeProc.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FI_SupportsExportTypeProc.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static int invoke(MemorySegment funcPtr,int type) { 61 | try { 62 | return (int) DOWN$MH.invokeExact(funcPtr, type); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_SupportsICCProfilesProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_SupportsICCProfilesProc)(void) 18 | * } 19 | */ 20 | public class FI_SupportsICCProfilesProc { 21 | 22 | FI_SupportsICCProfilesProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SupportsICCProfilesProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_SupportsICCProfilesProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static int invoke(MemorySegment funcPtr) { 59 | try { 60 | return (int) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_SupportsNoPixelsProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_SupportsNoPixelsProc)(void) 18 | * } 19 | */ 20 | public class FI_SupportsNoPixelsProc { 21 | 22 | FI_SupportsNoPixelsProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SupportsNoPixelsProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_SupportsNoPixelsProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static int invoke(MemorySegment funcPtr) { 59 | try { 60 | return (int) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_TellProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef long (*FI_TellProc)(fi_handle) 18 | * } 19 | */ 20 | public class FI_TellProc { 21 | 22 | FI_TellProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | long apply(MemorySegment handle); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_LONG, 35 | Libfreeimage.C_POINTER 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_TellProc.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FI_TellProc.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static long invoke(MemorySegment funcPtr,MemorySegment handle) { 61 | try { 62 | return (long) DOWN$MH.invokeExact(funcPtr, handle); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_ValidateProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_ValidateProc)(FreeImageIO *, fi_handle) 18 | * } 19 | */ 20 | public class FI_ValidateProc { 21 | 22 | FI_ValidateProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment io, MemorySegment handle); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER 37 | ); 38 | 39 | /** 40 | * The descriptor of this function pointer 41 | */ 42 | public static FunctionDescriptor descriptor() { 43 | return $DESC; 44 | } 45 | 46 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_ValidateProc.Function.class, "apply", $DESC); 47 | 48 | /** 49 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 50 | * The lifetime of the returned segment is managed by {@code arena} 51 | */ 52 | public static MemorySegment allocate(FI_ValidateProc.Function fi, Arena arena) { 53 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 54 | } 55 | 56 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 57 | 58 | /** 59 | * Invoke the upcall stub {@code funcPtr}, with given parameters 60 | */ 61 | public static int invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle) { 62 | try { 63 | return (int) DOWN$MH.invokeExact(funcPtr, io, handle); 64 | } catch (Throwable ex$) { 65 | throw new AssertionError("should not reach here", ex$); 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FI_WriteProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef unsigned int (*FI_WriteProc)(void *, unsigned int, unsigned int, fi_handle) 18 | * } 19 | */ 20 | public class FI_WriteProc { 21 | 22 | FI_WriteProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment buffer, int size, int count, MemorySegment handle); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_INT, 37 | Libfreeimage.C_INT, 38 | Libfreeimage.C_POINTER 39 | ); 40 | 41 | /** 42 | * The descriptor of this function pointer 43 | */ 44 | public static FunctionDescriptor descriptor() { 45 | return $DESC; 46 | } 47 | 48 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_WriteProc.Function.class, "apply", $DESC); 49 | 50 | /** 51 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 52 | * The lifetime of the returned segment is managed by {@code arena} 53 | */ 54 | public static MemorySegment allocate(FI_WriteProc.Function fi, Arena arena) { 55 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 56 | } 57 | 58 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 59 | 60 | /** 61 | * Invoke the upcall stub {@code funcPtr}, with given parameters 62 | */ 63 | public static int invoke(MemorySegment funcPtr,MemorySegment buffer, int size, int count, MemorySegment handle) { 64 | try { 65 | return (int) DOWN$MH.invokeExact(funcPtr, buffer, size, count, handle); 66 | } catch (Throwable ex$) { 67 | throw new AssertionError("should not reach here", ex$); 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FreeImage_OutputMessageFunction.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef void (*FreeImage_OutputMessageFunction)(FREE_IMAGE_FORMAT, const char *) 18 | * } 19 | */ 20 | public class FreeImage_OutputMessageFunction { 21 | 22 | FreeImage_OutputMessageFunction() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(int fif, MemorySegment msg); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FreeImage_OutputMessageFunction.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FreeImage_OutputMessageFunction.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static void invoke(MemorySegment funcPtr,int fif, MemorySegment msg) { 61 | try { 62 | DOWN$MH.invokeExact(funcPtr, fif, msg); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/FreeImage_OutputMessageFunctionStdCall.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef void (*FreeImage_OutputMessageFunctionStdCall)(FREE_IMAGE_FORMAT, const char *) 18 | * } 19 | */ 20 | public class FreeImage_OutputMessageFunctionStdCall { 21 | 22 | FreeImage_OutputMessageFunctionStdCall() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(int fif, MemorySegment msg); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FreeImage_OutputMessageFunctionStdCall.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FreeImage_OutputMessageFunctionStdCall.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static void invoke(MemorySegment funcPtr,int fif, MemorySegment msg) { 61 | try { 62 | DOWN$MH.invokeExact(funcPtr, fif, msg); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/RGBQUAD.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagRGBQUAD { 18 | * BYTE rgbBlue; 19 | * BYTE rgbGreen; 20 | * BYTE rgbRed; 21 | * BYTE rgbReserved; 22 | * } RGBQUAD 23 | * } 24 | */ 25 | public class RGBQUAD extends tagRGBQUAD { 26 | 27 | RGBQUAD() { 28 | // Should not be called directly 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/com/nextbreakpoint/freeimage4java/RGBTRIPLE.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagRGBTRIPLE { 18 | * BYTE rgbtBlue; 19 | * BYTE rgbtGreen; 20 | * BYTE rgbtRed; 21 | * } RGBTRIPLE 22 | * } 23 | */ 24 | public class RGBTRIPLE extends tagRGBTRIPLE { 25 | 26 | RGBTRIPLE() { 27 | // Should not be called directly 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module com.nextbreakpoint.freeimage4java { 2 | exports com.nextbreakpoint.freeimage4java; 3 | } -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/resources/META-INF/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-2024, Andrea Medeghini 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of FreeImage4Java nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /freeimage4java-linux/src/main/resources/META-INF/NOTICE.txt: -------------------------------------------------------------------------------- 1 | FreeImage4Java is distributed as independent JAR files, one for each supported operating system. 2 | Each JAR file contains a native library which must be installed in the library path of the Java runtime. 3 | 4 | Please note that the native library is statically liked with FreeImage library under the terms of FreeImage Public License, version 1.0. 5 | You should have received a copy of the FIPL v1.0 license with FreeImage4Java. See http://freeimage.sourceforge.net for more information about FreeImage. 6 | -------------------------------------------------------------------------------- /freeimage4java-macos/dump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FREEIMAGE_HOME=$(pwd)/native/freeimage/Dist 4 | 5 | export PATH=$PATH:${JEXTRACT_HOME}/bin 6 | 7 | jextract --dump-includes includes.txt \ 8 | --include-dir "${FREEIMAGE_HOME}" \ 9 | libfreeimage.h -------------------------------------------------------------------------------- /freeimage4java-macos/extract.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FREEIMAGE_HOME=$(pwd)/native/freeimage/Dist 4 | 5 | export PATH=$PATH:${JEXTRACT_HOME}/bin 6 | 7 | jextract @includes.txt \ 8 | --output src/main/java \ 9 | --target-package com.nextbreakpoint.freeimage4java \ 10 | --include-dir "${FREEIMAGE_HOME}" \ 11 | --use-system-load-library \ 12 | --library freeimage4java \ 13 | --header-class-name Libfreeimage \ 14 | libfreeimage.h -------------------------------------------------------------------------------- /freeimage4java-macos/libfreeimage.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /freeimage4java-macos/native/Makefile: -------------------------------------------------------------------------------- 1 | INSTALL_PATH := $(CURDIR)/../src/main/resources 2 | 3 | .PHONY: checkout 4 | checkout: 5 | ./scripts/checkout.sh 6 | 7 | .PHONY: compile 8 | compile: 9 | ./scripts/compile.sh 10 | 11 | .PHONY: clean 12 | clean: 13 | ./scripts/clean.sh 14 | 15 | .PHONY: install 16 | install: 17 | ./scripts/copy.sh $(INSTALL_PATH) 18 | 19 | .PHONY: all 20 | all: build-lib install 21 | 22 | .PHONY: build-lib 23 | build-lib: checkout compile 24 | -------------------------------------------------------------------------------- /freeimage4java-macos/native/freeimage.patch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbreakpoint/freeimage4java/4a780b2a064f6d47f954dd7b83139badfff9f1dc/freeimage4java-macos/native/freeimage.patch -------------------------------------------------------------------------------- /freeimage4java-macos/native/scripts/checkout.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | FREEIMAGE_HOME=$(pwd)/freeimage 6 | 7 | if [ ! -d "$FREEIMAGE_HOME" ]; then 8 | git clone https://github.com/nextbreakpoint/FreeImage.git "$FREEIMAGE_HOME" 9 | else 10 | pushd "$FREEIMAGE_HOME" 11 | git fetch 12 | popd 13 | fi 14 | 15 | pushd "$FREEIMAGE_HOME" 16 | git checkout ee5b759719c5d3f8dd62ac0a71129a14cab5b0cd 17 | popd 18 | -------------------------------------------------------------------------------- /freeimage4java-macos/native/scripts/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FREEIMAGE_HOME=$(pwd)/freeimage 6 | 7 | if [ -d "$FREEIMAGE_HOME" ]; then 8 | make -C "$FREEIMAGE_HOME" clean 9 | fi 10 | -------------------------------------------------------------------------------- /freeimage4java-macos/native/scripts/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FREEIMAGE_HOME=$(pwd)/freeimage 6 | 7 | LIB_TYPE=64 8 | 9 | cd "$FREEIMAGE_HOME" || exit 10 | 11 | git reset --hard 12 | patch -p1 -N < ../freeimage.patch 13 | 14 | make 15 | 16 | gcc --verbose \ 17 | -o libfreeimage4java.dylib \ 18 | -dynamiclib \ 19 | -m${LIB_TYPE} \ 20 | -Wall \ 21 | -fpic \ 22 | -Wl,-force_load \ 23 | libfreeimage.a \ 24 | -lm \ 25 | -lstdc++ 26 | -------------------------------------------------------------------------------- /freeimage4java-macos/native/scripts/copy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | mkdir -p "$1" && cp freeimage/libfreeimage4java.dylib "$1" 6 | -------------------------------------------------------------------------------- /freeimage4java-macos/output.txt: -------------------------------------------------------------------------------- 1 | WARNING: Skipping va_list (type is not supported) 2 | WARNING: Skipping __gnuc_va_list (type is not supported) 3 | -------------------------------------------------------------------------------- /freeimage4java-macos/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.nextbreakpoint 6 | com.nextbreakpoint.freeimage4java 7 | 3.18.0-2.2 8 | 9 | com.nextbreakpoint.freeimage4java.macos 10 | jar 11 | FreeImage4Java MacOS 12 | FreeImage4Java provides a Java wrapper of FreeImage library 13 | 14 | 15 | 16 | org.apache.maven.plugins 17 | maven-source-plugin 18 | 19 | 20 | attach-sources 21 | 22 | jar 23 | 24 | 25 | 26 | 27 | 28 | org.apache.maven.plugins 29 | maven-javadoc-plugin 30 | 31 | 32 | attach-javadocs 33 | 34 | jar 35 | 36 | 37 | 38 | 39 | 40 | org.apache.maven.plugins 41 | maven-jar-plugin 42 | 43 | 44 | native 45 | package 46 | 47 | jar 48 | 49 | 50 | x86_64 51 | 52 | **/*.dylib 53 | **/*.txt 54 | 55 | 56 | **/*.class 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /freeimage4java-macos/source: -------------------------------------------------------------------------------- 1 | export JAVA_HOME='/Library/Java/JavaVirtualMachines/temurin-22.jdk/Contents/Home' 2 | export JEXTRACT_HOME='/Users/andrea/Documents/tools/jextract-22' 3 | export PATH=$PATH:$JAVA_HOME/bin:$JEXTRACT_HOME/bin 4 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/BITMAPINFO.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagBITMAPINFO { 18 | * BITMAPINFOHEADER bmiHeader; 19 | * RGBQUAD bmiColors[1]; 20 | * } BITMAPINFO 21 | * } 22 | */ 23 | public class BITMAPINFO extends tagBITMAPINFO { 24 | 25 | BITMAPINFO() { 26 | // Should not be called directly 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/BITMAPINFOHEADER.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagBITMAPINFOHEADER { 18 | * DWORD biSize; 19 | * LONG biWidth; 20 | * LONG biHeight; 21 | * WORD biPlanes; 22 | * WORD biBitCount; 23 | * DWORD biCompression; 24 | * DWORD biSizeImage; 25 | * LONG biXPelsPerMeter; 26 | * LONG biYPelsPerMeter; 27 | * DWORD biClrUsed; 28 | * DWORD biClrImportant; 29 | * } BITMAPINFOHEADER 30 | * } 31 | */ 32 | public class BITMAPINFOHEADER extends tagBITMAPINFOHEADER { 33 | 34 | BITMAPINFOHEADER() { 35 | // Should not be called directly 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FICOMPLEX.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagFICOMPLEX { 18 | * double r; 19 | * double i; 20 | * } FICOMPLEX 21 | * } 22 | */ 23 | public class FICOMPLEX extends tagFICOMPLEX { 24 | 25 | FICOMPLEX() { 26 | // Should not be called directly 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FIRGB16.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagFIRGB16 { 18 | * WORD red; 19 | * WORD green; 20 | * WORD blue; 21 | * } FIRGB16 22 | * } 23 | */ 24 | public class FIRGB16 extends tagFIRGB16 { 25 | 26 | FIRGB16() { 27 | // Should not be called directly 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FIRGBA16.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagFIRGBA16 { 18 | * WORD red; 19 | * WORD green; 20 | * WORD blue; 21 | * WORD alpha; 22 | * } FIRGBA16 23 | * } 24 | */ 25 | public class FIRGBA16 extends tagFIRGBA16 { 26 | 27 | FIRGBA16() { 28 | // Should not be called directly 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FIRGBAF.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagFIRGBAF { 18 | * float red; 19 | * float green; 20 | * float blue; 21 | * float alpha; 22 | * } FIRGBAF 23 | * } 24 | */ 25 | public class FIRGBAF extends tagFIRGBAF { 26 | 27 | FIRGBAF() { 28 | // Should not be called directly 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FIRGBF.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagFIRGBF { 18 | * float red; 19 | * float green; 20 | * float blue; 21 | * } FIRGBF 22 | * } 23 | */ 24 | public class FIRGBF extends tagFIRGBF { 25 | 26 | FIRGBF() { 27 | // Should not be called directly 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_CloseProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef void (*FI_CloseProc)(FreeImageIO *, fi_handle, void *) 18 | * } 19 | */ 20 | public class FI_CloseProc { 21 | 22 | FI_CloseProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(MemorySegment io, MemorySegment handle, MemorySegment data); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libfreeimage.C_POINTER, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER 37 | ); 38 | 39 | /** 40 | * The descriptor of this function pointer 41 | */ 42 | public static FunctionDescriptor descriptor() { 43 | return $DESC; 44 | } 45 | 46 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_CloseProc.Function.class, "apply", $DESC); 47 | 48 | /** 49 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 50 | * The lifetime of the returned segment is managed by {@code arena} 51 | */ 52 | public static MemorySegment allocate(FI_CloseProc.Function fi, Arena arena) { 53 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 54 | } 55 | 56 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 57 | 58 | /** 59 | * Invoke the upcall stub {@code funcPtr}, with given parameters 60 | */ 61 | public static void invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle, MemorySegment data) { 62 | try { 63 | DOWN$MH.invokeExact(funcPtr, io, handle, data); 64 | } catch (Throwable ex$) { 65 | throw new AssertionError("should not reach here", ex$); 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_DescriptionProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef const char *(*FI_DescriptionProc)(void) 18 | * } 19 | */ 20 | public class FI_DescriptionProc { 21 | 22 | FI_DescriptionProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_DescriptionProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_DescriptionProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static MemorySegment invoke(MemorySegment funcPtr) { 59 | try { 60 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_ExtensionListProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef const char *(*FI_ExtensionListProc)(void) 18 | * } 19 | */ 20 | public class FI_ExtensionListProc { 21 | 22 | FI_ExtensionListProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_ExtensionListProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_ExtensionListProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static MemorySegment invoke(MemorySegment funcPtr) { 59 | try { 60 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_FormatProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef const char *(*FI_FormatProc)(void) 18 | * } 19 | */ 20 | public class FI_FormatProc { 21 | 22 | FI_FormatProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_FormatProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_FormatProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static MemorySegment invoke(MemorySegment funcPtr) { 59 | try { 60 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_InitProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef void (*FI_InitProc)(Plugin *, int) 18 | * } 19 | */ 20 | public class FI_InitProc { 21 | 22 | FI_InitProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(MemorySegment plugin, int format_id); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libfreeimage.C_POINTER, 35 | Libfreeimage.C_INT 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_InitProc.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FI_InitProc.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static void invoke(MemorySegment funcPtr,MemorySegment plugin, int format_id) { 61 | try { 62 | DOWN$MH.invokeExact(funcPtr, plugin, format_id); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_LoadProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef FIBITMAP *(*FI_LoadProc)(FreeImageIO *, fi_handle, int, int, void *) 18 | * } 19 | */ 20 | public class FI_LoadProc { 21 | 22 | FI_LoadProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(MemorySegment io, MemorySegment handle, int page, int flags, MemorySegment data); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER, 37 | Libfreeimage.C_INT, 38 | Libfreeimage.C_INT, 39 | Libfreeimage.C_POINTER 40 | ); 41 | 42 | /** 43 | * The descriptor of this function pointer 44 | */ 45 | public static FunctionDescriptor descriptor() { 46 | return $DESC; 47 | } 48 | 49 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_LoadProc.Function.class, "apply", $DESC); 50 | 51 | /** 52 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 53 | * The lifetime of the returned segment is managed by {@code arena} 54 | */ 55 | public static MemorySegment allocate(FI_LoadProc.Function fi, Arena arena) { 56 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 57 | } 58 | 59 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 60 | 61 | /** 62 | * Invoke the upcall stub {@code funcPtr}, with given parameters 63 | */ 64 | public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle, int page, int flags, MemorySegment data) { 65 | try { 66 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr, io, handle, page, flags, data); 67 | } catch (Throwable ex$) { 68 | throw new AssertionError("should not reach here", ex$); 69 | } 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_MimeProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef const char *(*FI_MimeProc)(void) 18 | * } 19 | */ 20 | public class FI_MimeProc { 21 | 22 | FI_MimeProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_MimeProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_MimeProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static MemorySegment invoke(MemorySegment funcPtr) { 59 | try { 60 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_OpenProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef void *(*FI_OpenProc)(FreeImageIO *, fi_handle, BOOL) 18 | * } 19 | */ 20 | public class FI_OpenProc { 21 | 22 | FI_OpenProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(MemorySegment io, MemorySegment handle, int read); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER, 37 | Libfreeimage.C_INT 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_OpenProc.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(FI_OpenProc.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle, int read) { 63 | try { 64 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr, io, handle, read); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_PageCapabilityProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (*FI_PageCapabilityProc)(FreeImageIO *, fi_handle, void *) 18 | * } 19 | */ 20 | public class FI_PageCapabilityProc { 21 | 22 | FI_PageCapabilityProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment io, MemorySegment handle, MemorySegment data); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER, 37 | Libfreeimage.C_POINTER 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_PageCapabilityProc.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(FI_PageCapabilityProc.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static int invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle, MemorySegment data) { 63 | try { 64 | return (int) DOWN$MH.invokeExact(funcPtr, io, handle, data); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_PageCountProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (*FI_PageCountProc)(FreeImageIO *, fi_handle, void *) 18 | * } 19 | */ 20 | public class FI_PageCountProc { 21 | 22 | FI_PageCountProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment io, MemorySegment handle, MemorySegment data); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER, 37 | Libfreeimage.C_POINTER 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_PageCountProc.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(FI_PageCountProc.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static int invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle, MemorySegment data) { 63 | try { 64 | return (int) DOWN$MH.invokeExact(funcPtr, io, handle, data); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_ReadProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef unsigned int (*FI_ReadProc)(void *, unsigned int, unsigned int, fi_handle) 18 | * } 19 | */ 20 | public class FI_ReadProc { 21 | 22 | FI_ReadProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment buffer, int size, int count, MemorySegment handle); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_INT, 37 | Libfreeimage.C_INT, 38 | Libfreeimage.C_POINTER 39 | ); 40 | 41 | /** 42 | * The descriptor of this function pointer 43 | */ 44 | public static FunctionDescriptor descriptor() { 45 | return $DESC; 46 | } 47 | 48 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_ReadProc.Function.class, "apply", $DESC); 49 | 50 | /** 51 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 52 | * The lifetime of the returned segment is managed by {@code arena} 53 | */ 54 | public static MemorySegment allocate(FI_ReadProc.Function fi, Arena arena) { 55 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 56 | } 57 | 58 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 59 | 60 | /** 61 | * Invoke the upcall stub {@code funcPtr}, with given parameters 62 | */ 63 | public static int invoke(MemorySegment funcPtr,MemorySegment buffer, int size, int count, MemorySegment handle) { 64 | try { 65 | return (int) DOWN$MH.invokeExact(funcPtr, buffer, size, count, handle); 66 | } catch (Throwable ex$) { 67 | throw new AssertionError("should not reach here", ex$); 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_RegExprProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef const char *(*FI_RegExprProc)(void) 18 | * } 19 | */ 20 | public class FI_RegExprProc { 21 | 22 | FI_RegExprProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_RegExprProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_RegExprProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static MemorySegment invoke(MemorySegment funcPtr) { 59 | try { 60 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_SaveProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_SaveProc)(FreeImageIO *, FIBITMAP *, fi_handle, int, int, void *) 18 | * } 19 | */ 20 | public class FI_SaveProc { 21 | 22 | FI_SaveProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment io, MemorySegment dib, MemorySegment handle, int page, int flags, MemorySegment data); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER, 37 | Libfreeimage.C_POINTER, 38 | Libfreeimage.C_INT, 39 | Libfreeimage.C_INT, 40 | Libfreeimage.C_POINTER 41 | ); 42 | 43 | /** 44 | * The descriptor of this function pointer 45 | */ 46 | public static FunctionDescriptor descriptor() { 47 | return $DESC; 48 | } 49 | 50 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SaveProc.Function.class, "apply", $DESC); 51 | 52 | /** 53 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 54 | * The lifetime of the returned segment is managed by {@code arena} 55 | */ 56 | public static MemorySegment allocate(FI_SaveProc.Function fi, Arena arena) { 57 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 58 | } 59 | 60 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 61 | 62 | /** 63 | * Invoke the upcall stub {@code funcPtr}, with given parameters 64 | */ 65 | public static int invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment dib, MemorySegment handle, int page, int flags, MemorySegment data) { 66 | try { 67 | return (int) DOWN$MH.invokeExact(funcPtr, io, dib, handle, page, flags, data); 68 | } catch (Throwable ex$) { 69 | throw new AssertionError("should not reach here", ex$); 70 | } 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_SeekProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (*FI_SeekProc)(fi_handle, long, int) 18 | * } 19 | */ 20 | public class FI_SeekProc { 21 | 22 | FI_SeekProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment handle, long offset, int origin); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_LONG, 37 | Libfreeimage.C_INT 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SeekProc.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(FI_SeekProc.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static int invoke(MemorySegment funcPtr,MemorySegment handle, long offset, int origin) { 63 | try { 64 | return (int) DOWN$MH.invokeExact(funcPtr, handle, offset, origin); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_SupportsExportBPPProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_SupportsExportBPPProc)(int) 18 | * } 19 | */ 20 | public class FI_SupportsExportBPPProc { 21 | 22 | FI_SupportsExportBPPProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(int bpp); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_INT 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SupportsExportBPPProc.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FI_SupportsExportBPPProc.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static int invoke(MemorySegment funcPtr,int bpp) { 61 | try { 62 | return (int) DOWN$MH.invokeExact(funcPtr, bpp); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_SupportsExportTypeProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_SupportsExportTypeProc)(FREE_IMAGE_TYPE) 18 | * } 19 | */ 20 | public class FI_SupportsExportTypeProc { 21 | 22 | FI_SupportsExportTypeProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(int type); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_INT 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SupportsExportTypeProc.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FI_SupportsExportTypeProc.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static int invoke(MemorySegment funcPtr,int type) { 61 | try { 62 | return (int) DOWN$MH.invokeExact(funcPtr, type); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_SupportsICCProfilesProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_SupportsICCProfilesProc)(void) 18 | * } 19 | */ 20 | public class FI_SupportsICCProfilesProc { 21 | 22 | FI_SupportsICCProfilesProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SupportsICCProfilesProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_SupportsICCProfilesProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static int invoke(MemorySegment funcPtr) { 59 | try { 60 | return (int) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_SupportsNoPixelsProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_SupportsNoPixelsProc)(void) 18 | * } 19 | */ 20 | public class FI_SupportsNoPixelsProc { 21 | 22 | FI_SupportsNoPixelsProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SupportsNoPixelsProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_SupportsNoPixelsProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static int invoke(MemorySegment funcPtr) { 59 | try { 60 | return (int) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_TellProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef long (*FI_TellProc)(fi_handle) 18 | * } 19 | */ 20 | public class FI_TellProc { 21 | 22 | FI_TellProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | long apply(MemorySegment handle); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_LONG, 35 | Libfreeimage.C_POINTER 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_TellProc.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FI_TellProc.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static long invoke(MemorySegment funcPtr,MemorySegment handle) { 61 | try { 62 | return (long) DOWN$MH.invokeExact(funcPtr, handle); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_ValidateProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_ValidateProc)(FreeImageIO *, fi_handle) 18 | * } 19 | */ 20 | public class FI_ValidateProc { 21 | 22 | FI_ValidateProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment io, MemorySegment handle); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER 37 | ); 38 | 39 | /** 40 | * The descriptor of this function pointer 41 | */ 42 | public static FunctionDescriptor descriptor() { 43 | return $DESC; 44 | } 45 | 46 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_ValidateProc.Function.class, "apply", $DESC); 47 | 48 | /** 49 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 50 | * The lifetime of the returned segment is managed by {@code arena} 51 | */ 52 | public static MemorySegment allocate(FI_ValidateProc.Function fi, Arena arena) { 53 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 54 | } 55 | 56 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 57 | 58 | /** 59 | * Invoke the upcall stub {@code funcPtr}, with given parameters 60 | */ 61 | public static int invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle) { 62 | try { 63 | return (int) DOWN$MH.invokeExact(funcPtr, io, handle); 64 | } catch (Throwable ex$) { 65 | throw new AssertionError("should not reach here", ex$); 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FI_WriteProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef unsigned int (*FI_WriteProc)(void *, unsigned int, unsigned int, fi_handle) 18 | * } 19 | */ 20 | public class FI_WriteProc { 21 | 22 | FI_WriteProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment buffer, int size, int count, MemorySegment handle); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_INT, 37 | Libfreeimage.C_INT, 38 | Libfreeimage.C_POINTER 39 | ); 40 | 41 | /** 42 | * The descriptor of this function pointer 43 | */ 44 | public static FunctionDescriptor descriptor() { 45 | return $DESC; 46 | } 47 | 48 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_WriteProc.Function.class, "apply", $DESC); 49 | 50 | /** 51 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 52 | * The lifetime of the returned segment is managed by {@code arena} 53 | */ 54 | public static MemorySegment allocate(FI_WriteProc.Function fi, Arena arena) { 55 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 56 | } 57 | 58 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 59 | 60 | /** 61 | * Invoke the upcall stub {@code funcPtr}, with given parameters 62 | */ 63 | public static int invoke(MemorySegment funcPtr,MemorySegment buffer, int size, int count, MemorySegment handle) { 64 | try { 65 | return (int) DOWN$MH.invokeExact(funcPtr, buffer, size, count, handle); 66 | } catch (Throwable ex$) { 67 | throw new AssertionError("should not reach here", ex$); 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FreeImage_OutputMessageFunction.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef void (*FreeImage_OutputMessageFunction)(FREE_IMAGE_FORMAT, const char *) 18 | * } 19 | */ 20 | public class FreeImage_OutputMessageFunction { 21 | 22 | FreeImage_OutputMessageFunction() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(int fif, MemorySegment msg); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FreeImage_OutputMessageFunction.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FreeImage_OutputMessageFunction.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static void invoke(MemorySegment funcPtr,int fif, MemorySegment msg) { 61 | try { 62 | DOWN$MH.invokeExact(funcPtr, fif, msg); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/FreeImage_OutputMessageFunctionStdCall.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef void (*FreeImage_OutputMessageFunctionStdCall)(FREE_IMAGE_FORMAT, const char *) 18 | * } 19 | */ 20 | public class FreeImage_OutputMessageFunctionStdCall { 21 | 22 | FreeImage_OutputMessageFunctionStdCall() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(int fif, MemorySegment msg); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FreeImage_OutputMessageFunctionStdCall.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FreeImage_OutputMessageFunctionStdCall.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static void invoke(MemorySegment funcPtr,int fif, MemorySegment msg) { 61 | try { 62 | DOWN$MH.invokeExact(funcPtr, fif, msg); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/RGBQUAD.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagRGBQUAD { 18 | * BYTE rgbBlue; 19 | * BYTE rgbGreen; 20 | * BYTE rgbRed; 21 | * BYTE rgbReserved; 22 | * } RGBQUAD 23 | * } 24 | */ 25 | public class RGBQUAD extends tagRGBQUAD { 26 | 27 | RGBQUAD() { 28 | // Should not be called directly 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/com/nextbreakpoint/freeimage4java/RGBTRIPLE.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagRGBTRIPLE { 18 | * BYTE rgbtBlue; 19 | * BYTE rgbtGreen; 20 | * BYTE rgbtRed; 21 | * } RGBTRIPLE 22 | * } 23 | */ 24 | public class RGBTRIPLE extends tagRGBTRIPLE { 25 | 26 | RGBTRIPLE() { 27 | // Should not be called directly 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module com.nextbreakpoint.freeimage4java { 2 | exports com.nextbreakpoint.freeimage4java; 3 | } -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/resources/META-INF/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-2024, Andrea Medeghini 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of FreeImage4Java nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /freeimage4java-macos/src/main/resources/META-INF/NOTICE.txt: -------------------------------------------------------------------------------- 1 | FreeImage4Java is distributed as independent JAR files, one for each supported operating system. 2 | Each JAR file contains a native library which must be installed in the library path of the Java runtime. 3 | 4 | Please note that the native library is statically liked with FreeImage library under the terms of FreeImage Public License, version 1.0. 5 | You should have received a copy of the FIPL v1.0 license with FreeImage4Java. See http://freeimage.sourceforge.net for more information about FreeImage. 6 | -------------------------------------------------------------------------------- /freeimage4java-tests/sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbreakpoint/freeimage4java/4a780b2a064f6d47f954dd7b83139badfff9f1dc/freeimage4java-tests/sample.png -------------------------------------------------------------------------------- /freeimage4java-windows/dump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FREEIMAGE_HOME="$(cygpath -w $(pwd)/native/freeimage/Dist)" 4 | INCLUDE_PATH="$(cygpath -w $CYGWIN_HOME/usr/include)" 5 | 6 | export PATH=$PATH:${JEXTRACT_HOME}/bin 7 | 8 | jextract --dump-includes includes.txt \ 9 | --include-dir "${FREEIMAGE_HOME}" \ 10 | --include-dir "${INCLUDE_PATH}" \ 11 | libfreeimage.h -------------------------------------------------------------------------------- /freeimage4java-windows/extract.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FREEIMAGE_HOME="$(cygpath -w $(pwd)/native/freeimage/Dist)" 4 | INCLUDE_PATH="$(cygpath -w $CYGWIN_HOME/usr/include)" 5 | 6 | export PATH=$PATH:${JEXTRACT_HOME}/bin 7 | 8 | jextract @includes.txt \ 9 | --output src/main/java \ 10 | --target-package com.nextbreakpoint.freeimage4java \ 11 | --include-dir "${FREEIMAGE_HOME}" \ 12 | --include-dir "${INCLUDE_PATH}" \ 13 | --use-system-load-library \ 14 | --library freeimage4java \ 15 | --header-class-name Libfreeimage \ 16 | libfreeimage.h -------------------------------------------------------------------------------- /freeimage4java-windows/libfreeimage.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /freeimage4java-windows/native/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | RUN apt-get update -y && apt-get -y install git make gcc=4:11.2.0-1ubuntu1 g++=4:11.2.0-1ubuntu1 mingw-w64=8.0.0-1 4 | 5 | WORKDIR /var/native 6 | -------------------------------------------------------------------------------- /freeimage4java-windows/native/Makefile: -------------------------------------------------------------------------------- 1 | INSTALL_PATH := $(CURDIR)/../src/main/resources 2 | 3 | .PHONY: checkout 4 | checkout: 5 | ./scripts/checkout.sh 6 | 7 | .PHONY: configure 8 | configure: 9 | ./scripts/configure.sh 10 | 11 | .PHONY: compile 12 | compile: 13 | ./scripts/compile.sh 14 | 15 | .PHONY: clean 16 | clean: 17 | ./scripts/clean.sh 18 | 19 | .PHONY: install 20 | install: 21 | ./scripts/copy.sh $(INSTALL_PATH) 22 | 23 | .PHONY: all 24 | all: build-lib install 25 | 26 | .PHONY: build-image 27 | build-image: 28 | docker build -t freeimage4java-windows . 29 | 30 | .PHONY: build-lib 31 | build-lib: build-image 32 | docker run --rm -i -v $(CURDIR):/var/native freeimage4java-windows make checkout compile 33 | -------------------------------------------------------------------------------- /freeimage4java-windows/native/freeimage.patch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbreakpoint/freeimage4java/4a780b2a064f6d47f954dd7b83139badfff9f1dc/freeimage4java-windows/native/freeimage.patch -------------------------------------------------------------------------------- /freeimage4java-windows/native/scripts/checkout.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | FREEIMAGE_HOME=$(pwd)/freeimage 6 | 7 | if [ ! -d "$FREEIMAGE_HOME" ]; then 8 | git clone https://github.com/nextbreakpoint/FreeImage.git "$FREEIMAGE_HOME" 9 | else 10 | pushd "$FREEIMAGE_HOME" 11 | git fetch 12 | popd 13 | fi 14 | 15 | pushd "$FREEIMAGE_HOME" 16 | git checkout ee5b759719c5d3f8dd62ac0a71129a14cab5b0cd 17 | popd 18 | -------------------------------------------------------------------------------- /freeimage4java-windows/native/scripts/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FREEIMAGE_HOME=$(pwd)/freeimage 6 | 7 | if [ -d "$FREEIMAGE_HOME" ]; then 8 | make -C "$FREEIMAGE_HOME" -f Makefile.mingw clean 9 | fi 10 | -------------------------------------------------------------------------------- /freeimage4java-windows/native/scripts/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FREEIMAGE_HOME=$(pwd)/freeimage 6 | 7 | LIB_TYPE=64 8 | 9 | cd "$FREEIMAGE_HOME" || exit 10 | 11 | git reset --hard 12 | patch -p1 -N < ../freeimage.patch 13 | 14 | make -f Makefile.mingw 15 | 16 | x86_64-w64-mingw32-gcc --verbose \ 17 | -o freeimage4java.dll \ 18 | -shared \ 19 | -m${LIB_TYPE} \ 20 | -Wall \ 21 | -fpic \ 22 | -static-libgcc \ 23 | -static-libstdc++ \ 24 | -Wl,--out-implib=freeimage4java.dll.a \ 25 | -Wl,-add-stdcall-alias \ 26 | -Wl,--no-undefined \ 27 | -Wl,-Bsymbolic \ 28 | -Wl,--whole-archive \ 29 | libfreeimage.a \ 30 | -Wl,--no-whole-archive \ 31 | -Wl,-Bstatic \ 32 | -lm \ 33 | -lstdc++ \ 34 | -lws2_32 -------------------------------------------------------------------------------- /freeimage4java-windows/native/scripts/copy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | mkdir -p "$1" && cp freeimage/freeimage4java.dll "$1" 6 | -------------------------------------------------------------------------------- /freeimage4java-windows/output.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbreakpoint/freeimage4java/4a780b2a064f6d47f954dd7b83139badfff9f1dc/freeimage4java-windows/output.txt -------------------------------------------------------------------------------- /freeimage4java-windows/source: -------------------------------------------------------------------------------- 1 | export CYGWIN_HOME="/cygdrive/c/Users/andrea/Documents/cygwin" 2 | export JAVA_HOME=/cygdrive/c/Users/andrea/Documents/jdk-22.0.1+8 3 | export JEXTRACT_HOME=/cygdrive/c/Users/andrea/Documents/jextract-22 4 | export PATH=$PATH:$JAVA_HOME/bin:$JEXTRACT_HOME/bin 5 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/BITMAPINFO.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagBITMAPINFO { 18 | * BITMAPINFOHEADER bmiHeader; 19 | * RGBQUAD bmiColors[1]; 20 | * } BITMAPINFO 21 | * } 22 | */ 23 | public class BITMAPINFO extends tagBITMAPINFO { 24 | 25 | BITMAPINFO() { 26 | // Should not be called directly 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/BITMAPINFOHEADER.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagBITMAPINFOHEADER { 18 | * DWORD biSize; 19 | * LONG biWidth; 20 | * LONG biHeight; 21 | * WORD biPlanes; 22 | * WORD biBitCount; 23 | * DWORD biCompression; 24 | * DWORD biSizeImage; 25 | * LONG biXPelsPerMeter; 26 | * LONG biYPelsPerMeter; 27 | * DWORD biClrUsed; 28 | * DWORD biClrImportant; 29 | * } BITMAPINFOHEADER 30 | * } 31 | */ 32 | public class BITMAPINFOHEADER extends tagBITMAPINFOHEADER { 33 | 34 | BITMAPINFOHEADER() { 35 | // Should not be called directly 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FICOMPLEX.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagFICOMPLEX { 18 | * double r; 19 | * double i; 20 | * } FICOMPLEX 21 | * } 22 | */ 23 | public class FICOMPLEX extends tagFICOMPLEX { 24 | 25 | FICOMPLEX() { 26 | // Should not be called directly 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FIRGB16.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagFIRGB16 { 18 | * WORD red; 19 | * WORD green; 20 | * WORD blue; 21 | * } FIRGB16 22 | * } 23 | */ 24 | public class FIRGB16 extends tagFIRGB16 { 25 | 26 | FIRGB16() { 27 | // Should not be called directly 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FIRGBA16.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagFIRGBA16 { 18 | * WORD red; 19 | * WORD green; 20 | * WORD blue; 21 | * WORD alpha; 22 | * } FIRGBA16 23 | * } 24 | */ 25 | public class FIRGBA16 extends tagFIRGBA16 { 26 | 27 | FIRGBA16() { 28 | // Should not be called directly 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FIRGBAF.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagFIRGBAF { 18 | * float red; 19 | * float green; 20 | * float blue; 21 | * float alpha; 22 | * } FIRGBAF 23 | * } 24 | */ 25 | public class FIRGBAF extends tagFIRGBAF { 26 | 27 | FIRGBAF() { 28 | // Should not be called directly 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FIRGBF.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagFIRGBF { 18 | * float red; 19 | * float green; 20 | * float blue; 21 | * } FIRGBF 22 | * } 23 | */ 24 | public class FIRGBF extends tagFIRGBF { 25 | 26 | FIRGBF() { 27 | // Should not be called directly 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_CloseProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef void (*FI_CloseProc)(FreeImageIO *, fi_handle, void *) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_CloseProc { 21 | 22 | FI_CloseProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(MemorySegment io, MemorySegment handle, MemorySegment data); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libfreeimage.C_POINTER, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER 37 | ); 38 | 39 | /** 40 | * The descriptor of this function pointer 41 | */ 42 | public static FunctionDescriptor descriptor() { 43 | return $DESC; 44 | } 45 | 46 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_CloseProc.Function.class, "apply", $DESC); 47 | 48 | /** 49 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 50 | * The lifetime of the returned segment is managed by {@code arena} 51 | */ 52 | public static MemorySegment allocate(FI_CloseProc.Function fi, Arena arena) { 53 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 54 | } 55 | 56 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 57 | 58 | /** 59 | * Invoke the upcall stub {@code funcPtr}, with given parameters 60 | */ 61 | public static void invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle, MemorySegment data) { 62 | try { 63 | DOWN$MH.invokeExact(funcPtr, io, handle, data); 64 | } catch (Throwable ex$) { 65 | throw new AssertionError("should not reach here", ex$); 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_DescriptionProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef char *(*FI_DescriptionProc)(void) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_DescriptionProc { 21 | 22 | FI_DescriptionProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_DescriptionProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_DescriptionProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static MemorySegment invoke(MemorySegment funcPtr) { 59 | try { 60 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_ExtensionListProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef char *(*FI_ExtensionListProc)(void) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_ExtensionListProc { 21 | 22 | FI_ExtensionListProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_ExtensionListProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_ExtensionListProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static MemorySegment invoke(MemorySegment funcPtr) { 59 | try { 60 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_FormatProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef char *(*FI_FormatProc)(void) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_FormatProc { 21 | 22 | FI_FormatProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_FormatProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_FormatProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static MemorySegment invoke(MemorySegment funcPtr) { 59 | try { 60 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_InitProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef void (*FI_InitProc)(Plugin *, int) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_InitProc { 21 | 22 | FI_InitProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(MemorySegment plugin, int format_id); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libfreeimage.C_POINTER, 35 | Libfreeimage.C_INT 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_InitProc.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FI_InitProc.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static void invoke(MemorySegment funcPtr,MemorySegment plugin, int format_id) { 61 | try { 62 | DOWN$MH.invokeExact(funcPtr, plugin, format_id); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_LoadProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef FIBITMAP *(*FI_LoadProc)(FreeImageIO *, fi_handle, int, int, void *) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_LoadProc { 21 | 22 | FI_LoadProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(MemorySegment io, MemorySegment handle, int page, int flags, MemorySegment data); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER, 37 | Libfreeimage.C_INT, 38 | Libfreeimage.C_INT, 39 | Libfreeimage.C_POINTER 40 | ); 41 | 42 | /** 43 | * The descriptor of this function pointer 44 | */ 45 | public static FunctionDescriptor descriptor() { 46 | return $DESC; 47 | } 48 | 49 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_LoadProc.Function.class, "apply", $DESC); 50 | 51 | /** 52 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 53 | * The lifetime of the returned segment is managed by {@code arena} 54 | */ 55 | public static MemorySegment allocate(FI_LoadProc.Function fi, Arena arena) { 56 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 57 | } 58 | 59 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 60 | 61 | /** 62 | * Invoke the upcall stub {@code funcPtr}, with given parameters 63 | */ 64 | public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle, int page, int flags, MemorySegment data) { 65 | try { 66 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr, io, handle, page, flags, data); 67 | } catch (Throwable ex$) { 68 | throw new AssertionError("should not reach here", ex$); 69 | } 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_MimeProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef char *(*FI_MimeProc)(void) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_MimeProc { 21 | 22 | FI_MimeProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_MimeProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_MimeProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static MemorySegment invoke(MemorySegment funcPtr) { 59 | try { 60 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_OpenProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef void *(*FI_OpenProc)(FreeImageIO *, fi_handle, BOOL) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_OpenProc { 21 | 22 | FI_OpenProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(MemorySegment io, MemorySegment handle, int read); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER, 37 | Libfreeimage.C_LONG 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_OpenProc.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(FI_OpenProc.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle, int read) { 63 | try { 64 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr, io, handle, read); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_PageCapabilityProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (*FI_PageCapabilityProc)(FreeImageIO *, fi_handle, void *) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_PageCapabilityProc { 21 | 22 | FI_PageCapabilityProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment io, MemorySegment handle, MemorySegment data); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER, 37 | Libfreeimage.C_POINTER 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_PageCapabilityProc.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(FI_PageCapabilityProc.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static int invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle, MemorySegment data) { 63 | try { 64 | return (int) DOWN$MH.invokeExact(funcPtr, io, handle, data); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_PageCountProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (*FI_PageCountProc)(FreeImageIO *, fi_handle, void *) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_PageCountProc { 21 | 22 | FI_PageCountProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment io, MemorySegment handle, MemorySegment data); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER, 37 | Libfreeimage.C_POINTER 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_PageCountProc.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(FI_PageCountProc.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static int invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle, MemorySegment data) { 63 | try { 64 | return (int) DOWN$MH.invokeExact(funcPtr, io, handle, data); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_ReadProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef unsigned int (*FI_ReadProc)(void *, unsigned int, unsigned int, fi_handle) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_ReadProc { 21 | 22 | FI_ReadProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment buffer, int size, int count, MemorySegment handle); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_INT, 37 | Libfreeimage.C_INT, 38 | Libfreeimage.C_POINTER 39 | ); 40 | 41 | /** 42 | * The descriptor of this function pointer 43 | */ 44 | public static FunctionDescriptor descriptor() { 45 | return $DESC; 46 | } 47 | 48 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_ReadProc.Function.class, "apply", $DESC); 49 | 50 | /** 51 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 52 | * The lifetime of the returned segment is managed by {@code arena} 53 | */ 54 | public static MemorySegment allocate(FI_ReadProc.Function fi, Arena arena) { 55 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 56 | } 57 | 58 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 59 | 60 | /** 61 | * Invoke the upcall stub {@code funcPtr}, with given parameters 62 | */ 63 | public static int invoke(MemorySegment funcPtr,MemorySegment buffer, int size, int count, MemorySegment handle) { 64 | try { 65 | return (int) DOWN$MH.invokeExact(funcPtr, buffer, size, count, handle); 66 | } catch (Throwable ex$) { 67 | throw new AssertionError("should not reach here", ex$); 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_RegExprProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef char *(*FI_RegExprProc)(void) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_RegExprProc { 21 | 22 | FI_RegExprProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_POINTER); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_RegExprProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_RegExprProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static MemorySegment invoke(MemorySegment funcPtr) { 59 | try { 60 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_SaveProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_SaveProc)(FreeImageIO *, FIBITMAP *, fi_handle, int, int, void *) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_SaveProc { 21 | 22 | FI_SaveProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment io, MemorySegment dib, MemorySegment handle, int page, int flags, MemorySegment data); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_LONG, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER, 37 | Libfreeimage.C_POINTER, 38 | Libfreeimage.C_INT, 39 | Libfreeimage.C_INT, 40 | Libfreeimage.C_POINTER 41 | ); 42 | 43 | /** 44 | * The descriptor of this function pointer 45 | */ 46 | public static FunctionDescriptor descriptor() { 47 | return $DESC; 48 | } 49 | 50 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SaveProc.Function.class, "apply", $DESC); 51 | 52 | /** 53 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 54 | * The lifetime of the returned segment is managed by {@code arena} 55 | */ 56 | public static MemorySegment allocate(FI_SaveProc.Function fi, Arena arena) { 57 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 58 | } 59 | 60 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 61 | 62 | /** 63 | * Invoke the upcall stub {@code funcPtr}, with given parameters 64 | */ 65 | public static int invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment dib, MemorySegment handle, int page, int flags, MemorySegment data) { 66 | try { 67 | return (int) DOWN$MH.invokeExact(funcPtr, io, dib, handle, page, flags, data); 68 | } catch (Throwable ex$) { 69 | throw new AssertionError("should not reach here", ex$); 70 | } 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_SeekProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (*FI_SeekProc)(fi_handle, long, int) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_SeekProc { 21 | 22 | FI_SeekProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment handle, int offset, int origin); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_LONG, 37 | Libfreeimage.C_INT 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SeekProc.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(FI_SeekProc.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static int invoke(MemorySegment funcPtr,MemorySegment handle, int offset, int origin) { 63 | try { 64 | return (int) DOWN$MH.invokeExact(funcPtr, handle, offset, origin); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_SupportsExportBPPProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_SupportsExportBPPProc)(int) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_SupportsExportBPPProc { 21 | 22 | FI_SupportsExportBPPProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(int bpp); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_LONG, 35 | Libfreeimage.C_INT 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SupportsExportBPPProc.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FI_SupportsExportBPPProc.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static int invoke(MemorySegment funcPtr,int bpp) { 61 | try { 62 | return (int) DOWN$MH.invokeExact(funcPtr, bpp); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_SupportsExportTypeProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_SupportsExportTypeProc)(FREE_IMAGE_TYPE) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_SupportsExportTypeProc { 21 | 22 | FI_SupportsExportTypeProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(int type); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_LONG, 35 | Libfreeimage.C_INT 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SupportsExportTypeProc.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FI_SupportsExportTypeProc.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static int invoke(MemorySegment funcPtr,int type) { 61 | try { 62 | return (int) DOWN$MH.invokeExact(funcPtr, type); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_SupportsICCProfilesProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_SupportsICCProfilesProc)(void) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_SupportsICCProfilesProc { 21 | 22 | FI_SupportsICCProfilesProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_LONG); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SupportsICCProfilesProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_SupportsICCProfilesProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static int invoke(MemorySegment funcPtr) { 59 | try { 60 | return (int) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_SupportsNoPixelsProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_SupportsNoPixelsProc)(void) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_SupportsNoPixelsProc { 21 | 22 | FI_SupportsNoPixelsProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_LONG); 35 | 36 | /** 37 | * The descriptor of this function pointer 38 | */ 39 | public static FunctionDescriptor descriptor() { 40 | return $DESC; 41 | } 42 | 43 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_SupportsNoPixelsProc.Function.class, "apply", $DESC); 44 | 45 | /** 46 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 47 | * The lifetime of the returned segment is managed by {@code arena} 48 | */ 49 | public static MemorySegment allocate(FI_SupportsNoPixelsProc.Function fi, Arena arena) { 50 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 51 | } 52 | 53 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 54 | 55 | /** 56 | * Invoke the upcall stub {@code funcPtr}, with given parameters 57 | */ 58 | public static int invoke(MemorySegment funcPtr) { 59 | try { 60 | return (int) DOWN$MH.invokeExact(funcPtr); 61 | } catch (Throwable ex$) { 62 | throw new AssertionError("should not reach here", ex$); 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_TellProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef long (*FI_TellProc)(fi_handle) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_TellProc { 21 | 22 | FI_TellProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment handle); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_LONG, 35 | Libfreeimage.C_POINTER 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_TellProc.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FI_TellProc.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static int invoke(MemorySegment funcPtr,MemorySegment handle) { 61 | try { 62 | return (int) DOWN$MH.invokeExact(funcPtr, handle); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_ValidateProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef BOOL (*FI_ValidateProc)(FreeImageIO *, fi_handle) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_ValidateProc { 21 | 22 | FI_ValidateProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment io, MemorySegment handle); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_LONG, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_POINTER 37 | ); 38 | 39 | /** 40 | * The descriptor of this function pointer 41 | */ 42 | public static FunctionDescriptor descriptor() { 43 | return $DESC; 44 | } 45 | 46 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_ValidateProc.Function.class, "apply", $DESC); 47 | 48 | /** 49 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 50 | * The lifetime of the returned segment is managed by {@code arena} 51 | */ 52 | public static MemorySegment allocate(FI_ValidateProc.Function fi, Arena arena) { 53 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 54 | } 55 | 56 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 57 | 58 | /** 59 | * Invoke the upcall stub {@code funcPtr}, with given parameters 60 | */ 61 | public static int invoke(MemorySegment funcPtr,MemorySegment io, MemorySegment handle) { 62 | try { 63 | return (int) DOWN$MH.invokeExact(funcPtr, io, handle); 64 | } catch (Throwable ex$) { 65 | throw new AssertionError("should not reach here", ex$); 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FI_WriteProc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef unsigned int (*FI_WriteProc)(void *, unsigned int, unsigned int, fi_handle) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FI_WriteProc { 21 | 22 | FI_WriteProc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment buffer, int size, int count, MemorySegment handle); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER, 36 | Libfreeimage.C_INT, 37 | Libfreeimage.C_INT, 38 | Libfreeimage.C_POINTER 39 | ); 40 | 41 | /** 42 | * The descriptor of this function pointer 43 | */ 44 | public static FunctionDescriptor descriptor() { 45 | return $DESC; 46 | } 47 | 48 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FI_WriteProc.Function.class, "apply", $DESC); 49 | 50 | /** 51 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 52 | * The lifetime of the returned segment is managed by {@code arena} 53 | */ 54 | public static MemorySegment allocate(FI_WriteProc.Function fi, Arena arena) { 55 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 56 | } 57 | 58 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 59 | 60 | /** 61 | * Invoke the upcall stub {@code funcPtr}, with given parameters 62 | */ 63 | public static int invoke(MemorySegment funcPtr,MemorySegment buffer, int size, int count, MemorySegment handle) { 64 | try { 65 | return (int) DOWN$MH.invokeExact(funcPtr, buffer, size, count, handle); 66 | } catch (Throwable ex$) { 67 | throw new AssertionError("should not reach here", ex$); 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FreeImage_OutputMessageFunction.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef void (*FreeImage_OutputMessageFunction)(FREE_IMAGE_FORMAT, char *) 18 | * } 19 | */ 20 | public class FreeImage_OutputMessageFunction { 21 | 22 | FreeImage_OutputMessageFunction() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(int fif, MemorySegment msg); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FreeImage_OutputMessageFunction.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FreeImage_OutputMessageFunction.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static void invoke(MemorySegment funcPtr,int fif, MemorySegment msg) { 61 | try { 62 | DOWN$MH.invokeExact(funcPtr, fif, msg); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/FreeImage_OutputMessageFunctionStdCall.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef void (*FreeImage_OutputMessageFunctionStdCall)(FREE_IMAGE_FORMAT, char *) __attribute__((stdcall)) 18 | * } 19 | */ 20 | public class FreeImage_OutputMessageFunctionStdCall { 21 | 22 | FreeImage_OutputMessageFunctionStdCall() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(int fif, MemorySegment msg); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libfreeimage.C_INT, 35 | Libfreeimage.C_POINTER 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libfreeimage.upcallHandle(FreeImage_OutputMessageFunctionStdCall.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(FreeImage_OutputMessageFunctionStdCall.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static void invoke(MemorySegment funcPtr,int fif, MemorySegment msg) { 61 | try { 62 | DOWN$MH.invokeExact(funcPtr, fif, msg); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/RGBQUAD.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagRGBQUAD { 18 | * BYTE rgbBlue; 19 | * BYTE rgbGreen; 20 | * BYTE rgbRed; 21 | * BYTE rgbReserved; 22 | * } RGBQUAD 23 | * } 24 | */ 25 | public class RGBQUAD extends tagRGBQUAD { 26 | 27 | RGBQUAD() { 28 | // Should not be called directly 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/com/nextbreakpoint/freeimage4java/RGBTRIPLE.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.freeimage4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef struct tagRGBTRIPLE { 18 | * BYTE rgbtBlue; 19 | * BYTE rgbtGreen; 20 | * BYTE rgbtRed; 21 | * } RGBTRIPLE 22 | * } 23 | */ 24 | public class RGBTRIPLE extends tagRGBTRIPLE { 25 | 26 | RGBTRIPLE() { 27 | // Should not be called directly 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module com.nextbreakpoint.freeimage4java { 2 | exports com.nextbreakpoint.freeimage4java; 3 | } -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/resources/META-INF/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-2024, Andrea Medeghini 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of FreeImage4Java nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /freeimage4java-windows/src/main/resources/META-INF/NOTICE.txt: -------------------------------------------------------------------------------- 1 | FreeImage4Java is distributed as independent JAR files, one for each supported operating system. 2 | Each JAR file contains a native library which must be installed in the library path of the Java runtime. 3 | 4 | Please note that the native library is statically liked with FreeImage library under the terms of FreeImage Public License, version 1.0. 5 | You should have received a copy of the FIPL v1.0 license with FreeImage4Java. See http://freeimage.sourceforge.net for more information about FreeImage. 6 | -------------------------------------------------------------------------------- /legal/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-2024, Andrea Medeghini 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of FreeImage4Java nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /legal/NOTICE.txt: -------------------------------------------------------------------------------- 1 | FreeImage4Java is distributed as independent JAR files, one for each supported operating system. 2 | Each JAR file contains a native library which must be installed in the library path of the Java runtime. 3 | 4 | Please note that the native library is statically liked with FreeImage library under the terms of FreeImage Public License, version 1.0. 5 | You should have received a copy of the FIPL v1.0 license with FreeImage4Java. See http://freeimage.sourceforge.net for more information about FreeImage. 6 | -------------------------------------------------------------------------------- /maven-version-rules.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | .*-alpha.* 8 | .*-beta.* 9 | .*-Beta.* 10 | .*-ea.* 11 | .*-RC.* 12 | .*-M.* 13 | 14 | --------------------------------------------------------------------------------