Xojo.Core.MemoryBlock.Constructor(other As MemoryBlock)

From Xojo Documentation

Revision as of 17:29, 11 August 2019 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Creates a new MemoryBlock with the data from an existing MemoryBlock.

Sample Code

Load image data into a MemoryBlock and then use that data to construct the image later:

Var f As Xojo.IO.FolderItem = Xojo.IO.SpecialFolder.GetResource("MyImage.JPG")

Var b As Xojo.IO.BinaryStream
b = Xojo.IO.BinaryStream.Open(f, BinaryStream.LockModes.Read)

Var mb As New Xojo.Core.MemoryBlock(b.Read(b.Length))


Var image As iOSImage
image = iOSImage.FromData(mb)

ImageView1.Image = image