Giter Club home page Giter Club logo

fbutils's Introduction

Framebuffer Graphics

Write directly to the linux framebuffer. I use this from Raspbian Lite on multiple Raspberry Pi devices for displaying monitoring dashboards with pre-rendered graphs from AWS CloudWatch.

Note: you may need/want to usermod your current user to add it into the video group like so, to avoid needing to use sudo to run each of these commands. The ttymode command still requires sudo, however:

sudo usermod -G video $(whoami)

Dependencies

Install libpng-dev and libjpeg-dev if you are using the PNG or JPEG functions. make is required to build.

sudo apt-get install libpng-dev libjpeg-dev make

Building

make

Usage

  • fb-describe

    • outputs the device name, as well as dimensions. this can be used by drawing scripts to calculate sizes.
    • example:
    $ fb-describe
    /dev/fb0 1280 800
  • fb-clear

    • clears the /dev/fb0 framebuffer
    • options:
      • -g (optional) - grayscale value from 0 (black) to 255 (white)
        • example: fb-clear -g 255
  • fb-ttymode

    • sets the mode of the tty for graphics or text use
    • example:
    $ fb-ttymode graphics # (this will cause text to not work, so run over ssh!)
    $ fb-ttymode text
  • fb-pngdraw / fb-jpgdraw / fb-svgdraw

    • draws an image to the framebuffer
    • options:
      • -f - path to the image file to draw.
      • -x (optional) default: 0 - the x position to draw
      • -y (optional) default: 0 - the y position to draw
      • -w (optional) default: display width - the width of the image
      • -h (optional) default: display height - the height of the image
      • -hue [mask] (optional) default: disabled - apply a hue-shift to the image, in the red, green, blue, cyan, yellow, magenta, or white hue. Valid characters in mask string are "rgbcymw".
      • -hue-threshold (optional) default: 20 - when applying a hue shift, pixels with RGB values abs. differences less than this are ignored.
      • -invert (optional) default: disabled - apply a 255 - x transform to all pixels in the image, inverting it.
      • -grayscale (optional) default: disabled - shortcut for the options -hue w -hue-threshold 0
    • example:
    $ fb-pngdraw -f foo.png -x 0 -y 0 -w 100 -h 100 -invert
    $ fb-jpgdraw -f foo.jpg -x 0 -y 0 -w 100 -h 100 -hue r

TODO

  • Add text rendering function with freetype
  • Add compositing which allows for multiple draw commands to be rendered to an offscreen buffer, and then rendered
  • Add alpha rendering ability

Licence

MIT

fbutils's People

Contributors

richinfante avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

moneytech

fbutils's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.