a vpi Picture to a gdi+ Image:
Code: Select all
gpPictToImage(Pict,Image):-
PictBin = vpi::pictToBin(Pict),
MemSize = binary::getSize(PictBin),
HGlobal = util::globalAlloc(0x0042,MemSize),
% GMEM_MOVEABLE + GMEM_ZEROINIT = 0x0002 + 0x0040
Pointer = util::globalLock(HGlobal),
PointerBin = uncheckedConvert(pointer,PictBin),
memory::copy(Pointer,PointerBin,MemSize),
_ = createStreamOnHGlobal(HGlobal,b_true,Stream), % b_true = DeleteOnRelease
_ = gdip::gdipLoadImageFromStream(Stream,Image).
of the same name.
I have yet to find a way to convert the other way round, i.e. from
Image to Picture (other than saving the Image as a file and reading
the file using vpi).
Chan Bok
Axon Research