aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Test.java164
-rw-r--r--src/libgamma/AdjustmentMethod.java254
-rw-r--r--src/libgamma/AdjustmentMethodCapabilities.java167
-rw-r--r--src/libgamma/CRTC.java305
-rw-r--r--src/libgamma/CRTCInformation.java580
-rw-r--r--src/libgamma/ConnectorType.java168
-rw-r--r--src/libgamma/GammaRamps.java332
-rw-r--r--src/libgamma/Libgamma.java50
-rw-r--r--src/libgamma/LibgammaException.java436
-rw-r--r--src/libgamma/Partition.java145
-rw-r--r--src/libgamma/Ramp.java179
-rw-r--r--src/libgamma/Ramp16.java100
-rw-r--r--src/libgamma/Ramp32.java77
-rw-r--r--src/libgamma/Ramp64.java64
-rw-r--r--src/libgamma/Ramp8.java103
-rw-r--r--src/libgamma/Rampd.java88
-rw-r--r--src/libgamma/Rampf.java78
-rw-r--r--src/libgamma/Site.java155
-rw-r--r--src/libgamma/SubpixelOrder.java97
-rw-r--r--src/libgamma_AdjustmentMethod.c173
-rw-r--r--src/libgamma_CRTC.c441
-rw-r--r--src/libgamma_GammaRamps.c359
-rw-r--r--src/libgamma_LibgammaException.c145
-rw-r--r--src/libgamma_Partition.c123
-rw-r--r--src/libgamma_Ramp.c230
-rw-r--r--src/libgamma_Site.c143
26 files changed, 0 insertions, 5156 deletions
diff --git a/src/Test.java b/src/Test.java
deleted file mode 100644
index e42971f..0000000
--- a/src/Test.java
+++ /dev/null
@@ -1,164 +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 <http://www.gnu.org/licenses/>.
- */
-import libgamma.*;
-
-
-/**
- * jlibgamma test class.
- */
-public class Test
-{
- public static void p(boolean text) { System.out.println(text); }
- public static void p(byte text) { System.out.println(text); }
- public static void p(short text) { System.out.println(text); }
- public static void p(int text) { System.out.println(text); }
- public static void p(long text) { System.out.println(text); }
- public static void p(char text) { System.out.println(text); }
- public static void p(String text) { System.out.println(text); }
- public static void p(Object text) { System.out.println(text); }
- public static void p() { System.out.println(); }
-
- public static void P(boolean text) { System.out.print(text + " "); }
- public static void P(byte text) { System.out.print(text + " "); }
- public static void P(short text) { System.out.print(text + " "); }
- public static void P(int text) { System.out.print(text + " "); }
- public static void P(long text) { System.out.print(text + " "); }
- public static void P(char text) { System.out.print(text + " "); }
- public static void P(String text) { System.out.print(text + " "); }
- public static void P(Object text) { System.out.print(text + " "); }
-
-
- /**
- * Main test function.
- *
- * @param args Command line arguments, excluding $0.
- */
- public static void main(String[] args) throws LibgammaException
- {
- p(LibgammaException.name_of_error(-3));
- p(LibgammaException.value_of_error("LIBGAMMA_NO_SUCH_SITE"));
- p();
-
- LibgammaException err = new LibgammaException(LibgammaException.LIBGAMMA_DEVICE_REQUIRE_GROUP);
- p(err.error_code);
- p(err.group_gid);
- p(err.group_name);
- p(err.string);
- err = new LibgammaException(5);
- p(err.string);
- p(err);
- p();
-
- for (AdjustmentMethod method : AdjustmentMethod.list_methods(0)) P(method.value); p();
- for (AdjustmentMethod method : AdjustmentMethod.list_methods(1)) P(method.value); p();
- for (AdjustmentMethod method : AdjustmentMethod.list_methods(2)) P(method.value); p();
- for (AdjustmentMethod method : AdjustmentMethod.list_methods(3)) P(method.value); p();
- for (AdjustmentMethod method : AdjustmentMethod.list_methods(4)) P(method.value); p();
- p();
-
- AdjustmentMethod method = AdjustmentMethod.list_methods(0)[0];
- p(method);
- p(SubpixelOrder.HORIZONTAL_RGB);
- p(ConnectorType.VGA);
- p();
-
- p(AdjustmentMethod.X_RANDR.is_available());
- p(AdjustmentMethod.X_RANDR.get_default_site());
- p(AdjustmentMethod.X_RANDR.get_default_site_variable());
- p();
-
- for (byte b : CRTCInformation.unhex("0123456789abcdef")) P(b & 255); p();
- p(CRTCInformation.behex(CRTCInformation.unhex("0123456789abcdef")));
- p();
-
- Site site = new Site(method, ":0");
- p(site.partitions_available);
- p(site);
- Partition partition = new Partition(site, 0);
- p(partition.crtcs_available);
- p(partition);
- CRTC crtc = new CRTC(partition, 0);
- p(crtc);
- p();
-
- CRTCInformation info = crtc.get_information(~0);
- p(info);
- p();
-
- AdjustmentMethodCapabilities caps = method.get_capabilities();
- p(caps);
- p();
-
- GammaRamps<Ramp16> ramps = new GammaRamps<Ramp16>(info.red_gamma_size, info.green_gamma_size,
- info.blue_gamma_size, 16);
-
- int[] saved_red = new int[ramps.red.size];
- int[] saved_green = new int[ramps.green.size];
- int[] saved_blue = new int[ramps.blue.size];
-
- crtc.get_gamma(ramps);
-
- for (int i = 0; i < ramps.red.size; i++)
- { P(ramps.red.get(i));
- ramps.red.set(i, (saved_red[i] = ramps.red.get(i)) / 2);
- }
- p();
- p();
- for (int i = 0; i < ramps.green.size; i++)
- { P(ramps.green.get(i));
- ramps.green.set(i, (saved_green[i] = ramps.green.get(i)) / 2);
- }
- p();
- p();
- for (int i = 0; i < ramps.blue.size; i++)
- { P(ramps.blue.get(i));
- ramps.blue.set(i, (saved_blue[i] = ramps.blue.get(i)) / 2);
- }
- p();
- p();
-
- crtc.set_gamma(ramps);
-
- try
- { Thread.sleep(1000);
- }
- catch (InterruptedException _error)
- { /* ignore. */
- }
-
- for (int i = 0; i < ramps.red. size; i++) ramps.red. set(i, saved_red[i]);
- for (int i = 0; i < ramps.green.size; i++) ramps.green.set(i, saved_green[i]);
- for (int i = 0; i < ramps.blue. size; i++) ramps.blue. set(i, saved_blue[i]);
-
- crtc.set_gamma(ramps);
-
- ramps.close();
- crtc.close();
- partition.close();
- site.close();
-
- try
- { throw new LibgammaException(0);
- }
- catch (LibgammaException error)
- { p(error);
- }
- }
-
-}
-
diff --git a/src/libgamma/AdjustmentMethod.java b/src/libgamma/AdjustmentMethod.java
deleted file mode 100644
index 7805533..0000000
--- a/src/libgamma/AdjustmentMethod.java
+++ /dev/null
@@ -1,254 +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 <http://www.gnu.org/licenses/>.
- */
-package libgamma;
-
-
-/**
- * Class of adjustment methods.
- */
-public enum AdjustmentMethod
-{
- /**
- * The identifier for the dummy adjustment method.
- * This method can be configured and is useful for
- * testing your program's ability to handle errors.
- */
- DUMMY(0),
-
- /**
- * The identifier for the adjustment method with
- * uses the RandR protocol under the X display server.
- */
- X_RANDR(1),
-
- /**
- * The identifier for the adjustment method with
- * uses the VidMode protocol under the X display server.
- * This is an older alternative to RandR that can
- * work on some drivers that are not supported by RandR,
- * however it can only control the primary CRTC per
- * screen (partition).
- */
- X_VIDMODE(2),
-
- /**
- * The identifier for the Direct Rendering Manager
- * adjustment method that is available in Linux
- * (built in to the Linux kernel with a userland
- * library for access) and is a part of the
- * Direct Rendering Infrastructure. This adjustment
- * method all work when you are in non-graphical
- * mode; however a display server cannnot be
- * started while this is running, but it can be
- * started while a display server is running.
- */
- LINUX_DRM(3),
-
- /**
- * The identifier for the Graphics Device Interface
- * adjustment method that is available in Windows.
- * This method is not well tested; it can be compiled
- * to be available under X.org using a translation layer.
- */
- W32_GDI(4),
-
- /**
- * The identifier for the CoreGraphics adjustment
- * method that is available in Mac OS X that can
- * adjust gamma ramps under the Quartz display server.
- * This method is not well tested; it can be compiled
- * to be available under X.org using a translation layer.
- */
- QUARTZ_CORE_GRAPHICS(5)
-
- ;
-
-
- /**
- * Type initialiser.
- */
- static
- {
- Libgamma.initialise();
- }
-
-
-
- /**
- * The index of the last gamma method, neither it
- * nor any index before it may actually be supported
- * as it could have been disabled at compile-time
- */
- public static final int MAX = 5;
-
- /**
- * The number adjustment methods provided by this library.
- * Note however that this includes adjstment methods that
- * have been removed at compile-time.
- */
- public static final int COUNT = MAX + 1;
-
- /**
- * Adjustment methods by their numerical values.
- */
- public static AdjustmentMethod[] VALUES =
- {
- DUMMY, X_RANDR, X_VIDMODE, LINUX_DRM, W32_GDI, QUARTZ_CORE_GRAPHICS
- };
-
-
-
- /**
- * Constructor.
- *
- * @param value The numerical value of the adjustment method.
- */
- private AdjustmentMethod(int value)
- {
- this.value = value;
- }
-
-
- /**
- * The numerical value of the adjustment method.
- */
- public final int value;
-
-
-
- /**
- * Check whether the adjustment method is available.
- *
- * @return Whether the adjustment method is available.
- */
- public boolean is_available()
- {
- return libgamma_is_method_available(this.value) != 0;
- }
-
- /**
- * Get the default site for the adjustment method.
- *
- * @return The default site for the adjustment method.
- */
- public String get_default_site()
- {
- return libgamma_method_default_site(this.value);
- }
-
- /**
- * Get the default variable that determines the default
- * site for the adjustment method.
- *
- * @return default variable that determines the default
- * site for the adjustment method.
- */
- public String get_default_site_variable()
- {
- return libgamma_method_default_site_variable(this.value);
- }
-
- /**
- * Return the capabilities of the adjustment method.
- *
- * @return The capabilities of the adjustment method.
- */
- public AdjustmentMethodCapabilities get_capabilities()
- {
- return new AdjustmentMethodCapabilities(libgamma_method_capabilities(this.value));
- }
-
-
-
- /**
- * List available adjustment methods by their order of preference based on the environment.
- *
- * @param operation Allowed values:
- * 0: Methods that the environment suggests will work, excluding fake.
- * 1: Methods that the environment suggests will work, including fake.
- * 2: All real non-fake methods.
- * 3: All real methods.
- * 4: All methods.
- * Other values invoke undefined behaviour.
- * @return List available adjustment methods by their order of preference.
- */
- public static AdjustmentMethod[] list_methods(int operation)
- {
- int[] methods = libgamma_list_methods(operation);
- AdjustmentMethod[] rc = new AdjustmentMethod[methods.length];
- for (int i = 0; i < methods.length; i++)
- rc[i] = VALUES[methods[i]];
- return rc;
- }
-
-
-
- /**
- * List available adjustment methods by their order of preference based on the environment.
- *
- * @param operation Allowed values:
- * 0: Methods that the environment suggests will work, excluding fake.
- * 1: Methods that the environment suggests will work, including fake.
- * 2: All real non-fake methods.
- * 3: All real methods.
- * 4: All methods.
- * Other values invoke undefined behaviour.
- * @return List available adjustment methods by their order of preference.
- */
- private static native int[] libgamma_list_methods(int operation);
-
- /**
- * Check whether an adjustment method is available, non-existing (invalid) methods will be
- * identified as not available under the rationale that the library may be out of date.
- *
- * @param method The adjustment method.
- * @return Whether the adjustment method is available.
- */
- private static native int libgamma_is_method_available(int method);
-
- /**
- * Return the capabilities of an adjustment method.
- *
- * @param method The adjustment method (display server and protocol).
- * @return Input parameter to the constructor of {@link AdjustmentMethodCapabilities}.
- */
- private static native long libgamma_method_capabilities(int method);
-
-
- /**
- * Return the default site for an adjustment method.
- *
- * @param method The adjustment method (display server and protocol.)
- * @return The default site, {@code null} if it cannot be determined or
- * if multiple sites are not supported by the adjustment method.
- */
- private static native String libgamma_method_default_site(int method);
-
- /**
- * Return the default variable that determines
- * the default site for an adjustment method.
- *
- * @param method The adjustment method (display server and protocol.)
- * @return The environ variables that is used to determine the
- * default site. {@code null} if there is none, that is,
- * if the method does not support multiple sites.
- */
- private static native String libgamma_method_default_site_variable(int method);
-
-}
-
diff --git a/src/libgamma/AdjustmentMethodCapabilities.java b/src/libgamma/AdjustmentMethodCapabilities.java
deleted file mode 100644
index 36cfbb9..0000000
--- a/src/libgamma/AdjustmentMethodCapabilities.java
+++ /dev/null
@@ -1,167 +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 <http://www.gnu.org/licenses/>.
- */
-package libgamma;
-
-
-/**
- * Capabilities of adjustment methods.
- */
-public class AdjustmentMethodCapabilities
-{
- /**
- * Type initialiser.
- */
- static
- {
- Libgamma.initialise();
- }
-
-
-
- /**
- * Constructor.
- *
- * @param data Low half: the value of {@link #crtc_information}.
- * High half: the values of the booleanic variables.
- */
- AdjustmentMethodCapabilities(long data)
- {
- this.crtc_information = (int)data;
-
- this.default_site_known = (data & (1L << 33L)) != 0;
- this.multiple_sites = (data & (1L << 34L)) != 0;
- this.multiple_partitions = (data & (1L << 35L)) != 0;
- this.multiple_crtcs = (data & (1L << 36L)) != 0;
- this.partitions_are_graphics_cards = (data & (1L << 37L)) != 0;
- this.site_restore = (data & (1L << 38L)) != 0;
- this.partition_restore = (data & (1L << 39L)) != 0;
- this.crtc_restore = (data & (1L << 40L)) != 0;
- this.identical_gamma_sizes = (data & (1L << 41L)) != 0;
- this.fixed_gamma_size = (data & (1L << 42L)) != 0;
- this.fixed_gamma_depth = (data & (1L << 43L)) != 0;
- this.real = (data & (1L << 44L)) != 0;
- this.fake = (data & (1L << 45L)) != 0;
- }
-
-
-
- /**
- * OR of the CRTC information fields in {@link CRTCInformation}
- * that may (but can fail) be read successfully.
- */
- public int crtc_information;
-
- /**
- * Whether the default site is known, if true the site is integrated
- * to the system or can be determined using environment variables.
- */
- public boolean default_site_known;
-
- /**
- * Whether the adjustment method supports multiple sites rather
- * than just the default site.
- */
- public boolean multiple_sites;
-
- /**
- * Whether the adjustment method supports multiple partitions
- * per site.
- */
- public boolean multiple_partitions;
-
- /**
- * Whether the adjustment method supports multiple CRTC:s
- * per partition per site.
- */
- public boolean multiple_crtcs;
-
- /**
- * Whether the partition to graphics card is a bijection.
- */
- public boolean partitions_are_graphics_cards;
-
- /**
- * Whether the adjustment method supports {@link Site#restore}.
- */
- public boolean site_restore;
-
- /**
- * Whether the adjustment method supports {@link Partition#restore}.
- */
- public boolean partition_restore;
-
- /**
- * Whether the adjustment method supports {@link CRTC#restore}.
- */
- public boolean crtc_restore;
-
- /**
- * Whether the {@link #red_gamma_size}, {@link #green_gamma_size} and
- * {@link #blue_gamma_size} fields in {@link CRTCInformation} will
- * always have the same values as each other for the adjustment method.
- */
- public boolean identical_gamma_sizes;
-
- /**
- * Whether the {@link #red_gamma_size}, {@link #green_gamma_size} and
- * {@link #blue_gamma_size} fields in {@link CRTCInformation} will
- * always be filled with the same value for the adjustment method.
- */
- public boolean fixed_gamma_size;
-
- /**
- * Whether the {@link #gamma_depth} field in {@link CRTCInformation}
- * will always be filled with the same value for the adjustment method.
- */
- public boolean fixed_gamma_depth;
-
- /**
- * Whether the adjustment method will actually perform adjustments.
- */
- public boolean real;
-
- /**
- * Whether the adjustment method is implement using a translation layer.
- */
- public boolean fake;
-
-
- /**
- * {@inheritDoc}
- */
- public String toString()
- {
- return "<AdjustmentMethodCapabilities: " +
- "information = " + Integer.toString(this.crtc_information) + ", " +
- "default_site_known = " + Boolean.toString(this.default_site_known) + ", " +
- "multiple_sites = " + Boolean.toString(this.multiple_sites) + ", " +
- "multiple_partitions = " + Boolean.toString(this.multiple_partitions) + ", " +
- "multiple_crtcs = " + Boolean.toString(this.multiple_crtcs) + ", " +
- "partitions_are_graphics_cards = " + Boolean.toString(this.partitions_are_graphics_cards) + ", " +
- "site_restore = " + Boolean.toString(this.site_restore) + ", " +
- "partition_restore = " + Boolean.toString(this.partition_restore) + ", " +
- "crtc_restore = " + Boolean.toString(this.crtc_restore) + ", " +
- "identical_gamma_sizes = " + Boolean.toString(this.identical_gamma_sizes) + ", " +
- "fixed_gamma_size = " + Boolean.toString(this.fixed_gamma_size) + ", " +
- "fixed_gamma_depth = " + Boolean.toString(this.fixed_gamma_depth) + ", " +
- "real = " + Boolean.toString(this.real) + ", " +
- "fake = " + Boolean.toString(this.fake) + ">";
- }
-
-}
-
diff --git a/src/libgamma/CRTC.java b/src/libgamma/CRTC.java
deleted file mode 100644
index 5bbb445..0000000
--- a/src/libgamma/CRTC.java
+++ /dev/null
@@ -1,305 +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 <http://www.gnu.org/licenses/>.
- */
-package libgamma;
-
-
-/**
- * Cathode ray tube controller state.
- *
- * The CRTC controls the gamma ramps for the
- * monitor that is plugged in to the connector
- * that the CRTC belongs to.
- */
-public class CRTC
-{
- /**
- * Type initialiser.
- */
- static
- {
- Libgamma.initialise();
- }
-
-
-
- /**
- * Constructor.
- *
- * @param partition The partition this CRTC belongs to.
- * @param crtc The index of the CRTC within its partition.
- */
- public CRTC(Partition partition, int crtc) throws LibgammaException
- {
- this.partition = partition;
- this.crtc = crtc;
- long[] r = libgamma_crtc_create(partition.address, crtc);
- this.address = r[0];
- if (r[1] != 0)
- throw new LibgammaException((int)(r[1]));
- }
-
-
- /**
- * The partition this CRTC belongs to.
- */
- public final Partition partition;
-
- /**
- * The index of the CRTC within its partition.
- */
- public final int crtc;
-
- /**
- * The address of the native object.
- */
- final long address;
-
-
- /**
- * Release resources.
- */
- public void close()
- {
- libgamma_crtc_free(this.address);
- }
-
- /**
- * Restore the gamma ramps for the CRTC to the system settings.
- */
- public void restore() throws LibgammaException
- {
- int r = libgamma_crtc_restore(this.address);
- if (r != 0)
- throw new LibgammaException(r);
- }
-
- /**
- * Read information about the CRTC.
- *
- * @param fields OR:ed identifiers for the information about the CRTC that should be read.
- * @return Information about the CRTC.
- */
- public CRTCInformation get_information(int fields)
- {
- Object[] r = libgamma_get_crtc_information(this.address, fields);
- byte[] edid = (byte[])(r[0]);
- String connector_name = (String)(r[1]);
- float[] gamma = (float[])(r[2]);
- int[] ints = (int[])(r[3]);
- return new CRTCInformation(edid, connector_name, gamma, ints);
- }
-
- /**
- * Get the current gamma ramps for the CRTC.
- *
- * @param output The gamma ramp structure to fill.
- */
- public <T extends Ramp> void get_gamma(GammaRamps<T> output) throws LibgammaException
- {
- int r = 0;
- if (output.depth == 8) r = libgamma_crtc_get_gamma_ramps8(this.address, output.address);
- else if (output.depth == 16) r = libgamma_crtc_get_gamma_ramps16(this.address, output.address);
- else if (output.depth == 32) r = libgamma_crtc_get_gamma_ramps32(this.address, output.address);
- else if (output.depth == 64) r = libgamma_crtc_get_gamma_ramps64(this.address, output.address);
- else if (output.depth == -1) r = libgamma_crtc_get_gamma_rampsf(this.address, output.address);
- else if (output.depth == -2) r = libgamma_crtc_get_gamma_rampsd(this.address, output.address);
- if (r != 0)
- throw new LibgammaException(r);
- }
-
- /**
- * Set the gamma ramps for the CRTC.
- *
- * @param values The gamma ramps to apply.
- */
- public <T extends Ramp> void set_gamma(GammaRamps<T> values) throws LibgammaException
- {
- int r = 0;
- if (values.depth == 8) r = libgamma_crtc_set_gamma_ramps8(this.address, values.address);
- else if (values.depth == 16) r = libgamma_crtc_set_gamma_ramps16(this.address, values.address);
- else if (values.depth == 32) r = libgamma_crtc_set_gamma_ramps32(this.address, values.address);
- else if (values.depth == 64) r = libgamma_crtc_set_gamma_ramps64(this.address, values.address);
- else if (values.depth == -1) r = libgamma_crtc_set_gamma_rampsf(this.address, values.address);
- else if (values.depth == -2) r = libgamma_crtc_set_gamma_rampsd(this.address, values.address);
- if (r != 0)
- throw new LibgammaException(r);
- }
-
-
- /**
- * {@inheritDoc}
- */
- public String toString()
- {
- return "<Site: partition = " + this.partition.toString() + ", " +
- "crtc = " + Integer.toString(this.crtc) + ">";
- }
-
-
-
- /**
- * Create a CRTC state.
- *
- * @param partition The partition state for the partition that the CRTC belongs to.
- * @param crtc The index of the CRTC within the partition.
- * @return Element 0: The value for {@link #address}.
- * Element 1: Error code, zero on success.
- */
- private static native long[] libgamma_crtc_create(long partition, int crtc);
-
- /**
- * Release all resources held by a CRTC state
- * and free the CRTC state pointer.
- *
- * @param address The CRTC state.
- */
- private static native void libgamma_crtc_free(long address);
-
- /**
- * Restore the gamma ramps for a CRTC to the system settings for that CRTC.
- *
- * @param address The CRTC state.
- * @return Zero on success, and error code on failure.
- */
- private static native int libgamma_crtc_restore(long address);
-
- /**
- * Read information about a CRTC.
- *
- * @param crtc The state of the CRTC whose information should be read.
- * @param fields OR:ed identifiers for the information about the CRTC that should be read.
- * @return Input parameters for the constructor of {@link CRTCInformation}
- */
- private static native Object[] libgamma_get_crtc_information(long crtc, int fields);
-
-
- /**
- * Get the current gamma ramps for a CRTC, 8-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to fill with the current values
- * @return Zero on success, an error code on failure.
- */
- private static native int libgamma_crtc_get_gamma_ramps8(long address, long ramps);
-
- /**
- * Set the gamma ramps for a CRTC, 8-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to apply.
- * @return Zero on success, an error code on failure.
- */
- private static native int libgamma_crtc_set_gamma_ramps8(long address, long ramps);
-
-
- /**
- * Get the current gamma ramps for a CRTC, 16-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to fill with the current values
- * @return Zero on success, an error code on failure.
- */
- private static native int libgamma_crtc_get_gamma_ramps16(long address, long ramps);
-
- /**
- * Set the gamma ramps for a CRTC, 16-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to apply.
- * @return Zero on success, an error code on failure.
- */
- private static native int libgamma_crtc_set_gamma_ramps16(long address, long ramps);
-
-
- /**
- * Get the current gamma ramps for a CRTC, 32-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to fill with the current values.
- * @return Zero on success, an error code on failure.
- */
- private static native int libgamma_crtc_get_gamma_ramps32(long address, long ramps);
-
- /**
- * Set the gamma ramps for a CRTC, 32-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to apply.
- * @return Zero on success, an error code on failure.
- */
- private static native int libgamma_crtc_set_gamma_ramps32(long address, long ramps);
-
-
- /**
- * Get the current gamma ramps for a CRTC, 64-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to fill with the current values.
- * @return Zero on success, an error code on failure.
- */
- private static native int libgamma_crtc_get_gamma_ramps64(long address, long ramps);
-
- /**
- * Set the gamma ramps for a CRTC, 64-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to apply.
- * @return Zero on success, an error code on failure.
- */
- private static native int libgamma_crtc_set_gamma_ramps64(long address, long ramps);
-
-
- /**
- * Set the gamma ramps for a CRTC, single precision floating point version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to apply.
- * @return Zero on success, an error code on failure.
- */
- private static native int libgamma_crtc_set_gamma_rampsf(long address, long ramps);
-
- /**
- * Get the current gamma ramps for a CRTC, single precision floating point version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to fill with the current values.
- * @return Zero on success, an error code on failure.
- */
- private static native int libgamma_crtc_get_gamma_rampsf(long address, long ramps);
-
-
- /**
- * Get the current gamma ramps for a CRTC, double precision floating point version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to fill with the current values.
- * @return Zero on success, an error code on failure.
- */
- private static native int libgamma_crtc_get_gamma_rampsd(long address, long ramps);
-
- /**
- * Set the gamma ramps for a CRTC, double precision floating point version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to apply.
- * @return Zero on success, an error code on failure.
- */
- private static native int libgamma_crtc_set_gamma_rampsd(long address, long ramps);
-
-}
-
diff --git a/src/libgamma/CRTCInformation.java b/src/libgamma/CRTCInformation.java
deleted file mode 100644
index a54a0c0..0000000
--- a/src/libgamma/CRTCInformation.java
+++ /dev/null
@@ -1,580 +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 <http://www.gnu.org/licenses/>.
- */
-package libgamma;
-
-
-/**
- * Cathode ray tube controller information data structure.
- */
-public class CRTCInformation
-{
- /**
- * Type initialiser.
- */
- static
- {
- Libgamma.initialise();
- }
-
-
-
- /**
- * For a {@link CRTCInformation} fill in the values for {@link #edid}
- * and {@link #edid_length} and report errors to {@link #edid_error}.
- */
- public static final int EDID = 1 << 0;
-
- /**
- * For a {@link CRTCInformation} fill in the value for
- * {@link #width_mm} and report errors to {@link #width_mm_error}.
- */
- public static final int WIDTH_MM = 1 << 1;
-
- /**
- * For a {@link CRTCInformation} fill in the value for
- * {@link #height_mm} and report errors to {@link #height_mm_error}.
- */
- public static final int HEIGHT_MM = 1 << 2;
-
- /**
- * For a {@link CRTCInformation} fill in the value for {@link #width_mm_edid}
- * and report errors to {@link #width_mm_edid_error}.
- */
- public static final int WIDTH_MM_EDID = 1 << 3;
-
- /**
- * For a {@link CRTCInformation} fill in the value for
- * {@link #height_mm_edid} and report errors to {@link #height_mm_edid_error}.
- */
- public static final int HEIGHT_MM_EDID = 1 << 4;
-
- /**
- * For a {@link CRTCInformation} fill in the values for
- * {@link #red_gamma_size}, {@link #green_gamma_size} and
- * {@link #blue_gamma_size}. and report errors to
- * {@link #gamma_size_error}.
- */
- public static final int GAMMA_SIZE = 1 << 5;
-
- /**
- * For a {@link CRTCInformation} fill in the value for
- * {@link #gamma_depth} and report errors to {@link #gamma_depth_error}.
- */
- public static final int GAMMA_DEPTH = 1 << 6;
-
- /**
- * For a {@link CRTCInformation} fill in the value for
- * {@link #gamma_support} and report errors to {@link #gamma_support_error}.
- */
- public static final int GAMMA_SUPPORT = 1 << 7;
-
- /**
- * For a {@link CRTCInformation} fill in the value for
- * {@link #subpixel_order} and report errors to {@link #subpixel_order_error}.
- */
- public static final int SUBPIXEL_ORDER = 1 << 8;
-
- /**
- * For a {@link CRTCInformation} fill in the value for
- * {@link #active} and report errors to {@link #active_error}.
- */
- public static final int ACTIVE = 1 << 9;
-
- /**
- * For a {@link CRTCInformation} fill in the value
- * for {@link #connector_name} and report errors to
- * {@link #connector_name_error}.
- */
- public static final int CONNECTOR_NAME = 1 << 10;
-
- /**
- * For a {@link CRTCInformation} fill in the
- * value for {@link #connector_type} and report
- * errors to {@link #connector_type_error}.
- */
- public static final int CONNECTOR_TYPE = 1 << 11;
-
- /**
- * For a {@link CRTCInformation} fill in the values for
- * {@link #gamma_red}, {@link #gamma_green} and
- * {@link #gamma_blue} and report errors to {@link #gamma_error}.
- */
- public static final int GAMMA = 1 << 12;
-
-
- /**
- * The number of {@link #*} values defined.
- */
- public static final int COUNT = 13;
-
-
- /**
- * Macro for both {@link CRTCInformation} fields
- * that can specify the size of the monitor's viewport
- * as specified in the monitor's Extended Display
- * Information Data.
- */
- public static final int MACRO_EDID_VIEWPORT = WIDTH_MM_EDID | HEIGHT_MM_EDID;
-
- /**
- * Macro for all {@link CRTCInformation} fields
- * that can be filled if the adjustment method have
- * support for reading the monitors' Extended Display
- * Information Data.
- */
- public static final int MACRO_EDID = EDID | MACRO_EDID_VIEWPORT | GAMMA;
-
- /**
- * Macro for both {@link CRTCInformation} fields
- * that can specify the size of the monitor's viewport
- * as provided by the adjustment method without this
- * library having to parse the monitor's Extended Display
- * Information Data.
- */
- public static final int MACRO_VIEWPORT = WIDTH_MM | HEIGHT_MM;
-
- /**
- * Macro for the {@link CRTCInformation} fields
- * that specifies the CRTC's gamma ramp sizes and gamma
- * ramp depth.
- */
- public static final int MACRO_RAMP = GAMMA_SIZE | GAMMA_DEPTH;
-
- /**
- * Macro for the {@link CRTCInformation} fields
- * that specifies the CRTC's connector type and the
- * partition unique name of the connector.
- */
- public static final int MACRO_CONNECTOR = CONNECTOR_NAME | CONNECTOR_TYPE;
-
- /**
- * Macro for the {@link CRTCInformation} fields
- * that required there is a monitor attached to
- * the connector, and that status itself.
- */
- public static final int MACRO_ACTIVE = MACRO_EDID | MACRO_VIEWPORT | SUBPIXEL_ORDER | ACTIVE;
-
-
-
- /**
- * Constructor.
- *
- * @param edid The value for {@link edid}.
- * @param connector_name The value for {@link connector_name}.
- * @param gamma The values for {@link gamma_red},
- * {@link gamma_green} and {@link gamma_blue}.
- * @param ints Values for the rest of the variables.
- */
- public CRTCInformation(byte[] edid, String connector_name, float[] gamma, int[] ints)
- {
- this.edid = edid;
- this.connector_name = connector_name;
- this.gamma_red = gamma[0];
- this.gamma_green = gamma[1];
- this.gamma_blue = gamma[2];
-
- this.edid_error = make_error(ints[0]);
- this.width_mm = ints[1];
- this.width_mm_error = make_error(ints[2]);
- this.height_mm = ints[3];
- this.height_mm_error = make_error(ints[4]);
- this.width_mm_edid = ints[5];
- this.width_mm_edid_error = make_error(ints[6]);
- this.height_mm_edid = ints[7];
- this.height_mm_edid_error = make_error(ints[8]);
- this.red_gamma_size = ints[9];
- this.green_gamma_size = ints[10];
- this.blue_gamma_size = ints[11];
- this.gamma_size_error = make_error(ints[12]);
- this.gamma_depth = (short)(ints[13]);
- this.gamma_depth_error = make_error(ints[14]);
- this.gamma_support = ints[15] != 0;
- this.gamma_support_error = make_error(ints[16]);
- this.subpixel_order = SubpixelOrder.VALUES[ints[17]];
- this.subpixel_order_error = make_error(ints[18]);
- this.active = ints[19] != 0;
- this.active_error = make_error(ints[20]);
- this.connector_name_error = make_error(ints[21]);
- this.connector_type = ConnectorType.VALUES[ints[22]];
- this.connector_type_error = make_error(ints[23]);
- this.gamma_error = make_error(ints[24]);
-
- this.has_error = (this.edid_error != null)
- || (this.width_mm_error != null)
- || (this.height_mm_error != null)
- || (this.width_mm_edid_error != null)
- || (this.height_mm_edid_error != null)
- || (this.gamma_size_error != null)
- || (this.gamma_depth_error != null)
- || (this.gamma_support_error != null)
- || (this.subpixel_order_error != null)
- || (this.connector_name_error != null)
- || (this.connector_type_error != null);
- }
-
-
- /**
- * Create an {@link LibgammaException} from an error code.
- *
- * @param error_code The error code.
- * @return An {@link LibgammaException} for the error,
- * {@code null} if <tt>error_code</tt> is zero.
- */
- private static LibgammaException make_error(int error_code)
- {
- if (error_code == 0)
- return null;
- else
- return new LibgammaException(error_code);
- }
-
-
-
- /**
- * The Extended Display Identification Data associated with
- * the attached monitor. This is raw byte array that is usually
- * 128 bytes long.
- */
- public final byte[] edid;
-
- /**
- * Error that occurred when fetching the value for
- * {@link #edid}, {@code null} on success.
- */
- public final LibgammaException edid_error;
-
-
- /**
- * The phyical width, in millimetres, of the viewport of the
- * attached monitor, as reported by the adjustment method. This
- * value may be incorrect, which is a known issue with the X
- * server where it is the result of the X server attempting
- * the estimate the size on its own.
- * Zero means that its is not applicable, which is the case
- * for projectors.
- */
- public final int width_mm;
-
- /**
- * Error that occurred when fetching the value for
- * {@link #width_mm}, {@code null} on success.
- */
- public final LibgammaException width_mm_error;
-
-
- /**
- * The phyical height, in millimetres, of the viewport of the
- * attached monitor, as reported by the adjustment method. This
- * value may be incorrect, which is a known issue with the X
- * server where it is the result of the X server attempting
- * the estimate the size on its own.
- * Zero means that its is not applicable, which is the case
- * for projectors.
- */
- public final int height_mm;
-
- /**
- * Error that occurred when fetching the value for
- * {@link #height_mm}, {@code null} on success.
- */
- public final LibgammaException height_mm_error;
-
-
- /**
- * The phyical width, in millimetres, of the viewport of the
- * attached monitor, as reported by it the monitor's Extended
- * Display Information Data. This value can only contain whole
- * centimetres, which means that the result is always zero
- * modulus ten. However, this could change with revisions of
- * the EDID structure.
- * Zero means that its is not applicable, which is the case
- * for projectors.
- */
- public final int width_mm_edid;
-
- /**
- * Error that occurred when fetching the value for
- * {@link #width_mm_edid}, {@code null} on success.
- */
- public final LibgammaException width_mm_edid_error;
-
-
- /**
- * The phyical height, in millimetres, of the viewport of the
- * attached monitor, as reported by it the monitor's Extended
- * Display Information Data. This value can only contain whole
- * centimetres, which means that the result is always zero
- * modulus ten. However, this could change with revisions of
- * the EDID structure.
- * Zero means that its is not applicable, which is the case
- * for projectors.
- */
- public final int height_mm_edid;
-
- /**
- * Error that occurred when fetching the value for
- * {@link #height_mm_edid}, {@code null} on success.
- */
- public final LibgammaException height_mm_edid_error;
-
-
- /**
- * The size of the encoding axis of the red gamma ramp.
- */
- public final int red_gamma_size;
-
- /**
- * The size of the encoding axis of the green gamma ramp.
- */
- public final int green_gamma_size;
-
- /**
- * The size of the encoding axis of the blue gamma ramp.
- */
- public final int blue_gamma_size;
-
- /**
- * Error that occurred when fetching the values for
- * {@link #red_gamma_size}, {@link #green_gamma_size}
- * and {@link #blue_gamma_size}, {@code null} on success.
- */
- public final LibgammaException gamma_size_error;
-
-
- /**
- * 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 gamma_depth;
-
- /**
- * Error that occurred when fetching the value for
- * {@link #gamma_depth}, {@code null} on success.
- */
- public final LibgammaException gamma_depth_error;
-
-
- /**
- * Whether gamma ramp adjustments are supported.
- */
- public final boolean gamma_support;
-
- /**
- * Error that occurred when fetching the value for
- * {@link #gamma_support}, {@code null} on success.
- */
- public final LibgammaException gamma_support_error;
-
-
- /**
- * The layout of the subpixels.
- * You cannot count on this value --- especially for CRT:s ---
- * but it is provided anyway as a means of distinguishing monitors.
- */
- public final SubpixelOrder subpixel_order;
-
- /**
- * Error that occurred when fetching the value for
- * {@link #subpixel_order}, {@code null} on success.
- */
- public final LibgammaException subpixel_order_error;
-
-
- /**
- * Whether there is a monitors connected to the CRTC.
- */
- public final boolean active;
-
- /**
- * Error that occurred when fetching the value for
- * {@link #active}, {@code null} on success.
- */
- public final LibgammaException active_error;
-
-
- /**
- * The name of the connector as designated by the display
- * server or as give by this library in case the display
- * server lacks this feature.
- */
- public final String connector_name;
-
- /**
- * Error that occurred when fetching the value for
- * {@link #connector_name}, {@code null} on success.
- */
- public final LibgammaException connector_name_error;
-
-
- /**
- * The type of the connector that is associated with the CRTC.
- */
- public final ConnectorType connector_type;
-
- /**
- * Error that occurred when fetching the value for
- * {@link #connector_type}, {@code null} on success.
- */
- public final LibgammaException connector_type_error;
-
-
- /**
- * The gamma characteristics of the monitor as reported
- * in its Extended Display Information Data. The value
- * holds the value for the red channel. If you do not have
- * and more accurate measurement of the gamma for the
- * monitor this could be used to give a rought gamma
- * correction; simply divide the value with 2.2 and use
- * the result for the red channel in the gamma correction.
- */
- public final float gamma_red;
-
- /**
- * The gamma characteristics of the monitor as reported
- * in its Extended Display Information Data. The value
- * holds the value for the green channel. If you do not have
- * and more accurate measurement of the gamma for the
- * monitor this could be used to give a rought gamma
- * correction; simply divide the value with 2.2 and use
- * the result for the green channel in the gamma correction.
- */
- public final float gamma_green;
-
- /**
- * The gamma characteristics of the monitor as reported
- * in its Extended Display Information Data. The value
- * holds the value for the blue channel. If you do not have
- * and more accurate measurement of the gamma for the
- * monitor this could be used to give a rought gamma
- * correction; simply divide the value with 2.2 and use
- * the result for the blue channel in the gamma correction.
- */
- public final float gamma_blue;
-
- /**
- * Error that occurred when fetching the values for
- * {@link #red_gamma}, {@link #green_gamma} and
- * {@link #blue_gamma}, {@code null} on success.
- */
- public final LibgammaException gamma_error;
-
-
- /**
- * Whether any of the error fields are non-{@code null}.
- */
- public final boolean has_error;
-
-
-
- /**
- * Helper function for {@link #toString}.
- *
- * @param error An error, may be {@code null}.
- * @return A textual representation of <tt>error</tt>
- */
- private static String errorToString(LibgammaException error)
- {
- if (error == null)
- return "<null>";
- else
- return error.toString();
- }
-
-
- /**
- * {@inheritDoc}
- */
- public String toString()
- {
- String depth_str = Integer.toString(this.gamma_depth);
- if (this.gamma_depth == -1) depth_str = "float";
- if (this.gamma_depth == -1) depth_str = "double";
-
- return "<CRTCInformation: " +
- "edid = " + behex(this.edid) + ", " +
- "edid_error = " + errorToString(this.edid_error) + ", " +
- "width_mm = " + Integer.toString(this.width_mm) + ", " +
- "width_mm_error = " + errorToString(this.width_mm_error) + ", " +
- "height_mm = " + Integer.toString(this.height_mm) + ", " +
- "height_mm_error = " + errorToString(this.height_mm_error) + ", " +
- "width_mm_edid = " + Integer.toString(this.width_mm_edid) + ", " +
- "width_mm_edid_error = " + errorToString(this.width_mm_edid_error) + ", " +
- "height_mm_edid = " + Integer.toString(this.height_mm_edid) + ", " +
- "height_mm_edid_error = " + errorToString(this.height_mm_edid_error) + ", " +
- "red_gamma_size = " + Integer.toString(this.red_gamma_size) + ", " +
- "green_gamma_size = " + Integer.toString(this.green_gamma_size) + ", " +
- "blue_gamma_size = " + Integer.toString(this.blue_gamma_size) + ", " +
- "gamma_size_error = " + errorToString(this.gamma_size_error) + ", " +
- "gamma_depth = " + depth_str + ", " +
- "gamma_depth_error = " + errorToString(this.gamma_depth_error) + ", " +
- "gamma_support = " + Boolean.toString(this.gamma_support) + ", " +
- "gamma_support_error = " + errorToString(this.gamma_support_error) + ", " +
- "subpixel_order = " + this.subpixel_order.toString() + ", " +
- "subpixel_order_error = " + errorToString(this.subpixel_order_error) + ", " +
- "active = " + Boolean.toString(this.active) + ", " +
- "active_error = " + errorToString(this.active_error) + ", " +
- "connector_name = " + (this.connector_name == null ? "<null>" : this.connector_name) + ", " +
- "connector_name_error = " + errorToString(this.connector_name_error) + ", " +
- "connector_type = " + this.connector_type.toString() + ", " +
- "connector_type_error = " + errorToString(this.connector_type_error) + ", " +
- "gamma_red = " + Float.toString(this.gamma_red) + ", " +
- "gamma_green = " + Float.toString(this.gamma_green) + ", " +
- "gamma_blue = " + Float.toString(this.gamma_blue) + ", " +
- "gamma_error = " + errorToString(this.gamma_error) + ", " +
- "has_error = " + Boolean.toString(this.has_error) + ">";
- }
-
-
-
- /**
- * Convert a raw representation of an EDID to a lowercase hexadecimal representation.
- *
- * @param edid The EDID in raw representation.
- * @return The EDID in lowercase hexadecimal representation,
- */
- public static String behex(byte[] edid)
- {
- char[] rc = new char[edid.length * 2];
- for (int i = 0; i < edid.length; i++)
- { rc[i * 2 + 0] = "0123456789abcdef".charAt((edid[i] >> 4) & 15);
- rc[i * 2 + 1] = "0123456789abcdef".charAt((edid[i] >> 0) & 15);
- }
- return new String(rc);
- }
-
- /**
- * Convert an hexadecimal representation of an EDID to a raw representation.
- *
- * @param edid The EDID in hexadecimal representation.
- * @return The EDID in raw representation, it will be half the length
- * of <tt>edid</tt> (the input value).
- */
- public static byte[] unhex(String edid)
- {
- byte[] rc = new byte[edid.length() / 2];
- edid = edid.toLowerCase();
- for (int i = 0; i < rc.length; i++)
- { rc[i] = (byte)("0123456789abcdef".indexOf(edid.charAt(i * 2 + 0)) << 4);
- rc[i] |= (byte)("0123456789abcdef".indexOf(edid.charAt(i * 2 + 1)) << 0);
- }
- return rc;
- }
-
-}
-
diff --git a/src/libgamma/ConnectorType.java b/src/libgamma/ConnectorType.java
deleted file mode 100644
index cdb737c..0000000
--- a/src/libgamma/ConnectorType.java
+++ /dev/null
@@ -1,168 +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 <http://www.gnu.org/licenses/>.
- */
-package libgamma;
-
-
-/**
- * Types for connectors.
- */
-public enum ConnectorType
-{
- /**
- * The adjustment method does not know the connector's type
- * (This could be considered an error).
- */
- Unknown(0),
-
- /**
- * Video Graphics Array (VGA).
- */
- VGA(1),
-
- /**
- * Digital Visual Interface, unknown type.
- */
- DVI(2),
-
- /**
- * Digital Visual Interface, integrated (DVI-I).
- */
- DVII(3),
-
- /**
- * Digital Visual Interface, digital only (DVI-D).
- */
- DVID(4),
-
- /**
- * Digital Visual Interface, analogue only (DVI-A).
- */
- DVIA(5),
-
- /**
- * Composite video.
- */
- Composite(6),
-
- /**
- * Separate Video (S-video).
- */
- SVIDEO(7),
-
- /**
- * Low-voltage differential signaling (LVDS).
- */
- LVDS(8),
-
- /**
- * Component video, usually separate cables for each channel.
- */
- Component(9),
-
- /**
- * 9 pin DIN (Deutsches Institut für Normung) connector.
- */
- NinePinDIN(10),
-
- /**
- * DisplayPort.
- */
- DisplayPort(11),
-
- /**
- * High-Definition Multimedia Interface (HDMI), unknown type.
- */
- HDMI(12),
-
- /**
- * High-Definition Multimedia Interface, type A (HDMI-A).
- */
- HDMIA(13),
-
- /**
- * High-Definition Multimedia Interface, type B (HDMI-B).
- */
- HDMIB(14),
-
- /**
- * Television, unknown connector.
- */
- TV(15),
-
- /**
- * Embedded DisplayPort (eDP).
- */
- eDP(16),
-
- /**
- * A virtual connector.
- */
- VIRTUAL(17),
-
- /**
- * Display Serial Interface (DSI).
- */
- DSI(18),
-
- /**
- * LFP connector.
- * (If you know what this is add it to Wikipedia.)
- */
- LFP(19)
-
- ;
-
-
- /**
- * Type initialiser.
- */
- static
- {
- Libgamma.initialise();
- }
-
-
-
- /**
- * Subpixel orders by their numerical values.
- */
- public static ConnectorType[] VALUES =
- {
- Unknown, VGA, DVI, DVII, DVID, DVIA, Composite, SVIDEO, LVDS, Component,
- NinePinDIN, DisplayPort, HDMI, HDMIA, HDMIB, TV, eDP, VIRTUAL, DSI, LFP
- };
-
-
- /**
- * Constructor.
- *
- * @param value The numerical value of the connector type.
- */
- private ConnectorType(int value)
- {
- this.value = value;
- }
-
-
- /**
- * The numerical value of the connector type.
- */
- public int value;
-
-}
-
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 <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>
-{
- /**
- * 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 "<GammaRamps: depth = " + depth_str + ", " +
- "red = " + this.red.toString() +
- "green = " + this.green.toString() +
- "blue = " + this.blue.toString() + ">";
- }
-
-
- /**
- * 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/Libgamma.java b/src/libgamma/Libgamma.java
deleted file mode 100644
index dbb9d1c..0000000
--- a/src/libgamma/Libgamma.java
+++ /dev/null
@@ -1,50 +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 <http://www.gnu.org/licenses/>.
- */
-package libgamma;
-
-
-/**
- * Library initialisation class.
- */
-class Libgamma
-{
- /**
- * Initialise the library.
- */
- static void initialise()
- {
- if (Libgamma.initialised)
- return;
- Libgamma.initialised = true;
-
- try
- { System.loadLibrary("gamma-java");
- }
- catch (Throwable err)
- { throw new Error(err);
- }
- }
-
-
- /**
- * Whether {@link #initialise} has been invoked.
- */
- private static boolean initialised = false;
-
-}
-
diff --git a/src/libgamma/LibgammaException.java b/src/libgamma/LibgammaException.java
deleted file mode 100644
index bc8611e..0000000
--- a/src/libgamma/LibgammaException.java
+++ /dev/null
@@ -1,436 +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 <http://www.gnu.org/licenses/>.
- */
-package libgamma;
-
-
-/**
- * <p>
- * Class of <tt>libgamma</tt> exceptions including
- * native system exceptions.
- * </p>
- * <p>
- * The class contains constants with <tt>libgamma</tt> error
- * codes. It does however not contain system error codes.
- * </p>
- */
-@SuppressWarnings("serial")
-public class LibgammaException extends Exception
-{
- /**
- * Type initialiser.
- */
- static
- {
- Libgamma.initialise();
- }
-
-
-
- /**
- * This error code is never used. It is only provided
- * so you know its error code if you plan to iterate
- * over all <tt>libgamma</tt> error codes.
- */
- public static final int LIBGAMMA_ERRNO_SET = -1;
-
- /**
- * The selected adjustment method does not exist
- * or has been excluded at compile-time.
- */
- public static final int LIBGAMMA_NO_SUCH_ADJUSTMENT_METHOD = -2;
-
- /**
- * The selected site does not exist.
- */
- public static final int LIBGAMMA_NO_SUCH_SITE = -3;
-
- /**
- * The selected partition does not exist.
- */
- public static final int LIBGAMMA_NO_SUCH_PARTITION = -4;
-
- /**
- * The selected CRTC does not exist.
- */
- public static final int LIBGAMMA_NO_SUCH_CRTC = -5;
-
- /**
- * Counter overflowed when counting the number
- * of available items.
- */
- public static final int LIBGAMMA_IMPOSSIBLE_AMOUNT = -6;
-
- /**
- * The selected connector is disabled, it does
- * not have a CRTC.
- */
- public static final int LIBGAMMA_CONNECTOR_DISABLED = -7;
-
- /**
- * The selected CRTC could not be opened,
- * reason unknown.
- */
- public static final int LIBGAMMA_OPEN_CRTC_FAILED = -8;
-
- /**
- * The CRTC information field is not supported
- * by the adjustment method.
- */
- public static final int LIBGAMMA_CRTC_INFO_NOT_SUPPORTED = -9;
-
- /**
- * Failed to read the current gamma ramps for
- * the selected CRTC, reason unknown.
- */
- public static final int LIBGAMMA_GAMMA_RAMP_READ_FAILED = -10;
-
- /**
- * Failed to write the current gamma ramps for
- * the selected CRTC, reason unknown.
- */
- public static final int LIBGAMMA_GAMMA_RAMP_WRITE_FAILED = -11;
-
- /**
- * The specified ramp sizes does not match the
- * ramps sizes returned by the adjustment methods
- * in response to the query/command.
- */
- public static final int LIBGAMMA_GAMMA_RAMP_SIZE_CHANGED = -12;
-
- /**
- * The specified ramp sizes are not identical
- * which is required by the adjustment method.
- * (Only returned in debug mode.)
- */
- public static final int LIBGAMMA_MIXED_GAMMA_RAMP_SIZE = -13;
-
- /**
- * The specified ramp sizes are not supported
- * by the adjustment method.
- * (Only returned in debug mode.)
- */
- public static final int LIBGAMMA_WRONG_GAMMA_RAMP_SIZE = -14;
-
- /**
- * The adjustment method reported that the gamma
- * ramps size is 1, or perhaps even zero or negative.
- */
- public static final int LIBGAMMA_SINGLETON_GAMMA_RAMP = -15;
-
- /**
- * The adjustment method failed to list
- * available CRTC:s, reason unknown.
- */
- public static final int LIBGAMMA_LIST_CRTCS_FAILED = -16;
-
- /**
- * Failed to acquire mode resources from the
- * adjustment method.
- */
- public static final int LIBGAMMA_ACQUIRING_MODE_RESOURCES_FAILED = -17;
-
- /**
- * The adjustment method reported that a negative
- * number of partitions exists in the site.
- */
- public static final int LIBGAMMA_NEGATIVE_PARTITION_COUNT = -18;
-
- /**
- * The adjustment method reported that a negative
- * number of CRTC:s exists in the partition.
- */
- public static final int LIBGAMMA_NEGATIVE_CRTC_COUNT = -19;
-
- /**
- * Device cannot be access becauses of
- * insufficient permissions.
- */
- public static final int LIBGAMMA_DEVICE_RESTRICTED = -20;
-
- /**
- * Device cannot be access, reason unknown.
- */
- public static final int LIBGAMMA_DEVICE_ACCESS_FAILED = -21;
-
- /**
- * Device cannot be access, membership of the
- * {@link #group_gid} (named by {@link #group_name}
- * (can be {@code null}, if so <tt>errno</tt> may have
- * been set to tell why)) is required.
- */
- public static final int LIBGAMMA_DEVICE_REQUIRE_GROUP = -22;
-
- /**
- * The graphics card appear to have been removed.
- */
- public static final int LIBGAMMA_GRAPHICS_CARD_REMOVED = -23;
-
- /**
- * The state of the requested information is unknown.
- */
- public static final int LIBGAMMA_STATE_UNKNOWN = -24;
-
- /**
- * Failed to determine which connector the
- * CRTC belongs to.
- */
- public static final int LIBGAMMA_CONNECTOR_UNKNOWN = -25;
-
- /**
- * The detected connector type is not listed
- * in this library and has to be updated.
- */
- public static final int LIBGAMMA_CONNECTOR_TYPE_NOT_RECOGNISED = -26;
-
- /**
- * The detected subpixel order is not listed
- * in this library and has to be updated.
- */
- public static final int LIBGAMMA_SUBPIXEL_ORDER_NOT_RECOGNISED = -27;
-
- /**
- * The length of the EDID does not match that
- * of any supported EDID structure revision.
- */
- public static final int LIBGAMMA_EDID_LENGTH_UNSUPPORTED = -28;
-
- /**
- * The magic number in the EDID does not match
- * that of any supported EDID structure revision.
- */
- public static final int LIBGAMMA_EDID_WRONG_MAGIC_NUMBER = -29;
-
- /**
- * The EDID structure revision used by the
- * mointor is not supported.
- */
- public static final int LIBGAMMA_EDID_REVISION_UNSUPPORTED = -30;
-
- /**
- * The gamma characteristics field in the EDID
- * is left unspecified.
- * (This could be considered a non-error.)
- */
- public static final int LIBGAMMA_GAMMA_NOT_SPECIFIED = -31;
-
- /**
- * The checksum in the EDID is incorrect, all
- * request information has been provided
- * by you cannot count on it.
- */
- public static final int LIBGAMMA_EDID_CHECKSUM_ERROR = -32;
-
- /**
- * Both of the errors {@link #LIBGAMMA_GAMMA_NOT_SPECIFIED}
- * and {@link #LIBGAMMA_EDID_CHECKSUM_ERROR} have occurred.
- */
- public static final int LIBGAMMA_GAMMA_NOT_SPECIFIED_AND_EDID_CHECKSUM_ERROR = -33;
-
- /**
- * Failed to query the gamma ramps size from the
- * adjustment method, reason unknown.
- */
- public static final int LIBGAMMA_GAMMA_RAMPS_SIZE_QUERY_FAILED = -34;
-
- /**
- * The selected partition could not be opened,
- * reason unknown.
- */
- public static final int LIBGAMMA_OPEN_PARTITION_FAILED = -35;
-
- /**
- * The selected site could not be opened,
- * reason unknown.
- */
- public static final int LIBGAMMA_OPEN_SITE_FAILED = -36;
-
- /**
- * Failed to query the adjustment method for
- * its protocol version, reason unknown.
- */
- public static final int LIBGAMMA_PROTOCOL_VERSION_QUERY_FAILED = -37;
-
- /**
- * The adjustment method's version of its
- * protocol is not supported.
- */
- public static final int LIBGAMMA_PROTOCOL_VERSION_NOT_SUPPORTED = -38;
-
- /**
- * The adjustment method failed to list
- * available partitions, reason unknown.
- */
- public static final int LIBGAMMA_LIST_PARTITIONS_FAILED = -39;
-
- /**
- * Partition exists by index, but the partition
- * at that index does not exist.
- */
- public static final int LIBGAMMA_NULL_PARTITION = -40;
-
- /**
- * There is not mointor connected to the
- * connector of the selected CRTC.
- */
- public static final int LIBGAMMA_NOT_CONNECTED = -41;
-
- /**
- * Data extraction from a reply from the
- * adjustment method failed, reason unknown.
- */
- public static final int LIBGAMMA_REPLY_VALUE_EXTRACTION_FAILED = -42;
-
- /**
- * No EDID property was found on the output.
- */
- public static final int LIBGAMMA_EDID_NOT_FOUND = -43;
-
- /**
- * Failed to list properties on the output,
- * reason unknown.
- */
- public static final int LIBGAMMA_LIST_PROPERTIES_FAILED = -44;
-
- /**
- * Failed to query a property's value from
- * the output, reason unknown.
- */
- public static final int LIBGAMMA_PROPERTY_VALUE_QUERY_FAILED = -45;
-
- /**
- * A request for information on an output
- * failed, reason unknown.
- */
- public static final int LIBGAMMA_OUTPUT_INFORMATION_QUERY_FAILED = -46;
-
-
- /**
- * The number of the libgamma error with the
- * lowest number. If this is lower than the
- * number your program thinks it should be sould
- * update your program for new errors.
- */
- public static final int LIBGAMMA_ERROR_MIN = -46;
-
-
-
- /**
- * Constructor.
- *
- * @param error_code The error code.
- */
- public LibgammaException(int error_code)
- {
- this.error_code = error_code;
- if (error_code == LIBGAMMA_DEVICE_REQUIRE_GROUP)
- { this.group_gid = libgamma_group_gid();
- this.group_name = libgamma_group_name();
- }
- else
- { this.group_gid = 0;
- this.group_name = null;
- }
- if (error_code < 0)
- this.string = name_of_error(error_code);
- else
- this.string = strerror(error_code);
- }
-
-
- /**
- * The error code.
- * Cannot be {@link #LIBGAMMA_ERRNO_SET}.
- */
- public final int error_code;
-
- /**
- * Group that the user needs to be a member of if
- * {@link #error_code} is {@link #LIBGAMMA_DEVICE_REQUIRE_GROUP}.
- */
- public final int group_gid;
-
- /**
- * Group that the user needs to be a member of if
- * {@link #error_code} is {@link #LIBGAMMA_DEVICE_REQUIRE_GROUP},
- * {@code null} if the name of the group {@link #group_gid}
- * cannot be determined.
- */
- public final String group_name;
-
- /**
- * Name of textual description of the error.
- */
- public final String string;
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString()
- {
- return this.string;
- }
-
-
-
- /**
- * Returns the name of the definition associated with
- * a <tt>libgamma</tt> error code.
- *
- * @param value The error code.
- * @return The name of the definition associated with the error code,
- * {@code null} if the error code does not exist.
- */
- public static native String name_of_error(int value);
-
- /**
- * Return the value of a <tt>libgamma</tt> error definition
- * refered to by name.
- *
- * @param name The name of the definition associated with the error code.
- * @return The error code, zero if the name is {@code null}
- * or does not refer to a <tt>libgamma</tt> error.
- */
- public static native int value_of_error(String name);
-
-
- /**
- * Acquire the value that should go to {@link #group_gid}.
- *
- * @return The value that should go to {@link #group_gid}.
- */
- private static native int libgamma_group_gid();
-
- /**
- * Acquire the value that should go to {@link #group_name}.
- *
- * @return The value that should go to {@link #group_name}.
- */
- private static native String libgamma_group_name();
-
- /**
- * Get a textual description of a system error code.
- *
- * @param error_code The error code.
- * @return A textual description of the error code.
- */
- private static native String strerror(int error_code);
-
-}
-
diff --git a/src/libgamma/Partition.java b/src/libgamma/Partition.java
deleted file mode 100644
index 740bc11..0000000
--- a/src/libgamma/Partition.java
+++ /dev/null
@@ -1,145 +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 <http://www.gnu.org/licenses/>.
- */
-package libgamma;
-
-
-/**
- * Partition state.
- *
- * Probably the majority of display server only one partition
- * per site. However, X.org can, and traditional used to have
- * on multi-headed environments, multiple partitions per site.
- * In X.org partitions are called 'screens'. It is not to be
- * confused with monitor. A screen is a collection of monitors,
- * and the mapping from monitors to screens is a surjection.
- * On hardware-level adjustment methods, such as Direct
- * Rendering Manager, a partition is a graphics card.
- */
-public class Partition
-{
- /**
- * Type initialiser.
- */
- static
- {
- Libgamma.initialise();
- }
-
-
-
- /**
- * Constructor.
- *
- * @param site The site this partition belongs to.
- * @param partition The index of the partition.
- */
- public Partition(Site site, int partition) throws LibgammaException
- {
- this.site = site;
- this.partition = partition;
- long[] r = libgamma_partition_create(site.address, partition);
- this.address = r[0];
- this.crtcs_available = (int)(r[1]);
- if (r[2] != 0)
- throw new LibgammaException((int)(r[2]));
- }
-
-
- /**
- * The site this partition belongs to.
- */
- public final Site site;
-
- /**
- * The index of the partition.
- */
- public final int partition;
-
- /**
- * The number of CRTC:s that are available under this
- * partition. Note that the CRTC:s are not necessarily
- * online.
- */
- public final int crtcs_available;
-
- /**
- * The address of the native object.
- */
- final long address;
-
-
- /**
- * Release resources.
- */
- public void close()
- {
- libgamma_partition_free(this.address);
- }
-
- /**
- * Restore the gamma ramps all CRTC:s within the partition to the system settings.
- */
- public void restore() throws LibgammaException
- {
- int r = libgamma_partition_restore(this.address);
- if (r != 0)
- throw new LibgammaException(r);
- }
-
-
- /**
- * {@inheritDoc}
- */
- public String toString()
- {
- return "<Partition: site = " + this.site.toString() + ", " +
- "partition = " + Integer.toString(this.partition) + ", " +
- "crtcs_available = " + Integer.toString(this.crtcs_available) + ">";
- }
-
-
-
- /**
- * Create a partition state.
- *
- * @param site The site state for the site that the partition belongs to.
- * @param partition The index of the partition within the site.
- * @return Element 0: The value for {@link #address}.
- * Element 1: The value for {@link #crtcs_available}
- * Element 2: Error code, zero on success.
- */
- private static native long[] libgamma_partition_create(long site, int partition);
-
- /**
- * Release all resources held by a partition state
- * and free the partition state pointer.
- *
- * @param address The partition state.
- */
- private static native void libgamma_partition_free(long address);
-
- /**
- * Restore the gamma ramps all CRTC:s within a partition to the system settings.
- *
- * @param address The partition state.
- * @return Zero on success, and error code on failure.
- */
- private static native int libgamma_partition_restore(long address);
-
-}
-
diff --git a/src/libgamma/Ramp.java b/src/libgamma/Ramp.java
deleted file mode 100644
index ef55f9d..0000000
--- a/src/libgamma/Ramp.java
+++ /dev/null
@@ -1,179 +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 <http://www.gnu.org/licenses/>.
- */
-package libgamma;
-
-
-/**
- * A single gamma ramp.
- */
-public abstract class Ramp
-{
- /**
- * Type initialiser.
- */
- static
- {
- Libgamma.initialise();
- }
-
-
-
- /**
- * 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;
-
-
- /**
- * {@inheritDoc}
- */
- public String toString()
- {
- return "<Ramp: size = " + Integer.toString(size) + ">";
- }
-
-
- /**
- * 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
deleted file mode 100644
index cbf7ff0..0000000
--- a/src/libgamma/Ramp16.java
+++ /dev/null
@@ -1,100 +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 <http://www.gnu.org/licenses/>.
- */
-package libgamma;
-
-
-/**
- * A single 16-bit gamma ramp.
- */
-public class Ramp16 extends Ramp
-{
- /**
- * Type initialiser.
- */
- static
- {
- Libgamma.initialise();
- }
-
-
-
- /**
- * 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
deleted file mode 100644
index 563a77f..0000000
--- a/src/libgamma/Ramp32.java
+++ /dev/null
@@ -1,77 +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 <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
deleted file mode 100644
index d772e96..0000000
--- a/src/libgamma/Ramp64.java
+++ /dev/null
@@ -1,64 +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 <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
deleted file mode 100644
index ca0150a..0000000
--- a/src/libgamma/Ramp8.java
+++ /dev/null
@@ -1,103 +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 <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
deleted file mode 100644
index 7f34eb4..0000000
--- a/src/libgamma/Rampd.java
+++ /dev/null
@@ -1,88 +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 <http://www.gnu.org/licenses/>.
- */
-package libgamma;
-
-
-/**
- * A single double percision floating point gamma ramp.
- */
-public class Rampd extends Ramp
-{
- /**
- * Type initialiser.
- */
- static
- {
- Libgamma.initialise();
- }
-
-
-
- /**
- * 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
deleted file mode 100644
index 31fd55b..0000000
--- a/src/libgamma/Rampf.java
+++ /dev/null
@@ -1,78 +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 <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;
- }
-
-}
-
diff --git a/src/libgamma/Site.java b/src/libgamma/Site.java
deleted file mode 100644
index 2dbe2b3..0000000
--- a/src/libgamma/Site.java
+++ /dev/null
@@ -1,155 +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 <http://www.gnu.org/licenses/>.
- */
-package libgamma;
-
-
-/**
- * Site state.
- *
- * On operating systems that integrate a graphical environment
- * there is usually just one site. However, one systems with
- * pluggable graphics, like Unix-like systems such as GNU/Linux
- * and the BSD:s, there can usually be any (feasible) number of
- * sites. In X.org parlance they are called displays.
- */
-public class Site
-{
- /**
- * Type initialiser.
- */
- static
- {
- Libgamma.initialise();
- }
-
-
-
- /**
- * Constructor.
- *
- * @param method The adjustmet method.
- * @param site The site identifier.
- */
- public Site(AdjustmentMethod method, String site) throws LibgammaException
- {
- this.method = method;
- this.site = site;
- long[] r = libgamma_site_create(method.value, site);
- this.address = r[0];
- this.partitions_available = (int)(r[1]);
- if (r[2] != 0)
- throw new LibgammaException((int)(r[2]));
- }
-
-
- /**
- * This field specifies, for the methods if this library,
- * which adjustment method (display server and protocol)
- * is used to adjust the gamma ramps.
- */
- public final AdjustmentMethod method;
-
- /**
- * The site identifier. It can either be {@code null} or
- * a string. {@code null} indicates the default site. On
- * systems like the Unix-like systems, where the graphics
- * are pluggable, this is usually resolved by an environment
- * variable, such as "DISPLAY" for X.org.
- */
- public final String site;
-
- /**
- * The number of partitions that is available on this site.
- * Probably the majority of display server only one partition
- * per site. However, X.org can, and traditional used to have
- * on multi-headed environments, multiple partitions per site.
- * In X.org partitions are called 'screens'. It is not to be
- * confused with monitor. A screen is a collection of monitors,
- * and the mapping from monitors to screens is a surjection.
- * On hardware-level adjustment methods, such as Direct
- * Rendering Manager, a partition is a graphics card.
- */
- public final int partitions_available;
-
- /**
- * The address of the native object.
- */
- final long address;
-
-
- /**
- * Release resources.
- */
- public void close()
- {
- libgamma_site_free(this.address);
- }
-
- /**
- * Restore the gamma ramps all CRTC:s within the site to the system settings.
- */
- public void restore() throws LibgammaException
- {
- int r = libgamma_site_restore(this.address);
- if (r != 0)
- throw new LibgammaException(r);
- }
-
-
- /**
- * {@inheritDoc}
- */
- public String toString()
- {
- return "<Site: method = " + this.method.toString() + ", " +
- "site = " + (this.site == null ? "(null)" : this.site) + ", " +
- "partitions_available = " + Integer.toString(this.partitions_available) + ">";
- }
-
-
-
-
- /**
- * Create a site state.
- *
- * @param method The adjustment method (display server and protocol.)
- * @param site The site identifier.
- * @return Element 0: The value for {@link #address}.
- * Element 1: The value for {@link #partitions_available}
- * Element 2: Error code, zero on success.
- */
- private static native long[] libgamma_site_create(int method, String site);
-
- /**
- * Release all resources held by a site state
- * and free the site state pointer.
- *
- * @param address The site state.
- */
- private static native void libgamma_site_free(long address);
-
- /**
- * Restore the gamma ramps all CRTC:s within a site to the system settings.
- *
- * @param address The site state.
- * @return Zero on success, and error code on failure.
- */
- private static native int libgamma_site_restore(long address);
-
-}
-
diff --git a/src/libgamma/SubpixelOrder.java b/src/libgamma/SubpixelOrder.java
deleted file mode 100644
index 9cc9efd..0000000
--- a/src/libgamma/SubpixelOrder.java
+++ /dev/null
@@ -1,97 +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 <http://www.gnu.org/licenses/>.
- */
-package libgamma;
-
-
-/**
- * Orders for subpixels. Currently the possible values are
- * very biased to LCD, Plasma and monochrome monitors.
- */
-public enum SubpixelOrder
-{
- /**
- * The adjustment method does not know the order of the subpixels.
- * (This could be considered an error.)
- */
- UNKNOWN(0),
-
- /**
- * There are no subpixels in the monitor.
- */
- NONE(1),
-
- /**
- * The subpixels are ordered red, green and then blue, from left to right.
- */
- HORIZONTAL_RGB(2),
-
- /**
- * The subpixels are ordered blue, green and then red, from left to right.
- */
- HORIZONTAL_BGR(3),
-
- /**
- * The subpixels are ordered red, green and then blue, from the top down.
- */
- VERTICAL_RGB(4),
-
- /**
- * The subpixels are ordered blue, green and then red, from the top down.
- */
- VERTICAL_BGR(5)
-
- ;
-
-
- /**
- * Type initialiser.
- */
- static
- {
- Libgamma.initialise();
- }
-
-
-
- /**
- * Subpixel orders by their numerical values.
- */
- public static SubpixelOrder[] VALUES =
- {
- UNKNOWN, NONE, HORIZONTAL_RGB, HORIZONTAL_BGR, VERTICAL_RGB, VERTICAL_BGR
- };
-
-
- /**
- * Constructor.
- *
- * @param value The numerical value of the subpixel order.
- */
- private SubpixelOrder(int value)
- {
- this.value = value;
- }
-
-
- /**
- * The numerical value of the subpixel order.
- */
- public int value;
-
-}
-
diff --git a/src/libgamma_AdjustmentMethod.c b/src/libgamma_AdjustmentMethod.c
deleted file mode 100644
index 76c4877..0000000
--- a/src/libgamma_AdjustmentMethod.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/**
- * jlibgamma -- Display server abstraction layer for gamma ramp and Java
- * Copyright (C) 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/>.
- */
-#include "libgamma_AdjustmentMethod.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <libgamma.h>
-
-
-#define J JNIEnv* env, jclass class
-
-
-#if LIBGAMMA_METHOD_COUNT > 6
-# error LIBGAMMA_METHOD_COUNT has been updated
-#endif
-
-
-
-/**
- * List available adjustment methods by their order of preference based on the environment.
- *
- * @param operation Allowed values:
- * 0: Methods that the environment suggests will work, excluding fake.
- * 1: Methods that the environment suggests will work, including fake.
- * 2: All real non-fake methods.
- * 3: All real methods.
- * 4: All methods.
- * Other values invoke undefined behaviour.
- * @return List available adjustment methods by their order of preference.
- */
-jintArray Java_libgamma_AdjustmentMethod_libgamma_1list_1methods(J, jint operation)
-{
- int methods[LIBGAMMA_METHOD_COUNT];
- size_t i, n;
- jintArray rc;
-
- n = libgamma_list_methods(methods, LIBGAMMA_METHOD_COUNT, operation);
- if (n > LIBGAMMA_METHOD_COUNT)
- abort(); /* Prevented by the #if above and package maintenance. */
-
- rc = (*env)->NewIntArray(env, n);
-
- /* Remember, jint is 32 bits, int is 16+ bits. */
- for (i = 0; i < n; i++)
- (*env)->SetIntArrayRegion(env, rc, i, 1, methods + i);
-
- return rc;
- (void) class;
-}
-
-
-/**
- * Check whether an adjustment method is available, non-existing (invalid) methods will be
- * identified as not available under the rationale that the library may be out of date.
- *
- * @param method The adjustment method.
- * @return Whether the adjustment method is available.
- */
-jint Java_libgamma_AdjustmentMethod_libgamma_1is_1method_1available(J, jint method)
-{
- return libgamma_is_method_available(method);
- (void) env;
- (void) class;
-}
-
-
-
-/**
- * Return the capabilities of an adjustment method.
- *
- * @param method The adjustment method (display server and protocol).
- * @return Input parameter to the constructor of {@link AdjustmentMethodCapabilities}.
- */
-jlong Java_libgamma_AdjustmentMethod_libgamma_1method_1capabilities(J, jint method)
-{
- libgamma_method_capabilities_t caps;
- jlong rc;
-
- libgamma_method_capabilities(&caps, method);
- rc = (jlong)(caps.crtc_information);
- rc &= 0xFFFFFFFFLL;
- rc |= caps.default_site_known ? (1LL < 33) : 0;
- rc |= caps.multiple_sites ? (1LL < 34) : 0;
- rc |= caps.multiple_partitions ? (1LL < 35) : 0;
- rc |= caps.multiple_crtcs ? (1LL < 36) : 0;
- rc |= caps.partitions_are_graphics_cards ? (1LL < 37) : 0;
- rc |= caps.site_restore ? (1LL < 38) : 0;
- rc |= caps.partition_restore ? (1LL < 39) : 0;
- rc |= caps.crtc_restore ? (1LL < 40) : 0;
- rc |= caps.identical_gamma_sizes ? (1LL < 41) : 0;
- rc |= caps.fixed_gamma_size ? (1LL < 42) : 0;
- rc |= caps.fixed_gamma_depth ? (1LL < 43) : 0;
- rc |= caps.real ? (1LL < 44) : 0;
- rc |= caps.fake ? (1LL < 45) : 0;
- return rc;
- (void) env;
- (void) class;
-}
-
-
-/**
- * Return the default site for an adjustment method.
- *
- * @param method The adjustment method (display server and protocol.)
- * @return The default site, {@code null} if it cannot be determined or
- * if multiple sites are not supported by the adjustment method.
- */
-jstring Java_libgamma_AdjustmentMethod_libgamma_1method_1default_1site(J, jint method)
-{
- /* It is really unlikely that `malloc` returns `NULL` here
- * and error handing makes this unnecessarily comples,
- * therefore we will simply skip it. */
-
- char* do_not_free_this = libgamma_method_default_site(method);
- char* this_will_be_freed;
- size_t n;
- if (do_not_free_this == NULL)
- return NULL;
-
- n = strlen(do_not_free_this) + 1;
- this_will_be_freed = malloc(n * sizeof(char));
- memcpy(this_will_be_freed, do_not_free_this, n * sizeof(char));
-
- return (*env)->NewStringUTF(env, this_will_be_freed);
- (void) class;
-}
-
-
-/**
- * Return the default variable that determines
- * the default site for an adjustment method.
- *
- * @param method The adjustment method (display server and protocol.)
- * @return The environ variables that is used to determine the
- * default site. {@code null} if there is none, that is,
- * if the method does not support multiple sites.
- */
-jstring Java_libgamma_AdjustmentMethod_libgamma_1method_1default_1site_1variable(J, jint method)
-{
- /* It is really unlikely that `malloc` returns `NULL` here
- * and error handing makes this unnecessarily comples,
- * therefore we will simply skip it. */
-
- const char* do_not_free_this = libgamma_method_default_site_variable(method);
- char* this_will_be_freed;
- size_t n;
- if (do_not_free_this == NULL)
- return NULL;
-
- n = strlen(do_not_free_this) + 1;
- this_will_be_freed = malloc(n * sizeof(char));
- memcpy(this_will_be_freed, do_not_free_this, n * sizeof(char));
-
- return (*env)->NewStringUTF(env, this_will_be_freed);
- (void) class;
-}
-
diff --git a/src/libgamma_CRTC.c b/src/libgamma_CRTC.c
deleted file mode 100644
index 4146de6..0000000
--- a/src/libgamma_CRTC.c
+++ /dev/null
@@ -1,441 +0,0 @@
-/**
- * jlibgamma -- Display server abstraction layer for gamma ramp and Java
- * Copyright (C) 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/>.
- */
-#include "libgamma_CRTC.h"
-
-#include <errno.h>
-#include <stdlib.h>
-
-#include <libgamma.h>
-
-
-#define J JNIEnv* env, jclass class
-
-
-
-/**
- * Make a failure-return.
- *
- * @param error_code The error code returned from the failing function or zero to read `errno`.
- * @return The object to return.
- */
-static jlongArray fail(JNIEnv* env, int error_code)
-{
- jlongArray rc = (*env)->NewLongArray(env, 2);
- jlong e, z = 0;
- if ((error_code == LIBGAMMA_ERRNO_SET) || !error_code)
- error_code = errno;
- e = (jlong)error_code;
- (*env)->SetLongArrayRegion(env, rc, 0, 1, &z);
- (*env)->SetLongArrayRegion(env, rc, 1, 1, &e);
- return rc;
-}
-
-
-/**
- * Make a success-return.
- *
- * @param state The native object.
- * @return The object to return.
- */
-static jlongArray ok(JNIEnv* env, void* state)
-{
- jlong a = (jlong)(size_t)state, z = 0;
- jlongArray rc = (*env)->NewLongArray(env, 2);
- (*env)->SetLongArrayRegion(env, rc, 0, 1, &a);
- (*env)->SetLongArrayRegion(env, rc, 1, 1, &z);
- return rc;
-}
-
-
-/**
- * Create a CRTC state.
- *
- * @param partition The partition state for the partition that the CRTC belongs to.
- * @param crtc The index of the CRTC within the partition.
- * @return Element 0: The value for {@link #address}.
- * Element 1: Error code, zero on success.
- */
-jlongArray Java_libgamma_CRTC_libgamma_1crtc_1create(J, jlong partition, jint crtc)
-{
- libgamma_crtc_state_t* state = malloc(sizeof(libgamma_crtc_state_t));
- void* super = (void*)(size_t)partition;
- int r;
- if (state == NULL)
- return fail(env, 0);
- r = libgamma_crtc_initialise(state, super, crtc);
- if (r != 0)
- return fail(env, r);
- return ok(env, state);
- (void) class;
-}
-
-
-/**
- * Release all resources held by a CRTC state
- * and free the CRTC state pointer.
- *
- * @param address The CRTC state.
- */
-void Java_libgamma_CRTC_libgamma_1crtc_1free(J, jlong address)
-{
- void* this = (void*)(size_t)address;
- libgamma_crtc_free(this);
- (void) env;
- (void) class;
-}
-
-
-/**
- * Restore the gamma ramps for a CRTC to the system settings for that CRTC.
- *
- * @param address The CRTC state.
- * @return Zero on success, and error code on failure.
- */
-jint Java_libgamma_CRTC_libgamma_1crtc_1restore(J, jlong address)
-{
- void* this = (void*)(size_t)address;
- int r = libgamma_crtc_restore(this);
- if (r != 0)
- return r == LIBGAMMA_ERRNO_SET ? errno : r;
- return 0;
- (void) env;
- (void) class;
-}
-
-
-/**
- * Read information about a CRTC.
- *
- * @param crtc The state of the CRTC whose information should be read.
- * @param fields OR:ed identifiers for the information about the CRTC that should be read.
- * @return Input parameters for the constructor of {@link CRTCInformation}
- */
-jobjectArray Java_libgamma_CRTC_libgamma_1get_1crtc_1information(J, jlong crtc, jint fields)
-{
- void* this_voidp = (void*)(size_t)crtc;
- libgamma_crtc_state_t* this = this_voidp;
- jbyteArray edid = NULL;
- jstring connector_name = NULL;
- jclass class_of_jobject = (*env)->FindClass(env, "java/lang/Object");
- jintArray ints_ = (*env)->NewIntArray(env, 25);
- jfloatArray gamma_ = (*env)->NewFloatArray(env, 3);
- jobjectArray rc = (*env)->NewObjectArray(env, 4, class_of_jobject, NULL);
- libgamma_crtc_information_t info;
- jint ints[25];
- jfloat gamma[3];
-
- libgamma_get_crtc_information(&info, this, fields);
-
- if (info.edid != NULL)
- {
- edid = (*env)->NewByteArray(env, info.edid_length);
- (*env)->SetByteArrayRegion(env, edid, 0, info.edid_length, (const jbyte*)(info.edid));
- free(info.edid);
- }
-
- if (connector_name != NULL)
- connector_name = (*env)->NewStringUTF(env, info.connector_name);
-
- gamma[0] = (jfloat)info.gamma_red;
- gamma[1] = (jfloat)info.gamma_green;
- gamma[2] = (jfloat)info.gamma_blue;
-
- ints[0] = (jint)info.edid_error;
- ints[1] = (jint)info.width_mm;
- ints[2] = (jint)info.width_mm_error;
- ints[3] = (jint)info.height_mm;
- ints[4] = (jint)info.height_mm_error;
- ints[5] = (jint)info.width_mm_edid;
- ints[6] = (jint)info.width_mm_edid_error;
- ints[7] = (jint)info.height_mm_edid;
- ints[8] = (jint)info.height_mm_edid_error;
- ints[9] = (jint)info.red_gamma_size;
- ints[10] = (jint)info.green_gamma_size;
- ints[11] = (jint)info.blue_gamma_size;
- ints[12] = (jint)info.gamma_size_error;
- ints[13] = (jint)info.gamma_depth;
- ints[14] = (jint)info.gamma_depth_error;
- ints[15] = (jint)info.gamma_support;
- ints[16] = (jint)info.gamma_support_error;
- ints[17] = (jint)info.subpixel_order;
- ints[18] = (jint)info.subpixel_order_error;
- ints[19] = (jint)info.active;
- ints[20] = (jint)info.active_error;
- ints[21] = (jint)info.connector_name_error;
- ints[22] = (jint)info.connector_type;
- ints[23] = (jint)info.connector_type_error;
- ints[24] = (jint)info.gamma_error;
-
- (*env)->SetIntArrayRegion(env, ints_, 0, 25, ints);
- (*env)->SetFloatArrayRegion(env, gamma_, 0, 3, gamma);
-
- (*env)->SetObjectArrayElement(env, rc, 0, edid);
- (*env)->SetObjectArrayElement(env, rc, 1, connector_name);
- (*env)->SetObjectArrayElement(env, rc, 2, gamma_);
- (*env)->SetObjectArrayElement(env, rc, 3, ints_);
-
- return rc;
- (void) class;
-}
-
-
-
-/**
- * Get the current gamma ramps for a CRTC, 8-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to fill with the current values
- * @return Zero on success, an error code on failure.
- */
-jint Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps8(J, jlong address, jlong ramps)
-{
- void* crtc_voidp = (void*)(size_t)address;
- libgamma_crtc_state_t* crtc = crtc_voidp;
- void* output_voidp = (void*)(size_t)ramps;
- libgamma_gamma_ramps8_t* output = output_voidp;
- int r = libgamma_crtc_get_gamma_ramps8(crtc, output);
- return r == LIBGAMMA_ERRNO_SET ? errno : r;
- (void) env;
- (void) class;
-}
-
-
-/**
- * Set the gamma ramps for a CRTC, 8-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to apply.
- * @return Zero on success, an error code on failure.
- */
-jint Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps8(J, jlong address, jlong ramps)
-{
- void* crtc_voidp = (void*)(size_t)address;
- libgamma_crtc_state_t* crtc = crtc_voidp;
- void* values_voidp = (void*)(size_t)ramps;
- libgamma_gamma_ramps8_t* values = values_voidp;
- int r = libgamma_crtc_set_gamma_ramps8(crtc, *values);
- return r == LIBGAMMA_ERRNO_SET ? errno : r;
- (void) env;
- (void) class;
-}
-
-
-
-/**
- * Get the current gamma ramps for a CRTC, 16-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to fill with the current values
- * @return Zero on success, an error code on failure.
- */
-jint Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps16(J, jlong address, jlong ramps)
-{
- void* crtc_voidp = (void*)(size_t)address;
- libgamma_crtc_state_t* crtc = crtc_voidp;
- void* output_voidp = (void*)(size_t)ramps;
- libgamma_gamma_ramps16_t* output = output_voidp;
- int r = libgamma_crtc_get_gamma_ramps16(crtc, output);
- return r == LIBGAMMA_ERRNO_SET ? errno : r;
- (void) env;
- (void) class;
-}
-
-
-/**
- * Set the gamma ramps for a CRTC, 16-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to apply.
- * @return Zero on success, an error code on failure.
- */
-jint Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps16(J, jlong address, jlong ramps)
-{
- void* crtc_voidp = (void*)(size_t)address;
- libgamma_crtc_state_t* crtc = crtc_voidp;
- void* values_voidp = (void*)(size_t)ramps;
- libgamma_gamma_ramps16_t* values = values_voidp;
- int r = libgamma_crtc_set_gamma_ramps16(crtc, *values);
- return r == LIBGAMMA_ERRNO_SET ? errno : r;
- (void) env;
- (void) class;
-}
-
-
-
-/**
- * Get the current gamma ramps for a CRTC, 32-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to fill with the current values.
- * @return Zero on success, an error code on failure.
- */
-jint Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps32(J, jlong address, jlong ramps)
-{
- void* crtc_voidp = (void*)(size_t)address;
- libgamma_crtc_state_t* crtc = crtc_voidp;
- void* output_voidp = (void*)(size_t)ramps;
- libgamma_gamma_ramps32_t* output = output_voidp;
- int r = libgamma_crtc_get_gamma_ramps32(crtc, output);
- return r == LIBGAMMA_ERRNO_SET ? errno : r;
- (void) env;
- (void) class;
-}
-
-
-/**
- * Set the gamma ramps for a CRTC, 32-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to apply.
- * @return Zero on success, an error code on failure.
- */
-jint Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps32(J, jlong address, jlong ramps)
-{
- void* crtc_voidp = (void*)(size_t)address;
- libgamma_crtc_state_t* crtc = crtc_voidp;
- void* values_voidp = (void*)(size_t)ramps;
- libgamma_gamma_ramps32_t* values = values_voidp;
- int r = libgamma_crtc_set_gamma_ramps32(crtc, *values);
- return r == LIBGAMMA_ERRNO_SET ? errno : r;
- (void) env;
- (void) class;
-}
-
-
-
-/**
- * Get the current gamma ramps for a CRTC, 64-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to fill with the current values.
- * @return Zero on success, an error code on failure.
- */
-jint Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps64(J, jlong address, jlong ramps)
-{
- void* crtc_voidp = (void*)(size_t)address;
- libgamma_crtc_state_t* crtc = crtc_voidp;
- void* output_voidp = (void*)(size_t)ramps;
- libgamma_gamma_ramps64_t* output = output_voidp;
- int r = libgamma_crtc_get_gamma_ramps64(crtc, output);
- return r == LIBGAMMA_ERRNO_SET ? errno : r;
- (void) env;
- (void) class;
-}
-
-
-/**
- * Set the gamma ramps for a CRTC, 64-bit gamma-depth version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to apply.
- * @return Zero on success, an error code on failure.
- */
-jint Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps64(J, jlong address, jlong ramps)
-{
- void* crtc_voidp = (void*)(size_t)address;
- libgamma_crtc_state_t* crtc = crtc_voidp;
- void* values_voidp = (void*)(size_t)ramps;
- libgamma_gamma_ramps64_t* values = values_voidp;
- int r = libgamma_crtc_set_gamma_ramps64(crtc, *values);
- return r == LIBGAMMA_ERRNO_SET ? errno : r;
- (void) env;
- (void) class;
-}
-
-
-
-/**
- * Set the gamma ramps for a CRTC, single precision floating point version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to apply.
- * @return Zero on success, an error code on failure.
- */
-jint Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1rampsf(J, jlong address, jlong ramps)
-{
- void* crtc_voidp = (void*)(size_t)address;
- libgamma_crtc_state_t* crtc = crtc_voidp;
- void* output_voidp = (void*)(size_t)ramps;
- libgamma_gamma_rampsf_t* output = output_voidp;
- int r = libgamma_crtc_get_gamma_rampsf(crtc, output);
- return r == LIBGAMMA_ERRNO_SET ? errno : r;
- (void) env;
- (void) class;
-}
-
-
-/**
- * Get the current gamma ramps for a CRTC, single precision floating point version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to fill with the current values.
- * @return Zero on success, an error code on failure.
- */
-jint Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1rampsf(J, jlong address, jlong ramps)
-{
- void* crtc_voidp = (void*)(size_t)address;
- libgamma_crtc_state_t* crtc = crtc_voidp;
- void* values_voidp = (void*)(size_t)ramps;
- libgamma_gamma_rampsf_t* values = values_voidp;
- int r = libgamma_crtc_set_gamma_rampsf(crtc, *values);
- return r == LIBGAMMA_ERRNO_SET ? errno : r;
- (void) env;
- (void) class;
-}
-
-
-
-/**
- * Get the current gamma ramps for a CRTC, double precision floating point version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to fill with the current values.
- * @return Zero on success, an error code on failure.
- */
-jint Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1rampsd(J, jlong address, jlong ramps)
-{
- void* crtc_voidp = (void*)(size_t)address;
- libgamma_crtc_state_t* crtc = crtc_voidp;
- void* output_voidp = (void*)(size_t)ramps;
- libgamma_gamma_rampsd_t* output = output_voidp;
- int r = libgamma_crtc_get_gamma_rampsd(crtc, output);
- return r == LIBGAMMA_ERRNO_SET ? errno : r;
- (void) env;
- (void) class;
-}
-
-
-/**
- * Set the gamma ramps for a CRTC, double precision floating point version.
- *
- * @param address The CRTC state.
- * @param ramps The gamma ramps to apply.
- * @return Zero on success, an error code on failure.
- */
-jint Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1rampsd(J, jlong address, jlong ramps)
-{
- void* crtc_voidp = (void*)(size_t)address;
- libgamma_crtc_state_t* crtc = crtc_voidp;
- void* values_voidp = (void*)(size_t)ramps;
- libgamma_gamma_rampsd_t* values = values_voidp;
- int r = libgamma_crtc_set_gamma_rampsd(crtc, *values);
- return r == LIBGAMMA_ERRNO_SET ? errno : r;
- (void) env;
- (void) class;
-}
-
diff --git a/src/libgamma_GammaRamps.c b/src/libgamma_GammaRamps.c
deleted file mode 100644
index aa91a0f..0000000
--- a/src/libgamma_GammaRamps.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/**
- * jlibgamma -- Display server abstraction layer for gamma ramp and Java
- * Copyright (C) 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/>.
- */
-#include "libgamma_GammaRamps.h"
-
-#include <stdlib.h>
-#include <errno.h>
-
-#include <libgamma.h>
-
-
-#define J JNIEnv* env, jclass class
-
-
-
-/**
- * Make a failure-return.
- *
- * @param error_code The error code returned from the failing function or zero to read `errno`.
- * @return The object to return.
- */
-static jlongArray fail(JNIEnv* env, int error_code)
-{
- jlongArray rc = (*env)->NewLongArray(env, 5);
- jlong e, z = 0;
- if ((error_code == LIBGAMMA_ERRNO_SET) || !error_code)
- error_code = errno;
- e = (jlong)error_code;
- (*env)->SetLongArrayRegion(env, rc, 0, 1, &z);
- (*env)->SetLongArrayRegion(env, rc, 1, 1, &z);
- (*env)->SetLongArrayRegion(env, rc, 2, 1, &z);
- (*env)->SetLongArrayRegion(env, rc, 3, 1, &z);
- (*env)->SetLongArrayRegion(env, rc, 4, 1, &e);
- return rc;
-}
-
-
-/**
- * Make a success-return.
- *
- * @param ramps The native object.
- * @param red The red gamma ramp.
- * @param green The green gamma ramp.
- * @param blue The blue gamma ramp.
- * @return The object to return.
- */
-static jlongArray ok(JNIEnv* env, void* ramps, void* red, void* green, void* blue)
-{
- jlong a = (jlong)(size_t)ramps;
- jlong b = (jlong)(size_t)red;
- jlong c = (jlong)(size_t)green;
- jlong d = (jlong)(size_t)blue, z = 0;
- jlongArray rc = (*env)->NewLongArray(env, 5);
- (*env)->SetLongArrayRegion(env, rc, 0, 1, &a);
- (*env)->SetLongArrayRegion(env, rc, 1, 1, &b);
- (*env)->SetLongArrayRegion(env, rc, 2, 1, &c);
- (*env)->SetLongArrayRegion(env, rc, 3, 1, &d);
- (*env)->SetLongArrayRegion(env, rc, 4, 1, &z);
- return rc;
-}
-
-
-
-/**
- * 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.
- */
-jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1ramps8_1create(J, jint red_size, jint green_size, jint blue_size)
-{
- libgamma_gamma_ramps8_t* ramps = malloc(sizeof(libgamma_gamma_ramps8_t));
- int r;
- if (ramps == NULL)
- return fail(env, 0);
- ramps->red_size = red_size;
- ramps->green_size = green_size;
- ramps->blue_size = blue_size;
- r = libgamma_gamma_ramps8_initialise(ramps);
- if (r != 0)
- return fail(env, r);
- return ok(env, ramps, ramps->red, ramps->green, ramps->blue);
- (void) class;
-}
-
-
-/**
- * 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.
- */
-jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1ramps16_1create(J, jint red_size, jint green_size, jint blue_size)
-{
- libgamma_gamma_ramps16_t* ramps = malloc(sizeof(libgamma_gamma_ramps16_t));
- int r;
- if (ramps == NULL)
- return fail(env, 0);
- ramps->red_size = red_size;
- ramps->green_size = green_size;
- ramps->blue_size = blue_size;
- r = libgamma_gamma_ramps16_initialise(ramps);
- if (r != 0)
- return fail(env, r);
- return ok(env, ramps, ramps->red, ramps->green, ramps->blue);
- (void) class;
-}
-
-
-/**
- * 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.
- */
-jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1ramps32_1create(J, jint red_size, jint green_size, jint blue_size)
-{
- libgamma_gamma_ramps32_t* ramps = malloc(sizeof(libgamma_gamma_ramps32_t));
- int r;
- if (ramps == NULL)
- return fail(env, 0);
- ramps->red_size = red_size;
- ramps->green_size = green_size;
- ramps->blue_size = blue_size;
- r = libgamma_gamma_ramps32_initialise(ramps);
- if (r != 0)
- return fail(env, r);
- return ok(env, ramps, ramps->red, ramps->green, ramps->blue);
- (void) class;
-}
-
-
-/**
- * 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.
- */
-jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1ramps64_1create(J, jint red_size, jint green_size, jint blue_size)
-{
- libgamma_gamma_ramps64_t* ramps = malloc(sizeof(libgamma_gamma_ramps64_t));
- int r;
- if (ramps == NULL)
- return fail(env, 0);
- ramps->red_size = red_size;
- ramps->green_size = green_size;
- ramps->blue_size = blue_size;
- r = libgamma_gamma_ramps64_initialise(ramps);
- if (r != 0)
- return fail(env, r);
- return ok(env, ramps, ramps->red, ramps->green, ramps->blue);
- (void) class;
-}
-
-
-/**
- * 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.
- */
-jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1rampsf_1create(J, jint red_size, jint green_size, jint blue_size)
-{
- libgamma_gamma_rampsf_t* ramps = malloc(sizeof(libgamma_gamma_rampsf_t));
- int r;
- if (ramps == NULL)
- return fail(env, 0);
- ramps->red_size = red_size;
- ramps->green_size = green_size;
- ramps->blue_size = blue_size;
- r = libgamma_gamma_rampsf_initialise(ramps);
- if (r != 0)
- return fail(env, r);
- return ok(env, ramps, ramps->red, ramps->green, ramps->blue);
- (void) class;
-}
-
-
-/**
- * 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.
- */
-jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1rampsd_1create(J, jint red_size, jint green_size, jint blue_size)
-{
- libgamma_gamma_rampsd_t* ramps = malloc(sizeof(libgamma_gamma_rampsd_t));
- int r;
- if (ramps == NULL)
- return fail(env, 0);
- ramps->red_size = red_size;
- ramps->green_size = green_size;
- ramps->blue_size = blue_size;
- r = libgamma_gamma_rampsd_initialise(ramps);
- if (r != 0)
- return fail(env, r);
- return ok(env, ramps, ramps->red, ramps->green, ramps->blue);
- (void) class;
-}
-
-
-
-/**
- * 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.
- */
-void Java_libgamma_GammaRamps_libgamma_1gamma_1ramps8_1free(J, jlong address)
-{
- void* this = (void*)(size_t)address;
- libgamma_gamma_ramps8_free(this);
- (void) env;
- (void) class;
-}
-
-
-/**
- * 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.
- */
-void Java_libgamma_GammaRamps_libgamma_1gamma_1ramps16_1free(J, jlong address)
-{
- void* this = (void*)(size_t)address;
- libgamma_gamma_ramps16_free(this);
- (void) env;
- (void) class;
-}
-
-
-/**
- * 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.
- */
-void Java_libgamma_GammaRamps_libgamma_1gamma_1ramps32_1free(J, jlong address)
-{
- void* this = (void*)(size_t)address;
- libgamma_gamma_ramps32_free(this);
- (void) env;
- (void) class;
-}
-
-
-/**
- * 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.
- */
-void Java_libgamma_GammaRamps_libgamma_1gamma_1ramps64_1free(J, jlong address)
-{
- void* this = (void*)(size_t)address;
- libgamma_gamma_ramps64_free(this);
- (void) env;
- (void) class;
-}
-
-
-/**
- * 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.
- */
-void Java_libgamma_GammaRamps_libgamma_1gamma_1rampsf_1free(J, jlong address)
-{
- void* this = (void*)(size_t)address;
- libgamma_gamma_rampsf_free(this);
- (void) env;
- (void) class;
-}
-
-
-/**
- * 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.
- */
-void Java_libgamma_GammaRamps_libgamma_1gamma_1rampsd_1free(J, jlong address)
-{
- void* this = (void*)(size_t)address;
- libgamma_gamma_rampsd_free(this);
- (void) env;
- (void) class;
-}
-
diff --git a/src/libgamma_LibgammaException.c b/src/libgamma_LibgammaException.c
deleted file mode 100644
index 5621a58..0000000
--- a/src/libgamma_LibgammaException.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/**
- * jlibgamma -- Display server abstraction layer for gamma ramp and Java
- * Copyright (C) 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/>.
- */
-#include "libgamma_LibgammaException.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <libgamma.h>
-
-
-#define J JNIEnv* env, jclass class
-
-
-
-/**
- * Returns the name of the definition associated with
- * a <tt>libgamma</tt> error code.
- *
- * @param value The error code.
- * @return The name of the definition associated with the error code,
- * {@code null} if the error code does not exist.
- */
-jstring Java_libgamma_LibgammaException_name_1of_1error(J, jint value)
-{
- /* It is really unlikely that `malloc` returns `NULL` here
- * and error handing makes this unnecessarily comples,
- * therefore we will simply skip it. */
-
- const char* do_not_free_this = libgamma_name_of_error(value);
- char* this_will_be_freed;
- size_t n;
- if (do_not_free_this == NULL)
- return NULL;
-
- n = strlen(do_not_free_this) + 1;
- this_will_be_freed = malloc(n * sizeof(char));
- memcpy(this_will_be_freed, do_not_free_this, n * sizeof(char));
-
- return (*env)->NewStringUTF(env, this_will_be_freed);
- (void) class;
-}
-
-
-/**
- * Return the value of a <tt>libgamma</tt> error definition
- * refered to by name.
- *
- * @param name The name of the definition associated with the error code.
- * @return The error code, zero if the name is {@code null}
- * or does not refer to a <tt>libgamma</tt> error.
- */
-jint Java_libgamma_LibgammaException_value_1of_1error(J, jstring name)
-{
- const char* name_chars;
- int rc;
- if (name == NULL)
- return 0;
- name_chars = (*env)->GetStringUTFChars(env, name, NULL);
- rc = libgamma_value_of_error(name_chars);
- (*env)->ReleaseStringUTFChars(env, name, name_chars);
- return rc;
- (void) class;
-}
-
-
-/**
- * Acquire the value that should go to {@link #group_gid}.
- *
- * @return The value that should go to {@link #group_gid}.
- */
-jint Java_libgamma_LibgammaException_libgamma_1group_1gid(J)
-{
- return libgamma_group_gid;
- (void) env;
- (void) class;
-}
-
-
-/**
- * Acquire the value that should go to {@link #group_name}.
- *
- * @return The value that should go to {@link #group_name}.
- */
-jstring Java_libgamma_LibgammaException_libgamma_1group_1name(J)
-{
- /* It is really unlikely that `malloc` returns `NULL` here
- * and error handing makes this unnecessarily comples,
- * therefore we will simply skip it. */
-
- const char* do_not_free_this = libgamma_group_name;
- char* this_will_be_freed;
- size_t n;
- if (do_not_free_this == NULL)
- return NULL;
-
- n = strlen(do_not_free_this) + 1;
- this_will_be_freed = malloc(n * sizeof(char));
- memcpy(this_will_be_freed, do_not_free_this, n * sizeof(char));
-
- return (*env)->NewStringUTF(env, this_will_be_freed);
- (void) class;
-}
-
-
-/**
- * Get a textual description of a system error code.
- *
- * @param error_code The error code.
- * @return A textual description of the error code.
- */
-jstring Java_libgamma_LibgammaException_strerror(J, jint error_code)
-{
- /* It is really unlikely that `malloc` returns `NULL` here
- * and error handing makes this unnecessarily comples,
- * therefore we will simply skip it. */
-
- const char* do_not_free_this = strerror(error_code);
- char* this_will_be_freed;
- size_t n;
- if (do_not_free_this == NULL)
- return NULL;
-
- n = strlen(do_not_free_this) + 1;
- this_will_be_freed = malloc(n * sizeof(char));
- memcpy(this_will_be_freed, do_not_free_this, n * sizeof(char));
-
- return (*env)->NewStringUTF(env, this_will_be_freed);
- (void) class;
-}
-
diff --git a/src/libgamma_Partition.c b/src/libgamma_Partition.c
deleted file mode 100644
index 65bf2e0..0000000
--- a/src/libgamma_Partition.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * jlibgamma -- Display server abstraction layer for gamma ramp and Java
- * Copyright (C) 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/>.
- */
-#include "libgamma_Partition.h"
-
-#include <errno.h>
-#include <stdlib.h>
-
-#include <libgamma.h>
-
-
-#define J JNIEnv* env, jclass class
-
-
-/**
- * Make a failure-return.
- *
- * @param error_code The error code returned from the failing function or zero to read `errno`.
- * @return The object to return.
- */
-static jlongArray fail(JNIEnv* env, int error_code)
-{
- jlongArray rc = (*env)->NewLongArray(env, 3);
- jlong e, z = 0;
- if ((error_code == LIBGAMMA_ERRNO_SET) || !error_code)
- error_code = errno;
- e = (jlong)error_code;
- (*env)->SetLongArrayRegion(env, rc, 0, 1, &z);
- (*env)->SetLongArrayRegion(env, rc, 1, 1, &z);
- (*env)->SetLongArrayRegion(env, rc, 2, 1, &e);
- return rc;
-}
-
-
-/**
- * Make a success-return.
- *
- * @param state The native object.
- * @param count The subelement count.
- * @return The object to return.
- */
-static jlongArray ok(JNIEnv* env, void* state, size_t count)
-{
- jlong a = (jlong)(size_t)state;
- jlong b = (jlong)count, z = 0;
- jlongArray rc = (*env)->NewLongArray(env, 3);
- (*env)->SetLongArrayRegion(env, rc, 0, 1, &a);
- (*env)->SetLongArrayRegion(env, rc, 1, 1, &b);
- (*env)->SetLongArrayRegion(env, rc, 2, 1, &z);
- return rc;
-}
-
-
-/**
- * Create a partition state.
- *
- * @param site The site state for the site that the partition belongs to.
- * @param partition The index of the partition within the site.
- * @return Element 0: The value for {@link #address}.
- * Element 1: The value for {@link #crtcs_available}
- * Element 2: Error code, zero on success.
- */
-jlongArray Java_libgamma_Partition_libgamma_1partition_1create(J, jlong site, jint partition)
-{
- libgamma_partition_state_t* state = malloc(sizeof(libgamma_partition_state_t));
- void* super = (void*)(size_t)site;
- int r;
- if (state == NULL)
- return fail(env, 0);
- r = libgamma_partition_initialise(state, super, partition);
- if (r != 0)
- return fail(env, r);
- return ok(env, state, state->crtcs_available);
- (void) class;
-}
-
-
-/**
- * Release all resources held by a partition state
- * and free the partition state pointer.
- *
- * @param address The partition state.
- */
-void Java_libgamma_Partition_libgamma_1partition_1free(J, jlong address)
-{
- void* this = (void*)(size_t)address;
- libgamma_partition_free(this);
- (void) env;
- (void) class;
-}
-
-
-/**
- * Restore the gamma ramps all CRTC:s within a partition to the system settings.
- *
- * @param address The partition state.
- * @return Zero on success, and error code on failure.
- */
-jint Java_libgamma_Partition_libgamma_1partition_1restore(J, jlong address)
-{
- void* this = (void*)(size_t)address;
- int r = libgamma_partition_restore(this);
- if (r != 0)
- return r == LIBGAMMA_ERRNO_SET ? errno : r;
- return 0;
- (void) env;
- (void) class;
-}
-
diff --git a/src/libgamma_Ramp.c b/src/libgamma_Ramp.c
deleted file mode 100644
index cdbbc03..0000000
--- a/src/libgamma_Ramp.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/**
- * jlibgamma -- Display server abstraction layer for gamma ramp and Java
- * Copyright (C) 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/>.
- */
-#include "libgamma_Ramp.h"
-
-#include <libgamma.h>
-
-
-#define J JNIEnv* env, jclass class
-
-
-
-/**
- * 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.
- */
-jshort Java_libgamma_Ramp_libgamma_1gamma_1ramps8_1get(J, jlong address, jint stop)
-{
- void* this_voidp = (void*)(size_t)address;
- uint8_t* this = this_voidp;
- return (jshort)(this[stop]);
- (void) env;
- (void) class;
-}
-
-
-/**
- * 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.
- */
-jint Java_libgamma_Ramp_libgamma_1gamma_1ramps16_1get(J, jlong address, jint stop)
-{
- void* this_voidp = (void*)(size_t)address;
- uint16_t* this = this_voidp;
- return (jint)(this[stop]);
- (void) env;
- (void) class;
-}
-
-
-/**
- * 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.
- */
-jlong Java_libgamma_Ramp_libgamma_1gamma_1ramps32_1get(J, jlong address, jint stop)
-{
- void* this_voidp = (void*)(size_t)address;
- uint32_t* this = this_voidp;
- return (jlong)(this[stop]);
- (void) env;
- (void) class;
-}
-
-
-/**
- * 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.
- */
-jlong Java_libgamma_Ramp_libgamma_1gamma_1ramps64_1get(J, jlong address, jint stop)
-{
- void* this_voidp = (void*)(size_t)address;
- uint64_t* this = this_voidp;
- return (jlong)(this[stop]);
- (void) env;
- (void) class;
-}
-
-
-/**
- * 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.
- */
-jfloat Java_libgamma_Ramp_libgamma_1gamma_1rampsf_1get(J, jlong address, jint stop)
-{
- void* this_voidp = (void*)(size_t)address;
- float* this = this_voidp;
- return (jfloat)(this[stop]);
- (void) env;
- (void) class;
-}
-
-
-/**
- * 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.
- */
-jdouble Java_libgamma_Ramp_libgamma_1gamma_1rampsd_1get(J, jlong address, jint stop)
-{
- void* this_voidp = (void*)(size_t)address;
- double* this = this_voidp;
- return (jdouble)(this[stop]);
- (void) env;
- (void) class;
-}
-
-
-
-/**
- * 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.
- */
-void Java_libgamma_Ramp_libgamma_1gamma_1ramps8_1set(J, jlong address, jint stop, jshort value)
-{
- void* this_voidp = (void*)(size_t)address;
- uint8_t* this = this_voidp;
- this[stop] = (uint8_t)value;
- (void) env;
- (void) class;
-}
-
-
-/**
- * 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.
- */
-void Java_libgamma_Ramp_libgamma_1gamma_1ramps16_1set(J, jlong address, jint stop, jint value)
-{
- void* this_voidp = (void*)(size_t)address;
- uint16_t* this = this_voidp;
- this[stop] = (uint16_t)value;
- (void) env;
- (void) class;
-}
-
-
-/**
- * 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.
- */
-void Java_libgamma_Ramp_libgamma_1gamma_1ramps32_1set(J, jlong address, jint stop, jlong value)
-{
- void* this_voidp = (void*)(size_t)address;
- uint32_t* this = this_voidp;
- this[stop] = (uint32_t)value;
- (void) env;
- (void) class;
-}
-
-
-/**
- * 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.
- */
-void Java_libgamma_Ramp_libgamma_1gamma_1ramps64_1set(J, jlong address, jint stop, jlong value)
-{
- void* this_voidp = (void*)(size_t)address;
- uint64_t* this = this_voidp;
- this[stop] = (uint64_t)value;
- (void) env;
- (void) class;
-}
-
-
-/**
- * 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.
- */
-void Java_libgamma_Ramp_libgamma_1gamma_1rampsf_1set(J, jlong address, jint stop, jfloat value)
-{
- void* this_voidp = (void*)(size_t)address;
- float* this = this_voidp;
- this[stop] = (float)value;
- (void) env;
- (void) class;
-}
-
-
-/**
- * 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.
- */
-void Java_libgamma_Ramp_libgamma_1gamma_1rampsd_1set(J, jlong address, jint stop, jdouble value)
-{
- void* this_voidp = (void*)(size_t)address;
- double* this = this_voidp;
- this[stop] = (double)value;
- (void) env;
- (void) class;
-}
-
diff --git a/src/libgamma_Site.c b/src/libgamma_Site.c
deleted file mode 100644
index 2b227d9..0000000
--- a/src/libgamma_Site.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
- * jlibgamma -- Display server abstraction layer for gamma ramp and Java
- * Copyright (C) 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/>.
- */
-#include "libgamma_Site.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include <libgamma.h>
-
-
-#define J JNIEnv* env, jclass class
-
-
-
-/**
- * Make a failure-return.
- *
- * @param error_code The error code returned from the failing function or zero to read `errno`.
- * @return The object to return.
- */
-static jlongArray fail(JNIEnv* env, int error_code)
-{
- jlongArray rc = (*env)->NewLongArray(env, 3);
- jlong e, z = 0;
- if ((error_code == LIBGAMMA_ERRNO_SET) || !error_code)
- error_code = errno;
- e = (jlong)error_code;
- (*env)->SetLongArrayRegion(env, rc, 0, 1, &z);
- (*env)->SetLongArrayRegion(env, rc, 1, 1, &z);
- (*env)->SetLongArrayRegion(env, rc, 2, 1, &e);
- return rc;
-}
-
-
-/**
- * Make a success-return.
- *
- * @param state The native object.
- * @param count The subelement count.
- * @return The object to return.
- */
-static jlongArray ok(JNIEnv* env, void* state, size_t count)
-{
- jlong a = (jlong)(size_t)state;
- jlong b = (jlong)count, z = 0;
- jlongArray rc = (*env)->NewLongArray(env, 3);
- (*env)->SetLongArrayRegion(env, rc, 0, 1, &a);
- (*env)->SetLongArrayRegion(env, rc, 1, 1, &b);
- (*env)->SetLongArrayRegion(env, rc, 2, 1, &z);
- return rc;
-}
-
-
-/**
- * Create a site state.
- *
- * @param method The adjustment method (display server and protocol.)
- * @param site The site identifier.
- * @return Element 0: The value for {@link #address}.
- * Element 1: The value for {@link #partitions_available}
- * Element 2: Error code, zero on success.
- */
-jlongArray Java_libgamma_Site_libgamma_1site_1create(J, jint method, jstring site)
-{
- libgamma_site_state_t* state = malloc(sizeof(libgamma_site_state_t));
- const char* site_chars;
- char* site_;
- int r;
- if (site != NULL)
- {
- int saved_errno = 0;
- size_t n;
- site_chars = (*env)->GetStringUTFChars(env, site, NULL);
- n = strlen(site_chars) + 1;
- site_ = malloc(n * sizeof(char));
- if (site_ == NULL)
- saved_errno = errno;
- else
- memcpy(site_, site_chars, n * sizeof(char));
- (*env)->ReleaseStringUTFChars(env, site, site_chars);
- if (saved_errno)
- return fail(env, errno);
- }
- else
- site_ = NULL;
- if (state == NULL)
- return fail(env, 0);
- r = libgamma_site_initialise(state, method, site_);
- if (r != 0)
- return fail(env, r);
- return ok(env, state, state->partitions_available);
- (void) class;
-}
-
-
-/**
- * Release all resources held by a site state
- * and free the site state pointer.
- *
- * @param address The site state.
- */
-void Java_libgamma_Site_libgamma_1site_1free(J, jlong address)
-{
- void* this = (void*)(size_t)address;
- libgamma_site_free(this);
- (void) env;
- (void) class;
-}
-
-
-/**
- * Restore the gamma ramps all CRTC:s within a site to the system settings.
- *
- * @param address The site state.
- * @return Zero on success, and error code on failure.
- */
-jint Java_libgamma_Site_libgamma_1site_1restore(J, jlong address)
-{
- void* this = (void*)(size_t)address;
- int r = libgamma_site_restore(this);
- if (r != 0)
- return r == LIBGAMMA_ERRNO_SET ? errno : r;
- return 0;
- (void) env;
- (void) class;
-}
-