Browse Source

Adding QImage display driver

remotes/origin_old/ugfx_release_2.6
Joel Bodenmann 5 years ago
parent
commit
038a1f3630
  1. 1
      docs/releases.txt
  2. 2
      drivers/gdisp/QImage/driver.mk
  3. 21
      drivers/gdisp/QImage/gdisp_lld_config.h
  4. 64
      drivers/gdisp/QImage/gdisp_lld_driver.c
  5. 38
      drivers/gdisp/QImage/gdisp_lld_qimage.cpp
  6. 15
      drivers/gdisp/QImage/gdisp_lld_qimage.h
  7. 1
      drivers/gdisp/readme.txt

1
docs/releases.txt

@ -10,6 +10,7 @@ FIX: Fixing issue in STM32F746G-Discovery board file that resulted in bad color
FEATURE: Added gwinPrintg()
FIX: Fix sprintg and related functions handling of NULL pointers.
FIX: Fixing width calculation of gdispGDrawString() and gdispGFillString().
FEATURE: Added QImage display driver.
*** Release 2.5 ***

2
drivers/gdisp/QImage/driver.mk

@ -0,0 +1,2 @@
GFXINC += $(GFXLIB)/drivers/gdisp/QImage
GFXSRC += $(GFXLIB)/drivers/gdisp/QImage/gdisp_lld_QImage.c

21
drivers/gdisp/QImage/gdisp_lld_config.h

@ -0,0 +1,21 @@
/*
* This file is subject to the terms of the GFX License. If a copy of
* the license was not distributed with this file, you can obtain one at:
*
* http://ugfx.org/license.html
*/
#pragma once
#if GFX_USE_GDISP
/*===========================================================================*/
/* Driver hardware support. */
/*===========================================================================*/
#define GDISP_HARDWARE_DRAWPIXEL TRUE
#define GDISP_HARDWARE_PIXELREAD TRUE
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
#endif /* GFX_USE_GDISP */

64
drivers/gdisp/QImage/gdisp_lld_driver.c

@ -0,0 +1,64 @@
/*b
* This file is subject to the terms of the GFX License. If a copy of
* the license was not distributed with this file, you can obtain one at:
*
* http://ugfx.org/license.html
*/
#include "../../../gfx.h"
#if GFX_USE_GDISP
#define GDISP_DRIVER_VMT GDISPVMT_QImage
#include "gdisp_lld_config.h"
#include "../../../src/gdisp/gdisp_driver.h"
#include "gdisp_lld_qimage.h"
#ifndef GDISP_SCREEN_HEIGHT
#define GDISP_SCREEN_HEIGHT 512
#endif
#ifndef GDISP_SCREEN_WIDTH
#define GDISP_SCREEN_WIDTH 512
#endif
#ifndef GDISP_INITIAL_CONTRAST
#define GDISP_INITIAL_CONTRAST 50
#endif
#ifndef GDISP_INITIAL_BACKLIGHT
#define GDISP_INITIAL_BACKLIGHT 100
#endif
LLDSPEC bool_t gdisp_lld_init(GDisplay *g)
{
/* No board interface and no private driver area */
g->priv = g->board = 0;
if (!qimage_init(g, GDISP_SCREEN_WIDTH, GDISP_SCREEN_HEIGHT)) {
return FALSE;
}
/* Initialise the GDISP structure */
g->g.Width = GDISP_SCREEN_WIDTH;
g->g.Height = GDISP_SCREEN_HEIGHT;
g->g.Orientation = GDISP_ROTATE_0;
g->g.Powermode = powerOn;
g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
g->g.Contrast = GDISP_INITIAL_CONTRAST;
return TRUE;
}
#if GDISP_HARDWARE_DRAWPIXEL
void gdisp_lld_draw_pixel(GDisplay *g)
{
qimage_setPixel(g);
}
#endif
#if GDISP_HARDWARE_PIXELREAD
color_t gdisp_lld_get_pixel_color(GDisplay *g)
{
return qimage_getPixel(g);
}
#endif
#endif /* GFX_USE_GDISP */

38
drivers/gdisp/QImage/gdisp_lld_qimage.cpp

@ -0,0 +1,38 @@
#include <QImage>
#include "../../../gfx.h"
#include "../../../src/gdisp/gdisp_driver.h"
#include "gdisp_lld_qimage.h"
bool_t qimage_init(GDisplay* g, coord_t width, coord_t height)
{
QImage* qimage = new QImage(width, height, QImage::Format_RGB888);
if (!qimage) {
return FALSE;
}
qimage->fill(Qt::gray);
g->priv = qimage;
return TRUE;
}
void qimage_setPixel(GDisplay* g)
{
QImage* qimage = static_cast<QImage*>(g->priv);
if (!qimage) {
return;
}
QRgb rgbVal = qRgb(RED_OF(g->p.color), GREEN_OF(g->p.color), BLUE_OF(g->p.color));
qimage->setPixel(g->p.x, g->p.y, rgbVal);
}
color_t qimage_getPixel(GDisplay* g)
{
const QImage* qimage = static_cast<const QImage*>(g->priv);
if (!qimage) {
return 0;
}
return static_cast<color_t>(qimage->pixel(g->p.x, g->p.y));
}

15
drivers/gdisp/QImage/gdisp_lld_qimage.h

@ -0,0 +1,15 @@
#pragma once
#include "../../../gfx.h"
#ifdef __cplusplus
extern "C" {
#endif
bool_t qimage_init(GDisplay* g, coord_t width, coord_t height);
void qimage_setPixel(GDisplay* g);
color_t qimage_getPixel(GDisplay* g);
#ifdef __cplusplus
}
#endif

1
drivers/gdisp/readme.txt

@ -29,6 +29,7 @@ ST7565 - Small monochrome LCD
STM32LTDC - STM32 ART graphics STM32F4 and STM32F7 series CPU's
TestStub - NULL driver just to test compile
TLS8204 - Small monochrome LCD
QImage - Driver that allows rendering into a QImage object (of the Qt framework)
uGFXnet - Remote Network display (in drivers/multiple/uGFXnet directory)
Win32 - Microsoft Windows (in drivers/multiple/Win32 directory)
X - X Windows (Xlib) (in drivers/multiple/X directory)
Loading…
Cancel
Save