aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-04-27 01:38:12 +0200
committerSven Gothel <[email protected]>2013-04-27 01:38:12 +0200
commit94ea306d1809290db678d3181619bdc39d4334bb (patch)
treecd61bb347f6980dbdc5d2aac86f59b4261c1325e /src/jogl/classes/com/jogamp
parentff9fb2d0adc81fdf25d6e26b91e1f67d8241e3e4 (diff)
Move JPEGDecoder.PixelStorage -> TextureData.ColorSink: Appropriate name + public use
Diffstat (limited to 'src/jogl/classes/com/jogamp')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java15
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java9
2 files changed, 20 insertions, 4 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
index 5b72bea82..15b8930bb 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
@@ -56,6 +56,21 @@ import com.jogamp.opengl.util.GLBuffers;
public class TextureData {
public static enum ColorSpace { RGB, YCbCr, YCCK, CMYK };
+ public static interface ColorSink {
+ /**
+ * @param width
+ * @param height
+ * @param sourceCS the color-space of the decoded JPEG
+ * @param sourceComponents number of components used for the given source color-space
+ * @return Either {@link ColorSpace#RGB} or {@link ColorSpace#YCbCr}. {@link ColorSpace#YCCK} and {@link ColorSpace#CMYK} will throw an exception!
+ * @throws RuntimeException
+ */
+ public ColorSpace allocate(int width, int height, ColorSpace sourceCS, int sourceComponents) throws RuntimeException;
+ public void store2(int x, int y, byte c1, byte c2);
+ public void storeRGB(int x, int y, byte r, byte g, byte b);
+ public void storeYCbCr(int x, int y, byte Y, byte Cb, byte Cr);
+ }
+
protected int width;
protected int height;
private int border;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java
index 71dd53939..14253e4af 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java
@@ -38,6 +38,7 @@ import jogamp.opengl.util.jpeg.JPEGDecoder;
import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.util.texture.TextureData.ColorSpace;
+import com.jogamp.opengl.util.texture.TextureData.ColorSink;
public class JPEGImage {
private static final boolean DEBUG = Debug.debug("JPEGImage");
@@ -60,7 +61,7 @@ public class JPEGImage {
return new JPEGImage(in, ColorSpace.RGB);
}
- private static class JPEGPixelStorage implements JPEGDecoder.PixelStorage {
+ private static class JPEGColorSink implements ColorSink {
int width=0, height=0;
int sourceComponents=0;
ColorSpace sourceCS = ColorSpace.YCbCr;
@@ -68,7 +69,7 @@ public class JPEGImage {
final ColorSpace storageCS;
ByteBuffer data = null;
- JPEGPixelStorage(ColorSpace storageCM) {
+ JPEGColorSink(ColorSpace storageCM) {
this.storageCS = storageCM;
switch(storageCS) {
case RGB:
@@ -118,7 +119,7 @@ public class JPEGImage {
};
private JPEGImage(InputStream in, ColorSpace cs) throws IOException {
- pixelStorage = new JPEGPixelStorage(cs);
+ pixelStorage = new JPEGColorSink(cs);
final JPEGDecoder decoder = new JPEGDecoder();
decoder.parse(in);
pixelWidth = decoder.getWidth();
@@ -138,7 +139,7 @@ public class JPEGImage {
}
decoder.clear(null);
}
- private JPEGPixelStorage pixelStorage;
+ private JPEGColorSink pixelStorage;
private final int pixelWidth, pixelHeight, glFormat, bytesPerPixel;
private boolean reversedChannels;
private final ByteBuffer data;