I am looking for VB6 code that will decompress a 24-bit tga file if anyone has it can you please post it.
Thought I told someone you can find it on Google, because, I know I did!
Private Function DecompressTGA(RLEStream() As Byte, Bits As Long, Höhe As Long, Breite As Long) As Byte()
Dim InitSize As Long
Dim Temp() As Byte
Dim n As Long
Dim K As Boolean
Dim B As Long
Dim l As Long
Dim fertig As Long
Dim z As Long
Dim Länge As Long
Dim Byteanzahl As Long
Byteanzahl = Bits / 8
InitSize = CLng(Höhe * Breite * Byteanzahl)
ReDim Temp(0 To InitSize)
Do While fertig < InitSize
If l > UBound(RLEStream) Then GoTo Ende
z = 0
If RLEStream(l) > 127 Then
n = RLEStream(l) - 127
For B = 0 To n - 1
CopyMemory Temp(fertig), RLEStream(l + 1), Byteanzahl
fertig = fertig + Byteanzahl
Next B
K = True
Else
n = RLEStream(l) + 1
Länge = n * Byteanzahl
CopyMemory Temp(fertig), RLEStream(l + 1), Länge
K = False
z = z + Länge
fertig = fertig + z
End If
If K = True Then
l = Byteanzahl + 1 + l
n = z + (n * Byteanzahl) + 1
Else
l = (n * Byteanzahl + 1) + l
n = z + n
End If
Loop
Ende:
DecompressTGA = Temp
End Function
Hah thanks I looked and couldn't find anything, I guess my google searching skills are bad.
For the people wanting to use this:
Höhe is Height.
Breite is Width.
Fertig is Finished.
Länge is Length.
Byteanzahl is actually byte amount.