Fix WebP visibility issues.

This commit is contained in:
Harald Kuhr 2022-09-09 14:09:58 +02:00
parent c60116a611
commit a1fcfc3958
11 changed files with 21 additions and 29 deletions

View File

@ -29,14 +29,14 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.twelvemonkeys.imageio.plugins.webp.lossless.transform; package com.twelvemonkeys.imageio.plugins.webp.lossless;
import java.awt.image.*; import java.awt.image.*;
/** /**
* @author Simon Kammermeier * @author Simon Kammermeier
*/ */
public class ColorIndexingTransform implements Transform { final class ColorIndexingTransform implements Transform {
private final byte[] colorTable; private final byte[] colorTable;
private final byte bits; private final byte bits;

View File

@ -29,14 +29,14 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.twelvemonkeys.imageio.plugins.webp.lossless.transform; package com.twelvemonkeys.imageio.plugins.webp.lossless;
import java.awt.image.*; import java.awt.image.*;
/** /**
* @author Simon Kammermeier * @author Simon Kammermeier
*/ */
public class ColorTransform implements Transform { final class ColorTransform implements Transform {
private final Raster data; private final Raster data;
private final byte bits; private final byte bits;

View File

@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.twelvemonkeys.imageio.plugins.webp.lossless.huffman; package com.twelvemonkeys.imageio.plugins.webp.lossless;
import com.twelvemonkeys.imageio.plugins.webp.LSBBitReader; import com.twelvemonkeys.imageio.plugins.webp.LSBBitReader;
@ -38,7 +38,7 @@ import java.io.IOException;
/** /**
* @author Simon Kammermeier * @author Simon Kammermeier
*/ */
public class HuffmanCodeGroup { final class HuffmanCodeGroup {
/** /**
* Used for green, backward reference length and color cache * Used for green, backward reference length and color cache
*/ */

View File

@ -29,14 +29,14 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.twelvemonkeys.imageio.plugins.webp.lossless.huffman; package com.twelvemonkeys.imageio.plugins.webp.lossless;
import java.awt.image.*; import java.awt.image.*;
/** /**
* @author Simon Kammermeier * @author Simon Kammermeier
*/ */
public class HuffmanInfo { final class HuffmanInfo {
public Raster huffmanMetaCodes; //Raster allows intuitive lookup by x and y public Raster huffmanMetaCodes; //Raster allows intuitive lookup by x and y
public int metaCodeBits; public int metaCodeBits;

View File

@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.twelvemonkeys.imageio.plugins.webp.lossless.huffman; package com.twelvemonkeys.imageio.plugins.webp.lossless;
import com.twelvemonkeys.imageio.plugins.webp.LSBBitReader; import com.twelvemonkeys.imageio.plugins.webp.LSBBitReader;
@ -65,7 +65,7 @@ import java.util.List;
* *
* @author Simon Kammermeier * @author Simon Kammermeier
*/ */
public class HuffmanTable { final class HuffmanTable {
private static final int LEVEL1_BITS = 8; private static final int LEVEL1_BITS = 8;
/** /**

View File

@ -29,14 +29,14 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.twelvemonkeys.imageio.plugins.webp.lossless.transform; package com.twelvemonkeys.imageio.plugins.webp.lossless;
/** /**
* PredictorMode. * PredictorMode.
* *
* @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a> * @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a>
*/ */
public interface PredictorMode { interface PredictorMode {
// Special rules: // Special rules:
// Top-left pixel of image is predicted BLACK // Top-left pixel of image is predicted BLACK
// Rest of top pixels is predicted L // Rest of top pixels is predicted L

View File

@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.twelvemonkeys.imageio.plugins.webp.lossless.transform; package com.twelvemonkeys.imageio.plugins.webp.lossless;
import java.awt.image.*; import java.awt.image.*;
@ -40,7 +40,7 @@ import static java.lang.Math.min;
/** /**
* @author Simon Kammermeier * @author Simon Kammermeier
*/ */
public class PredictorTransform implements Transform { final class PredictorTransform implements Transform {
private final Raster data; private final Raster data;
private final byte bits; private final byte bits;

View File

@ -29,14 +29,14 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.twelvemonkeys.imageio.plugins.webp.lossless.transform; package com.twelvemonkeys.imageio.plugins.webp.lossless;
import java.awt.image.*; import java.awt.image.*;
/** /**
* @author Simon Kammermeier * @author Simon Kammermeier
*/ */
public class SubtractGreenTransform implements Transform { final class SubtractGreenTransform implements Transform {
private static void addGreenToBlueAndRed(byte[] rgb) { private static void addGreenToBlueAndRed(byte[] rgb) {
rgb[0] = (byte) ((rgb[0] + rgb[1]) & 0xff); rgb[0] = (byte) ((rgb[0] + rgb[1]) & 0xff);

View File

@ -29,16 +29,16 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.twelvemonkeys.imageio.plugins.webp.lossless.transform; package com.twelvemonkeys.imageio.plugins.webp.lossless;
import java.awt.image.WritableRaster; import java.awt.image.*;
/** /**
* Transform. * Transform.
* *
* @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a> * @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a>
*/ */
public interface Transform { interface Transform {
void applyInverse(WritableRaster raster); void applyInverse(WritableRaster raster);
} }

View File

@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.twelvemonkeys.imageio.plugins.webp.lossless.transform; package com.twelvemonkeys.imageio.plugins.webp.lossless;
/** /**
* TransformType. * TransformType.
@ -37,7 +37,7 @@ package com.twelvemonkeys.imageio.plugins.webp.lossless.transform;
* @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a> * @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a>
*/ */
// Hmm.. Why doesn't SUBTRACT_GREEN follow the convention? // Hmm.. Why doesn't SUBTRACT_GREEN follow the convention?
public interface TransformType { interface TransformType {
int PREDICTOR_TRANSFORM = 0; int PREDICTOR_TRANSFORM = 0;
int COLOR_TRANSFORM = 1; int COLOR_TRANSFORM = 1;
int SUBTRACT_GREEN = 2; int SUBTRACT_GREEN = 2;

View File

@ -32,14 +32,6 @@
package com.twelvemonkeys.imageio.plugins.webp.lossless; package com.twelvemonkeys.imageio.plugins.webp.lossless;
import com.twelvemonkeys.imageio.plugins.webp.LSBBitReader; import com.twelvemonkeys.imageio.plugins.webp.LSBBitReader;
import com.twelvemonkeys.imageio.plugins.webp.lossless.huffman.HuffmanCodeGroup;
import com.twelvemonkeys.imageio.plugins.webp.lossless.huffman.HuffmanInfo;
import com.twelvemonkeys.imageio.plugins.webp.lossless.transform.ColorIndexingTransform;
import com.twelvemonkeys.imageio.plugins.webp.lossless.transform.ColorTransform;
import com.twelvemonkeys.imageio.plugins.webp.lossless.transform.PredictorTransform;
import com.twelvemonkeys.imageio.plugins.webp.lossless.transform.SubtractGreenTransform;
import com.twelvemonkeys.imageio.plugins.webp.lossless.transform.Transform;
import com.twelvemonkeys.imageio.plugins.webp.lossless.transform.TransformType;
import javax.imageio.IIOException; import javax.imageio.IIOException;
import javax.imageio.ImageReadParam; import javax.imageio.ImageReadParam;