Working on an app that creates bitmaps and haven't run across how to set the buffer to the image created. Most literature and forum threads focus on loading a bitmap from a file directory and loading the buffer from that. How can I load the bitmap my app has drawn into the buffer?
B4X:
Dim Buffer() As Byte
Dim OutputStream1 As OutputStream
OutputStream1.InitializeToBytesArray(1000)
Buffer=? (That new bitmap the app has drawn)
OutputStream1.WriteBytes(Buffer, 0, Buffer.Length)
'write image to database ...
Dim bmp As B4XBitmap= ImageView1.Bitmap 'or your bitmap ...
Dim OutputStream1 As OutputStream
OutputStream1.InitializeToBytesArray(1000)
bmp.WriteToStream(OutputStream1, 90, "JPEG")
Dim Buffer() As Byte = OutputStream1.ToBytesArray
oSQL.ExecNonQuery2("INSERT INTO myTable VALUES (NULL, ?)", Array As Object(Buffer))
I looked through the posts (for example SQL Tutorial) and even find only statements pointing to transfer a bitmap file into a byte array (Dim Buffer() As Byte = File.ReadBytes(File.DirAssets, "smiley.gif")). But this is not I am looking for. 1st I need an b4x/b4a example how to transfer layout...