mardi 31 mars 2015

Change bufferedImage pixels in java

I have a small problem. I have a BufferedImage which has pixels that have an RGB value. This code is used to create an RGB value from de R, G, B, A values.



private int getRGB(int r, int g, int b, int a){
return (a << 24) | (r << 16) | (g << 8) | b;
}


The first question is, how can i get the R, G, B, A values from a Pixel, because the pixel RGB will return the number that is generated by the code above.


And if I have those values, can I put 2 pixels on top of each other so it calculates the new values or do I have to do that by manual? With automatic calculation you can think of Java 2D when you put 2 transport things on top it will merge the colors.


Thank you very much.


Aucun commentaire:

Enregistrer un commentaire