FD- / LaMetric-SDK

An unofficial SDK for developing native standalone LaMetric Time apps
GNU General Public License v3.0
26 stars 2 forks source link

Control B/W Pixels directly, or display B/W images on text side? #1

Open Thyraz opened 2 years ago

Thyraz commented 2 years ago

Hi FD-

very cool project. The main reason for 'custom apps' (in my case) would be to control ALL pixels on the Lametric, not just the color pixels by using icons.

Have you been able to achieve that using the SDK? Either by setting image data similar to the base64 icons, or maybe even more low-level?

Thank you in advance, Tobi

FD- commented 2 years ago

Hi, The lowest level of controlling the display would be simply writing to the frame buffer (/dev/fb0).

However, my SDK offers you the advantage of not having to get your hands dirty with the technicalities of the frame buffer format, plus (because it builds on the technologies of built-in apps), it allows your custom apps to seamlessly integrate into the rest of the system (configuration through the iOS/Android app, notifications, app cycling, ...).

For drawing arbitrary content anywhere on the screen, just implement your own widget that subclasses from LWidgetBase. In the paintEvent() method, you should then be able to construct a QPainter to draw arbitrary screen contents, including image data loaded from a file.

If you need details for any of these steps, don't hesitate to ask! I'm curious to see how your project turns out!

Thyraz commented 2 years ago

Thanks for the heads-up.

I have no experience with QT so far, which isn't that helpful in this case. ;)

So, while I already thought that LWidgetBase might be the class I need, I wasn't aware of the paintEvent() method.

Thank you for the offer for more detailed help. I'll try to set up a project to see if I run into problems or not.

The app I need isn't that complicated, I just want to be able to get better use of the Display from the SmartHome system I use. I already do that with an official Lametric custom "app" with a few frames for texts / charts. But I often miss the possibility to use the whole display with full pixel control. So the main goal will be to receive and display base64 image strings from the SmartHome software

FD- commented 2 years ago

I didn't have any experience with QT ahead of this project either, but luckily, most of it is well documented. Please note I never implemented my own custom widgets (all pre-made widgets from lfoundation were enough for me), but I'm pretty sure it will work as I described. For unclear details, you can always have a look at the decompilation of the LChartWidget class for example (I can recommend Ghidra for decompilation!).

What you want to achieve is definitely possible. Let me know how it goes!

Thyraz commented 2 years ago

Ok, will see what's needed to get Ghidra up and running and how to decompile with it. ;)

The needed resources are in /usr/lib/liblfoundation.*, correct?

FD- commented 2 years ago

Yes, exactly, that's the key library. From a quick look at the LIcon widget (draws image files, but AFAICT only in the 8x8 color area by default) it seems like you could even use a QLabel (as a subwidget inside your LWidgetBase) for rendering a QPixmap without having to deal with the paintEvent.