• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Images visible

 
Arijit Ghosh
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there any way to hide the images in the jar file just as we obfuscate the class files ?

Regards,
Arijit
 
Michael Yuan
author
Ranch Hand
Posts: 1427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not think you can. But you place the images on a server and use an authentication scheme to protect it. The MIDlet downloads the images at runtime.
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can, you need to write a program to put your images and name/size data into a binary data file and another file to teach your MIDLet how to read them back. Many games on the internet are doing that. If you download one, except a logo, you see no images, but when you play it, all images are showing up.
 
Arijit Ghosh
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael...

Well yes .. I can always do the server stuff but I was hoping that we could hide it when we send it off in JAR file.

Roaseanne.... need a little more clarification.. any sample codes that you can share ?

So basically I need to create 2 more files apart from the standard ones that I create. I also need to modify the MIDlt to read th images.

Some sample code please. Or some link which explains in detail.

Thanks,
Arijit
 
Michael Yuan
author
Ranch Hand
Posts: 1427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Roseanne's idea would work. But you need to know how PNG images files are structured to make it work. The image file is essentially an array of bytes with headers. You can write a program to write all odd numbered items in the array first and then the even numbered items. People will not be able to read your scrambled images but your MIDlet can put the bytes back to their original orders at runtime.
 
Arijit Ghosh
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Michael.. that was helpful..

Regards,
Arijit
 
Arijit Ghosh
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ideally for a commercial product.. will it affect the speed or any other features ?

I will need to unscramble first before I can use the API methods .. right Is it advisable to do that ?


Regards,
Arijit
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you don't have to seperate the even/odd bytes, that would affect the speed. You don't need to know the png file structure either.

You just still use the same InputStream methods to read everything back, the only thing you need to know is where to start read, where to finish. Those are your companies convention, you should not let anyone else to know. For the same reason, I cannot give you sample code.

Be creative, that is it!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic