EFM32 Giant Gecko Software Documentation  efm32gg-doc-5.1.2
glib.h File Reference

Detailed Description

Silicon Labs Graphics Library.

License

Copyright 2015 Silicon Labs, http://www.silabs.com

This file is licensensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.

Definition in file glib.h.

#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include "glib_color.h"
#include "dmd/dmd.h"
#include "em_types.h"

Go to the source code of this file.

Data Structures

struct  __GLIB_Context_t
 GLIB Drawing Context (Multiple instances of GLIB_Context_t can exist) More...
 
struct  __GLIB_Font_t
 Font definition structure. More...
 
struct  __GLIB_Rectangle_t
 Rectangle structure. More...
 

Macros

#define ECODE_GLIB_BASE   0x00000000
 
#define GLIB_ERROR_FILE_NOT_SUPPORTED   (ECODE_GLIB_BASE | 0x0007)
 
#define GLIB_ERROR_INVALID_ARGUMENT   (ECODE_GLIB_BASE | 0x0005)
 
#define GLIB_ERROR_INVALID_CHAR   (ECODE_GLIB_BASE | 0x0002)
 
#define GLIB_ERROR_INVALID_CLIPPINGREGION   (ECODE_GLIB_BASE | 0x0004)
 
#define GLIB_ERROR_INVALID_FILE   (ECODE_GLIB_BASE | 0x0009)
 
#define GLIB_ERROR_IO   (ECODE_GLIB_BASE | 0x0008)
 
#define GLIB_ERROR_NOTHING_TO_DRAW   (ECODE_GLIB_BASE | 0x0001)
 
#define GLIB_ERROR_OUT_OF_MEMORY   (ECODE_GLIB_BASE | 0x0006)
 
#define GLIB_OK   0x00000000
 
#define GLIB_OUT_OF_BOUNDS   (ECODE_GLIB_BASE | 0x0003)
 

Typedefs

typedef struct __GLIB_Context_t GLIB_Context_t
 GLIB Drawing Context (Multiple instances of GLIB_Context_t can exist)
 
typedef enum __GLIB_Font_Class GLIB_Font_Class
 Font classes.
 
typedef struct __GLIB_Font_t GLIB_Font_t
 Font definition structure.
 
typedef struct __GLIB_Rectangle_t GLIB_Rectangle_t
 Rectangle structure.
 

Enumerations

enum  __GLIB_Font_Class {
  InvalidFont = 0,
  FullFont,
  NumbersOnlyFont
}
 Font classes. More...
 

Functions

EMSTATUS GLIB_applyClippingRegion (const GLIB_Context_t *pContext)
 Apply the clipping region from the GLIB_Context_t in the DMD driver. More...
 
EMSTATUS GLIB_clear (GLIB_Context_t *pContext)
 Clears the display with the background color of the GLIB_Context_t. More...
 
EMSTATUS GLIB_clearRegion (const GLIB_Context_t *pContext)
 Clears the clipping region by filling it with the background color of the GLIB_Context_t. More...
 
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. More...
 
EMSTATUS GLIB_contextInit (GLIB_Context_t *pContext)
 Initialize the GLIB_Context_t. More...
 
EMSTATUS GLIB_displaySleep (void)
 Sets the display in sleep mode. More...
 
EMSTATUS GLIB_displayWakeUp (void)
 Returns the display from sleep mode. More...
 
EMSTATUS GLIB_drawBitmap (GLIB_Context_t *pContext, int32_t x, int32_t y, uint32_t width, uint32_t height, const uint8_t *picData)
 Draws a bitmap. More...
 
EMSTATUS GLIB_drawChar (GLIB_Context_t *pContext, char myChar, int32_t x, int32_t y, bool opaque)
 Draws a char using the font supplied with the library. More...
 
EMSTATUS GLIB_drawCircle (GLIB_Context_t *pContext, int32_t x, int32_t y, uint32_t radius)
 Draws a circle with center at x, y, and a radius. More...
 
EMSTATUS GLIB_drawCircleFilled (GLIB_Context_t *pContext, int32_t x, int32_t y, uint32_t radius)
 Draws a filled circle with center at x, y, and a radius. More...
 
EMSTATUS GLIB_drawLine (GLIB_Context_t *pContext, int32_t x1, int32_t y1, int32_t x2, int32_t y2)
 Draws a line from x1,y1 to x2, y2. More...
 
EMSTATUS GLIB_drawLineH (GLIB_Context_t *pContext, int32_t x1, int32_t y1, int32_t x2)
 Draws a horizontal line from x1, y1 to x2, y2. More...
 
EMSTATUS GLIB_drawLineV (GLIB_Context_t *pContext, int32_t x1, int32_t y1, int32_t y2)
 Draws a vertical line from x1, y1 to x1, y2. More...
 
EMSTATUS GLIB_drawPartialCircle (GLIB_Context_t *pContext, int32_t xCenter, int32_t yCenter, uint32_t radius, uint8_t bitMask)
 Draws a partial circle with center at x, y, and a radius. More...
 
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. More...
 
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. More...
 
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. More...
 
EMSTATUS GLIB_drawPolygon (GLIB_Context_t *pContext, uint32_t numPoints, const int32_t *polyPoints)
 Draws a polygon using Bresnham's Midpoint Line Algorithm. More...
 
EMSTATUS GLIB_drawRect (GLIB_Context_t *pContext, const GLIB_Rectangle_t *pRect)
 Draws a rectangle outline defined by the passed in rectangle. More...
 
EMSTATUS GLIB_drawRectFilled (GLIB_Context_t *pContext, const GLIB_Rectangle_t *pRect)
 Draws a filled rectangle defined by the passed in rectangle. The filled rectangle is drawn from (xMin, yMin) to (xMax, yMax), inclusive, of the rectangle passed in. More...
 
EMSTATUS GLIB_drawString (GLIB_Context_t *pContext, const char *pString, uint32_t sLength, int32_t x0, int32_t y0, bool opaque)
 Draws a string using the font supplied with the library. More...
 
void GLIB_normalizeRect (GLIB_Rectangle_t *pRect)
 Normalize the rectangle that is passed in. Sets yMin to the minimum value of yMin and yMax. Sets yMax to the maximum value of yMin and yMax. And the same for xMin and xMax. More...
 
bool GLIB_rectContainsPoint (const GLIB_Rectangle_t *pRect, int32_t xCenter, int32_t yCenter)
 Checks if the point passed in is in the interior of the rectangle passed in. More...
 
EMSTATUS GLIB_resetClippingRegion (GLIB_Context_t *pContext)
 Reset the GLIB_Context_t clipping region to the whole display. More...
 
EMSTATUS GLIB_resetDisplayClippingArea (GLIB_Context_t *pContext)
 Reset the display driver clipping area to the whole display. More...
 
uint32_t GLIB_rgbColor (uint8_t red, uint8_t green, uint8_t blue)
 Convert 3 uint8_t color components into a 24-bit color. More...
 
EMSTATUS GLIB_setClippingRegion (GLIB_Context_t *pContext, const GLIB_Rectangle_t *pRect)
 Sets the clippingRegion of the passed in GLIB_Context_t. More...
 
EMSTATUS GLIB_setFont (GLIB_Context_t *pContext, GLIB_Font_t *pFont)
 Set new font for the library. Note that GLIB defines a default font in glib.c. Redefine GLIB_DEFAULT_FONT to change the default font. More...
 

Variables

const GLIB_Font_t GLIB_FontNarrow6x8
 Narrow 6x8 pixels font containing characters and numbers.
 
const GLIB_Font_t GLIB_FontNormal8x8
 Normal 8x8 pixels font containing characters and numbers.
 
const GLIB_Font_t GLIB_FontNumber16x20
 Large 16x20 pixels font containing only numbers.