public @Test void testInitializeRGBChannels_KduPreV7() throws Exception { assumeTrue(format("JNI version=%d, expected < 7, ignoring", JNI_VERSION), JNI_VERSION < 7); KakaduUtilities.initializeRGBChannels(channels); verify(channels).Init(eq(3)); List<List<Object>> args = colorMappingCapturer.invocationArguments; assertEquals(3, args.size()); List<List<Object>> expectedCallsAndArgs = asList(asList(0, 0, 0), asList(1, 0, 1), asList(2, 0, 2)); assertEquals(expectedCallsAndArgs, args); }
public static void initializeRGBChannels(Jp2_channels channels) throws KduException { final int numColours = 3; channels.Init(numColours); Method setColourMapping; Object[] args1; Object[] args2; Object[] args3; final int major = getKakaduJniMajorVersion(); try { if (major < 7) { setColourMapping = Jp2_channels.class.getMethod("Set_colour_mapping", int.class, int.class, int.class); args1 = new Object[] { 0, 0, 0 }; args2 = new Object[] { 1, 0, 1 }; args3 = new Object[] { 2, 0, 2 }; } else { setColourMapping = Jp2_channels.class.getMethod("Set_colour_mapping", int.class, int.class, int.class, int.class, int.class); final int _codestream_idx = 0; final int _data_format = 0; args1 = new Object[] { 0, 0, 0, _codestream_idx, _data_format }; args2 = new Object[] { 1, 0, 1, _codestream_idx, _data_format }; args3 = new Object[] { 2, 0, 2, _codestream_idx, _data_format }; } } catch (NoSuchMethodException | SecurityException e) { throw new RuntimeException("Unable to acquire method Jp2_channels.Set_colour_mapping reflectively", e); } try { setColourMapping.invoke(channels, args1); setColourMapping.invoke(channels, args2); setColourMapping.invoke(channels, args3); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new RuntimeException("Error calling Jp2_channels.Set_colour_mapping(...)", e); } }
KakaduUtilities { public static void initializeRGBChannels(Jp2_channels channels) throws KduException { final int numColours = 3; channels.Init(numColours); Method setColourMapping; Object[] args1; Object[] args2; Object[] args3; final int major = getKakaduJniMajorVersion(); try { if (major < 7) { setColourMapping = Jp2_channels.class.getMethod("Set_colour_mapping", int.class, int.class, int.class); args1 = new Object[] { 0, 0, 0 }; args2 = new Object[] { 1, 0, 1 }; args3 = new Object[] { 2, 0, 2 }; } else { setColourMapping = Jp2_channels.class.getMethod("Set_colour_mapping", int.class, int.class, int.class, int.class, int.class); final int _codestream_idx = 0; final int _data_format = 0; args1 = new Object[] { 0, 0, 0, _codestream_idx, _data_format }; args2 = new Object[] { 1, 0, 1, _codestream_idx, _data_format }; args3 = new Object[] { 2, 0, 2, _codestream_idx, _data_format }; } } catch (NoSuchMethodException | SecurityException e) { throw new RuntimeException("Unable to acquire method Jp2_channels.Set_colour_mapping reflectively", e); } try { setColourMapping.invoke(channels, args1); setColourMapping.invoke(channels, args2); setColourMapping.invoke(channels, args3); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new RuntimeException("Error calling Jp2_channels.Set_colour_mapping(...)", e); } } }
KakaduUtilities { public static void initializeRGBChannels(Jp2_channels channels) throws KduException { final int numColours = 3; channels.Init(numColours); Method setColourMapping; Object[] args1; Object[] args2; Object[] args3; final int major = getKakaduJniMajorVersion(); try { if (major < 7) { setColourMapping = Jp2_channels.class.getMethod("Set_colour_mapping", int.class, int.class, int.class); args1 = new Object[] { 0, 0, 0 }; args2 = new Object[] { 1, 0, 1 }; args3 = new Object[] { 2, 0, 2 }; } else { setColourMapping = Jp2_channels.class.getMethod("Set_colour_mapping", int.class, int.class, int.class, int.class, int.class); final int _codestream_idx = 0; final int _data_format = 0; args1 = new Object[] { 0, 0, 0, _codestream_idx, _data_format }; args2 = new Object[] { 1, 0, 1, _codestream_idx, _data_format }; args3 = new Object[] { 2, 0, 2, _codestream_idx, _data_format }; } } catch (NoSuchMethodException | SecurityException e) { throw new RuntimeException("Unable to acquire method Jp2_channels.Set_colour_mapping reflectively", e); } try { setColourMapping.invoke(channels, args1); setColourMapping.invoke(channels, args2); setColourMapping.invoke(channels, args3); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new RuntimeException("Error calling Jp2_channels.Set_colour_mapping(...)", e); } } private  KakaduUtilities(); }
KakaduUtilities { public static void initializeRGBChannels(Jp2_channels channels) throws KduException { final int numColours = 3; channels.Init(numColours); Method setColourMapping; Object[] args1; Object[] args2; Object[] args3; final int major = getKakaduJniMajorVersion(); try { if (major < 7) { setColourMapping = Jp2_channels.class.getMethod("Set_colour_mapping", int.class, int.class, int.class); args1 = new Object[] { 0, 0, 0 }; args2 = new Object[] { 1, 0, 1 }; args3 = new Object[] { 2, 0, 2 }; } else { setColourMapping = Jp2_channels.class.getMethod("Set_colour_mapping", int.class, int.class, int.class, int.class, int.class); final int _codestream_idx = 0; final int _data_format = 0; args1 = new Object[] { 0, 0, 0, _codestream_idx, _data_format }; args2 = new Object[] { 1, 0, 1, _codestream_idx, _data_format }; args3 = new Object[] { 2, 0, 2, _codestream_idx, _data_format }; } } catch (NoSuchMethodException | SecurityException e) { throw new RuntimeException("Unable to acquire method Jp2_channels.Set_colour_mapping reflectively", e); } try { setColourMapping.invoke(channels, args1); setColourMapping.invoke(channels, args2); setColourMapping.invoke(channels, args3); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new RuntimeException("Error calling Jp2_channels.Set_colour_mapping(...)", e); } } private  KakaduUtilities(); static int[] findOptimalResolutionInfo(final int sourceDWTLevels,
            final int newSubSamplingFactor); static void initializeKakaduMessagesManagement(); static List<ImageReaderWriterSpi> getJDKImageReaderWriterSPI(
            ServiceRegistry registry, String formatName, boolean isReader); static BufferedImage subsampleImage(ColorModel cm, BufferedImage bi,
            final int destinationWidth, final int destinationHeight,
            final int interpolationType); static boolean isKakaduAvailable(); synchronized static void loadKakadu(); static void computeRegions(final Rectangle sourceBounds,
            Dimension destSize, ImageWriteParam param); static boolean notEqual(double value, double reference); static String readTerminatedString(byte[] contents); static String getKakaduJniLibVersion(); static int getKakaduJniMajorVersion(); static String getKakaduNativeLibVersion(); static void initializeRGBChannels(Jp2_channels channels); }
