[4.61B3] Unsharp font when using AlphaBlend

Just starting out? Need help? Post your questions and find answers here.
User avatar
Michael Vogel
Addict
Addict
Posts: 2797
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: [4.61B3] Unsharp font when using AlphaBlend

Post by Michael Vogel »

I still get weird results when using AlphaBlend with the new beta.

The image seen in the latest posting was done with windows XP. When using W7 the text results are blurry, which has been the reason for starting this thread. There was also another trhead available facing the second issue with some comments from freak, but thread #41044 seems to be unavailable now.
User avatar
Michael Vogel
Addict
Addict
Posts: 2797
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: [4.61B3] Unsharp font when using AlphaBlend

Post by Michael Vogel »

As there is a workaround to get a smoother text (which needs a little more cpu power) by using larger fonts I would need to know the font size which is used by default for all gadgets - is there a simple command available like GetGadgetFont()to get the point size?

The following example shows text smoothing by setting the constant #Smooth equals 1:

Code: Select all

#Smooth=0
#Button=64

Procedure CreateButtonText(n,size,Text.s)

	#NoTransparency=$ff000000

	size<<#Smooth
	CreateImage(n,size,size,32|#PB_Image_Transparent)

	StartDrawing(ImageOutput(n))

	DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
	DrawingFont(FontID(0))
	DrawText((size-TextWidth(Text))>>1,(size-TextHeight("Wg"))>>1,Text,#NoTransparency|#Black)
	StopDrawing()

	size>>#Smooth
	ResizeImage(n,size,size)

EndProcedure
Procedure Main()

	WinID=OpenWindow(0,0,0,#Button<<2,#Button,"ABCD",#PB_Window_ScreenCentered|#PB_Window_Invisible|#PB_Window_SystemMenu)
	LoadFont(0,"Trebuchet MS",MulDiv_(#Button,4,5))

	For i=0 To 3
		CreateButtonText(i,#Button,Mid("ABCD",i+1,1))
		ButtonImageGadget(i,i*#Button,0,#Button,#Button,ImageID(i))
	Next i

	HideWindow(0,0)

	quit=0
	Repeat
		Select WaitWindowEvent()
		Case #WM_CHAR,#PB_Event_CloseWindow
			quit=1
		EndSelect
	Until quit

EndProcedure
Main()
Post Reply