Click here to Skip to main content
15,896,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
DrawImage from byte[] array using GameCanvas, is it possible?
Server sends jpg-image, which stores in byte[] array, how to display it?
I have seen about drawing from int[] array, where each element is RGB color,
by in my case I need to decode image fist.
Please, help.
edit:
	try{
os.write(data);//send request to server
 
Thread.sleep(200);
    while(is.available()==0)//wait
    {
 
    }
slen = 96860;
byte[] img = new byte[96860];
is.read(img, 0, slen);// read image into array
 
      Image image = Image.createImage(img,0,slen);// creating image
g.drawImage(image,        // <== illegal argument exception
        0,
        0,
        100);
}
catch(Exception x){
    System.out.print(x.toString());
}

in Debug i see image size and content, and this method works when use ImageItem and form.append.. , but in Canvas - it not works.
Posted
Updated 11-Sep-10 6:25am
v7
Comments
Sandeep Mewara 11-Sep-10 10:28am    
Question titles are suppose to be short and concise. Body should contain details. Please use it. It's for you only to describe all.

Your problem is with the last argument "100". Read up on anchor points in the JSR-118 documentation. There are only certain values allowed for the anchor argument, and 100 is not one of them. Whatever value you want should be expressed sumbolically, for example Graphics.HCENTER | Graphics.TOP

[Hint: if you want to reply to this, don't post another 'Answer', make a comment to this one. If you like this answer, vote for it and mark it 'accepted'. Thanks.
 
Share this answer
 
<b>sadsadas</b>
<b>sad<b></b>sa</b>
dsa
dsa
dsa
dsa
dsa
dsa
dad
sad
asd
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900