Page 1 of 1

2D graphic lib for ESP-IDF ?

Posted: Mon Jan 23, 2017 6:00 pm
by nmenoux
Hi guys,

I'm currently developing some ESP-IDF code to drive an epaper display (GDE021A1) based on the spi_master for SPI communications. It seems to work as I could draw 'something' on screen but I need some basic 2D graphic library for working on an array buffer (lines, .., draw text) before pushing it to the the display through SPI commands.

If you have any graphic libs you've already used with ESP-IDF, I would be delighted to dive in :-)

Thanks for your help,

Nicolas

Re: 2D graphic lib for ESP-IDF ?

Posted: Tue Jan 24, 2017 1:18 am
by kolban
Howdy,
I for one have been using the Adafruit-GFX-Library running on the ESP32 to achieve a number of driver displays ... see:

https://github.com/adafruit/Adafruit-GFX-Library

Re: 2D graphic lib for ESP-IDF ?

Posted: Sat Feb 04, 2017 9:04 pm
by peter_
Hello Kolban,
do you have ported the Adafruit GFX Lib to esp-idf? If yes can you post it? It would save me some redundant work.
Regards
Peter

Re: 2D graphic lib for ESP-IDF ?

Posted: Mon May 18, 2020 11:42 am
by fasani
I'm also interested on this topic, to get both Adafruit GFX and fonts working, in a Epaper new component I'm trying to make.
https://github.com/martinberlin/cale-id ... /README.md

I just started with IDF a few months ago. My idea is to make something the way GxEPD is doing on espressif32-arduino but only using IDF (No arduino as a component)
This is also a nice example made in IDF 2.0:

https://github.com/loboris/ESP32_ePaper_example

I could see functions to draw lines and shapes in the library. But I could not compile it since I want to stick to 4.0 now.

Re: 2D graphic lib for ESP-IDF ?

Posted: Mon May 25, 2020 10:43 am
by fasani
Yesterday night I found some time to port this library and make the Fonts part work in IDF.
This is part of my intent to port an existing Epaper espressif32-arduino Firmware into ESP-IDF. You can find it here and unless I'm missing something it can be already added as a git submodule in existing projects.

https://github.com/martinberlin/Adafrui ... ry-ESP-IDF

When linking a component like this from other components do not forget to add in the CMakeLists file:

idf_component_register(SRCS ${srcs}
REQUIRES "Adafruit-GFX"
)

So your component can extend this class. Soon I will add an Epaper driver example implementing this if someone shows interest.

Please be aware that I'm quite new to C++ OOP (About 1 and half years experience)
So my classes and OOP may not be perfect. Other than that Adafruit uses the Print namespace of Arduino, due to that, I was forced to add some classes that I didn't wanted to add. So please check the README before using this.
Is working for geometries and print/println tests this are my demo images

Re: 2D graphic lib for ESP-IDF ?

Posted: Mon May 25, 2020 2:38 pm
by tuupola
If you are looking for library to draw graphical primitives and want to get rid of Arduino stuff check HAGL. It is still work in progress but API should be 80% stable. You need to provide it with HAL which has putpixel function for your e-paper display.

https://github.com/tuupola/hagl

Re: 2D graphic lib for ESP-IDF ?

Posted: Tue May 26, 2020 5:44 am
by fasani
Nice one! You just have one star more :)

Please note that my fork does not include Arduino.h at all. I just had to include Print & Printable headers since Adafruit extends them.
But could be changed if possibly by someone's pull request that understands better than me how a GFX library works.
My assumption is that Adafruit GFX extends Print just to re-use the print/println/printf methods but it would be a lot nicer if that methods are directly inside the library.

Actually I could add just print / println as methods and get rid of Print and Printable for the good ;)
This methods should just do a for...loop and send each char to the Adafruit_GFX write function:

Code: Select all

size_t Epd::write(uint8_t v){
  Adafruit_GFX::write(v);
  return 1;
}

void Epd::print(const std::string& text){
   for(auto c : text) {
     write(uint8_t(c));
   }
}

void Epd::println(const std::string& text){
   for(auto c : text) {
     write(uint8_t(c));
   }
   write(10); // newline
}