However Canvas.DrawBitmap works fine.
I've even tried rewriting the DrawText line without using any of the variables, and I get the same result.
I've even tried rewriting the DrawText line without using any of the variables, and I get the same result.
B4X:
public Sub DrawHTML(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int)
Dim tempX As Int = X, temp As Int, Info As TextInfo, NeedsClip As Boolean = Width > 0 And Height > 0, Image As ImageInfo, tempX2 As Int, tempY2 As Int, Alignment As String
If Not(WasSplit) Then
If Width > 0 Then WordWrapHTML(BG, Width)
else If LineHeight = 0 Then
CalculateHTMLSize(BG, False)
End If
If NeedsClip Then MakeClipPath(BG,X,Y,Width,Height)
Y = Y - StartY
For temp = 0 To ParsedHTML.Size-1
Info = ParsedHTML.Get(temp)
If Info.Align > 0 Then
Select Case Info.Align
Case 7,4,1
Alignment = "LEFT"
tempX2 = X
Case 8,5,2
Alignment = "CENTER"
tempX2 = X + Width * 0.5 - Info.Width * 0.5
Case 9,6,3
Alignment = "RIGHT"
tempX2 = X + Width - Info.Width
End Select
Select Case Info.Align
Case 7,8,9'top
tempY2 = Y + Info.LineHeight
Case 4,5,6'middle
tempY2 = Y + LineHeight * 0.5 - Info.LineHeight * 0.5
Case 1,2,3'bottom
tempY2 = Y + LineHeight - (Info.Height - Info.LineHeight)
End Select
BG.DrawText(Info.Text, tempX2, tempY2, Info.Font, Info.Size, Info.Color, Alignment)
Else
Select Case Info.Align
Case TAG_CRLF, TAG_CRLF_Natural
Y = Y + LineHeight
X = tempX
Case TAG_IMG
Image = Images.Get(Info.Size)
BG.DrawBitmap(Image.BMP, Null, SetRect(X, Y, Info.Width, Info.Height))
X = X + Info.Width
End Select
End If
Next
If NeedsClip Then BG.RemoveClip
End Sub