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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionImg(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 TypeMethodDescriptionvoidUse to refresh the BufferedImage before draw it or save it.voidAdd an Img on this.voidafficher()voidPrint the ARGB level.voidchangerAlpha(int x)Add x in alpha (non-transparency) to the all image.voidchangerPixel(Pixel a, Pixel b)Replace pixel a by pixel b.voidReplace 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.voidCount 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.intcompterPixel(Pixel a)Count how much pixel there is on the image.voiddessiner()voiddraw()draw the Img.booleanStandard equals function.byte[][]getA()bytegetA(int i, int j)byte[][]getAlpha()byte[][]getB()bytegetB(int i, int j)getBi()byte[][]getBleu()byte[][]getG()bytegetG(int i, int j)byte[][]getGray()intgetImage()intgetNbrDePixel(Pixel a)intgetNbrDePixel(Pixel a, int x)getPixel(int i, int j)byte[][]getR()bytegetR(int i, int j)getResultAsHtmlDiv(String sr)byte[][]getRouge()byte[][]getVert()intgetWidth()booleaniniWH()Initialize width & height.voidvoiddraw a shadow on the border of a colored zone as ant alitrunk.voidrogner(int a, int b, int c, int d)trim the Img.voidtrim the Img to cut transparent border.voidsauvegarde(String s)voidsauvegarder(String nom)voidsauvegarder(String rep, String filename)save the Img as a .png image with a correct name.voidtry to save the Img.voidsetA(int i, int j, byte x)voidsetAlpha()voidsetAlpha(byte[][] x)voidsetAlpha(int i, int j, byte x)voidsetARVB(int i, int j, byte x)voidsetARVB(int i, int j, int x)voidsetB(int i, int j, byte x)voidsetBleu()voidsetBleu(byte[][] x)voidsetBleu(int i, int j, byte x)voidsetG(int i, int j, byte x)voidsetR(int i, int j, byte x)voidsetRouge()voidsetRouge(byte[][] x)voidsetRouge(int i, int j, byte x)voidsetVert()voidsetVert(byte[][] x)voidsetVert(int i, int j, byte x)voidvoidsupprimerLaTransparencePartielle(int x)Replace all non 100% or 0% transparent pixel by a 100% or a 0% transparent pixel.voidtourner()voidtourner(byte x)rotate the Img.voidtourner(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
-