mardi 14 avril 2015

it's possible to use Java.awt.Image android application

I've written a Java methods ,but i have to use this method in android project,so someone can help me to convert it into android or help me what should i do?



public Image getImage(){

ColorModel cm = grayColorModel() ;

if( n == 1){// in case it's a 8 bit/pixel image
return Toolkit.getDefaultToolkit().createImage(new MemoryImageSource(w, h,cm, pixData, 0, w));

}//endif

}

protected ColorModel grayColorModel()
{
byte[] r = new byte[256] ;
for (int i = 0; i <256 ; i++ )
r[i] = (byte)(i & 0xff ) ;
return (new IndexColorModel(8,256,r,r,r));
}

Aucun commentaire:

Enregistrer un commentaire