glib.c File Reference

Silicon Labs Graphics Library: General Routines.


Copyright 2018 Silicon Laboratories Inc.

The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.

Definition in file glib.c.

#include <stdint.h>
#include "em_types.h"
#include "em_device.h"
#include "glib.h"


#define GLIB_DEFAULT_FONT   ((GLIB_Font_t *)&GLIB_FontNormal8x8)


EMSTATUS GLIB_applyClippingRegion (const GLIB_Context_t *pContext)
 Apply the clipping region from the GLIB_Context_t in the DMD driver.
EMSTATUS GLIB_clear (GLIB_Context_t *pContext)
 Clears the display with the background color of the GLIB_Context_t.
EMSTATUS GLIB_clearRegion (const GLIB_Context_t *pContext)
 Clears the clipping region by filling it with the background color of the GLIB_Context_t.
void GLIB_colorTranslate24bpp (uint32_t color, uint8_t *red, uint8_t *green, uint8_t *blue)
 Extracts the color components from the 32-bit color passed and puts them in the passed in 8-bits ints. The color is 24-bit RGB.
EMSTATUS GLIB_contextInit (GLIB_Context_t *pContext)
 Initialize the GLIB_Context_t.
EMSTATUS GLIB_displaySleep ()
 Sets the display in sleep mode.
EMSTATUS GLIB_displayWakeUp ()
 Returns the display from sleep mode.
EMSTATUS GLIB_drawPixel (GLIB_Context_t *pContext, int32_t x, int32_t y)
 Draws a pixel at x, y using foregroundColor defined in the GLIB_Context_t.
EMSTATUS GLIB_drawPixelColor (GLIB_Context_t *pContext, int32_t x, int32_t y, uint32_t color)
 Draws a pixel at x, y using the color parameter.
EMSTATUS GLIB_drawPixelRGB (GLIB_Context_t *pContext, int32_t x, int32_t y, uint8_t red, uint8_t green, uint8_t blue)
 Draws a pixel at x, y with color defined by red, green and blue 1 byte per channel.
EMSTATUS GLIB_resetClippingRegion (GLIB_Context_t *pContext)
 Reset the GLIB_Context_t clipping region to the whole display.
EMSTATUS GLIB_resetDisplayClippingArea (GLIB_Context_t *pContext)
 Reset the display driver clipping area to the whole display.
uint32_t GLIB_rgbColor (uint8_t red, uint8_t green, uint8_t blue)
 Convert 3 uint8_t color components into a 24-bit color.
EMSTATUS GLIB_setClippingRegion (GLIB_Context_t *pContext, const GLIB_Rectangle_t *pRect)
 Sets the clippingRegion of the passed in GLIB_Context_t.

Macro Definition Documentation

#define GLIB_DEFAULT_FONT   ((GLIB_Font_t *)&GLIB_FontNormal8x8)

Define the default font. An application can override the default font by defining GLIB_NO_DEFAULT_FONT and by providing a custom GLIB_DEFAULT_FONT macro that points to a GLIB_Font_t structure that should be used as a default font.

Definition at line 33 of file glib.c.

Referenced by GLIB_contextInit().