A simple clock application

Here you can discuss ReactOS related topics.

Moderator: Moderator Team

Gasmann
Posts: 283
Joined: Fri Nov 26, 2004 6:53 pm
Location: Germany
Contact:

A simple clock application

Post by Gasmann »

Hi all!

I just began learning WinAPI a bit and made a simple clock application :)
It runs greatly on ReactOS except that Pen-Width seems to be ignored.

Btw, there's a strange color problem when taking screenshots with ImageShack QuickShot (and I couldn't get anything else to make screenshots of it). So only a somewhat screwed screenshot provided :D

edit: new screenshot
old one is here: http://home.arcor.de/gasmann01/clock/clock.png


[ external image ]

I will try to increase my skills in WinAPI coding in future. Hopefully this can be useful to ReactOS someday.

Here you can get the clock: http://home.arcor.de/gasmann01/clock
Last edited by Gasmann on Sun Oct 21, 2007 2:39 pm, edited 2 times in total.
dreams
Posts: 207
Joined: Tue Sep 26, 2006 10:23 am
Location: Holland
Contact:

Post by dreams »

Maybe you can run ros inside a virtual machine and let the host operating system take a screenshot of it? :)
Mrkaras
Posts: 379
Joined: Sat Nov 27, 2004 5:43 am
Location: Australia
Contact:

Post by Mrkaras »

I thought Reactos now included a screenshot utility? anyway you should be able to use http://www.sharemation.com/lanmail/othe ... hooter.zip
this was the screenshot tool I specifically wrote for Reactos, until it gets its own.
Gasmann
Posts: 283
Joined: Fri Nov 26, 2004 6:53 pm
Location: Germany
Contact:

Post by Gasmann »

Too bad that ScreenShooter can only save to JPG... PNG is much more suitable (read: more efficient) when it comes to saving 'simple' pictures like screenshots! Additionally, it's lossless and thus gives higher quality (try zooming in to 500% and then compare JPG to PNG!) You will see what I mean if you look at http://home.arcor.de/gasmann01/clock/1.jpg and http://home.arcor.de/gasmann01/clock/2.png (1: taken with your tool, 2: taken with IrfanView) The JPG is twice as large with almost the same content shown on it.

Nevertheless I'll try it on ReactOS now. :roll:

edit: it works really good, thanks! What did you write that tool in? Surely not plain winapi, otherwise the executable wouldn't be so large!?
Haos
Test Team
Posts: 2954
Joined: Thu Mar 22, 2007 5:42 am
Contact:

Post by Haos »

Orly? I seriously doubt it, unless you set jpg to No Compression... but then, the quality is much better than png...

As a standart, i use 80% quality, that seem to be optimal for quality/size ratio. Using this i measured jpg size against the png done by the best available - PNGOUT plugin.

I used irfanview to take desktop screenshot.

Jpeg size was 48kb, while png with pngout - 43kb while the default png - 50kb with compression ratio 6 (default). With best compression ratio - 9, the size was 45kb.

I agree that jpg is more suitable for photorealistic graphics, but it doesnt mean its worse than png.
counting_pine
Posts: 237
Joined: Fri Nov 26, 2004 10:44 pm
Location: Fallowfield

Post by counting_pine »

Haos wrote:Orly? I seriously doubt it, unless you set jpg to No Compression... but then, the quality is much better than png...
The JPEG quality will always be worse than PNG - PNG is completely lossless, but JPEG compression will create artifacts.

For (almost) any PNG image, it's possible to save a JPEG with a smaller size, but the smaller the image, the more quality loss, and the bigger the artifacts. On simple screenshots they look really ugly.
JPEG is only really worth using on screenshots like that if you're really concerned about the file size, and even then, you may find that a JPEG saved with reasonable quality will be larger than the equivalent PNG.

By the way, if you're saving a screenshot like the one above, you may get better results from the PNGOUT plugin if you set the filter type to "None".
Haos
Test Team
Posts: 2954
Joined: Thu Mar 22, 2007 5:42 am
Contact:

Post by Haos »

Using the None filter, the result was worse by approx 1kB, although the passes went faster. Still its 44kb vs 45 by jpeg, while jpeg was saved a lot faster and without any visible artifacts, at least not in the normal view.

http://img135.imageshack.us/my.php?imag ... d01yr6.png
vs
http://img89.imageshack.us/my.php?image ... d03hw7.jpg

