The28AWG / minijoe

Automatically exported from code.google.com/p/minijoe
1 stars 0 forks source link

Images won't display. #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
  1. Create a new .js file in the "javascript" directory.
  2. Include your .js file in the build script (to compile it) and in MjRuntime.java
  3. After adding the following code, try to run your javascript (using run-runtime):

var canvas = document.getElementById("canvas"); var ctx = canvas.getContext("2d"); var img = new Image(); img.src = 'images/star.png'; ctx.drawImage(img,0,0);

What is the expected output? What do you see instead?

The expected output, is that star.png shows in the upper-lefthand corner of
the canvas.  Instead, I get an exception.  Exception included below.  The
same javascript code works fine in a browser.

What version of the product are you using? On what operating system?

I've checked out the latest from the trunk. I am using windows XP, with WTK 2.5.1.

Please provide any additional information below.

   [wtkrun] java.lang.NullPointerException
   [wtkrun]     at com.google.minijoe.sys.JsFunction.eval(+2248)
   [wtkrun]     at com.google.minijoe.sys.JsFunction.exec(+70)
   [wtkrun]     at com.google.minijoe.samples.runtime.MjRuntime.commandAction(+89)
   [wtkrun]     at javax.microedition.lcdui.List.callKeyPressed(+80)
   [wtkrun]     at javax.microedition.lcdui.Display$DisplayAccessor.keyEvent(+198)
   [wtkrun]     at
javax.microedition.lcdui.Display$DisplayManagerImpl.keyEvent(+11)
   [wtkrun]     at com.sun.midp.lcdui.DefaultEventHandler.keyEvent(+127)
   [wtkrun]     at com.sun.midp.lcdui.AutomatedEventHandler.keyEvent(+210)
   [wtkrun]     at
com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.handleVmEvent(+114)
   [wtkrun]     at
com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+57)
   [wtkrun] com.google.minijoe.sys.JsException: Error at line 3 (pc:0x21):
ReferenceError: java.lang.NullPointerException
   [wtkrun]     at com.google.minijoe.sys.JsFunction.eval(+3009)
   [wtkrun]     at com.google.minijoe.sys.JsFunction.exec(+70)
   [wtkrun]     at com.google.minijoe.samples.runtime.MjRuntime.commandAction(+89)
   [wtkrun]     at javax.microedition.lcdui.List.callKeyPressed(+80)
   [wtkrun]     at javax.microedition.lcdui.Display$DisplayAccessor.keyEvent(+198)
   [wtkrun]     at
javax.microedition.lcdui.Display$DisplayManagerImpl.keyEvent(+11)
   [wtkrun]     at com.sun.midp.lcdui.DefaultEventHandler.keyEvent(+127)
   [wtkrun]     at com.sun.midp.lcdui.AutomatedEventHandler.keyEvent(+210)
   [wtkrun]     at
com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.handleVmEvent(+114)
   [wtkrun]     at
com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+57)

Original issue reported on code.google.com by BusBusBus@gmail.com on 13 Apr 2009 at 4:53

GoogleCodeExporter commented 9 years ago
I was led to believe the platform supports images by the following example:

http://minijoe.com/ota/emulator?sid=9

Original comment by BusBusBus@gmail.com on 13 Apr 2009 at 8:30

GoogleCodeExporter commented 9 years ago
Looking at the code, it looks like image drawing via the canvas is possible but
currently that code is not written and that spot in the code as marked as a 
TODO.
I've started working on that functionality, but my code is not yet working.

Original comment by maksim....@gmail.com on 16 Apr 2009 at 9:43

GoogleCodeExporter commented 9 years ago
The canvas is just included as an example and not part of the core javascript 
engine.

However, supporting images would certainly be nice to have. Let me know if you 
have a
patch. 

Original comment by stefan.haustein on 5 May 2009 at 12:15

GoogleCodeExporter commented 9 years ago
Is this issue is been resolved.I was trying with the code from the SVN and got 
the same above mentioned exception.Have you finished that part of the code or 
if you da have a patch for this than please let me know.

Thanks in advance.

Original comment by bio.af...@gmail.com on 19 Aug 2011 at 3:56