Page 6 of 7

Posted: Fri Nov 03, 2006 11:31 pm
by netmaestro
OK, thanks very much for testing. It seems the clock uses some cpu on some machines but I don't know why. Frustrating.

Posted: Fri Nov 03, 2006 11:38 pm
by Flype
it might be a GDI issue :?:

do you have a small GDI snippet you want me to 'speed-test' on my machine ?


PS:
when i say maximum zoom - i say the zoom of the max value of the trackbar (not the radio buttons).

Posted: Sat Nov 04, 2006 12:26 am
by blueznl
i feel (almost) guilty as i think i was the one who triggered all your work by requesting a clock way back :-)

not that guilty though :-)

anyway, got one request: could you give it an option to hide the seconds? the moving arm is somewhat distracting, especially with multiple clocks open

but darn, it's a beautifull thing you made!

Posted: Sat Nov 04, 2006 12:37 am
by GeoTrail
Here's 100% zoom on my PC
Image

Posted: Sat Nov 04, 2006 1:04 am
by netmaestro
OK, option to remove secondhand is done (not yet for 2000 version). You will have to redo any saved settings using the new version, as it will not accept saved settings that don't include the secondhand status. So just Forget Settings on all your clocks before shutting them down and then Remember Settings on all the new ones.

Here's how it works:

Image

One picture is worth many words.

Posted: Sun Nov 05, 2006 11:31 pm
by netmaestro
There is an update to this program. It covers three main bases:

1. The timing method for the 2000 version is better, it's now employed by TransparentClock.exe and so there is no more need for a 2000 version

2. There was a bug in the resize function where there could potentially be a crash under certain conditions, this is corrected.

3. The timing logic for the Jump and No Secondhand options is rewritten to only update the clock graphic once on the variable Date() getting a new second, which should effectively remove all CPU usage for people who are getting some. The Sweep option updates the graphic 17 times a second.

This clock is pretty much done, so please download the current version, which is going to be final unless a bug shows up. Thanks to all testers and enjoy the clock!

Posted: Sun Nov 05, 2006 11:53 pm
by Joakim Christiansen
What if we would like a background for the clock? :P (not transparent)

Posted: Sun Nov 05, 2006 11:55 pm
by netmaestro
Check the program name... :twisted:

Posted: Mon Nov 06, 2006 1:02 am
by Joakim Christiansen
netmaestro wrote:Check the program name... :twisted:
Oh, yeah... :oops:

Posted: Mon Nov 06, 2006 3:47 am
by yrreti
Again Netmaestro

Thank you very much for providing your excellent transparent
clock, and for all the nice improvements you've made for us all.
:D
yrreti

Posted: Mon Nov 06, 2006 8:01 am
by Flype
hello,

1/
can you just add some menu-separators in the pop-menu to make it more readable ?

2/
What if we would like a background for the clock? Razz (not transparent)
Yes, like the your previous VistaClock, which included 2 backgrounds.
Not possible to re-use them ?

Posted: Mon Nov 06, 2006 8:34 am
by Michael Vogel
Hi,

observing your project with interest - the actually version can not be seen on my (old) Win2000 notebook, earlier versions did...

Concerning the CPU usage, I can tell you only about the last working version (with the sweeping second hand):

I had about 25% CPU usage, but when using smaller factors of the picture (128x128) the CPU usage went down to about 5%. For me it seems to be that my old (built in) graphic "card" needs a lot of performance to do the transparent things...

I'm looking forward and wish you the best for your project - and wait for all peaces of code (or libs) you will publish.

Michael

PS I also searched for some old code when I started to write also a clock (but failed to make a good code for the hands) - relaunched it and... voilĂ , it also took around 20% of the CPU performance (and this without all your really nice hands).

Code: Select all

