Page 1 of 1

Merry Christmas!

Posted: Wed Dec 25, 2019 9:27 am
by TI-994A
Image

Re: Merry Christmas!

Posted: Wed Dec 25, 2019 9:47 am
by BarryG
Merry Christmas, too! :D

Re: Merry Christmas!

Posted: Wed Dec 25, 2019 5:25 pm
by box_80
Happy holidays everyone. :mrgreen:

Re: Merry Christmas!

Posted: Wed Dec 25, 2019 5:54 pm
by VB6_to_PBx
Merry Christmas !!!

Re: Merry Christmas!

Posted: Wed Dec 25, 2019 11:32 pm
by netmaestro
Merry Christmas to all and to all a "Code Tight"!

Re: Merry Christmas!

Posted: Thu Dec 26, 2019 5:54 am
by kenmo
Enjoy the holidays, everyone, get some deserved rest, and look forward to 2020 :D

Re: Merry Christmas!

Posted: Thu Dec 26, 2019 10:26 am
by Michael Vogel

Code: Select all

; Define
	#Text="Merry Christmas!"
	#FontName="Segoe UI"
	#FontSize=80
	#FontType=#PB_Font_Bold|#PB_Font_Italic

	#WX=900
	#WY=200

	#FX=10
	#FY=20

	#Pen=		3

	#ColBack=	$FFFFC0
	#ColBorder=	#Black
	#ColFill=		#Yellow
	#ColSnow=	#White
	#ColShadow=#Black

	#Draw=		$FF000000
	#Color=		$00FFFFFF

	Global Dim Snow(#WX)
	Global Dim Cloud.Rect(0)

; EndDefine

Procedure Init()

	LoadFont (0,#FontName,#FontSize,#FontType)

	OpenWindow(0,0,0,#WX,#WY,"Snowy Font by Michael Vogel",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
	CanvasGadget(0,0,0,#WX,#WY)

	CreateImage(0,#WX,#WY,32,#Red)
	StartDrawing(ImageOutput(0))
	DrawingMode(#PB_2DDrawing_AllChannels)
	Box(0,0,#WX,#WY,#ColBack)
	StopDrawing()

	CompilerIf 0
		StartDrawing(ImageOutput(0))
		DrawingFont(FontID(0))
		DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
		DrawText(#FX,#FY,#Text,#Draw|#ColFill,0)
		StopDrawing()

	CompilerElse
		StartVectorDrawing(ImageVectorOutput(0))
		VectorFont(FontID(0))
		MovePathCursor(#FX,#FY)
		AddPathText(#Text)
		VectorSourceColor(#Draw|#ColBorder)
		StrokePath(#Pen+3,#PB_Path_Preserve|#PB_Path_RoundCorner)
		VectorSourceColor(#Draw|#ColFill)
		FillPath(#PB_Path_Preserve)
		StopVectorDrawing()

	CompilerEndIf

EndProcedure
Procedure Snowcloud(x,y,w,h)
	
	; Work in process... (shapes need to be polished a little bit)
	
	If w>5

		If w<46

			TranslateCoordinates(x,y-15)
			ScaleCoordinates(w/800,0.05)
			MovePathCursor(33,327)
			AddPathCurve(20,359,33,359,59,366)
			AddPathCurve(151,399,184,353,243,372)
			AddPathCurve(308,405,341,425,420,399)
			AddPathCurve(485,379,518,346,590,366)
			AddPathCurve(656,386,695,379,741,340)
			AddPathCurve(780,300,695,274,669,261)
			AddPathCurve(603,235,524,215,459,215)
			AddPathCurve(420,222,393,228,354,228)
			AddPathCurve(249,235,99,228,33,327)
			ClosePath()
			VectorSourceColor($FFFEFEFE)
			FillPath(#PB_Path_Preserve)
			ResetCoordinates()
			VectorSourceColor($FF292A2B)
			StrokePath(2.7,#PB_Path_RoundCorner|#PB_Path_RoundEnd)

		Else
			TranslateCoordinates(x-12,y-12)
			ScaleCoordinates(w/600,0.07)
			
			MovePathCursor(251,499)
			AddPathCurve(232,462,220,462,178,475)
			AddPathCurve(159,480,121,499,107,512)
			AddPathCurve(93,528,83,561,110,566)
			AddPathCurve(131,570,153,570,173,573)
			AddPathCurve(207,580,195,580,224,572)
			AddPathCurve(246,565,249,568,259,543)
			AddPathCurve(266,524,259,517,251,499)
			ClosePath()
			VectorSourceColor($FFFEFEFE)
			FillPath(#PB_Path_Preserve)
			ResetCoordinates()
			VectorSourceColor($FF292A2B)
			StrokePath(2.7,#PB_Path_RoundCorner|#PB_Path_RoundEnd)

			TranslateCoordinates(x-12,y-12)
			ScaleCoordinates(w/600,0.07)
			MovePathCursor(178,35)
			AddPathCurve(85,103,163,253,175,341)
			AddPathCurve(176,365,178,387,180,411)
			AddPathCurve(180,419,181,455,193,455)
			AddPathCurve(214,455,212,436,214,418)
			AddPathCurve(222,372,278,341,247,275)
			AddPathCurve(234,243,193,235,215,211)
			AddPathCurve(291,125,476,159,562,98)
			AddPathCurve(586,81,559,72,535,67)
			AddPathCurve(456,54,398,30,313,25)
			AddPathCurve(278,22,212,20,178,35)
			ClosePath()
			VectorSourceColor($FF241EE3)
			FillPath(#PB_Path_Preserve)
			ResetCoordinates()
			VectorSourceColor($FF292A2B)
			StrokePath(2.7,#PB_Path_RoundCorner|#PB_Path_RoundEnd)

			TranslateCoordinates(x-12,y-12)
			ScaleCoordinates(w/600,0.07)
			MovePathCursor(210,211)
			AddPathCurve(203,226,219,259,224,272)
			AddPathCurve(236,301,251,287,258,314)
			AddPathCurve(264,330,259,301,293,308)
			AddPathCurve(320,311,302,313,325,301)
			AddPathCurve(357,284,403,270,440,267)
			AddPathCurve(466,267,442,257,474,255)
			AddPathCurve(544,252,535,223,571,220)
			AddPathCurve(601,216,604,220,635,206)
			AddPathCurve(655,198,675,186,696,177)
			AddPathCurve(721,165,719,160,736,138)
			AddPathCurve(750,120,758,108,745,84)
			AddPathCurve(726,54,703,64,675,45)
			AddPathCurve(650,28,625,52,601,66)
			AddPathCurve(576,79,564,79,540,100)
			AddPathCurve(508,122,494,115,457,125)
			AddPathCurve(418,135,393,140,352,147)
			AddPathCurve(313,154,232,171,212,206)
			AddPathLine(210,211)
			ClosePath()
			VectorSourceColor($FFFEFEFE)
			FillPath(#PB_Path_Preserve)
			ResetCoordinates()
			VectorSourceColor($FF292A2B)
			StrokePath(2.7,#PB_Path_RoundCorner|#PB_Path_RoundEnd)

		EndIf

	EndIf


EndProcedure
Procedure Snowstorm()

	Protected a,b
	Protected x,y,z

	StartDrawing(ImageOutput(0))
	DrawingFont(FontID(0))

	While x<#WX
		While y<#WY
			If Point(x,y)&#Color=#ColBorder
				Snow(x)=y
				;Box(x,0,1,y,#Blue)
				y=#WY
			Else
				y+1
			EndIf
		Wend
		x+1
		y=0
	Wend

	;DrawingMode(#PB_2DDrawing_AlphaBlend)
	;DrawText(#FX,#FY,#Text,#Draw|#ColFill,0)
	StopDrawing()
	
	
	StartVectorDrawing(ImageVectorOutput(0))
	; Work in process (recognizing the best places for the snow should be optimized)
	
	x=0
	y=0
	z=0
	While x<#WX
		;Debug Str(x)+": "+Str(snow(x))
		y=Snow(x)
		If y
			If z=0
				a=x
				b=y
				z=1
			ElseIf Abs(b-y)>5
				Snowcloud(a-1,Snow((a+x)/2),x-a+2,5)
				z=0
			EndIf
		Else
			If a>0
				Snowcloud(a-1,Snow((a+x)/2),x-a+2,5)
				a=0
			EndIf
			z=0
		EndIf
		x+1
	Wend



	StopVectorDrawing()


EndProcedure
Procedure Main()

	Init()
	Snowstorm()

	StartDrawing(CanvasOutput(0))
	DrawImage(ImageID(0),0,0)
	;DrawAlphaImage(ImageID(0),1,1)
	StopDrawing()

	Repeat
		Select WaitWindowEvent()
		Case #PB_Event_CloseWindow,#WM_CHAR
			End
		EndSelect
	ForEver

EndProcedure
Main()

Re: Merry Christmas!

Posted: Fri Dec 27, 2019 8:23 pm
by Kurzer
Better late than never: :lol:

I wish you all a merry christmas (or rather that you had a merry christmas) and as a precaution a happy new year right after. :-)

Kurzer

@Michael Vogel: Nice Code, thank you! On a display with > 96 dpi resolution the constant #WX have to be adjustet. Otherwise the text is not displayed fully. ;-)

Re: Merry Christmas!

Posted: Sat Dec 28, 2019 12:25 am
by VB6_to_PBx
Michael Vogel ,

remarkable effect for such a small amount of Code !

Merry Christmas !!!

Re: Merry Christmas!

Posted: Sun Dec 29, 2019 3:29 pm
by Fred
Merry Christmas everybody !!