danger.ui
Class ImmutableBitmap

java.lang.Object
  extended by danger.ui.Bitmap
      extended by danger.ui.ImmutableBitmap


public class ImmutableBitmap
extends Bitmap

An immutable bitmap provides all the functionality a regular Bitmap has, but it shares its content with another bitmap and does not allow that content to be altered in any way. (The content may still be altered through the other bitmap, though.)


Nested Class Summary
 
Nested classes/interfaces inherited from class danger.ui.Bitmap
Bitmap.FromResource
 
Field Summary
 
Fields inherited from class danger.ui.Bitmap
COMPOSE_ALPHA, COPYBITS_ALPHA, COPYBITS_ALPHA_MASK, COPYBITS_CLAMP_TRANSPARENCY, COPYBITS_FLAGS_MASK, COPYBITS_INTERPOLATED, COPYBITS_INVERTED, COPYBITS_NORMAL_BLIT, COPYBITS_SRCOVER, COPYBITS_SRCOVER_TRANS, DONT_PRESERVE_TRANSPARENCY, NO_COMPOSE_ALPHA, PALETTE_BGR16, PALETTE_BGR16_ALPHA, PALETTE_BGR16_OFFSET, PALETTE_FLAGS_MASK, PALETTE_NONE, PALETTE_RGB16_LE, PALETTE_RGB16_LE_ALPHA, PALETTE_RGB16_LE_OFFSET, PALETTE_SIZE_MASK, PRESERVE_TRANSPARENCY
 
Constructor Summary
ImmutableBitmap(Bitmap src)
          Construct an instance.
 
Method Summary
 boolean copyRotated(Bitmap from, int degrees)
          On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.
 void copyScaled(Bitmap src)
          On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.
 Pen createPen(int dx, int dy)
          On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.
 void flipX()
          On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.
 void flipY()
          On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.
 byte[] getPixels()
          On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.
 void mirror()
          On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.
 void replaceColor(int color, int newColor)
          On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.
 void replacePaletteColor(int color, int newColor)
          On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.
 void setPalette(int[] palette)
          On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.
 void setPixels(byte[] pixels)
          On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.
 void setTo(Bitmap src)
          On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.
 void setTransparentColor(int color)
          On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.
 void setTransparentColorRGB(int color)
          On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.
 
Methods inherited from class danger.ui.Bitmap
canDrawInverted, cloneAndFlipX, cloneAndFlipY, convertToScreenColorSpace, convertToScreenColorSpace, convertToScreenColorSpace, convertToScreenColorSpace, copy, copy, copy, copyBits, copyBits, copyBitsInterpolated, copyBitsTo, copyInterpolated, createOptimalBitmap, createPen, flatten, getColorSpace, getFlattenedSize, getHeight, getPalette, getPaletteFlags, getPaletteOffset, getPaletteSize, getPoint, getPoint, getStride, getTransparentColor, getTransparentColorRGB, getWidth, isGrayscale, newFromEncodedData, newFromFlattenedData, newFromJPEGData, newFromPNGData, replacePaletteColors, rotateBy, scaleTo, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImmutableBitmap

public ImmutableBitmap(Bitmap src)
Construct an instance.

Parameters:
src - non-null; the bitmap to track
Method Detail

createPen

public Pen createPen(int dx,
                     int dy)
On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.

Overrides:
createPen in class Bitmap
Parameters:
dx - the x offset
dy - the y offset
Returns:
non-null; the pen

setTo

public final void setTo(Bitmap src)
On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.

Overrides:
setTo in class Bitmap

copyScaled

public final void copyScaled(Bitmap src)
On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.

Overrides:
copyScaled in class Bitmap

copyRotated

public final boolean copyRotated(Bitmap from,
                                 int degrees)
On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.

Overrides:
copyRotated in class Bitmap
Parameters:
from - the source Bitmap
degrees - 0, 90, 180, or 270
Returns:
whether the rotated copy was successful

mirror

public final void mirror()
On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.

Overrides:
mirror in class Bitmap

flipX

public final void flipX()
On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.

Overrides:
flipX in class Bitmap

flipY

public final void flipY()
On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.

Overrides:
flipY in class Bitmap

replaceColor

public void replaceColor(int color,
                         int newColor)
On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.

Overrides:
replaceColor in class Bitmap
Parameters:
color - the old color, in 32-bit ARGB format
newColor - the new color, in 32-bit ARGB format

replacePaletteColor

public void replacePaletteColor(int color,
                                int newColor)
On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.

Overrides:
replacePaletteColor in class Bitmap
Parameters:
color - the old color, in 24-bit RGB format
newColor - the new color, in 24-bit RGB format

setPalette

public void setPalette(int[] palette)
On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.

Overrides:
setPalette in class Bitmap
Parameters:
palette - The palette array to copy from, in packed ARGB.

setTransparentColor

public void setTransparentColor(int color)
On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.

Overrides:
setTransparentColor in class Bitmap
Parameters:
color - A colorspace dependent integer to use as the transparent color.

setTransparentColorRGB

public void setTransparentColorRGB(int color)
On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.

Overrides:
setTransparentColorRGB in class Bitmap
Parameters:
color - An RGB color packed into an integer. The alpha component is masked out and ignored.

getPixels

public byte[] getPixels()
On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.

Overrides:
getPixels in class Bitmap
Returns:
a reference to the pixel array for this bitmap
See Also:
Bitmap.setPixels(byte[])

setPixels

public void setPixels(byte[] pixels)
On instances of this class, this method simply throws a UIException indicating that the bitmap is immutable.

Overrides:
setPixels in class Bitmap
Parameters:
pixels - the new pixel array for this bitmap
See Also:
Bitmap.getPixels()