@@ -0,0 +1,1681 @@
+package by.vshkl.pxlsrt.core.mode;%0A%0Aimport android.graphics.Color;%0A%0Apublic class Hue %7B%0A%0A    private static final int hueValue = 180;%0A%0A    public static int getFirstHueX(int%5B%5D pixels, int x, int y, int width) %7B%0A        while (getHue(pixels%5Bx + y * width%5D) %3C hueValue) %7B%0A            x++;%0A            if (x %3E= width) %7B%0A                return -1;%0A            %7D%0A        %7D%0A        return x;%0A    %7D%0A%0A    public static int getNextNotHueX(int%5B%5D pixels, int x, int y, int width) %7B%0A        x++;%0A        while (getHue(pixels%5Bx + y * width%5D) %3E hueValue) %7B%0A            x++;%0A            if (x %3E= width) %7B%0A                return width - 1;%0A            %7D%0A        %7D%0A        return x - 1;%0A    %7D%0A%0A    public static int getFirstHueY(int%5B%5D pixels, int x, int y, int width, int height) %7B%0A        if (y %3C height) %7B%0A            while (getHue(pixels%5Bx + y * width%5D) %3C hueValue) %7B%0A                y++;%0A                if (y %3E= height) %7B%0A                    return -1;%0A                %7D%0A            %7D%0A        %7D%0A        return y;%0A    %7D%0A%0A    public static int getNextNotHueY(int%5B%5D pixels, int x, int y, int width, int height) %7B%0A        y++;%0A        if (y %3C height) %7B%0A            while (getHue(pixels%5Bx + y * width%5D) %3E hueValue) %7B%0A                y++;%0A                if (y %3E= height) %7B%0A                    return height - 1;%0A                %7D%0A            %7D%0A        %7D%0A        return y;%0A    %7D%0A%0A    private static int getHue(int pixelColor) %7B%0A        int r = Color.red(pixelColor);%0A        int g = Color.green(pixelColor);%0A        int b = Color.blue(pixelColor);%0A        double hue = 100 / Math.PI * Math.atan2(Math.sqrt(3) * (g - b), 2 * r - g - b);%0A        return hue %3C 0 ? (int) (hue + 360) : (int) hue;%0A    %7D%0A%7D%0A

Add hue sorting