[libbluray-devel] Updated DVBBufferedImage (merge from dslibbluray)
hpi1
git at videolan.org
Thu Nov 15 12:04:38 CET 2012
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Oct 3 14:10:36 2012 +0300| [58416144b894ae3f61bc9c3e17c05c773556a3be] | committer: hpi1
Updated DVBBufferedImage (merge from dslibbluray)
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=58416144b894ae3f61bc9c3e17c05c773556a3be
---
.../bdj/java/org/dvb/ui/DVBBufferedImage.java | 85 +++++++++++++++++++-
1 file changed, 82 insertions(+), 3 deletions(-)
diff --git a/src/libbluray/bdj/java/org/dvb/ui/DVBBufferedImage.java b/src/libbluray/bdj/java/org/dvb/ui/DVBBufferedImage.java
index 4c0390b..4b5728f 100644
--- a/src/libbluray/bdj/java/org/dvb/ui/DVBBufferedImage.java
+++ b/src/libbluray/bdj/java/org/dvb/ui/DVBBufferedImage.java
@@ -19,9 +19,16 @@
package org.dvb.ui;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Image;
import java.awt.image.BufferedImage;
+import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
-public class DVBBufferedImage extends BufferedImage {
+public class DVBBufferedImage extends Image {
public DVBBufferedImage(int width, int height)
{
this(width, height, TYPE_BASE);
@@ -29,16 +36,87 @@ public class DVBBufferedImage extends BufferedImage {
public DVBBufferedImage(int width, int height, int type)
{
- super(width, height, type == TYPE_BASE ? TYPE_INT_RGB : TYPE_INT_ARGB);
+ this.type = type;
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ GraphicsDevice gd = ge.getDefaultScreenDevice();
+ GraphicsConfiguration gc = gd.getDefaultConfiguration();
+ bufferedImage = gc.createCompatibleImage(width, height);
+ }
+
+ private DVBBufferedImage(BufferedImage image, int type) {
+ this.type = type;
+ this.bufferedImage = image;
}
public DVBGraphics createGraphics() {
- DVBGraphics gfx = new DVBGraphicsImpl(super.createGraphics());
+ DVBGraphics gfx = new DVBGraphicsImpl(bufferedImage.createGraphics());
gfx.type = type;
return gfx;
}
public void dispose() {
+ bufferedImage = null;
+ }
+
+ public void flush() {
+ bufferedImage.flush();
+ }
+
+ public Graphics getGraphics() {
+ return bufferedImage.getGraphics();
+ }
+
+ public int getHeight() {
+ return bufferedImage.getHeight();
+ }
+
+ public int getHeight(ImageObserver observer) {
+ return bufferedImage.getHeight(observer);
+ }
+
+ public Image getImage() {
+ return bufferedImage;
+ }
+
+ public Object getProperty(String name, ImageObserver observer) {
+ return bufferedImage.getProperty(name, observer);
+ }
+
+ public int getRGB(int x, int y) {
+ return bufferedImage.getRGB(x, y);
+ }
+
+ public int[] getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize) {
+ return bufferedImage.getRGB(startX, startY, w, h, rgbArray, offset, scansize);
+ }
+
+ public Image getScaledInstance(int width, int height, int hints) {
+ return bufferedImage.getScaledInstance(width, height, hints);
+ }
+
+ public ImageProducer getSource() {
+ return bufferedImage.getSource();
+ }
+
+ public DVBBufferedImage getSubimage(int x, int y, int w, int h) throws DVBRasterFormatException {
+ BufferedImage subImage = bufferedImage.getSubimage(x, y, w, h);
+ return new DVBBufferedImage(subImage, this.type);
+ }
+
+ public int getWidth() {
+ return bufferedImage.getWidth();
+ }
+
+ public int getWidth(ImageObserver observer) {
+ return bufferedImage.getWidth(observer);
+ }
+
+ public void setRGB(int x, int y, int rgb) {
+ this.bufferedImage.setRGB(x, y, rgb);
+ }
+
+ public void setRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize) {
+ bufferedImage.setRGB(startX, startY, w, h, rgbArray, offset, scansize);
}
public String toString()
@@ -50,4 +128,5 @@ public class DVBBufferedImage extends BufferedImage {
public static final int TYPE_BASE = 21;
private int type = TYPE_BASE;
+ private BufferedImage bufferedImage;
}
More information about the libbluray-devel
mailing list