diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-09-04 21:28:49 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-09-04 21:28:49 +0200 |
commit | a5fef41f49da3d82a619629c5060fc9a3565eeb2 (patch) | |
tree | 6209eaac2bdb31f2fa32e95374085b3bba54fca9 /src/libgamma | |
parent | add states (diff) | |
download | jlibgamma-a5fef41f49da3d82a619629c5060fc9a3565eeb2.tar.gz jlibgamma-a5fef41f49da3d82a619629c5060fc9a3565eeb2.tar.bz2 jlibgamma-a5fef41f49da3d82a619629c5060fc9a3565eeb2.tar.xz |
add gamma ramps + suppress serial warning on libgammaexception
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/libgamma/GammaRamps.java | 291 | ||||
-rw-r--r-- | src/libgamma/LibgammaException.java | 1 | ||||
-rw-r--r-- | src/libgamma/Ramp.java | 160 | ||||
-rw-r--r-- | src/libgamma/Ramp16.java | 90 | ||||
-rw-r--r-- | src/libgamma/Ramp32.java | 77 | ||||
-rw-r--r-- | src/libgamma/Ramp64.java | 64 | ||||
-rw-r--r-- | src/libgamma/Ramp8.java | 103 | ||||
-rw-r--r-- | src/libgamma/Rampd.java | 78 | ||||
-rw-r--r-- | src/libgamma/Rampf.java | 78 |
9 files changed, 942 insertions, 0 deletions
diff --git a/src/libgamma/GammaRamps.java b/src/libgamma/GammaRamps.java new file mode 100644 index 0000000..32be718 --- /dev/null +++ b/src/libgamma/GammaRamps.java @@ -0,0 +1,291 @@ +/** + * 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 <http://www.gnu.org/licenses/>. + */ +package libgamma; + + +/** + * Gamma ramp structure. + * + * @param <T> The ramp class, should be select in accordance + * with the <tt>depth</tt> parameter of the constructor: + * <p> + * 8: Ramp8<br/> + * 16: Ramp16<br/> + * 32: Ramp32<br/> + * 64: Ramp64<br/> + * -1: Rampf<br/> + * -2: Rampd<br/> + * </p> + */ +public class GammaRamps<T extends Ramp> +{ + /** + * 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. + */ + private 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); + } + + + /** + * 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); + +} + diff --git a/src/libgamma/LibgammaException.java b/src/libgamma/LibgammaException.java index 619c653..8e623f2 100644 --- a/src/libgamma/LibgammaException.java +++ b/src/libgamma/LibgammaException.java @@ -28,6 +28,7 @@ package libgamma; * codes. It does however not contain system error codes. * </p> */ +@SuppressWarnings("serial") public class LibgammaException extends Exception { /** diff --git a/src/libgamma/Ramp.java b/src/libgamma/Ramp.java new file mode 100644 index 0000000..a916e67 --- /dev/null +++ b/src/libgamma/Ramp.java @@ -0,0 +1,160 @@ +/** + * 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 <http://www.gnu.org/licenses/>. + */ +package libgamma; + + +/** + * A single gamma ramp. + */ +public abstract class Ramp +{ + /** + * Constructor. + * + * @param address The address of the native object. + * @param size The size of the encoding axis of the gamma ramp. + */ + Ramp(long address, int size) + { + this.size = size; + this.address = address; + } + + + /** + * The size of the encoding axis of the gamma ramp. + */ + public final int size; + + /** + * The address of the native object. + */ + protected final long address; + + + /** + * Read the value of a stop in an 8-bit ramp. + * + * @param address The address of the ramp. + * @param stop The index of the stop. + * @return The value of the stop. + */ + protected static native short libgamma_gamma_ramps8_get(long address, int stop); + + /** + * Read the value of a stop in a 16-bit ramp. + * + * @param address The address of the ramp. + * @param stop The index of the stop. + * @return The value of the stop. + */ + protected static native int libgamma_gamma_ramps16_get(long address, int stop); + + /** + * Read the value of a stop in a 32-bit ramp. + * + * @param address The address of the ramp. + * @param stop The index of the stop. + * @return The value of the stop. + */ + protected static native long libgamma_gamma_ramps32_get(long address, int stop); + + /** + * Read the value of a stop in a 64-bit ramp. + * + * @param address The address of the ramp. + * @param stop The index of the stop. + * @return The value of the stop. + */ + protected static native long libgamma_gamma_ramps64_get(long address, int stop); + + /** + * Read the value of a stop in a single precision floating point ramp. + * + * @param address The address of the ramp. + * @param stop The index of the stop. + * @return The value of the stop. + */ + protected static native float libgamma_gamma_rampsf_get(long address, int stop); + + /** + * Read the value of a stop in a double precision floating point ramp. + * + * @param address The address of the ramp. + * @param stop The index of the stop. + * @return The value of the stop. + */ + protected static native double libgamma_gamma_rampsd_get(long address, int stop); + + + /** + * Set the value of a stop in an 8-bit ramp. + * + * @param address The address of the ramp. + * @param stop The index of the stop. + * @param value The value of the stop. + */ + protected static native void libgamma_gamma_ramps8_set(long address, int stop, short value); + + /** + * Set the value of a stop in a 16-bit ramp. + * + * @param address The address of the ramp. + * @param stop The index of the stop. + * @param value The value of the stop. + */ + protected static native void libgamma_gamma_ramps16_set(long address, int stop, int value); + + /** + * Set the value of a stop in a 32-bit ramp. + * + * @param address The address of the ramp. + * @param stop The index of the stop. + * @param value The value of the stop. + */ + protected static native void libgamma_gamma_ramps32_set(long address, int stop, long value); + + /** + * Set the value of a stop in a 64-bit ramp. + * + * @param address The address of the ramp. + * @param stop The index of the stop. + * @param value The value of the stop. + */ + protected static native void libgamma_gamma_ramps64_set(long address, int stop, long value); + + /** + * Set the value of a stop in a single precision floating point ramp. + * + * @param address The address of the ramp. + * @param stop The index of the stop. + * @param value The value of the stop. + */ + protected static native void libgamma_gamma_rampsf_set(long address, int stop, float value); + + /** + * Set the value of a stop in a double precision floating point ramp. + * + * @param address The address of the ramp. + * @param stop The index of the stop. + * @param value The value of the stop. + */ + protected static native void libgamma_gamma_rampsd_set(long address, int stop, double value); + +} + diff --git a/src/libgamma/Ramp16.java b/src/libgamma/Ramp16.java new file mode 100644 index 0000000..9582286 --- /dev/null +++ b/src/libgamma/Ramp16.java @@ -0,0 +1,90 @@ +/** + * 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 <http://www.gnu.org/licenses/>. + */ +package libgamma; + + +/** + * A single 16-bit gamma ramp. + */ +public class Ramp16 extends Ramp +{ + /** + * Constructor. + * + * @param address The address of the native object. + * @param size The size of the encoding axis of the gamma ramp. + */ + Ramp16(long address, int size) + { + super(address, size); + } + + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @return The value of the stop. + */ + public int get(int stop) + { + return libgamma_gamma_ramps16_get(this.address, stop); + } + + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @param value The new value of the stop. + * @return The new value of the stop. + */ + public long set(int stop, long value) + { + libgamma_gamma_ramps16_set(this.address, stop, (int)value); + return value; + } + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @param value The new value of the stop. + * @return The new value of the stop. + */ + public int set(int stop, int value) + { + libgamma_gamma_ramps16_set(this.address, stop, value); + return value; + } + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @param value The new value of the stop. + * @return The new value of the stop. + */ + public short set(int stop, short value) + { + libgamma_gamma_ramps16_set(this.address, stop, value); + return value; + } + +} + diff --git a/src/libgamma/Ramp32.java b/src/libgamma/Ramp32.java new file mode 100644 index 0000000..563a77f --- /dev/null +++ b/src/libgamma/Ramp32.java @@ -0,0 +1,77 @@ +/** + * 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 <http://www.gnu.org/licenses/>. + */ +package libgamma; + + +/** + * A single 32-bit gamma ramp. + */ +public class Ramp32 extends Ramp +{ + /** + * Constructor. + * + * @param address The address of the native object. + * @param size The size of the encoding axis of the gamma ramp. + */ + Ramp32(long address, int size) + { + super(address, size); + } + + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @return The value of the stop. + */ + public long get(int stop) + { + return libgamma_gamma_ramps32_get(this.address, stop); + } + + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @param value The new value of the stop. + * @return The new value of the stop. + */ + public long set(int stop, long value) + { + libgamma_gamma_ramps32_set(this.address, stop, value); + return value; + } + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @param value The new value of the stop. + * @return The new value of the stop. + */ + public int set(int stop, int value) + { + libgamma_gamma_ramps32_set(this.address, stop, value); + return value; + } + +} + diff --git a/src/libgamma/Ramp64.java b/src/libgamma/Ramp64.java new file mode 100644 index 0000000..d772e96 --- /dev/null +++ b/src/libgamma/Ramp64.java @@ -0,0 +1,64 @@ +/** + * 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 <http://www.gnu.org/licenses/>. + */ +package libgamma; + + +/** + * A single 64-bit gamma ramp. + */ +public class Ramp64 extends Ramp +{ + /** + * Constructor. + * + * @param address The address of the native object. + * @param size The size of the encoding axis of the gamma ramp. + */ + Ramp64(long address, int size) + { + super(address, size); + } + + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @return The value of the stop. + */ + public long get(int stop) + { + return libgamma_gamma_ramps64_get(this.address, stop); + } + + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @param value The new value of the stop. + * @return The new value of the stop. + */ + public long set(int stop, long value) + { + libgamma_gamma_ramps64_set(this.address, stop, value); + return value; + } + +} + diff --git a/src/libgamma/Ramp8.java b/src/libgamma/Ramp8.java new file mode 100644 index 0000000..ca0150a --- /dev/null +++ b/src/libgamma/Ramp8.java @@ -0,0 +1,103 @@ +/** + * 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 <http://www.gnu.org/licenses/>. + */ +package libgamma; + + +/** + * A single 8-bit gamma ramp. + */ +public class Ramp8 extends Ramp +{ + /** + * Constructor. + * + * @param address The address of the native object. + * @param size The size of the encoding axis of the gamma ramp. + */ + Ramp8(long address, int size) + { + super(address, size); + } + + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @return The value of the stop. + */ + public short get(short stop) + { + return libgamma_gamma_ramps8_get(this.address, stop); + } + + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @param value The new value of the stop. + * @return The new value of the stop. + */ + public long set(int stop, long value) + { + libgamma_gamma_ramps8_set(this.address, stop, (short)value); + return value; + } + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @param value The new value of the stop. + * @return The new value of the stop. + */ + public int set(int stop, int value) + { + libgamma_gamma_ramps8_set(this.address, stop, (short)value); + return value; + } + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @param value The new value of the stop. + * @return The new value of the stop. + */ + public short set(int stop, short value) + { + libgamma_gamma_ramps8_set(this.address, stop, value); + return value; + } + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @param value The new value of the stop. + * @return The new value of the stop. + */ + public byte set(int stop, byte value) + { + libgamma_gamma_ramps8_set(this.address, stop, value); + return value; + } + +} + diff --git a/src/libgamma/Rampd.java b/src/libgamma/Rampd.java new file mode 100644 index 0000000..9a7cf14 --- /dev/null +++ b/src/libgamma/Rampd.java @@ -0,0 +1,78 @@ +/** + * 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 <http://www.gnu.org/licenses/>. + */ +package libgamma; + + +/** + * A single double percision floating point gamma ramp. + */ +public class Rampd extends Ramp +{ + /** + * Constructor. + * + * @param address The address of the native object. + * @param size The size of the encoding axis of the gamma ramp. + */ + Rampd(long address, int size) + { + super(address, size); + } + + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @return The value of the stop. + */ + public double get(int stop) + { + return libgamma_gamma_rampsd_get(this.address, stop); + } + + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @param value The new value of the stop. + * @return The new value of the stop. + */ + public float set(int stop, float value) + { + libgamma_gamma_rampsd_set(this.address, stop, value); + return value; + } + + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @param value The new value of the stop. + * @return The new value of the stop. + */ + public double set(int stop, double value) + { + libgamma_gamma_rampsd_set(this.address, stop, value); + return value; + } + +} + diff --git a/src/libgamma/Rampf.java b/src/libgamma/Rampf.java new file mode 100644 index 0000000..31fd55b --- /dev/null +++ b/src/libgamma/Rampf.java @@ -0,0 +1,78 @@ +/** + * 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 <http://www.gnu.org/licenses/>. + */ +package libgamma; + + +/** + * A single single percision floating point gamma ramp. + */ +public class Rampf extends Ramp +{ + /** + * Constructor. + * + * @param address The address of the native object. + * @param size The size of the encoding axis of the gamma ramp. + */ + Rampf(long address, int size) + { + super(address, size); + } + + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @return The value of the stop. + */ + public float get(int stop) + { + return libgamma_gamma_rampsf_get(this.address, stop); + } + + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @param value The new value of the stop. + * @return The new value of the stop. + */ + public float set(int stop, float value) + { + libgamma_gamma_rampsf_set(this.address, stop, value); + return value; + } + + + /** + * Read the value of a stop. + * + * @param stop The index of the stop. + * @param value The new value of the stop. + * @return The new value of the stop. + */ + public double set(int stop, double value) + { + libgamma_gamma_rampsf_set(this.address, stop, (float)value); + return value; + } + +} + |