Package fr.formiko.usuel.images
Class Img
java.lang.Object
fr.formiko.usuel.images.Img
- All Implemented Interfaces:
Cloneable
Img is a BufferedImage where you can edit pixel value, then save it on a local file or draw it.
- Author:
- Hydrolien
-
Field Summary
-
Constructor Summary
ConstructorDescriptionImg(int width, int height)
Constructs a new grey 50% alpha Img whose width and height are specified by the arguments of the same name.Img(BufferedImage i)
Constructs a new Img with a BufferedImage.Constructs a new Img with a fileName. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Use to refresh the BufferedImage before draw it or save it.void
Add an Img on this.void
afficher()
void
Print the ARGB level.void
changerAlpha(int x)
Add x in alpha (non-transparency) to the all image.void
changerPixel(Pixel a, Pixel b)
Replace pixel a by pixel b.void
Replace max alpha pixel by an other color.clone()
Make a copie of the Img.int[]
get how much line are composed of transparents pixels.Count how much of eatch pixel there is on the image.void
Count how much of eatch pixel there is on the image and create a .html page to store the data.int[]
Make an array with all alpha value for all pixel of the Img.int[]
Make an array with all blue value for all pixel of the Img.int[]
Make an array with all red value for all pixel of the Img.int[]
Make an array with all green value for all pixel of the Img.int
compterPixel(Pixel a)
Count how much pixel there is on the image.void
dessiner()
void
draw()
draw the Img.boolean
Standard equals function.byte[][]
getA()
byte
getA(int i, int j)
byte[][]
getAlpha()
byte[][]
getB()
byte
getB(int i, int j)
getBi()
byte[][]
getBleu()
byte[][]
getG()
byte
getG(int i, int j)
byte[][]
getGray()
int
getImage()
int
getNbrDePixel(Pixel a)
int
getNbrDePixel(Pixel a, int x)
getPixel(int i, int j)
byte[][]
getR()
byte
getR(int i, int j)
getResultAsHtmlDiv(String sr)
byte[][]
getRouge()
byte[][]
getVert()
int
getWidth()
boolean
iniWH()
Initialize width & height.void
void
draw a shadow on the border of a colored zone as ant alitrunk.void
rogner(int a, int b, int c, int d)
trim the Img.void
trim the Img to cut transparent border.void
sauvegarde(String s)
void
sauvegarder(String nom)
void
sauvegarder(String rep, String filename)
save the Img as a .png image with a correct name.void
try to save the Img.void
setA(int i, int j, byte x)
void
setAlpha()
void
setAlpha(byte[][] x)
void
setAlpha(int i, int j, byte x)
void
setARVB(int i, int j, byte x)
void
setARVB(int i, int j, int x)
void
setB(int i, int j, byte x)
void
setBleu()
void
setBleu(byte[][] x)
void
setBleu(int i, int j, byte x)
void
setG(int i, int j, byte x)
void
setR(int i, int j, byte x)
void
setRouge()
void
setRouge(byte[][] x)
void
setRouge(int i, int j, byte x)
void
setVert()
void
setVert(byte[][] x)
void
setVert(int i, int j, byte x)
void
void
supprimerLaTransparencePartielle(int x)
Replace all non 100% or 0% transparent pixel by a 100% or a 0% transparent pixel.void
tourner()
void
tourner(byte x)
rotate the Img.void
tourner(int x)
-
Field Details
-
rand
-
bi
-
width
private int width -
height
private int height -
rouge
private byte[][] rouge -
vert
private byte[][] vert -
bleu
private byte[][] bleu -
alpha
private byte[][] alpha
-
-
Constructor Details
-
Img
Constructs a new Img with a BufferedImage. -
Img
Constructs a new Img with a fileName. -
Img
public Img(int width, int height)Constructs a new grey 50% alpha Img whose width and height are specified by the arguments of the same name.
-
-
Method Details
-
getBi
-
getImage
-
toBufferedImage
-
getAlpha
public byte[][] getAlpha() -
getA
public byte[][] getA() -
getA
public byte getA(int i, int j) -
setAlpha
public void setAlpha() -
setAlpha
public void setAlpha(int i, int j, byte x) -
setA
public void setA(int i, int j, byte x) -
getRouge
public byte[][] getRouge() -
getR
public byte[][] getR() -
getR
public byte getR(int i, int j) -
setRouge
public void setRouge() -
setRouge
public void setRouge(int i, int j, byte x) -
setR
public void setR(int i, int j, byte x) -
getVert
public byte[][] getVert() -
getG
public byte[][] getG() -
getG
public byte getG(int i, int j) -
setVert
public void setVert() -
setVert
public void setVert(int i, int j, byte x) -
setG
public void setG(int i, int j, byte x) -
getBleu
public byte[][] getBleu() -
getB
public byte[][] getB() -
getB
public byte getB(int i, int j) -
setBleu
public void setBleu() -
setBleu
public void setBleu(int i, int j, byte x) -
setB
public void setB(int i, int j, byte x) -
getGray
public byte[][] getGray() -
setRouge
public void setRouge(byte[][] x) -
setVert
public void setVert(byte[][] x) -
setBleu
public void setBleu(byte[][] x) -
setAlpha
public void setAlpha(byte[][] x) -
getWidth
public int getWidth() -
getHeight
public int getHeight() -
setARVB
public void setARVB(int i, int j, int x) -
setARVB
public void setARVB(int i, int j, byte x) -
getPixel
-
getNbrDePixel
-
getNbrDePixel
-
equals
Standard equals function. Null & other class type proof. -
clone
Make a copie of the Img. -
iniWH
public boolean iniWH()Initialize width & height. -
afficherLesTableaux
public void afficherLesTableaux()Print the ARGB level. -
add
Add an Img on this.
It can be used to make the map image. -
sauvegarder
save the Img as a .png image with a correct name.- Parameters:
rep
- the directory were to save the image.filename
- the name of the Image file. (without .png).
-
sauvegarder
-
sauvegarde
-
save
try to save the Img.- Throws:
IOException
-
draw
public void draw()draw the Img. -
dessiner
public void dessiner() -
afficher
public void afficher() -
compterNiveauDeRouge
public int[] compterNiveauDeRouge()Make an array with all red value for all pixel of the Img. -
compterNiveauDeVert
public int[] compterNiveauDeVert()Make an array with all green value for all pixel of the Img. -
compterNiveauDeBleu
public int[] compterNiveauDeBleu()Make an array with all blue value for all pixel of the Img. -
compterNiveauDeAlpha
public int[] compterNiveauDeAlpha()Make an array with all alpha value for all pixel of the Img. -
compterPixel
Count how much pixel there is on the image. -
compterChaquePixel
Count how much of eatch pixel there is on the image. -
compterChaquePixelToHtml
public void compterChaquePixelToHtml()Count how much of eatch pixel there is on the image and create a .html page to store the data. -
changerPixel
Replace pixel a by pixel b.
On Formiko it is used to create random color for ant and modify the image. -
changerPixelTransparent
Replace max alpha pixel by an other color. -
actualiserImage
public void actualiserImage()Use to refresh the BufferedImage before draw it or save it. -
tourner
public void tourner(byte x)rotate the Img.- Parameters:
x
- How much do we need to rotate : 1=90° 2=180° -1 or 3 = -90°
-
tourner
public void tourner(int x) -
tourner
public void tourner() -
changerAlpha
public void changerAlpha(int x)Add x in alpha (non-transparency) to the all image.
You can remove some alpha with an x<0. -
supprimerLaTransparencePartielle
public void supprimerLaTransparencePartielle(int x)Replace all non 100% or 0% transparent pixel by a 100% or a 0% transparent pixel.
On some image it can have some 99% transparent pixel, we may need to transforme them to 0% transparent pixel. (100 transparent pixel can be recolored more easyly.)- Parameters:
x
- alpha limit level between 0 and 255. If pixel alpha value is higer than x pixel will be at 255 alpha. Other wise it will be at 0 alpha.
-
supprimerLaTransparencePartielle
public void supprimerLaTransparencePartielle() -
ombrer
draw a shadow on the border of a colored zone as ant alitrunk. -
ombrer
-
rogner
public void rogner(int a, int b, int c, int d)trim the Img.- Parameters:
a
- How much do we need to trim in pixel before widthb
- How much do we need to trim in pixel before heightc
- How much do we need to trim in pixel after widthd
- How much do we need to trim in pixel after height
-
rognerBordTransparent
public void rognerBordTransparent()trim the Img to cut transparent border. -
compterBordTransparent
public int[] compterBordTransparent()get how much line are composed of transparents pixels. -
getResultAsHtmlDiv
-