public class MarvinImage
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
static int |
COLOR_MODEL_BINARY |
static int |
COLOR_MODEL_RGB |
static int |
PROPORTIONAL |
Constructor and Description |
---|
MarvinImage()
Creates an image with just 1x1 resolution.
|
MarvinImage(java.awt.image.BufferedImage img)
Constructor using a image in memory
|
MarvinImage(java.awt.image.BufferedImage img,
java.lang.String fmtName)
Constructor using a image in memory
|
MarvinImage(int w,
int h)
Constructor to blank image, passing the size of image
|
MarvinImage(int w,
int h,
int cm) |
Modifier and Type | Method and Description |
---|---|
void |
allocColorArray() |
int |
boundRGB(int rgb) |
void |
clear() |
void |
clear(int color) |
MarvinImage |
clone()
Clones the
MarvinImage |
static void |
copyColorArray(MarvinImage imgSource,
MarvinImage imgDestine) |
void |
drawLine(int x0,
int y0,
int x1,
int y1,
java.awt.Color c)
Bresenham´s Line Drawing implementation
|
void |
drawRect(int x,
int y,
int w,
int h,
java.awt.Color c)
Draws a rectangle in the image.
|
void |
drawRect(int x,
int y,
int w,
int h,
int length,
java.awt.Color c) |
boolean |
equals(java.lang.Object obj)
Compare two MarvinImage objects
|
void |
fillRect(int x,
int y,
int w,
int h,
java.awt.Color c)
Fills a rectangle in the image.
|
int |
getAlphaComponent(int x,
int y) |
boolean |
getBinaryColor(int x,
int y) |
boolean[] |
getBinaryColorArray() |
java.awt.image.BufferedImage |
getBufferedImage() |
java.awt.image.BufferedImage |
getBufferedImage(int width,
int height)
Resize and return the image passing the new height and width
|
java.awt.image.BufferedImage |
getBufferedImage(int width,
int height,
int type)
Resize and return the image passing the new height and width, but maintains width/height factor
|
java.awt.image.BufferedImage |
getBufferedImageNoAlpha() |
int |
getColorModel() |
int |
getComponents() |
java.lang.String |
getFormatName() |
int |
getHeight()
Returns the height
|
int |
getIntColor(int x,
int y)
Gets the integer color composition for x, y position
|
int[] |
getIntColorArray() |
int |
getIntComponent0(int x,
int y)
Gets the integer color component 0 in the x and y position
|
int |
getIntComponent1(int x,
int y)
Gets the integer color component 1 in the x and y position
|
int |
getIntComponent2(int x,
int y)
Gets the integer color component 2 in the x and y position
|
java.awt.image.BufferedImage |
getNewImageInstance()
Return a new instance of the BufferedImage
|
int |
getType()
Gets the type
|
int |
getWidth()
Returns the width
|
boolean |
isValidPosition(int x,
int y) |
int |
limit8bitsColor(int color)
Limits the color value between 0 and 255.
|
double |
multi8p(int x,
int y,
double masc)
Multiple of gradient windwos per masc relation of x y
|
int[] |
Multi8p(int x,
int y,
int[][] masc)
Convolution operator
|
void |
resize(int w,
int h)
Resize the image passing the new height and width
|
void |
setAlphaByColor(int alpha,
int color)
Set alpha to 0 for a given color
|
void |
setAlphaComponent(int x,
int y,
int alpha) |
void |
setBinaryColor(int x,
int y,
boolean value) |
void |
setBufferedImage(java.awt.image.BufferedImage img)
Sets a new image
|
void |
setColorModel(int cm) |
void |
setDimension(int w,
int h) |
void |
setIntColor(int x,
int y,
int color)
Sets the integer color composition in X an Y position
|
void |
setIntColor(int x,
int y,
int alpha,
int color) |
void |
setIntColor(int x,
int y,
int c0,
int c1,
int c2)
Sets the integer color in X an Y position
|
void |
setIntColor(int x,
int y,
int alpha,
int c0,
int c1,
int c2)
Sets the integer color in X an Y position
|
void |
setIntColorArray(int[] arr)
Set the integer color array for the entire image.
|
MarvinImage |
subimage(int x,
int y,
int width,
int height) |
void |
update() |
void |
updateColorArray() |
public static final int COLOR_MODEL_RGB
public static final int COLOR_MODEL_BINARY
public static final int PROPORTIONAL
public MarvinImage()
public MarvinImage(java.awt.image.BufferedImage img)
img
- Imagepublic MarvinImage(java.awt.image.BufferedImage img, java.lang.String fmtName)
img
- ImagefmtName
- Image format namepublic MarvinImage(int w, int h)
int
- widthint
- heightpublic MarvinImage(int w, int h, int cm)
public int getComponents()
public MarvinImage subimage(int x, int y, int width, int height)
public void updateColorArray()
public void update()
public void clear()
public void clear(int color)
public int getType()
public int getColorModel()
public void setColorModel(int cm)
public java.lang.String getFormatName()
public void setDimension(int w, int h)
public void allocColorArray()
public int[] getIntColorArray()
public void setIntColorArray(int[] arr)
public static void copyColorArray(MarvinImage imgSource, MarvinImage imgDestine)
public boolean[] getBinaryColorArray()
public boolean getBinaryColor(int x, int y)
public void setBinaryColor(int x, int y, boolean value)
public int getIntColor(int x, int y)
int
- xint
- ypublic void setAlphaComponent(int x, int y, int alpha)
x
- y
- alpha
- public int getAlphaComponent(int x, int y)
x
- y
- public int getIntComponent0(int x, int y)
int
- xint
- ypublic int getIntComponent1(int x, int y)
int
- xint
- ypublic int getIntComponent2(int x, int y)
int
- xint
- ypublic int getWidth()
public int getHeight()
public boolean isValidPosition(int x, int y)
public void setIntColor(int x, int y, int alpha, int color)
public void setIntColor(int x, int y, int color)
x
- positiony
- positioncolor
- color valuepublic void setIntColor(int x, int y, int c0, int c1, int c2)
x
- positiony
- positionc0
- component 0c1
- component 1c2
- component 2public void setIntColor(int x, int y, int alpha, int c0, int c1, int c2)
x
- positiony
- positionc0
- component 0c1
- component 1c2
- component 2public void setBufferedImage(java.awt.image.BufferedImage img)
BufferedImage
- imagempublic java.awt.image.BufferedImage getBufferedImage()
public java.awt.image.BufferedImage getBufferedImageNoAlpha()
public int limit8bitsColor(int color)
public int[] Multi8p(int x, int y, int[][] masc)
public java.awt.image.BufferedImage getNewImageInstance()
public java.awt.image.BufferedImage getBufferedImage(int width, int height)
height
- width
- public java.awt.image.BufferedImage getBufferedImage(int width, int height, int type)
height
- width
- public void resize(int w, int h)
height
- width
- public MarvinImage clone()
MarvinImage
clone
in class java.lang.Object
public double multi8p(int x, int y, double masc)
public int boundRGB(int rgb)
public void drawLine(int x0, int y0, int x1, int y1, java.awt.Color c)
public void drawRect(int x, int y, int w, int h, java.awt.Color c)
x
- rect´s start position in x-axisy
- rect´s start positioj in y-axisw
- rect´s widthh
- rect´s heightc
- rect´s colorpublic void drawRect(int x, int y, int w, int h, int length, java.awt.Color c)
public void fillRect(int x, int y, int w, int h, java.awt.Color c)
x
- rect´s start position in x-axisy
- rect´s start positioj in y-axisw
- rect´s widthh
- rect´s heightc
- rect´s colorpublic void setAlphaByColor(int alpha, int color)
color
- target colorpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- object to be compared. MarvinImage object is expected.