; Define
	UsePNGImageDecoder()
	UseTIFFImageDecoder()

	Global Alpha = 255

	Global UhrX=260
	Global UhrY=260
	Global MidX=UhrX>>1
	Global MidY=UhrY>>1

	Global Stunde,Minute,Sekunde
	Global Zeit,LetzteZeit

	Global WinID,ImageDC

	Enumeration
		#Hintergrund
		#Zeichenflaeche

		#Stundenzeiger

		#ImgBack
		#ImgBorder
		#ImgGloss
		#ImgLongPointer
		#ImgMediumPointer
		#ImgSmallPointer
	EndEnumeration

	DataSection
		Uhr:
		IncludeBinary "fiat.png"
		StundenZeiger:
		IncludeBinary "z1.bmp"
	EndDataSection

	Global Dim SinQ(59)
	Global Dim CosQ(59)

	For i=0 To 59
		SinQ(i)=Sin(i/30*#PI)*MidX
		CosQ(i)=Cos(i/30*#PI)*MidY
	Next i
; EndDefine

Procedure MyLineXY(x,y,x1,y1,Color,Width=3)
	hDC=ImageDC;GetDC_(WindowID(0))
	
	pen=CreatePen_(#PS_SOLID,Width,#Black)
	hPenOld=SelectObject_(hDC,pen)
	MoveToEx_(hDC,x-1,y,0):LineTo_(hDC,x1-1,y1)
	MoveToEx_(hDC,x,y-1,0):LineTo_(hDC,x1,y1-1)
	MoveToEx_(hDC,x+1,y,0):LineTo_(hDC,x1+1,y1)
	MoveToEx_(hDC,x,y+1,0):LineTo_(hDC,x1,y1+1)
	DeleteObject_(pen)
	DeleteObject_(hPenOld)
	
	pen=CreatePen_(#PS_SOLID,Width,Color)
	hPenOld=SelectObject_(hDC,pen)
	MoveToEx_(hDC,x,y,0):LineTo_(hDC,x1,y1)
	DeleteObject_(pen)
	DeleteObject_(hPenOld)
EndProcedure
Procedure UpdateClock()

	Zeit=Date()

	If Zeit<>LetzteZeit
		LetzteZeit=Zeit

		Stunde=Hour(Zeit)
		Minute=Minute(Zeit)
		Sekunde=Second(Zeit)

		; Fresh copy of background to draw on
		CreateImage(#Zeichenflaeche,UhrX,UhrY)

		ImageDC=StartDrawing(ImageOutput(#Zeichenflaeche))

		DrawAlphaImage(ImageID(#Hintergrund),0,0)

		MyLineXY(MidX-SinQ(Stunde)>>5,MidY+CosQ(Stunde)>>5,MidX+(SinQ(Stunde)*1)>>1,MidY-(CosQ(Stunde)*1)>>1,#White,3)
		MyLineXY(MidX-SinQ(Minute)>>5,MidY+CosQ(Minute)>>5,MidX+(SinQ(Minute)*6)>>3,MidY-(CosQ(Minute)*6)>>3,#White,5)
		MyLineXY(MidX-SinQ(Sekunde)>>3,MidY+CosQ(Sekunde)>>3,MidX+(SinQ(Sekunde)*7)>>3,MidY-(CosQ(Sekunde)*7)>>3,#Black,1)
		
		; Update the window
		Static ContextOffset.POINT
		Static BlendMode.BLENDFUNCTION
		Static BitmapInfo.BITMAP
		GetObject_(ImageID(#Zeichenflaeche),SizeOf(BITMAP),@BitmapInfo)
		BlendMode\SourceConstantAlpha=Alpha
		BlendMode\AlphaFormat=1
		UpdateLayeredWindow_(WindowID(0),0,0,@BitmapInfo+4,ImageDC,@ContextOffset,0,@BlendMode,2)
		FreeImage(#Zeichenflaeche)
		StopDrawing()
	EndIf
EndProcedure

#APPNAME = "Clock"
OpenWindow(1, 0, 0, 0, 0, #APPNAME + " Parent", #PB_Window_Invisible)
OpenWindow(0, 0, 0, 512, 384, #APPNAME, #PB_Window_Invisible, WindowID(1))
SetWindowLong_(WindowID(0), #GWL_EXSTYLE, GetWindowLong_(WindowID(0), #GWL_EXSTYLE) | #WS_EX_LAYERED)

CatchImage(#Hintergrund,?Uhr)
CatchImage(#Stundenzeiger,?Stundenzeiger)

UpdateClock()
HideWindow(0,0)

SetParent_(WindowID(0),0)
StickyWindow(0,1)

quit=0
Repeat
	UpdateClock()
	Select WaitWindowEvent(250)

	Case #WM_LBUTTONDOWN
		SendMessage_(WindowID(0), #WM_NCLBUTTONDOWN, #HTCAPTION, 0)

	Case #WM_CHAR
		quit=#True
	EndSelect
Until quit

Posted: Mon Nov 06, 2006 9:26 am
by Flype
Just a little GDI clock from the french forum (Erix14)
Catch it here : http://www.rx14.info/public/index.php?a=HorlogeRX

This one is very nice, smooth, cpu reasonable.
I think it is a good idea to add the date on the clock. maybe you can add it to TransparentClock (?)

Posted: Mon Nov 06, 2006 4:09 pm
by jack
@Michael Vogel, could you give a link to your images "fiat.png" and "z1.bmp" ?

Posted: Tue Nov 07, 2006 1:12 pm
by Michael Vogel
jack wrote:@Michael Vogel, could you give a link to your images "fiat.png" and "z1.bmp" ?
Be patient, its on my notebook far, far away...