'############################################################################################################################################
Function ELISC_GFX_BMPLoad(V_FilePathName As String) As FB.Image Ptr
If Dir(V_FilePathName, -1) = "" Then Return 0
Dim XFN As Integer = Freefile()
If Open(V_FilePathName For Binary Access Read As #XFN) <> 0 Then Return 0
Dim TW As Integer
Dim TH As Integer
Get #XFN, 19, TW
Get #XFN, 23, TH
Close #XFN
Dim TImg As FB.Image Ptr = Imagecreate(TW, Abs(TH), 32)
If TImg = 0 Then Return 0
Bload V_FilePathName, TImg
Return TImg
End Function
'############################################################################################################################################
Function ELISC_GFX_DrawTextBlitter(V_SourcePix As Uinteger, V_DestPix As Uinteger, V_Param As Uinteger Ptr) As Uinteger
If (V_SourcePix And &HFFFFFF) = &HFF00FF Then Return V_DestPix
If (V_SourcePix And &HFFFFFF) = &H000000 Then Return V_DestPix
Dim TA As Uinteger = V_SourcePix And &H0000FF
Dim TDR As Uinteger = (V_DestPix And &HFF0000) Shr 16
Dim TDG As Uinteger = (V_DestPix And &H00FF00) Shr 8
Dim TDB As Uinteger = (V_DestPix And &H0000FF)
Dim TPR As Uinteger = (*V_Param And &HFF0000) Shr 16
Dim TPG As Uinteger = (*V_Param And &H00FF00) Shr 8
Dim TPB As Uinteger = (*V_Param And &H0000FF)
Dim TOut As Uinteger
If TDR > TPR Then
TOut = TPR + (TDR - TPR) / 255 * (255 - TA)
Else: TOut = TDR + (TPR - TDR) / 255 * TA
End If
TOut Shl= 8
If TDG > TPG Then
TOut Or= TPG + (TDG - TPG) / 255 * (255 - TA)
Else: TOut Or= TDG + (TPG - TDG) / 255 * TA
End If
TOut Shl= 8
If TDB > TPB Then
TOut Or= TPB + (TDB - TPB) / 255 * (255 - TA)
Else: TOut Or= TDB + (TPB - TDB) / 255 * TA
End If
Return TOut
End Function
'############################################################################################################################################
Sub ELISC_GFX_DrawText(V_Img As Any Ptr, V_Font As FB.Image Ptr, V_PosX As Uinteger, V_PosY As Uinteger, V_Width As Uinteger, V_Text As String, V_ColText As Uinteger)
'MutexLock(ELISC_Mutex)
Dim TW As Uinteger = V_Font->Width / 255
Dim TPos As Uinteger = V_PosX + V_Width - 6 - (Len(V_Text) + 1) * TW
For X As Uinteger = 1 To Len(V_Text)
Put Cast(Any Ptr, V_Img), (TPos + (X * TW), V_PosY), Cast(Any Ptr, V_Font), (V_Text[X - 1] * TW, 0)-((V_Text[X - 1] + 1) * TW , V_Font->height), Custom, @ELISC_GFX_DrawTextBlitter, @V_ColText
Next
'MutexUnLock(ELISC_Mutex)
End Sub