diff --git a/common/src/main/AndroidManifest.xml b/common/src/main/AndroidManifest.xml index 2a153657..b9d4a22b 100644 --- a/common/src/main/AndroidManifest.xml +++ b/common/src/main/AndroidManifest.xml @@ -16,5 +16,4 @@ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see . --> - + diff --git a/common/src/main/java/com/bumptech/glide/gifencoder/AnimatedGifEncoder.java b/common/src/main/java/com/bumptech/glide/gifencoder/AnimatedGifEncoder.java index e7d40ee1..9d4f32be 100644 --- a/common/src/main/java/com/bumptech/glide/gifencoder/AnimatedGifEncoder.java +++ b/common/src/main/java/com/bumptech/glide/gifencoder/AnimatedGifEncoder.java @@ -70,8 +70,7 @@ public class AnimatedGifEncoder { * Sets the delay time between each frame, or changes it for subsequent frames * (applies to last frame added). * - * @param ms - * int delay time in milliseconds + * @param ms int delay time in milliseconds */ public void setDelay(int ms) { delay = Math.round(ms / 10.0f); @@ -82,8 +81,7 @@ public class AnimatedGifEncoder { * subsequent frames. Default is 0 if no transparent color has been set, * otherwise 2. * - * @param code - * int disposal code. + * @param code int disposal code. */ public void setDispose(int code) { if (code >= 0) { @@ -96,8 +94,7 @@ public class AnimatedGifEncoder { * 1; 0 means play indefinitely. Must be invoked before the first image is * added. * - * @param iter - * int number of iterations. + * @param iter int number of iterations. */ public void setRepeat(int iter) { if (iter >= 0) { @@ -112,8 +109,7 @@ public class AnimatedGifEncoder { * color becomes the transparent color for that frame. May be set to null to * indicate no transparent color. * - * @param color - * Color to be treated as transparent on display. + * @param color Color to be treated as transparent on display. */ public void setTransparent(int color) { transparent = color; @@ -126,8 +122,7 @@ public class AnimatedGifEncoder { * setSize was invoked, the size is used for all subsequent frames. * Otherwise, the actual size of the image is used for each frames. * - * @param im - * BufferedImage containing frame to write. + * @param im BufferedImage containing frame to write. * @return true if successful. */ public boolean addFrame(@Nullable Bitmap im) { @@ -140,17 +135,14 @@ public class AnimatedGifEncoder { * Invoking finish() flushes all frames. If setSize was invoked, the * size is used for all subsequent frames. Otherwise, the actual size of the image is used for * each frame. - * + *

* See page 11 of http://giflib.sourceforge.net/gif89.txt for the position of the frame * - * @param im - * BufferedImage containing frame to write. - * @param x - * Column number, in pixels, of the left edge of the image, with respect to the left - * edge of the Logical Screen. - * @param y - * Row number, in pixels, of the top edge of the image with respect to the top edge of - * the Logical Screen. + * @param im BufferedImage containing frame to write. + * @param x Column number, in pixels, of the left edge of the image, with respect to the left + * edge of the Logical Screen. + * @param y Row number, in pixels, of the top edge of the image with respect to the top edge of + * the Logical Screen. * @return true if successful. */ public boolean addFrame(@Nullable Bitmap im, int x, int y) { @@ -225,8 +217,7 @@ public class AnimatedGifEncoder { * Sets frame rate in frames per second. Equivalent to * setDelay(1000/fps). * - * @param fps - * float frame rate (frames per second) + * @param fps float frame rate (frames per second) */ public void setFrameRate(float fps) { if (fps != 0f) { @@ -253,10 +244,8 @@ public class AnimatedGifEncoder { * Sets the fixed GIF frame size for all the frames. * This should be called before start. * - * @param w - * int frame width. - * @param h - * int frame width. + * @param w int frame width. + * @param h int frame width. */ public void setSize(int w, int h) { if (started) { @@ -278,10 +267,8 @@ public class AnimatedGifEncoder { /** * Sets current GIF frame size. * - * @param w - * int frame width. - * @param h - * int frame width. + * @param w int frame width. + * @param h int frame width. */ private void setFrameSize(int w, int h) { width = w; @@ -292,8 +279,7 @@ public class AnimatedGifEncoder { * Initiates GIF file creation on the given stream. The stream is not closed * automatically. * - * @param os - * OutputStream on which GIF images are written. + * @param os OutputStream on which GIF images are written. * @return false if initial write failed. */ public boolean start(@Nullable OutputStream os) { @@ -313,8 +299,7 @@ public class AnimatedGifEncoder { /** * Initiates writing of a GIF file with the specified name. * - * @param file - * String containing output file name. + * @param file String containing output file name. * @return false if open or initial write failed. */ public boolean start(@NonNull String file) { @@ -366,7 +351,6 @@ public class AnimatedGifEncoder { /** * Returns index of palette color closest to c - * */ private int findClosest(int color) { if (colorTab == null) @@ -377,7 +361,7 @@ public class AnimatedGifEncoder { int minpos = 0; int dmin = 256 * 256 * 256; int len = colorTab.length; - for (int i = 0; i < len;) { + for (int i = 0; i < len; ) { int dr = r - (colorTab[i++] & 0xff); int dg = g - (colorTab[i++] & 0xff); int db = b - (colorTab[i] & 0xff); @@ -430,7 +414,7 @@ public class AnimatedGifEncoder { hasTransparentPixels = transparentPercentage > MIN_TRANSPARENT_PERCENTAGE; if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "got pixels for frame with " + transparentPercentage - + "% transparent pixels"); + + "% transparent pixels"); } } diff --git a/common/src/main/java/com/bumptech/glide/gifencoder/NeuQuant.java b/common/src/main/java/com/bumptech/glide/gifencoder/NeuQuant.java index 368a930b..48412a91 100644 --- a/common/src/main/java/com/bumptech/glide/gifencoder/NeuQuant.java +++ b/common/src/main/java/com/bumptech/glide/gifencoder/NeuQuant.java @@ -6,7 +6,7 @@ class NeuQuant { protected static final int netsize = 256; /* number of colours used */ /* four primes near 500 - assume no image has a length so large */ - /* that it is divisible by all four primes */ + /* that it is divisible by all four primes */ protected static final int prime1 = 499; protected static final int prime2 = 491; @@ -17,19 +17,19 @@ class NeuQuant { protected static final int minpicturebytes = (3 * prime4); - /* minimum size for input image */ + /* minimum size for input image */ - /* - * Program Skeleton ---------------- [select samplefac in range 1..30] [read - * image from input file] pic = (unsigned char*) malloc(3*width*height); - * initnet(pic,3*width*height,samplefac); learn(); unbiasnet(); [write output - * image header, using writecolourmap(f)] inxbuild(); write output image using - * inxsearch(b,g,r) - */ + /* + * Program Skeleton ---------------- [select samplefac in range 1..30] [read + * image from input file] pic = (unsigned char*) malloc(3*width*height); + * initnet(pic,3*width*height,samplefac); learn(); unbiasnet(); [write output + * image header, using writecolourmap(f)] inxbuild(); write output image using + * inxsearch(b,g,r) + */ - /* - * Network Definitions ------------------- - */ + /* + * Network Definitions ------------------- + */ protected static final int maxnetpos = (netsize - 1); @@ -54,19 +54,19 @@ class NeuQuant { /* defs for decreasing radius factor */ protected static final int initrad = (netsize >> 3); /* - * for 256 cols, radius - * starts - */ + * for 256 cols, radius + * starts + */ protected static final int radiusbiasshift = 6; /* at 32.0 biased by 6 bits */ protected static final int radiusbias = (((int) 1) << radiusbiasshift); protected static final int initradius = (initrad * radiusbias); /* - * and - * decreases - * by a - */ + * and + * decreases + * by a + */ protected static final int radiusdec = 30; /* factor of 1/30 each cycle */ @@ -86,9 +86,9 @@ class NeuQuant { protected static final int alpharadbias = (((int) 1) << alpharadbshift); - /* - * Types and Global Variables -------------------------- - */ + /* + * Types and Global Variables -------------------------- + */ protected byte[] thepicture; /* the input image itself */ @@ -101,7 +101,7 @@ class NeuQuant { protected int[] netindex = new int[256]; - /* for network lookup - really 256 */ + /* for network lookup - really 256 */ protected int[] bias = new int[netsize]; @@ -110,7 +110,7 @@ class NeuQuant { protected int[] radpower = new int[initrad]; - /* radpower for precomputation */ + /* radpower for precomputation */ /* * Initialise network in range (0,0,0) to (255,255,255) and set parameters @@ -168,7 +168,7 @@ class NeuQuant { p = network[i]; smallpos = i; smallval = p[1]; /* index on g */ - /* find smallest in i..netsize-1 */ + /* find smallest in i..netsize-1 */ for (j = i + 1; j < netsize; j++) { q = network[j]; if (q[1] < smallval) { /* index on g */ @@ -177,7 +177,7 @@ class NeuQuant { } } q = network[smallpos]; - /* swap p (i) and q (smallpos) entries */ + /* swap p (i) and q (smallpos) entries */ if (i != smallpos) { j = q[0]; q[0] = p[0]; @@ -192,7 +192,7 @@ class NeuQuant { q[3] = p[3]; p[3] = j; } - /* smallval entry is now in position i */ + /* smallval entry is now in position i */ if (smallval != previouscol) { netindex[previouscol] = (startpos + i) >> 1; for (j = previouscol + 1; j < smallval; j++) @@ -426,7 +426,7 @@ class NeuQuant { */ protected void altersingle(int alpha, int i, int b, int g, int r) { - /* alter hit neuron */ + /* alter hit neuron */ int[] n = network[i]; n[0] -= (alpha * (n[0] - b)) / initalpha; n[1] -= (alpha * (n[1] - g)) / initalpha; @@ -438,10 +438,10 @@ class NeuQuant { */ protected int contest(int b, int g, int r) { - /* finds closest neuron (min dist) and updates freq */ - /* finds best neuron (min dist-bias) and returns position */ - /* for frequently chosen neurons, freq[i] is high and bias[i] is negative */ - /* bias[i] = gamma*((1/netsize)-freq[i]) */ + /* finds closest neuron (min dist) and updates freq */ + /* finds best neuron (min dist-bias) and returns position */ + /* for frequently chosen neurons, freq[i] is high and bias[i] is negative */ + /* bias[i] = gamma*((1/netsize)-freq[i]) */ int i, dist, a, biasdist, betafreq; int bestpos, bestbiaspos, bestd, bestbiasd;