You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • In recent builds I have added a function called drawImages which allows you to draw multiple 'layers' at once, at different scales and rotations: https://github.com/espruino/Espruino/blob/feb45fe7378010be74e8952e087d23950dac050f/libs/graphics/jswrap_graphics.c#L2234

    It should go a long way towards making this much easier.

    Right now, the 'Image Clock' app exists which does a fullscreen background: https://github.com/espruino/BangleApps/blob/master/apps/imgclock/app.js

    And that works with a digital clock by just copying the area of the image where the clock is to an image stored in flash (The new drawImages would be a better way to handle that though).

    In terms of update speed, it's a mix of things -the default path for rendering has to deal with multiple BPP, screen rotation, etc so has a lot of overhead. New firmwares are a lot faster though as there's a 'fast path' for common operations.

    In terms of an analog clock - I'd suggest using drawImages. For example:

    var cg = Graphics.createArrayBuffer(16,200,1,{msb:true});
    var cgimg = {width:cg.getWidth(),height:cg.getHeight(),bpp:1,transparent:0,buffer:cg.buffer};
    cg.fillPoly([8,0, 16,100, 8,110, 0,100]);
    g.clear(1);
    g.drawImages([
      {image:img,x:0,y:24,scale:4},
      {image:cgimg,x:120,y:120,center:true,rotate:0.1},
      {image:cgimg,x:120,y:120,center:true,scale:0.7,rotate:1.1},
    ],{})
    

    Potentially you could even use a bounding box to redraw only what had changed... For hour/minute drawImages will be fine, but for second hand you may notice some lag from the redraw if you don't attempt to do something to restrict how much gets drawn.

About

Avatar for Gordon @Gordon started