android.image
Class RasterImage

java.lang.Object
  extended by android.image.Image
      extended by android.image.RasterImage
Direct Known Subclasses:
FromFile

public class RasterImage
extends Image

Represents a raster Image drawn into a Buffer. Because rotating and scaling arbitrary shapes/images is difficult, we can rasterize, then apply effects. It also allows us to merge images (i.e., overlays) into a single image to make drawing more efficient.


Field Summary
 
Fields inherited from class android.image.Image
BLACK_OUTLINE, CLEAR, WHITE
 
Constructor Summary
RasterImage(android.graphics.Bitmap img)
          Construct a RasterImage with the given Bitmap
RasterImage(int w, int h)
          Construct a RasterImage with the given width/height
 
Method Summary
 android.graphics.Canvas getCanvas()
          Get the Graphics2D associated with this RasterImage
 int getPixel(int x, int y)
          Get the java.awt.Color of the pixel at the given x/y
 java.lang.String getPixelAsString(int x, int y)
          Get a String of the Color pixel at the given x/y.
 int height()
          Return the height of this Image
 void paint(android.graphics.Canvas c, int xx, int yy)
          Draw this image into a Graphics
 void setPixel(int x, int y, double red, double green, double blue)
          Set the pixel at the given x/y to the given RGB intensities.
 void setPixel(int x, int y, double alpha, double red, double green, double blue)
          Set the pixel at the given x/y to the given ARGB intensities.
 void setPixel(int x, int y, int red, int green, int blue)
          Set the pixel at the given x/y to the given RGB intensities.
 void setPixel(int x, int y, int alpha, int red, int green, int blue)
          Set the pixel at the given x/y to the given ARGB intensities.
 void setPixel(int x, int y, java.lang.String color)
          Set the pixel at the given x/y to the given String Color
 int width()
          Return the width of this Image
 
Methods inherited from class android.image.Image
flipHorizontal, flipVertical, overlay, overlay, overlayxy, overlayxy, overlayxy, overlayxy, overlayxy, overlayxy, rasterize, rotate, rotate, toFile, toScene, toWhiteFile, toWhiteScene
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RasterImage

public RasterImage(int w,
                   int h)
Construct a RasterImage with the given width/height


RasterImage

public RasterImage(android.graphics.Bitmap img)
Construct a RasterImage with the given Bitmap

Method Detail

paint

public void paint(android.graphics.Canvas c,
                  int xx,
                  int yy)
Draw this image into a Graphics

Specified by:
paint in class Image

width

public int width()
Return the width of this Image

Specified by:
width in class Image

height

public int height()
Return the height of this Image

Specified by:
height in class Image

getCanvas

public android.graphics.Canvas getCanvas()
Get the Graphics2D associated with this RasterImage


getPixel

public int getPixel(int x,
                    int y)
Get the java.awt.Color of the pixel at the given x/y


getPixelAsString

public java.lang.String getPixelAsString(int x,
                                         int y)
Get a String of the Color pixel at the given x/y. E.g., "#00FF00" would be returned if the color of the pixel at the given x/y is blue.


setPixel

public void setPixel(int x,
                     int y,
                     java.lang.String color)
Set the pixel at the given x/y to the given String Color


setPixel

public void setPixel(int x,
                     int y,
                     int red,
                     int green,
                     int blue)
Set the pixel at the given x/y to the given RGB intensities. Intensities must be between 0 and 255, inclusive.


setPixel

public void setPixel(int x,
                     int y,
                     int alpha,
                     int red,
                     int green,
                     int blue)
Set the pixel at the given x/y to the given ARGB intensities. Intensities must be between 0 and 255, inclusive.


setPixel

public void setPixel(int x,
                     int y,
                     double red,
                     double green,
                     double blue)
Set the pixel at the given x/y to the given RGB intensities. Intensities must be between 0 and 1.0, inclusive.


setPixel

public void setPixel(int x,
                     int y,
                     double alpha,
                     double red,
                     double green,
                     double blue)
Set the pixel at the given x/y to the given ARGB intensities. Intensities must be between 0 and 1.0, inclusive.