Ultra FastImage for Blitz3D

Blitz3D Forums/Blitz3D Userlibs/Ultra FastImage for Blitz3D

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I like this Ultra FastImage DLL
and I also made a small programm that creates the Files automaticaly.
Blitz3D saves only .bmp Files not .png, you must give them
after creation an alphamap with e.g. "The Gimp" or other graphic programms and save them as .png

; Creates a  Fontname_Fontsize_Table.txt  and
;creates a Fontname_nT.bmp File, Blitz3D only can save .bmp files,  you can name them .png and the most Graphicprogramms load them, but it ist anyway a .bmp file.
;You can load the .bmp file with e.g. "The Gimp" and give them an Alphamap.  Transparency Color $000000
;Or with e.g. "The Gimp" You can mask the white Fontcolor before and give them other colors or a Bumpmap  or make other nice operations with.

Const FontSZ = 16  ;Fontsize
Global Fname$ = "Comic Sans MS"  ;Fontname
Global FrameSZ = 16   ;Some Fonts are a little bit smaller than the real size    if the Fontsize e.g. = 66 you can try if 64 brings good results anyway.

wdt  = 2

Repeat
	If FrameSZ <= wdt
		Exit
	Else
		wdt = wdt * 2
	EndIf
Forever

Graphics3D 16*wdt, 16*wdt, 0, 2
SetBuffer BackBuffer()

;fontLE01 = LoadFont("Square721 BT",FontSZ)
fontLE01 = LoadFont(Fname$,FontSZ,0)
SetFont fontLE01

f=WriteFile (Fname$ + "_" + FontSZ + "_Table.txt")

WriteLine f,";"+ Fname$ +" "+ FontSZ+ "PT"
WriteLine f,"AnimTexture = " + Fname$ + ".png"  ;<------- make a PNG with TransparentColor $000000 (Black) from the .BMP File
WriteLine f,"AnimTextureFlags = 2"
WriteLine f,"FrameWidth = " + wdt
WriteLine f,"FrameHeight = " + wdt
WriteLine f,"FrameCount = 256"
WriteLine f,""
WriteLine f,"Width = " + FontSZ
WriteLine f,"Height = " + FontSZ
WriteLine f,"FirstChar = 0"
WriteLine f,"Kerning = 0"


If f<>0 Then
	For i=0 To 255
		WriteLine f,Str(i)+" = "+StringWidth(Chr(i)) 
	Next
	CloseFile f
EndIf



While Not KeyDown(1)
	For i = 1 To 255
		z = z + 1
		If z = 16
			x1 = 0
			y = y + wdt
			z = 0
		EndIf
		x1 = x1 + wdt
		x = x1 - wdt
		RenderWorld
		Color 255,255,255
		y2 = y-0   ; y-2 moves the font 2 Pixel upwards
		Text x,y2,Chr$(i)
		Flip
	Next
    SaveBuffer FrontBuffer(), Fname$ +"_nT"+".bmp"  ;"_nT" for  "not transparent"  make .png File with transparent Color $000000 with e.g. "The Gimp"
	Exit
Wend
WaitKey()
End