• The following code works fine in the emulator.

    g.drawImage(atob("GBjCAP////+rStqvAAAAAAAAAAAqqAAAAAKv+oAAACtVV+gAAKVVXvoAApVV6/6AAlVXv/+AC1VXv6/gCVVVvu/gKValqnroLt7pfVV4L5vpVVV4LtulVX14LquVX6p4K6+lar5oC//te/tgC//5Xq3gAv/pVdWAAr/tVVaAAK/lVVoAACvlVegAAAKv+oAAAAAqqAAAAAAAAAAA"),40,40);
    
    

    But when I try to load it as a clock face for multiclock it fails.

    (() => {
      
      function getFace(){
        
        function draw() {
          g.reset();      g.drawImage(atob("GBjCAP////+rStqvAAAAAAAAAAAqqAAAAAKv+oAAACtVV+gAAKVVXvoAApVV6/6AAlVXv/+AC1VXv6/gCVVVvu/gKValqnroLt7pfVV4L5vpVVV4LtulVX14LquVX6p4K6+lar5oC//te/tgC//5Xq3gAv/pVdWAAr/tVVaAAK/lVVoAACvlVegAAAKv+oAAAAAqqAAAAAAAAAAA"),40,40);
        }
    
        return {init:draw};
      }
    
      return getFace;
    
    })();
    

    the error message I get is:

    
    Uncaught Error: Expecting first argument to a valid Image
     at line 1 col 251
    ...oAAAAAqqAAAAAAAAAAA"),40,40);
                                  ^
    in function "init" called from line 1 col 52
    ...le.drawWidgets();face.init();intervalRefSec=setInterval(face...
                                  ^
    in function "startdraw" called from line 1 col 102
    ...e=FACES[iface]();startdraw();
                                  ^
    in function called from system
    > 
    

    Any ideas what I am doing wrong ?

  • Ahh - it seems you might be using a 2 bit binary image with the palette included? I added the ability to do binary images with a palette reasonably recently (after the 2v08 firmware). If you install a 'cutting edge' firmware then you should get the ability to use them just fine - I'll do a 2v09 release soon anyway.

    Either that or going for 'image object' should work on 2v08. The downside there is you can't then store the images easily in flash - they just have to be part of your program code.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

image works fine in emulator throws exception on the watch

Posted by Avatar for HughB @HughB

Actions