drawString uses graphicsFillRect because bitmap fonts can be 'scaled' - you can have a bitmap font scaled up by 4x in which case each 'pixel' is a 4x4 rect.
For drawing pixel by pixel, setPixel is the way to go.
However what device are you using InlineC on? For instance on Bangle.js it can make a lot of sense to have an offscreen buffer and to use Inline C to write direct into that buffer, and then use g.drawImage to draw that to the screen (drawImage has a special fast path for blits)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
drawString
usesgraphicsFillRect
because bitmap fonts can be 'scaled' - you can have a bitmap font scaled up by 4x in which case each 'pixel' is a 4x4 rect.For drawing pixel by pixel,
setPixel
is the way to go.However what device are you using InlineC on? For instance on Bangle.js it can make a lot of sense to have an offscreen buffer and to use Inline C to write direct into that buffer, and then use
g.drawImage
to draw that to the screen (drawImage has a special fast path for blits)There's an example of that at https://github.com/espruino/BangleApps/blob/master/apps/geissclk/clock.js