Page 1 of 1

Reading and using various image files

Posted: 3 Jul 2016 17:49
by Ferenc Nagy
Kari,
You have sent me an answer how can I save screen pictures image files in small formats like JPG, PNG.
How can I read such files for the simple windowGDI instead of complicated gdiPlus? I'd like to display them add some more rectangles, polygons and circles to them then save the result.
In general, is it allowed to mix wdowGDi and gdiPlus graphica prdicates for the same rectangle of a window?

Posted: 4 Jul 2016 9:39
by drspro2
hi, maybe this is usefull, i have used this recently

first i load the image in GdiPlus (dont forget to initialize gdi)

Code: Select all

 trap(_Xpi = gdiplus_native::gdipLoadImageFromFile(Fn, Pict),_,fail),
-- then further on i use this to convert this image to normal vpi image
the normal pict should arrive in the Np

Code: Select all

_Wi = gdiplus_native::gdipGetImageWidth(Pict,Width),   _Hi = gdiplus_native::gdipGetImageHeight(Pict,Height),   Opp = Width * Height,  Opp < 900000,  % beveiliging   %786432   Pw = vpi::pictOpen(rct(0,0,Width,Height)),   HDC = vpi::winGetNativeGraphicContext(Pw, IsReleaseNeeded),   _ = gdiplus_native::gdipCreateFromHDC(HDC, Graphics), _Xpaqqq =  gdiplus_native::gdipDrawImage(Graphics,Pict,0,0),  Np = vpi::pictClose(Pw),