I am looking to encapsulate the PNG Drawing capability within a higher level image function that I can use for dynamically loading and drawing new images to the LED Matrix. The specific number of class instantiations I will need will never be known at compile time, but I will have multiple files open at once.
Where ImageManager calls the png.Open() function when initialized.
I have tried to encapsulate the PNG class and the File variable within a higher level class along with my callback functions inside it but then the compiler complains because the callback functions are not static.
If I set the functions to static I can no longer access the unique File variable that belongs to each instantiation.
Essentially I want to be able to pass in a File object to the Open() callback without having to explicitly define it as a global variable.
I am not extremely knowledgeable about C++ so maybe I am missing an obvious solution here...
Hi,
I have successfully gotten your library working on an ESP32 that displays to an RGB matrix using @mrfaptastic's Matrix library.
I am trying to find an alternative to having to define my File variable globally such as in: https://github.com/bitbank2/PNGdec/blob/master/examples/sdcard_slideshow/sdcard_slideshow.ino
I am looking to encapsulate the PNG Drawing capability within a higher level image function that I can use for dynamically loading and drawing new images to the LED Matrix. The specific number of class instantiations I will need will never be known at compile time, but I will have multiple files open at once.
Essentially I want a class like the following:
image1 = ImageManager("filename.png") image2 = ImageManager("file2.png")
image1.render() image2.render()
Where ImageManager calls the png.Open() function when initialized.
I have tried to encapsulate the PNG class and the File variable within a higher level class along with my callback functions inside it but then the compiler complains because the callback functions are not static. If I set the functions to static I can no longer access the unique File variable that belongs to each instantiation.
Essentially I want to be able to pass in a File object to the Open() callback without having to explicitly define it as a global variable.
I am not extremely knowledgeable about C++ so maybe I am missing an obvious solution here...
Thanks!