Reading and using various image files

Discussions related to Visual Prolog
User avatar
Ferenc Nagy
VIP Member
Posts: 289
Joined: 24 Apr 2007 12:26

Reading and using various image files

Unread post by Ferenc Nagy » 3 Jul 2016 17:49

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?
TIA, Regards,
Frank Nagy

drspro2
VIP Member
Posts: 78
Joined: 28 Apr 2006 12:03

Unread post by drspro2 » 4 Jul 2016 9:39

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),

Post Reply