KakaduUtilities { public static void initializeRGBChannels(Jp2_channels channels) throws KduException { final int numColours = 3; channels.Init(numColours); Method setColourMapping; Object[] args1; Object[] args2; Object[] args3; final int major = getKakaduJniMajorVersion(); try { if (major < 7) { setColourMapping = Jp2_channels.class.getMethod("Set_colour_mapping", int.class, int.class, int.class); args1 = new Object[] { 0, 0, 0 }; args2 = new Object[] { 1, 0, 1 }; args3 = new Object[] { 2, 0, 2 }; } else { setColourMapping = Jp2_channels.class.getMethod("Set_colour_mapping", int.class, int.class, int.class, int.class, int.class); final int _codestream_idx = 0; final int _data_format = 0; args1 = new Object[] { 0, 0, 0, _codestream_idx, _data_format }; args2 = new Object[] { 1, 0, 1, _codestream_idx, _data_format }; args3 = new Object[] { 2, 0, 2, _codestream_idx, _data_format }; } } catch (NoSuchMethodException | SecurityException e) { throw new RuntimeException("Unable to acquire method Jp2_channels.Set_colour_mapping reflectively", e); } try { setColourMapping.invoke(channels, args1); setColourMapping.invoke(channels, args2); setColourMapping.invoke(channels, args3); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new RuntimeException("Error calling Jp2_channels.Set_colour_mapping(...)", e); } } private  KakaduUtilities(); static int[] findOptimalResolutionInfo(final int sourceDWTLevels,
            final int newSubSamplingFactor); static void initializeKakaduMessagesManagement(); static List<ImageReaderWriterSpi> getJDKImageReaderWriterSPI(
            ServiceRegistry registry, String formatName, boolean isReader); static BufferedImage subsampleImage(ColorModel cm, BufferedImage bi,
            final int destinationWidth, final int destinationHeight,
            final int interpolationType); static boolean isKakaduAvailable(); synchronized static void loadKakadu(); static void computeRegions(final Rectangle sourceBounds,
            Dimension destSize, ImageWriteParam param); static boolean notEqual(double value, double reference); static String readTerminatedString(byte[] contents); static String getKakaduJniLibVersion(); static int getKakaduJniMajorVersion(); static String getKakaduNativeLibVersion(); static void initializeRGBChannels(Jp2_channels channels); static final double DOUBLE_TOLERANCE; static final double BIT_TO_BYTE_FACTOR; }