•  


GitHub - basvkesteren/fGUI: fGUI, a (Very) simple and lightweight 1-bit-per-pixel graphics library
Skip to content

fGUI, a (Very) simple and lightweight 1-bit-per-pixel graphics library

License

Notifications You must be signed in to change notification settings

basvkesteren/fGUI

Repository files navigation

fGUI

This is fGUI, a (Very) simple and lightweight 1-bit-per-pixel graphics library ('library' is probably a too big word for this..)

fGUI

Functionality

fGUI can: -Turn individual pixels on and off -Draw lines -Draw text (with an included tool to generate fonts) -Draw sprites (with an included tool to generate sprites)

It's purpose is to be a super-simple collection of functions to be used in embedded systems, to drive monochrome displays. It defines a piece of RAM (the framebuffer) and some functions to draw lines, text and whatnot in this framebuffer. A 'refresh' function is used to send this framebuffer to the display. The display-code is (obviously) hardware-dependend. Some display-code is included as an example.

Why

I created fGUI back in 2006 because, well, I wanted to use a graphical LCD on a PICmicro project. Notice how this is from before the 'arduino era' we live in today, u8glib and the likes didn't exist back then.

Current status

Works for me (tm)

How to use

Place the fGUI sources in a subfolder of your project ('fgui' would make sense..), then include something like the following snippet in your Makefile

    # Pick a display (see the hw folder)
    FGUI_DISPLAY = ssd1322
    # Include the fGUI makefile (change subfolder if you didn't pick 'fgui'!)
    include fgui/makefile.inc
    # The makefile has defined FGUI_SRC (the files to compile) and FGUI_DEFINES (defines that must exist during compilation)
    SRC += $(FGUI_SRC)
    DEFINES += $(patsubst %,-D%,$(FGUI_DEFINES))

Include fgui.h and any font/sprite header files you've generated in your code, and define the framebuffer ('unsigned char framebuffer[FGUI_FBSIZE];').

At startup call fgui_init to setup fGUI, call fgui_refresh every time you want to update the display

    #include
 <fgui.h>

    #include
 "font.h"


    ......
    
    
unsigned 
char
 framebuffer
[
FGUI_FBSIZE
];
    
    ......

    
fgui_init
(
framebuffer
);     
/* Initialise screen.. */

    fgui_clear
();               
/* ..clear framebuffer..*/

    fgui_setfont
(
font
);         
/* .. and set font */


    fgui_refresh
();             
/* Update display */

How to get fonts and sprites

In the 'tools' directory you'll find some console tools, all written for GCC on Linux (might work on other platforms too, haven't tried..). All these programs accept 1bpp BMP pictures; the program 'bmpfont' can be used to create fonts, 'bmpsprite' to create sprites. The third program, 'bmpreader', can be used to test the bmp reader code used by the other two programs.

An example sprite is included, the following command will generate a header-file from it:

    ./bmpsprite -i example_sprite.bmp -o example_sprite.h
    File size is 210 bytes, offset to image data 130 bytes
    Image size is 20 x 20, 1 bits/pixel
    Compression 
type
 is 0
    pixeldata is 4 bytes width (12 bits padding), total 80 bytes

Same goes for font-generation:

    ./bmpfont -i example_font.bmp -w 7 -o example_font.h
    File size is 1138 bytes, offset to image data 130 bytes
    Image size is 665 x 12, 1 bits/pixel
    Compression 
type
 is 0
    Character width 7, height 12, spacing 0
    Expect 95 characters 
in
 bitmap, should be 665 pixels width
    pixeldata is 84 bytes width (7 bits padding), total 1008 bytes
    :start at pixel 0, stop at pixel 7
    
    ......

    }:start at pixel 651, stop at pixel 658
    
~
:start at pixel 658, stop at pixel 665

Releases

No releases published

Packages

No packages published

Languages

- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본