|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.graphics.image.Raster
The Raster class representation an image within the
graphic API.
| Field Summary | |
static int |
A_AND_B
constant that tells about a blitting code |
protected int |
alpha
instance variable for the alpha value of each pixel |
static int |
ARGB
constant that tells about a type of the Raster |
protected int[] |
colors
instance variable for the used colors (only used for indexed type) |
protected int |
height
instance variable for the height of the Raster |
static int |
INDEXED
constant that tells about a type of the Raster |
protected int[][] |
rasterData
instance variable for the pixels of the Raster |
static int |
SRC_COPY
constant that tells about a blitting code |
protected double |
transparency
instance variable for the transparency level of the Raster |
protected int |
type
instance variable for the type of the Raster |
protected int |
usedBitCount
instance variable for the used bit count (integer based) of the Raster |
protected int |
width
instance variable for the width of the Raster |
| Constructor Summary | |
Raster(int width,
int height,
int colors)
Constructor specifying the width, the height
and the number of colors. |
|
Raster(int width,
int height,
int[] colors)
Constructor specifying the width, the height
and the colors to be used. |
|
Raster(int width,
int height,
int[][] rasterData,
int[] colors)
Constructor specifying the width, the height,
an array with the data for this Raster and the colors to be
used. |
|
| Method Summary | |
void |
blt(Raster raster,
int bltCode)
Performs a blit operation with the Raster given by
raster. |
static void |
blt(Raster dest,
Raster sourceA,
Raster sourceB,
int bltCode)
Performs a blit operation onto the two Rasters given by
sourceA and sourceB. |
void |
clear()
Clear the complete Raster. |
void |
create(int width,
int height)
(Re)Creates the Raster with the given width
and height. |
protected void |
createRaster()
Creates a two dimensional array that is large enough to keep all pixel values for the given with and height. |
static Raster |
decode(java.lang.String encodedString)
Decodes a string which has been previously create by the encode()
method. |
static Raster |
decode(java.lang.String encodedString,
boolean compressed)
Decodes a string which has been previously create by the encode()
method. |
void |
dispose()
Disposes all internally created data. |
java.lang.String |
encode()
Encodes the internal raster data by using a base64 encoded zip stream. |
java.lang.String |
encode(boolean compress)
Encodes the internal raster data by using a base64 encoded zip stream. |
boolean |
equals(java.lang.Object o)
|
void |
fill(int rgb)
Fills the complete Raster with pixels that have red-,
green- and blue-values specified by the integer representation of a
color given by RGB but have no alpha value. |
void |
fill(int r,
int g,
int b)
Fills the complete Raster with pixels that have red-,
green- and blue-values specified by r, g and
b but have no alpha value. |
int |
get(int x,
int y)
Returns the integer representation of the pixel specified through the coordinate given by x and y
NOTICE: The alpha value for the specified pixel is omitted. |
int |
getAlpha()
Returns the Alpha-value for this Raster. |
int |
getB(int x,
int y)
Returns the blue-value for the pixel specified through the coordinate given by x and y. |
int |
getColorIndex(int x,
int y)
Returns the index for the color of the pixel specified through the coordinate given by x and y.
|
protected int |
getDivider()
Returns the divider that is necessary to shift an integer such that one comes to the next pixel within an integer value. |
int |
getG(int x,
int y)
Returns the green-value for the pixel specified through the coordinate given by x and y. |
int |
getHeight()
Returns the height of this Raster. |
int |
getIndexedColor(int index)
Returns the integer representation of the color at the given index.
|
protected int |
getMask(int position)
Returns the bitmask that is necessary to bitmask a single pixel within an integer value. |
int |
getR(int x,
int y)
Returns the red-value for the pixel specified through the coordinate given by x and y. |
int |
getTransparency()
Returns the transparency of this Raster. |
protected int |
getUsedBits(int colors)
Returns an integer that indicates how many bit per an integer are used when using the number of color given by colors. |
int |
getWidth()
Returns the width of this Raster. |
boolean |
hasColor(int rgb)
Returns a boolean that indicates whether the color specified
through the integer representation given by RGB is used in
the Raster.
|
int |
hashCode()
No custom code for calculating a hash code is used here, rather System.identityHashCode(java.lang.Object) is called
and returned. |
int |
indexOf(int rgb)
Returns the index of the color specified through RGB.
|
void |
set(int x,
int y,
int rgb)
Sets the red-value, green-value and the blue-value of the pixel specified through the coordinate given by x and y to the
integer representation given by RGB.
|
void |
set(int x,
int y,
int r,
int g,
int b)
Sets the red-value, green-value and the blue-value of the pixel specified through the coordinate given by x and y to the
values given by r, g and b. |
void |
setB(int x,
int y,
int blue)
Sets the blue-value for the pixel specified through the coordinate given by x and y to the blue-value given by
blue. |
void |
setColorIndex(int x,
int y,
int index)
Sets the index of the pixel specified through the coordinate given by x and y to the index given by
index.
|
void |
setG(int x,
int y,
int green)
Sets the green-value for the pixel specified through the coordinate given by x and y to the green-value given by
green. |
void |
setIndexedColor(int index,
int rgb)
Sets the integer representation of a color given by RGB at
the index given by index.
|
void |
setR(int x,
int y,
int red)
Sets the red-value for the pixel specified through the coordinate given by x and y to the red-value given by
red. |
void |
setTransparency(int transparency)
Sets the transparency of this Raster. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int INDEXED
Raster
public static final int ARGB
Raster
public static final int A_AND_B
public static final int SRC_COPY
protected int width
Raster
protected int height
Raster
protected int type
Raster
protected int usedBitCount
Raster
protected int[] colors
protected int[][] rasterData
Raster
protected double transparency
Raster
protected int alpha
| Constructor Detail |
public Raster(int width,
int height,
int colors)
width, the height
and the number of colors.
width - the width of this Raster.height - the height of this Raster.colors - the number of colors to use.
public Raster(int width,
int height,
int[] colors)
width, the height
and the colors to be used.
width - the width of this Raster.height - the height of this Raster.colors - an array specifying the colors to be used.
public Raster(int width,
int height,
int[][] rasterData,
int[] colors)
width, the height,
an array with the data for this Raster and the colors to be
used.
width - the width of this Raster.height - the height of this Raster.rasterData - a two-dimensional array holding the data for this
Raster.colors - an array specifying the colors to be used.| Method Detail |
public int getWidth()
Raster.
Raster.public int getHeight()
Raster.
Raster.public int getTransparency()
Raster.
Raster.public void setTransparency(int transparency)
Raster.
transparency - the transparency of this Raster.public java.lang.String encode()
public java.lang.String encode(boolean compress)
compress - true, to gzip the bytes before base64 encoding
public static Raster decode(java.lang.String encodedString)
encode()
method.
encodedString - an encoded String
public static Raster decode(java.lang.String encodedString,
boolean compressed)
encode()
method.
encodedString - an encoded Stringcompressed - true, if the given encoded data is compressed
public int getAlpha()
Alpha-value for this Raster.
Alpha-value for this Raster.
public int getR(int x,
int y)
x and y.
x - x component of the pixel to return the red-value fory - y component of the pixel to return the red-value for
public void setR(int x,
int y,
int red)
x and y to the red-value given by
red.
x - x component of the pixel to return the red-value fory - y component of the pixel to return the red-value forred - the new red-value for the specified pixel
public int getG(int x,
int y)
x and y.
x - x component of the pixel to return the red-value fory - y component of the pixel to return the red-value for
public void setG(int x,
int y,
int green)
x and y to the green-value given by
green.
x - x component of the pixel to return the green-value fory - y component of the pixel to return the green-value forgreen - the new green-value for the specified pixel
public int getB(int x,
int y)
x and y.
x - x component of the pixel to return the blue-value fory - y component of the pixel to return the blue-value for
public void setB(int x,
int y,
int blue)
x and y to the blue-value given by
blue.
x - x component of the pixel to return the blue-value fory - y component of the pixel to return the blue-value forblue - the new blue-value for the specified pixel
public int get(int x,
int y)
x and y
x - x component of the pixel to return the integer representation
fory - y component of the pixel to return the integer representation
for
public void set(int x,
int y,
int r,
int g,
int b)
x and y to the
values given by r, g and b.
x - x component of the pixel to set the new values toy - y component of the pixel to set the new values tor - the new red-value for the specified pixelg - the new green-value for the specified pixelb - the new blue-value for the specified pixel
public void set(int x,
int y,
int rgb)
x and y to the
integer representation given by RGB.
x - x component of the pixel to set the new values toy - y component of the pixel to set the new values torgb - the new integer representation of the specified pixelpublic int indexOf(int rgb)
RGB.
Raster
rgb - the integer representation of the color to return the index
for
public boolean hasColor(int rgb)
boolean that indicates whether the color specified
through the integer representation given by RGB is used in
the Raster.
Raster
rgb - the integer representation of the color to check usage for
Raster
public int getColorIndex(int x,
int y)
x and y.
Raster
x - x component of the pixel to return the color index fory - y component of the pixel to return the color index for
public void setColorIndex(int x,
int y,
int index)
x and y to the index given by
index.
Raster
Raster
x - x component of the pixel to set the color index fory - y component of the pixel to set the color index forindex - the new color index for the pixel at the given coordinatepublic int getIndexedColor(int index)
index.
Raster
index - the index to return the color for
public void setIndexedColor(int index,
int rgb)
RGB at
the index given by index.
Raster
index - the index to set the integer representation of a color atrgb - the new integer representation of a color to setpublic void clear()
Raster. This means the complete
Raster is filled up with black pixels that have no alpha
value.
public void fill(int r,
int g,
int b)
Raster with pixels that have red-,
green- and blue-values specified by r, g and
b but have no alpha value.
r - the red-value for the pixels to fill the Raster
withg - the green-value for the pixels to fill the Raster
withb - the blue-value for the pixels to fill the Raster
withpublic void fill(int rgb)
Raster with pixels that have red-,
green- and blue-values specified by the integer representation of a
color given by RGB but have no alpha value.
rgb - the new integer representation of a color for the pixels to
fill the Raster with
public void blt(Raster raster,
int bltCode)
Raster given by
raster. The two Rasters are combined with
respect to the blit mode given by bltCode. The different
blit modes Raster supports are defines through constants
in this class.
raster - the Raster to combine this raster withbltCode - the blit mode to use
public void create(int width,
int height)
Raster with the given width
and height.
width - the new width for the Rasterheight - the new height for the Rasterpublic void dispose()
public java.lang.String toString()
public int hashCode()
System.identityHashCode(java.lang.Object) is called
and returned.
public boolean equals(java.lang.Object o)
protected void createRaster()
ARGB raster it is exactly the width
multiplied by the height. For an INDEXED raster the size
depends an the with, height and the count of used colors.
protected int getUsedBits(int colors)
colors.
colors - the number of used colors
protected int getDivider()
INDEXED raster.
protected int getMask(int position)
INDEXED
raster. This given position indicates for what pixel to
create the bitmask.
position - the pixel within an integer value the bitmask should be
created for
public static void blt(Raster dest,
Raster sourceA,
Raster sourceB,
int bltCode)
Rasters given by
sourceA and sourceB. The two
Rasters are combined with respect to the blit mode given
by bltCode. The different blit modes Raster
supports are defines through constants in this class.
sourceA - the Raster to combine the second
Raster with (destination)sourceB - the Raster to combine the first
Raster with (source only)bltCode - the blit mode to use
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||