Screenshot

Anything and everything about programming graphics with Ultibo
User avatar
Ultibo
Site Admin
Posts: 1476
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: Screenshot

Postby Ultibo » Sat Mar 18, 2017 9:11 am

Gavinmc42 wrote:When saving the screenshot image no timestamp is on the file.

It's related to the fact that the time has not been set (no NTP or RTC) and the different layers of the system think about time differently from each other.

To resolve it you can either include the NTP client (Services unit) or add a supported RTC chip or simply set the time manually to some known value, the reason for the "blank" time is because of the different ways time is encoded between different components.

Ultibo internally uses TFileTime which is 100 nanosecond intervals since 1 January 1601 (this is the same format as Windows file time).

Free Pascal uses a time format (TDateTime) that begins at 31 December 1899.

The FAT filesystem uses the DOS time format which begins at 1 January 1980 instead.

When Ultibo boots it sets the internal time to 31 December 1899 as a starting point and expects that NTP or RTC will set it to the correct value shortly, if that doesn't happen then this is before the start of DOS time so the value recorded against any files created will be zero which will appear in Windows as a blank.

I have thought about the idea of setting the starting default to 1 January 2000 or something which would then be a valid time in all of the encoded formats, does anyone remember what the "default" time and date value is for the BIOS in a modern PC?
Ultibo.org | Make something amazing
https://ultibo.org
Gavinmc42
Posts: 1003
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Screenshot

Postby Gavinmc42 » Sat Mar 18, 2017 9:30 am

Thanks Garry,

I will fake up a date based on compile time for testing?
Is there a way to read the timestamp on kernel.bin?

That means for unconnected stuff I will need to add a RTC.
Hmm, current project uses an i2c bus on an IDC ribbon cable, I can just crimp a RTC pcb on to it.
Must remember this for A+, Zero projects.
User avatar
Ultibo
Site Admin
Posts: 1476
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: Screenshot

Postby Ultibo » Sat Mar 18, 2017 9:59 am

Gavinmc42 wrote:Is there a way to read the timestamp on kernel.bin?

Totally untested, but something like this should work.

Code: Select all

uses
  ...
  Platform,
  FileSystem;
 
begin
  ClockSetTime(Int64(FSFileAgeEx('C:\kernel7.img')),False);

Adjust the name as needed for your Pi model.
Ultibo.org | Make something amazing
https://ultibo.org
Gavinmc42
Posts: 1003
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Screenshot

Postby Gavinmc42 » Sun Mar 19, 2017 3:19 am

Thanks Garry,
Will try it when back in at work Monday.
Did you look it up or do you just know this stuff :o
User avatar
Ultibo
Site Admin
Posts: 1476
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: Screenshot

Postby Ultibo » Sun Mar 19, 2017 10:14 am

Gavinmc42 wrote:... or do you just know this stuff :o

We wrote it ;)

Yes all of it :D

Every single line :o

It's true...

But I still had to check the syntax of the example because I make mistakes too. :roll:
Ultibo.org | Make something amazing
https://ultibo.org
Gavinmc42
Posts: 1003
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Screenshot

Postby Gavinmc42 » Mon Mar 20, 2017 5:15 am

Not sure if I should be impressed or terrified :D

Turns out you're human

This does not work
ClockSetTime(Int64(FSFileAgeEx('C:\kernel7.img')),False);

FILETIME is a record not an int.
Now learning about Pascal records.
May be able to figure it out

Code: Select all

 FileTimeToSystemTime
?
Gavinmc42
Posts: 1003
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Screenshot

Postby Gavinmc42 » Fri Apr 21, 2017 4:55 am

Screenshot uses ConsoleDeviceGetDefault.
I have three consoles windows, how do I switch focus to another console?

Getting image fine from the default, need to get image from another window.
User avatar
Ultibo
Site Admin
Posts: 1476
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: Screenshot

Postby Ultibo » Fri Apr 21, 2017 10:06 am

Gavinmc42 wrote:Screenshot uses ConsoleDeviceGetDefault.
I have three consoles windows, how do I switch focus to another console?

You are confusing two different concepts here, a console device like what is returned by ConsoleDeviceGetDefault represents the whole screen, everything you see including the windows, the orange border and the title etc.

Whereas a console window is just a single window where you can draw text or graphics, there can be up to four of them at once.

Screenshot uses a ConsoleDevice because it deals with the entire screen, not just one of the windows, if you follow the example from an earlier post in this thread that shows how to capture the whole screen you should get everything in your capture.

Of course if you just want to capture a single console window then the SaveBitmap example can capture any graphics window.
Ultibo.org | Make something amazing
https://ultibo.org
Gavinmc42
Posts: 1003
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Screenshot

Postby Gavinmc42 » Fri Apr 21, 2017 11:25 am

Yep confused, mixing coordinates :oops:
That explains a few weird pics I was getting too.

I want to try ConsoleWindowCreateEx, creating variable graphics window sizes.
Hmm, should work in QEMU? Or is it only limited to the 4 sizes/positions?
Gavinmc42
Posts: 1003
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Screenshot

Postby Gavinmc42 » Fri Apr 21, 2017 12:15 pm

Was not clear in latest release, does the QEMU disk stuff work yet?
Saved bitmap will end up somewhere?

Return to “Graphics”

Who is online

Users browsing this forum: No registered users and 1 guest