But if you know how could i make this png 1/2 of jpeg size, i`d be gratefull.
.aart3k
Posts: 339
Joined: Sat Apr 01, 2006 11:21 am

Post by .aart3k »

try to magnify jpeg - you'll see 8x8 fields, and as i can see on my lcd, there are artifacts - magnify area near ventrilo icon
counting_pine
Posts: 237
Joined: Fri Nov 26, 2004 10:44 pm
Location: Fallowfield

Post by counting_pine »

In that image, the JPEG artifacts are actually quite noticeable. The desktop background colour has bled into the white text, some of the colours in the icons are a bit blurred, and the IrfanView icons come out quite badly.

(Incidentally, was this the image you were talking about? I found the "None" filter type to be most effective. Also, the JPEG you posted is about 8KB larger than the PNG.)

Saved exactly as a PNG, the lower limit on that picture is probably around the 40KB mark. With that particular image, you could try reducing it to 256 colours (no dithering). There will be some loss of colour information, but with that image it's not very noticeable. I'd say in this case it's better than the JPEG since the edges are all still well defined. Saved without the PNGOUT plugin, it weighs in at just under 20KB.

If it's a close run thing between the JPEG and the PNG, go for the PNG, since the image will be a lot cleaner. Don't worry too much about using the PNGOUT plugin, unless file size is really important.
Mrkaras
Posts: 379
Joined: Sat Nov 27, 2004 5:43 am
Location: Australia
Contact:

Post by Mrkaras »

Gasmann wrote:Too bad that ScreenShooter can only save to JPG... PNG is much more suitable (read: more efficient) when it comes to saving 'simple' pictures like screenshots! Additionally, it's lossless and thus gives higher quality (try zooming in to 500% and then compare JPG to PNG!) You will see what I mean if you look at http://home.arcor.de/gasmann01/clock/1.jpg and http://home.arcor.de/gasmann01/clock/2.png (1: taken with your tool, 2: taken with IrfanView) The JPG is twice as large with almost the same content shown on it.

Nevertheless I'll try it on ReactOS now. :roll:

edit: it works really good, thanks! What did you write that tool in? Surely not plain winapi, otherwise the executable wouldn't be so large!?
it was just a quick hack together tool writen in Delphi, the entire code fits on the screen at once! I can add png if you like. I didn't even set the jpg quality and now that I check it defaults to 90%, so even as jpeg you could get a smaller file size with more compression and adding that option will take about 30 seconds, png a little longer but hey, its better than what you had befour isn't it!
Harteex
Posts: 224
Joined: Fri Nov 26, 2004 9:21 pm
Location: Sweden
Contact:

Post by Harteex »

Haos wrote:Using the None filter, the result was worse by approx 1kB, although the passes went faster. Still its 44kb vs 45 by jpeg, while jpeg was saved a lot faster and without any visible artifacts, at least not in the normal view.

http://img135.imageshack.us/my.php?imag ... d01yr6.png
vs
http://img89.imageshack.us/my.php?image ... d03hw7.jpg

But if you know how could i make this png 1/2 of jpeg size, i`d be gratefull.
You don't even have to zoom in to see that the jpeg quality is inferior to the png. Png is much better suited for this kind of picture.

Are you using a CRT monitor? Jpeg artifacts are less visible on CRTs.
Harteex
Posts: 224
Joined: Fri Nov 26, 2004 9:21 pm
Location: Sweden
Contact:

Re: A simple clock application

Post by Harteex »

Gasmann wrote:It runs greatly on ReactOS except that Pen-Width seems to be ignored.
If this works on Windows then it's a bug.. feel free to submit a bug report to BugZilla if you want.
Gasmann
Posts: 283
Joined: Fri Nov 26, 2004 6:53 pm
Location: Germany
Contact:

Re: A simple clock application

Post by Gasmann »

Harteex wrote:If this works on Windows then it's a bug.. feel free to submit a bug report to BugZilla if you want.
Good idea, I just did it :wink: Hope this helps: http://www.reactos.org/bugzilla/show_bug.cgi?id=2761

Btw, I really didn't intend to start such a huge discussion about jpg vs. png :shock:
Z98
Release Engineer
Posts: 3379
Joined: Tue May 02, 2006 8:16 pm
Contact:

Post by Z98 »

People on this forum don't need much to start a debate. This one was rather mild.
Haos
Test Team
Posts: 2954
Joined: Thu Mar 22, 2007 5:42 am
Contact:

Post by Haos »

No, i`m using LCD 1280x1024. I suppose i`m blind or adjusted for jpegs, as i dont really notice artifacts unless i get really close to screen...

Yeah, 8kb on 52kb img, which is barely 15%... It took well over a minute to save this PNG using PNGOUT plugin. PNG would be of similar size.

Also, you could see artifacts here only because of sharp cutoff between icons and background. If you`d be making sshots of a game for example, it wouldn`t be really noticable.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Semrush [Bot], Yandex [Bot] and 2 guests