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

Reading and using various image files

Unread post by Ferenc Nagy »

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
VIP Member
Posts: 75
Joined: 28 Apr 2006 12:03

Unread post 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),
Post Reply