How to display image after using setRGB(x,y,0) in Java? -


for(int x=0;x<20;x++) {     for(int y=0;y<20;y++)     {        img.setrgb(x, y,0);     } } 

i'm trying convert pixels in 20*20 region black colour. not working above code. need add more?

try this

int rgb=new color(0,0,0).getrgb(); // believe rgb black 0,0,0 cross check   for(int x=0;x<20;x++){  for(int y=0;y<20;y++){                img.setrgb(x, y,rgb);                }          } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -