Git Product home page Git Product logo

hagl's Issues

Input API?

Abstracting the way input is handled within the Backend will mean an easy way to implement different HAGL applications and allow running able them across different backends.

Is this something that you've been considering? Maybe like a keystate() or input() callback or something to set the input state across input devices.

Overflow bug in hagl_scale_blit

If the source bitmap has more than 256 pixels, the scaling produces a wrong result due to a bad cast:

color = ptr[(uint8_t)((py * source->width) + px)];

Should be:

color = ptr[(py * source->width) + px];

Big stack allocations

The library has "no dynamic allocations" but that's at the expense of large structures allocated on the stack. E.g. here and here. (I'm not even sure how the latter one works under ESP-IDF with its default stack size of ~3K for the main thread.)

Further, the HAGL_CHAR_BUFFER_SIZE calculation might have a bug as you are dividing the DISPLAY_DEPTH by 2, while I believe it should be by 8?

Support for getScreen?

Feature Request

In addition to getPixel would it be significant effort to have a getScreen or 'dumpScreenToImage`, write to SD

Use Case

I would like to be able to capture the screen, dump it to SD so I can draw it later

[Low prio] Offscreen drawing in a bitmap

Given that HAGL is essentially a software rasterizer (with an option to delegate a few things to the HAL below), I'm a bit surprised that bitmap_t is missing all the draw* and fill* methods that you've done for the "main" HAGL surface. The only difference between the bitmap variants and the regular ones is that in the bitmap variants you need a bitmap version of hagl_get_pixel and hagl_put_pixel. Which would be good to have anyway.

Treating bitmap_t as a valid offscreen drawing surface might allow you to fold back into the main HAGL project the "double" and "triple" buffering complexity, which (IMO) would reduce the complexity of the "driver" code.

hagl_put_char / hagl_put_text always drawn on black background

Offending line:
https://github.com/tuupola/hagl/blob/master/src/hagl.c#L364

The easiest fix would be for hagl_put_text / hagl_put_char to take a second color parameter which would represent the "background" color in the rasterized bitmap.

A completely different approach would be for HAGL to be reworked to have a notion of "state", which would include the current foreground color (used by draw* and text functions), current background color (used by fill* and text functions) and current font (used by text functions).

But that might be too big of a change.

Full list of supported displays/chips

Awesome library, love it!

Could you provide a complete list of existing drivers with the names of the supported controllers?
For example, I have a display based on ST7789 and before I write a driver for HAGL for this chip on ESP32, it would be very convenient to look at the list and check if someone has already written it.

cmake doesn't work

I'm using linux. Running cmake from a fresh checkout fails with:

Unknown CMake command "idf_component_register".

According to google, that's something related to ESP, which is not my platform. I kinda assumed it was not bound to ESP ("hardware agnostic"). Did I miss something ? Or should it be fixed ?

While I'm at it. If i understand well, the MIPI "driver" is only for SPI displays. Is it planned to support parallel (8bit) displays ? Would it be difficult to add ?

Hex to rgb565


uint16_t util_color_to_rgb565(const char *color)
{
  int red, green, blue;
  sscanf(color, "%02x%02x%02x", &red, &green, &blue);
  return ((red & 0xF8) << 8) | ((green & 0xFC) << 3) | (blue >> 3);
}

adding this to make use of taking string hex to convert to rgb565

Scaling fonts

Is there a way to scale up existing fonts, i.e. use one of the supplied fonts at double/triple etc., the actual size? If not, would a PR that adds this be reasonable?
I'm thinking versions of hagl_put_text / hagl_put_char that take a scale factor as a parameter.

DISPLAY_DEPTH < 8

How do I write a driver that works with bitmap_t for a 4-bit color display controller?
As far as I can see, bitmap_t does not correctly support DISPLAY_DEPTH < 8 bits.

null hal / qemu hal

Hi,

I'm trying to build an esp32 based project with both the hagl_hal (hagl_esp_mipi) and a qemu_hal which currently does nothing but I would like to expose the screen via network for testing purposes. It works fine when I use the real hal but I have issues using the qemu hal as it conflicts with the other hal at build time even if I don't require it explicitly my project.

The README for this repo states that to build a hal you need to implement hagl_hal_put_pixel which I did - and I was planning to choose the hal at compile time by including the hal header from hagl_esp_mipi vs my basic hal function based on some sdkconfig.

I noticed that hagl.h includes hagl_hal.h and also that hagl CMakeFile requires hagl_hal

I also noticed that at the very minimum hagl_hal.h needs to provide not just the hagl_hal_put_pixel function but also the color_t definition.

Do you have suggestions on how to use one hal vs another in esp32?

Why does text come out so small?

Thank you for this wonderful project. I try to run some of the examples and wonder why text comes out so small, e.g.

image

Console output:

Allocated back buffer to address 0x7fdad9500000.
w=320, h=240
w=6

This is the code:

hagl_backend_t *display = hagl_init();
printf("w=%d, h=%d\n", display->width, display->height);
grid(display); // code omitted
uint16_t w = hagl_put_text(display, (const wchar_t *)u"Schön bunt hier", 20, display->height / 2.0, 0xffff, font6x9);
printf("w=%d\n", w);
```

Which IDE used ?

hello, please can i know whict i the best IDE recommanded to program a RPI PICO or PICO W
And on wich IDE can i easily use this librairies ?

Generating new fonts

Hi,

Thanks for your helpful project !

How do you generate new fontx fonts in c code to be used with your library ?

Thanks,
Ronan

is it possible to use HAGL with platformio and arduino framework?

Hello.
Is it possible to use this library with ESP32 (TTGO TDISPLAY, buildin screen not used, attached DFR0665 screen) + platformio + arduino framework? I never used kconfig, makefile and stuff like that so im not sure how to prepare it.

here is my current attempt but can not compile it
https://github.com/smarq8/ESP32_arduino_platformIO_HAGL

main.cpp

#include <Arduino.h>
#include <hagl_hal.h>
#include <hagl.h>


void setup(){
    hagl_init();
}

void loop(){
    hagl_clear_screen();
    // some drawing stuff
    hagl_flush();
    delay(500);
}

platformio.ini

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
> Executing task: C:\Users\xXx\.platformio\penv\Scripts\platformio.exe run --environment esp32dev <

Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.3.2) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 3.10006.210326 (1.0.6)
 - tool-esptoolpy 1.30100.210531 (3.1.0)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 29 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <hagl>
Building in release mode
Compiling .pio\build\esp32dev\src\main.cpp.o
Compiling .pio\build\esp32dev\lib3a2\hagl\hagl.c.o
In file included from lib\hagl\src\hagl.c:49:0:
lib\hagl\include/hagl.h:45:22: fatal error: hagl_hal.h: No such file or directory

******************************************************************
* Looking for hagl_hal.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:hagl_hal.h"
* Web  > https://platformio.org/lib/search?query=header:hagl_hal.h
*
******************************************************************

compilation terminated.
src\main.cpp:2:22: fatal error: hagl_hal.h: No such file or directory

******************************************************************
* Looking for hagl_hal.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:hagl_hal.h"
* Web  > https://platformio.org/lib/search?query=header:hagl_hal.h
*
******************************************************************

compilation terminated.
*** [.pio\build\esp32dev\lib3a2\hagl\hagl.c.o] Error 1
*** [.pio\build\esp32dev\src\main.cpp.o] Error 1
====================================================================================== [FAILED] Took 2.17 seconds ======================================================================================The terminal process "C:\Users\xXx\.platformio\penv\Scripts\platformio.exe 'run', '--environment', 'esp32dev'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.