You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Hi - right now I think that's your only option. The code itself isn't that bad though. For example:

    var gr = Graphics.createArrayBuffer(24,16,1,{msb:­true});
    var grimg = gr.asImage();
    grimg.transparent = 0;
    
    g.clear();
    for (var i=1;i<=12;i++) {
      var ang = Math.PI*i/6;
      gr.clear().setFont("6x8:2").setFontAlign­(0,0).drawString(i,12,8);
      
      g.drawImage(grimg,
        88+Math.sin(ang)*70,
        88-Math.cos(ang)*70,
                  {rotate:ang});
    }
    

    Actually just drawing a bitmap font at an angle is kind of painful to do, so I don't think modifying Espruino would be significantly better that what's done here. There are other possibilities:

    • Vector fonts could be rendered at an angle - but again it requires Espruino mods and vector fonts don't look good small
    • You could store each of the 10 digits as a polyline, and could then use g.transFormVertices and g.drawPoly to draw the lines at the correct angle...

    1 Attachment

    • clock-rotate.png
About

Avatar for Gordon @Gordon started