Next Previous Contents

7. picoTK driver API

picoTK is split into two parts. Firstly a generic part, which contains the hardware independent code. Currently the generic part is fully contained in the file PTK_generic.. Secondly the driver part, which adapts picoTK to a specific hardware platform. Three drivers are furnished with picoTK for 1, 4 and 8 bit color depth respectively - they are contained in the files PTK_driver_1bpp.c, PTK_driver_4bpp.c and PTK_driver_8bpp.c respectively. They are alternatively linked together with the generic part to form the picoTK library. That is a change of the color depth yields a different picoTK library. Some of the functions in the driver are non trivial - like the text draw functions - while others are. The implementation is not yet fully optimized for speed. At present the 1 bit per pixel implementation is best optimized. The following describes the picoTK driver API functions.

7.1 Drawing functions

    void picoDriverInit(void)
    void picoDrawPointRaw(int x, int y, int color)
    void picoFillRectRaw(int x, int y, int w, int h, int color)
    void picoReverseRectRaw(int x, int y, int w, int h)
    int  picoDrawTextRaw(int x, int y, char *txt,
                         struct picoFont *font, int fgc, int bgc)
    int  picoDrawPixmapRaw(int x, int y, 
                           struct picoPixmap *pm, int fgc, int bgc)
    int  picoScrollRaw(int x, int y, int w, int h, int delta, int bgc)

picoDriverInit() Initializes the hardware, which is basically the clearing of the framebuffer. If your system requires intialization of a CRTC this has to been done here as well. When using RTEMS with the pc_386_lilo package the VGA subsystem has already been initialized and clearing the screen is all which has to be done. (Actually the PC's BIOS has already done the clearing of the screen on its own).

picoDrawPoint() This function draws a single point. It shall be optimized for speed as it is called for the line drawing and rectangle drawing functions as well.

picoFillRectRaw() Fills a rectangle window of the given size at the given origin with the specified color.

picoReverseRectRaw() Reverses a rectangle of the given size at the given origin. Every pixel value within this rectangle is inverted bitwise.

picoDrawTextRaw() Draws text. As opposed to the high-level routine picoDrawText() it does not do processing of non printables like linebreaks. This function is relatively time consuming. As it generally has to shift any byte from the font data to fit at the correct screen position. The 1 bit per pixel driver has an optimization for 8 pixel wide monospaced fonts on modulo 8 x position boundaries.

picoDrawPixmapRaw() Copies a picoTK pixmap to the screen. Currently only 1 bit color depth pixmaps are supported. With the 4 and 8 bit color depth drivers the pixmap is mapped to the screen by using the foreground and background colors for pixmap color values of 0 and 1 respectively.

picoScrollRaw() Horizontally scrolls the screen up or down by delta lines. Positive values of delta scroll down, negative scroll up.

7.2 Info functions

    int picoInfoSizeX(void); 
    int picoInfoSizeY(void);
    int picoInfoColorDepth(void);
picoInfoSizeX() and picoInfoSizeY() return the number of displayed pixels in X and Y direction respectively.

picoInfoColorDepth() return the number of bits per pixel. Values of 1, 4 or 8 mean 2, 16 or 256 simultaneously displayable colors. Color values range from 0 to 1, 15 and 255 respectively.


Next Previous Contents