Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Canvas Conversion

 
Murat Soyupak
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I am developing a software that runs on an MIDP 2.0 compatible phone. In some part of the program, the user draws something on the canvas. What he/she did draw should be sent to some PC over GPRS. I have no problem sending data over GPRS or making the user draw on the canvas. The problem I have is converting what has been drawn on the phone to some image. This image could be any format (png, jpg, etc.) as long as it can be displayed by a web browser, because this image will be accesed by other users via their web browsers. Can anyone help me on converting the drawing on the canvas to some image file? (Conversion can be done either on the phone or on the server side. I have Java programs on the server side. All I need to do is to have something like a byte array which can be converted to an image later) . Thanks in advance....
 
Yuri Magrisso
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this one:


Have in mind that this may take a lot of memory depending on the screen size.
You may need to call several times Image.getRGB(...) and send it in pieces.

May be you could use a simple Run Lenght Encoding to compress the data before you send it.

Yuri
 
Murat Soyupak
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot...
 
Yuri Magrisso
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm glad it helps
 
eddydreamed eddydreamed
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

Can you give the code to inject this code with httpConnection POST ?

Thanks for your help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic