DecodeABIC Example for Visual Basic
Private Sub DecodeAbic_Click()
Dim RasterIO As New LEADRasterIO
Dim InputData As New LEADRasterVariant
Dim OutputData As New LEADRasterVariant
Dim FileSize As Long
Dim FileName As String
Dim Data() As Byte
Dim i As Long
Dim BmpInfo As BITMAPINFO
Dim BmpFileHeader As BITMAPFILEHEADER
Dim BmpData As Byte
LEADRasterView1.Raster.UnlockSupport L_SUPPORT_ABIC_READ, L_KEY_ABIC_READ
FileName = "c:\Image2Raw.ica"
FileSize = FileLen(FileName)
ReDim Data(FileSize) As Byte
Open FileName For Binary Access Read As #1
Get #1, , Data
Close #1
InputData.vType = VALUE_ARRAY_BYTE
InputData.ItemCount = FileSize
For i = 0 To FileSize – 1
InputData.ShortItemValue(i) = Data(i)
Next i
RasterIO.DecodeABIC InputData, OutputData, 4, 472, 221, False
BmpInfo.bmiHeader.biSize = Len(BmpInfo.bmiHeader)
BmpInfo.bmiHeader.biWidth = 472
BmpInfo.bmiHeader.biHeight = 221
BmpInfo.bmiHeader.biBitCount = 4
BmpFileHeader.bfType = Asc("B") + (Asc("M") * 2 ^ 8)
BmpFileHeader.bfSize = Len(BmpInfo) + Len(BmpFileHeader) + OutputData.ItemCount
BmpFileHeader.bfReserved1 = 0
BmpFileHeader.bfReserved2 = 0
BmpFileHeader.bfOffBits = Len(BmpInfo) + Len(BmpFileHeader)
For i = 0 To 15
BmpInfo.bmiColors(i).rgbBlue = &H11 * i
BmpInfo.bmiColors(i).rgbRed = &H11 * i
BmpInfo.bmiColors(i).rgbGreen = &H11 * i
BmpInfo.bmiColors(i).rgbReserved = 0
Next u
Open "c:\Abic.bmp" For Binary Access Write As #1
Put #1, , BmpFileHeader
Put #1, , BmpInfo
For i = 0 To OutputData.ItemCount – 1
BmpData = OutputData.ShortItemValue(i)
Put #1, , BmpData
Next i
Close #1
End Sub