orontee / taranis

Local weather data on your PocketBook e-book reader.
GNU General Public License v3.0
22 stars 0 forks source link

Provide screenshot of the daily forecast to be used as power off logo #28

Closed orontee closed 10 months ago

orontee commented 1 year ago

Source: https://www.mobileread.com/forums/showpost.php?p=4354379&postcount=4

From the official documentation: image

Unfortunately no idea of how to set that "boot logo"...

neilswann80 commented 1 year ago

Also noticed a couple of references within inkview.h:

PageSnapshot(); #define REQ_SCREENSHOT

The latter I'm assuming would be called with something like:

iv_ipc_request(REQ_SCREENSHOT, 1, NULL, 0, 0);

Can't find any further info on their use. I've tried compiling a simple inkview app that calls these functions, but no screenshots appear in /mnt/ext1/screens or any tmp directory I've searched.

neilswann80 commented 1 year ago

FYI... one of the above commands definitely changed the bootlogo, just noticed after a reboot.

orontee commented 1 year ago

FYI... one of the above commands definitely changed the bootlogo, just noticed after a reboot.

@neilswann80 How does the new bootlogo look like? Is it a taranis snapshot??

neilswann80 commented 1 year ago

I added the command to a Tetris app I'm playing with, so the bootlogo was a screenshot of that. I'll see if I can find the location it's saved to.

neilswann80 commented 1 year ago

It's definitely the command: PageSnapshot();

I have a custom bootlogo set and it's overriding that, I have to manually set it back to my custom one or it will continue to show the PageSnapshot with every reboot; so that's good! :)

If I can find the save location, I'm hoping deleting the bitmap will restore my custom bootlogo for next reboot.

If the PageSnapshot can be moved to /mnt/ext1/system/logo/offlogo, then we should be able to set it to active within /mnt/ext/system/config/global.cfg

orontee commented 1 year ago

(...) If the PageSnapshot can be moved to /mnt/ext1/system/logo/offlogo, then we should be able to set it to active within /mnt/ext/system/config/global.cfg

@neilswann80 I am not sure I follow you. Why not simply call ibitmap *BitmapFromScreen(int x, int y, int w, int h); and save to /mnt/ext1/system/logo/offlogo?

From my point of view, the problem is not about capturing screen but it's to make the screenshot available to the system in a way that respect the user configuration (i.e. whether he wants applications with such capability to provide off/sleep images or not).

neilswann80 commented 1 year ago

Ah, yeah, I missed that command. What is the syntax for saving after the BitmapFromScreen function is called?

neilswann80 commented 1 year ago

Figured it out. Need to combine the functions:

int SaveBitmap(const char *filename, const ibitmap *bm); ibitmap *BitmapFromScreen(int x, int y, int w, int h);

So this:

SaveBitmap("/mnt/ext1/Photo/test.bmp", BitmapFromScreen(0, 0, 1072, 1448));

Worked for me on my HD3 with resolution of 1072x1448.

orontee commented 1 year ago

inkview.h defines USEROFFLOGOPATH. After saving a BMP to, say USEROFFLOGOPATH + "/taranis_weather_forecast.bmp", a new item taranis_weather_forecast.bmp is available in "Parameters / Appearance / Power off logo"; Selecting that item uses the BMP as power off logo...

Plan:

neilswann80 commented 1 year ago

Nice! 😄

This leaves it up to the user whether to select that specific wallpaper via a manual change of settings. 👍

Although this would mean that if selecting the "Random" power off logo option it would appear too, mixed in with the user selected images. Perhaps an on/off setting for adding/removing the taranis_weather_forecast.bmp from USEROFFLOGOPATH is still needed?

orontee commented 1 year ago

I agree. But first of all one must succeed in rendering a dedicated image since current weather and menu button don't make sense in a poweroff image! Using a sub-task could be the right way to go since they may have their own framebuffer (canvas in inkview.h terminology). Still I've to test this and it won't be easy; #52 is the priority right now.

neilswann80 commented 1 year ago

But first of all one must succeed in rendering a dedicated image since current weather and menu button don't make sense in a poweroff image!

What do you mean by "current weather" in this context?

Could you create a variable state that controls button transparency that's enabled for the screenshot process?

orontee commented 1 year ago

What do you mean by "current weather" in this context?

From left to right, top to bottom of Taranis screen there's: A "location box", the menu button, then what I call the "current weather box". The displayed information is valid for the current time. So it doesn't make sense to have it on a poweroff image.

Maybe it's not a real problem since the refresh timestamp is displayed...

Could you create a variable state that controls button transparency that's enabled for the screenshot process?

Could be possible but if it is it's not easier than removing that button temporarily. The true problem is to render the image "off screen" but I am pretty confident that it works if a sub-task is started. I'll work on this next week.

orontee commented 10 months ago

Just read from the "documentation" of SetCanvas:

One can manually create canvas, pass it to SetCanvas() and then draw into it using such functions as DrawPixel() and FillArea().

Thus generating the image to use as wallpaper shouldn't be difficult.

orontee commented 10 months ago

offlogo