Available in the LEADTOOLS Imaging toolkit. |
CreateUserBitmap example for Visual Basic
' allocate memory for a 640x480x24 bpp image
Dim lDataSize As Long
Dim BitmapData(640# * 480 * 24 / 8) As Byte
lDataSize = 640# * 480 * 24 / 8
' make sure I am using pixels
LEAD1.ScaleMode = 3
' Create the user bitmap
LEAD1.CreateUserBitmap 640, 480, 24, Empty, 0
' fill the bitmap data with gray
For i = 0 To lDataSize - 1
BitmapData(i) = 128 ' gray
Next
' set the bitmap data pointer
LEAD1.SetBitmapDataPointer BitmapData, lDataSize
' save the bitmap
LEAD1.Save "c:\gray.jpg", FILE_JPEG, 0, 25, SAVE_OVERWRITE
' reset the bitmap data pointer, because the BitmapData array
' will be freed when we exit this function
LEAD1.SetBitmapDataPointer Empty, 0
End Sub
Private Sub Command2_Click()
LEAD1.Load "c:\gray.jpg", 0, 0, 1
End Sub