import java.awt.*;
import java.awt.image.*;

class MyRaster extends Raster {
    ///////////////////////// Constructors //////////////////////

    /**
     *  This constructor creates an uninitialized
     *  MyRaster Object of a given size (w x h).
     */
    public MyRaster(int w, int h)
    {
		super(w, h);
    }

    /**
     *  This constructor creates an MyRaster initialized
     *  with the contents of an image.
     */
    public MyRaster(Image img)
    {
		super(img);
    }

	////////////////////////// Methods //////////////////////////

    /**
     *  Gets an alpha value from a Raster
     */
    public int getAlpha(int x, int y) {
		int alp = pixel[y*width+x] >>> 24;
        return alp;
    }

    /**
     *  Sets an alpha value to a given value
     */
    public boolean setAlpha(int alp, int x, int y) {
        pixel[y*width+x] &= 0x00ffffff;
		pixel[y*width+x] |= alp << 24;
        return true;
    }

    /**
     *  Gets an alpha float value from a Raster
     */
    public float getFloatAlpha(int x, int y) {
		float fAlp = (pixel[y*width+x] >>> 24) / 255f;
        return fAlp;
    }

    /**
     *  Sets an alpha float value to a given value
     */
    public boolean setFloatAlpha(float fAlp, int x, int y) {
        pixel[y*width+x] &= 0x00ffffff;
        pixel[y*width+x] |= (int)(fAlp * 255) << 24;
        return true;
    }


}