From 4d011465196751e559dd07df9874ba05cf7f5a43 Mon Sep 17 00:00:00 2001 From: "Sha..rd" Date: Sun, 21 Oct 2012 21:56:22 +0000 Subject: [PATCH] * Add ImageRaster.getWidth() and getHeight() git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9874 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../android/com/jme3/asset/AndroidImageInfo.java | 10 ++++++++++ .../com/jme3/texture/image/DefaultImageRaster.java | 10 ++++++++++ .../core/com/jme3/texture/image/ImageRaster.java | 14 ++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/engine/src/android/com/jme3/asset/AndroidImageInfo.java b/engine/src/android/com/jme3/asset/AndroidImageInfo.java index d762d07f1..301b5b666 100644 --- a/engine/src/android/com/jme3/asset/AndroidImageInfo.java +++ b/engine/src/android/com/jme3/asset/AndroidImageInfo.java @@ -59,6 +59,16 @@ public class AndroidImageInfo extends ImageRaster { return format; } + @Override + public int getWidth() { + return getBitmap().getWidth(); + } + + @Override + public int getHeight() { + return getBitmap().getHeight(); + } + @Override public void setPixel(int x, int y, ColorRGBA color) { getBitmap().setPixel(x, y, color.asIntARGB()); diff --git a/engine/src/core/com/jme3/texture/image/DefaultImageRaster.java b/engine/src/core/com/jme3/texture/image/DefaultImageRaster.java index d7457e332..4c9c4202f 100644 --- a/engine/src/core/com/jme3/texture/image/DefaultImageRaster.java +++ b/engine/src/core/com/jme3/texture/image/DefaultImageRaster.java @@ -65,6 +65,16 @@ public class DefaultImageRaster extends ImageRaster { } } + @Override + public int getWidth() { + return width; + } + + @Override + public int getHeight() { + return height; + } + @Override public void setPixel(int x, int y, ColorRGBA color) { rangeCheck(x, y); diff --git a/engine/src/core/com/jme3/texture/image/ImageRaster.java b/engine/src/core/com/jme3/texture/image/ImageRaster.java index b32c4fdcf..d16129708 100644 --- a/engine/src/core/com/jme3/texture/image/ImageRaster.java +++ b/engine/src/core/com/jme3/texture/image/ImageRaster.java @@ -91,6 +91,20 @@ public abstract class ImageRaster { public ImageRaster() { } + /** + * Returns the pixel width of the underlying image. + * + * @return the pixel width of the underlying image. + */ + public abstract int getWidth(); + + /** + * Returns the pixel height of the underlying image. + * + * @return the pixel height of the underlying image. + */ + public abstract int getHeight(); + /** * Sets the pixel at the given coordinate to the given color. *