Graphics lib: is it possible to mirror the buffer?

Posted on
  • I bought a cheap RGB123 clone (16x16 WS28xx rgb matrix) and the neopixel lib works with it. My problem is using Graphics lib the display is flipped on this module. I seem to need to mirror the buffer horizontally. I know that Graphics has setRotation to apply rotation before writing to the buffer, is there similar thing for mirroring? Another way could be to clone the buffer and apply matrix transform (is the arrayBuffer a 2D array?) to mirror it and then write the transformed buffer to the LEDs. Thought I'd ask here before researching the buffer transform route...

  • Yes, it should be pretty straightforward. You spotted setRotation, but it's actually got an optional second argument to mirror as well: http://www.espruino.com/Reference#l_Grap­hics_setRotation

    So you can either do setRotation(0,true) to flip one way, or can rotate 180 degrees and mirror with setRotation(2,true) to flip the other :)

  • Got it thanks!

  • Oh great this exactly what i'm looking for.
    Want to display text on display reflected in water...
    Thanks.

    é

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

Graphics lib: is it possible to mirror the buffer?

Posted by Avatar for n00b @n00b

Actions