Răsfoiți Sursa

* Add ImageRaster.getWidth() and getHeight()

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9874 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
Sha..rd 13 ani în urmă
părinte
comite
4d01146519

+ 10 - 0
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());

+ 10 - 0
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);

+ 14 - 0
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.
      * <p>