// Path: ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/ImagingKitUtils.java
// public static double clamp_0_1(double val){
// 	return Math.max(0.0, Math.min(val, 1.0));
// }


import static hageldave.imagingkit.core.util.ImagingKitUtils.clamp_0_1;
import java.util.Objects;
import java.util.Spliterator;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Stream;
	 * @param pixelSpliterator the {@code Spliterator<Pixel>} to which the
	 * returned spliterator delegates to.
	 * @return a spliterator with float[] elements consisting of normalized RGB channels.
	 *
	 * @since 1.4
	 */
	public static PixelConvertingSpliterator<PixelBase, double[]> getDoubletArrayElementSpliterator(
			Spliterator<? extends PixelBase> pixelSpliterator){
		PixelConvertingSpliterator<PixelBase, double[]> arraySpliterator = new PixelConvertingSpliterator<>(
				pixelSpliterator, getDoubleArrayConverter());
		return arraySpliterator;
	}

	/**
	 * @return Exemplary PixelConverter that converts to double[].
	 */
	public static PixelConverter<PixelBase, double[]> getDoubleArrayConverter(){
		return new PixelConverter<PixelBase, double[]>() {

			@Override
			public void convertPixelToElement(PixelBase px, double[] array) {
				array[0]=px.r_asDouble();
				array[1]=px.g_asDouble();
				array[2]=px.b_asDouble();
			}

			@Override
			public void convertElementToPixel(double[] array, PixelBase px) {
				px.setRGB_fromDouble_preserveAlpha(
						// clamp values between zero and one
// Path: ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/ImagingKitUtils.java
// public static double clamp_0_1(double val){
// 	return Math.max(0.0, Math.min(val, 1.0));
// }


// Path: ImagingKit_Core/src/main/java/hageldave/imagingkit/core/PixelConvertingSpliterator.java
import static hageldave.imagingkit.core.util.ImagingKitUtils.clamp_0_1;
import java.util.Objects;
import java.util.Spliterator;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Stream;

	 * @param pixelSpliterator the {@code Spliterator<Pixel>} to which the
	 * returned spliterator delegates to.
	 * @return a spliterator with float[] elements consisting of normalized RGB channels.
	 *
	 * @since 1.4
	 */
	public static PixelConvertingSpliterator<PixelBase, double[]> getDoubletArrayElementSpliterator(
			Spliterator<? extends PixelBase> pixelSpliterator){
		PixelConvertingSpliterator<PixelBase, double[]> arraySpliterator = new PixelConvertingSpliterator<>(
				pixelSpliterator, getDoubleArrayConverter());
		return arraySpliterator;
	}

	/**
	 * @return Exemplary PixelConverter that converts to double[].
	 */
	public static PixelConverter<PixelBase, double[]> getDoubleArrayConverter(){
		return new PixelConverter<PixelBase, double[]>() {

			@Override
			public void convertPixelToElement(PixelBase px, double[] array) {
				array[0]=px.r_asDouble();
				array[1]=px.g_asDouble();
				array[2]=px.b_asDouble();
			}

			@Override
			public void convertElementToPixel(double[] array, PixelBase px) {
				px.setRGB_fromDouble_preserveAlpha(
						// clamp values between zero and one
						clamp_0_1(array[0]),