Home

Add

Edit

Without Linenumbers

Code in Textfield

Download

  1. 
    
  2. 
    
  3. 
    
  4. '############################################################################################################################################
    
  5. Function ELISC_GFX_BMPLoad(V_FilePathName As String) As FB.Image Ptr
    
  6. If Dir(V_FilePathName, -1) = "" Then Return 0
    
  7. Dim XFN As Integer = Freefile()
    
  8. If Open(V_FilePathName For Binary Access Read As #XFN) <> 0 Then Return 0
    
  9. Dim TW As Integer
    
  10. Dim TH As Integer
    
  11. Get #XFN, 19, TW
    
  12. Get #XFN, 23, TH
    
  13. Close #XFN
    
  14. Dim TImg As FB.Image Ptr = Imagecreate(TW, Abs(TH), 32)
    
  15. If TImg = 0 Then Return 0
    
  16. Bload V_FilePathName, TImg
    
  17. Return TImg
    
  18. End Function
    
  19. 
    
  20. 
    
  21. 
    
  22. '############################################################################################################################################
    
  23. Function ELISC_GFX_DrawTextBlitter(V_SourcePix As Uinteger, V_DestPix As Uinteger, V_Param As Uinteger Ptr) As Uinteger
    
  24. If (V_SourcePix And &HFFFFFF) = &HFF00FF Then Return V_DestPix
    
  25. If (V_SourcePix And &HFFFFFF) = &H000000 Then Return V_DestPix
    
  26. Dim TA As Uinteger = V_SourcePix And &H0000FF
    
  27. Dim TDR As Uinteger = (V_DestPix And &HFF0000) Shr 16
    
  28. Dim TDG As Uinteger = (V_DestPix And &H00FF00) Shr 8
    
  29. Dim TDB As Uinteger = (V_DestPix And &H0000FF)
    
  30. Dim TPR As Uinteger = (*V_Param And &HFF0000) Shr 16
    
  31. Dim TPG As Uinteger = (*V_Param And &H00FF00) Shr 8
    
  32. Dim TPB As Uinteger = (*V_Param And &H0000FF)
    
  33. Dim TOut As Uinteger
    
  34. If TDR > TPR Then
    
  35.     TOut = TPR + (TDR - TPR) / 255 * (255 - TA)
    
  36. Else: TOut = TDR + (TPR - TDR) / 255 * TA
    
  37. End If
    
  38. TOut Shl= 8
    
  39. If TDG > TPG Then
    
  40.     TOut Or= TPG + (TDG - TPG) / 255 * (255 - TA)
    
  41. Else: TOut Or= TDG + (TPG - TDG) / 255 * TA
    
  42. End If
    
  43. TOut Shl= 8
    
  44. If TDB > TPB Then
    
  45.     TOut Or= TPB + (TDB - TPB) / 255 * (255 - TA)
    
  46. Else: TOut Or= TDB + (TPB - TDB) / 255 * TA
    
  47. End If
    
  48. Return TOut
    
  49. End Function
    
  50. 
    
  51. 
    
  52. 
    
  53. '############################################################################################################################################
    
  54. 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)
    
  55. 'MutexLock(ELISC_Mutex)
    
  56. Dim TW As Uinteger = V_Font->Width / 255
    
  57. Dim TPos As Uinteger = V_PosX + V_Width - 6 - (Len(V_Text) + 1) * TW
    
  58. For X As Uinteger = 1 To Len(V_Text)
    
  59.     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
    
  60. Next
    
  61. 'MutexUnLock(ELISC_Mutex)
    
  62. End Sub