Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Loading image in Canvas (Urgent)  RSS feed

 
Jonathas Carrijo
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to load an image and show it in a Canvas. I used the default toolkit's getImage() to load it, used a MediaTracker to, of course, track it, and it showed me that I got an error loading the image... Why?? Please... I need it working tomorrow. Look at the (sample) code:

Debug 1 prints out:
File exists: true
Debug 2 doesn't print
Debug 3 prinst out:
Error loading: true
Debug 4 prints:
drawImage: false
drawImage: false
drawImage: false
drawImage: false
drawImage: false
drawImage: false
drawImage: false
and so on...
Anybody can tell me what could be wrong since I get an error loading the image, and the image is actually at c:\juba\used.bmp... (debug one shows that)
Thanx in advance
Juba d-_-b
 
Rene Liebmann
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think, the problem is the bmp image. Have you ever tried to load a gif or jpg image? This should work. If you want to use bmp, then you have to use JAI - Java Advanced Imaging.
 
Jonathas Carrijo
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I love you! You saved my life... my future!!
Thank u so much
Juba d-_-b
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!