From d2386fa0e3cc5e80fcfe51f07751d13676655d76 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 21 Jul 2022 12:45:26 +0200 Subject: Improve makefile, change license to ISC, change code style, remove dist/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libgamma/GammaRamps.java | 332 ------------------------------------------- 1 file changed, 332 deletions(-) delete mode 100644 src/libgamma/GammaRamps.java (limited to 'src/libgamma/GammaRamps.java') diff --git a/src/libgamma/GammaRamps.java b/src/libgamma/GammaRamps.java deleted file mode 100644 index 61352e2..0000000 --- a/src/libgamma/GammaRamps.java +++ /dev/null @@ -1,332 +0,0 @@ -/** - * jlibgamma — Display server abstraction layer for gamma ramp and Java - * Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) - * - * This library is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this library. If not, see . - */ -package libgamma; - - -/** - * Gamma ramp structure. - * - * @param The ramp class, should be select in accordance - * with the depth parameter of the constructor: - *

- * 8: Ramp8
- * 16: Ramp16
- * 32: Ramp32
- * 64: Ramp64
- * -1: Rampf
- * -2: Rampd
- *

- */ -public class GammaRamps -{ - /** - * Type initialiser. - */ - static - { - Libgamma.initialise(); - } - - - - /** - * Constructor. - * - * @param red_size The size of the encoding axis of the red gamma ramp. - * @param green_size The size of the encoding axis of the green gamma ramp. - * @param blue_size The size of the encoding axis of the blue gamma ramp. - * @param depth The bit-depth of the value axes of gamma ramps, - * -1 for single precision floating point, and -2 for - * double precision floating point. - */ - public GammaRamps(int red_size, int green_size, int blue_size, int depth) throws LibgammaException - { - this(red_size, green_size, blue_size, (short)depth); - } - - /** - * Constructor. - * - * @param red_size The size of the encoding axis of the red gamma ramp. - * @param green_size The size of the encoding axis of the green gamma ramp. - * @param blue_size The size of the encoding axis of the blue gamma ramp. - * @param depth The bit-depth of the value axes of gamma ramps, - * -1 for single precision floating point, and -2 for - * double precision floating point. - */ - @SuppressWarnings("unchecked") - public GammaRamps(int red_size, int green_size, int blue_size, short depth) throws LibgammaException - { - long[] r; - if (depth == 8) r = libgamma_gamma_ramps8_create (red_size, green_size, blue_size); - else if (depth == 16) r = libgamma_gamma_ramps16_create(red_size, green_size, blue_size); - else if (depth == 32) r = libgamma_gamma_ramps32_create(red_size, green_size, blue_size); - else if (depth == 64) r = libgamma_gamma_ramps64_create(red_size, green_size, blue_size); - else if (depth == -1) r = libgamma_gamma_rampsf_create (red_size, green_size, blue_size); - else if (depth == -2) r = libgamma_gamma_rampsd_create (red_size, green_size, blue_size); - else - throw new IllegalArgumentException("depth must be either of: 8, 16, 32, 64, -1, -2."); - - if (r[4] != 0) - throw new LibgammaException((int)(r[4])); - - this.address = r[0]; - this.depth = depth; - - Ramp red = null; - Ramp green = null; - Ramp blue = null; - - if (depth == 8) red = (Ramp)(new Ramp8 (r[1], red_size)); - else if (depth == 16) red = (Ramp)(new Ramp16(r[1], red_size)); - else if (depth == 32) red = (Ramp)(new Ramp32(r[1], red_size)); - else if (depth == 64) red = (Ramp)(new Ramp64(r[1], red_size)); - else if (depth == -1) red = (Ramp)(new Rampf (r[1], red_size)); - else if (depth == -2) red = (Ramp)(new Rampd (r[1], red_size)); - - if (depth == 8) green = (Ramp)(new Ramp8 (r[2], green_size)); - else if (depth == 16) green = (Ramp)(new Ramp16(r[2], green_size)); - else if (depth == 32) green = (Ramp)(new Ramp32(r[2], green_size)); - else if (depth == 64) green = (Ramp)(new Ramp64(r[2], green_size)); - else if (depth == -1) green = (Ramp)(new Rampf (r[2], green_size)); - else if (depth == -2) green = (Ramp)(new Rampd (r[2], green_size)); - - if (depth == 8) blue = (Ramp)(new Ramp8 (r[3], blue_size)); - else if (depth == 16) blue = (Ramp)(new Ramp16(r[3], blue_size)); - else if (depth == 32) blue = (Ramp)(new Ramp32(r[3], blue_size)); - else if (depth == 64) blue = (Ramp)(new Ramp64(r[3], blue_size)); - else if (depth == -1) blue = (Ramp)(new Rampf (r[3], blue_size)); - else if (depth == -2) blue = (Ramp)(new Rampd (r[3], blue_size)); - - this.red = (T)red; - this.green = (T)green; - this.blue = (T)blue; - } - - - /** - * The gamma ramp for the red channel. - */ - public final T red; - - /** - * The gamma ramp for the green channel. - */ - public final T green; - - /** - * The gamma ramp for the blue channel. - */ - public final T blue; - - /** - * The bit-depth of the value axes of gamma ramps, - * -1 for single precision floating point, and -2 for - * double precision floating point. - */ - public final short depth; - - /** - * The address of the native object. - */ - final long address; - - - /** - * Release resources. - */ - public void close() - { - if (this.depth == 8) libgamma_gamma_ramps8_free(this.address); - else if (this.depth == 16) libgamma_gamma_ramps16_free(this.address); - else if (this.depth == 32) libgamma_gamma_ramps32_free(this.address); - else if (this.depth == 64) libgamma_gamma_ramps64_free(this.address); - else if (this.depth == -1) libgamma_gamma_rampsf_free(this.address); - else if (this.depth == -2) libgamma_gamma_rampsd_free(this.address); - } - - - /** - * {@inheritDoc} - */ - public String toString() - { - String depth_str = Integer.toString(this.depth); - if (this.depth == -1) depth_str = "float"; - if (this.depth == -1) depth_str = "double"; - - return ""; - } - - - /** - * Create and initialise a gamma ramp in the proper way that allows all adjustment - * methods to read from and write to it without causing segmentation violation. - * - * @param red_size The size of the encoding axis of the red gamma ramp. - * @param green_size The size of the encoding axis of the green gamma ramp. - * @param blue_size The size of the encoding axis of the blue gamma ramp. - * @return Element 0: The address of the native object. - * Element 1: The address of the red gamma ramp. - * Element 2: The address of the green gamma ramp. - * Element 3: The address of the blue gamma ramp. - * Element 4: Zero on success, an error code on error. - */ - private static native long[] libgamma_gamma_ramps8_create(int red_size, int green_size, int blue_size); - - /** - * Create and initialise a gamma ramp in the proper way that allows all adjustment - * methods to read from and write to it without causing segmentation violation. - * - * @param red_size The size of the encoding axis of the red gamma ramp. - * @param green_size The size of the encoding axis of the green gamma ramp. - * @param blue_size The size of the encoding axis of the blue gamma ramp. - * @return Element 0: The address of the native object. - * Element 1: The address of the red gamma ramp. - * Element 2: The address of the green gamma ramp. - * Element 3: The address of the blue gamma ramp. - * Element 4: Zero on success, an error code on error. - */ - private static native long[] libgamma_gamma_ramps16_create(int red_size, int green_size, int blue_size); - - /** - * Create and initialise a gamma ramp in the proper way that allows all adjustment - * methods to read from and write to it without causing segmentation violation. - * - * @param red_size The size of the encoding axis of the red gamma ramp. - * @param green_size The size of the encoding axis of the green gamma ramp. - * @param blue_size The size of the encoding axis of the blue gamma ramp. - * @return Element 0: The address of the native object. - * Element 1: The address of the red gamma ramp. - * Element 2: The address of the green gamma ramp. - * Element 3: The address of the blue gamma ramp. - * Element 4: Zero on success, an error code on error. - */ - private static native long[] libgamma_gamma_ramps32_create(int red_size, int green_size, int blue_size); - - /** - * Create and initialise a gamma ramp in the proper way that allows all adjustment - * methods to read from and write to it without causing segmentation violation. - * - * @param red_size The size of the encoding axis of the red gamma ramp. - * @param green_size The size of the encoding axis of the green gamma ramp. - * @param blue_size The size of the encoding axis of the blue gamma ramp. - * @return Element 0: The address of the native object. - * Element 1: The address of the red gamma ramp. - * Element 2: The address of the green gamma ramp. - * Element 3: The address of the blue gamma ramp. - * Element 4: Zero on success, an error code on error. - */ - private static native long[] libgamma_gamma_ramps64_create(int red_size, int green_size, int blue_size); - - /** - * Create and initialise a gamma ramp in the proper way that allows all adjustment - * methods to read from and write to it without causing segmentation violation. - * - * @param red_size The size of the encoding axis of the red gamma ramp. - * @param green_size The size of the encoding axis of the green gamma ramp. - * @param blue_size The size of the encoding axis of the blue gamma ramp. - * @return Element 0: The address of the native object. - * Element 1: The address of the red gamma ramp. - * Element 2: The address of the green gamma ramp. - * Element 3: The address of the blue gamma ramp. - * Element 4: Zero on success, an error code on error. - */ - private static native long[] libgamma_gamma_rampsf_create(int red_size, int green_size, int blue_size); - - /** - * Create and initialise a gamma ramp in the proper way that allows all adjustment - * methods to read from and write to it without causing segmentation violation. - * - * @param red_size The size of the encoding axis of the red gamma ramp. - * @param green_size The size of the encoding axis of the green gamma ramp. - * @param blue_size The size of the encoding axis of the blue gamma ramp. - * @return Element 0: The address of the native object. - * Element 1: The address of the red gamma ramp. - * Element 2: The address of the green gamma ramp. - * Element 3: The address of the blue gamma ramp. - * Element 4: Zero on success, an error code on error. - */ - private static native long[] libgamma_gamma_rampsd_create(int red_size, int green_size, int blue_size); - - - /** - * Release resources that are held by a gamma ramp strcuture that - * has been allocated by {@link #libgamma_gamma_ramps8_create} or - * otherwise initialised in the proper manner, as well as release - * the pointer to the structure. - * - * @param address The gamma ramps. - */ - private static native void libgamma_gamma_ramps8_free(long address); - - /** - * Release resources that are held by a gamma ramp strcuture that - * has been allocated by {@link #libgamma_gamma_ramps16_create} or - * otherwise initialised in the proper manner, as well as release - * the pointer to the structure. - * - * @param address The gamma ramps. - */ - private static native void libgamma_gamma_ramps16_free(long address); - - /** - * Release resources that are held by a gamma ramp strcuture that - * has been allocated by {@link #libgamma_gamma_ramps32_create} or - * otherwise initialised in the proper manner, as well as release - * the pointer to the structure. - * - * @param address The gamma ramps. - */ - private static native void libgamma_gamma_ramps32_free(long address); - - /** - * Release resources that are held by a gamma ramp strcuture that - * has been allocated by {@link #libgamma_gamma_ramps64_create} or - * otherwise initialised in the proper manner, as well as release - * the pointer to the structure. - * - * @param address The gamma ramps. - */ - private static native void libgamma_gamma_ramps64_free(long address); - - /** - * Release resources that are held by a gamma ramp strcuture that - * has been allocated by {@link #libgamma_gamma_rampsf_create} or - * otherwise initialised in the proper manner, as well as release - * the pointer to the structure. - * - * @param address The gamma ramps. - */ - private static native void libgamma_gamma_rampsf_free(long address); - - /** - * Release resources that are held by a gamma ramp strcuture that - * has been allocated by {@link #libgamma_gamma_rampsd_create} or - * otherwise initialised in the proper manner, as well as release - * the pointer to the structure. - * - * @param address The gamma ramps. - */ - private static native void libgamma_gamma_rampsd_free(long address); - -} - -- cgit v1.2.3-70-g09d2