Drawing pictures in CGI

Discussions related to Visual Prolog
vjoer
VIP Member
Posts: 57
Joined: 7 Feb 2006 13:42

Drawing pictures in CGI

Unread post by vjoer » 13 Jan 2010 20:55

Hello

I am using picturecanvas to draw pictures in memory.
However this does not work when my code is running as CGI executable.

I get the following error:

======================================== Dump: 2010/01/13 22:34:19 ---------------------------------------- Exception: notYetHandledError (com/visual-prolog/exception/runtime_exception) A runtime exception occurred. The runtime_exception handler does not recognize this exception. Parameters: error code = 6306 raised() (ID=6306) 2010/01/13 22:34:19 ThreadId=1160 Module: com/visual-prolog/exception/runtime_exception $JustDate: 2006-08-25 $$Revision: 2 $ Additional information: Unknown Error...C:\Program Files\Visual Prolog 7.0\pfc\gui\pictureCanvas.pro(41) C:\Program Files\Visual Prolog 7.0\pfc\gui\pictureCanvas.pro(38)

Could you advise on how to draw pictures under CGI?

Thanks
Viorel Farcas

User avatar
Thomas Linder Puls
VIP Member
Posts: 2447
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 13 Jan 2010 22:25

VPI is actually only made for use in GUI programs

However in Vip7.2 there is a predicate vpi::init() which will initialize vpi. We introduced it in order to use modal dialogs in console programs. Maybe calling that predicate may also make it possible to work with pictures in CGI programs. But maybe it wont (to be honest I don't know exactly what will and will not work).
Regards Thomas Linder Puls
PDC

vjoer
VIP Member
Posts: 57
Joined: 7 Feb 2006 13:42

Unread post by vjoer » 14 Jan 2010 8:50

I dont even have 7.2 . :(

Regards
Viorel Farcas

Paul Cerkez
VIP Member
Posts: 388
Joined: 6 Mar 2000 0:01

Unread post by Paul Cerkez » 14 Jan 2010 12:43

Thomas,
that is very interesting, I thought the VPI could only be used in a GUI application. I did not know about being able to initiate it in a console application.

If I initiate it, will it allow me to open a JPG or BMP file into a DIB memory space so I can access the bit structures with the VPI predicates? (If so, that will solve a minor problem I am having with JPG files in my console app).

thanks
AI Rules!
P.

User avatar
Thomas Linder Puls
VIP Member
Posts: 2447
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 14 Jan 2010 19:48

Actually it was in Vip 7.1 vpi::init/0 was intoduced.
Regards Thomas Linder Puls
PDC

Paul Cerkez
VIP Member
Posts: 388
Joined: 6 Mar 2000 0:01

Unread post by Paul Cerkez » 18 Jan 2010 18:51

one lesson learned (so far, and I may doing some thing wrong) using VPI in a console app:

vpi::pictLoad(Filename) crashes program if file is not a BMP.

A JPG yields a
"Exception: notYetHandledError ..."

A runtime exception occured. the run time_exception handler does not recognize this exception.

error code = 6101
ExtraInfo = Unknown Error.
consequently, only BMPs can be loaded

vpi::pictToBin returns a binary in BMP format and vpi::pictToBMP retruns a handle to a BMP. these will come in very handy if I can get the system to load a JPG.

if I convert all of the JPGs to BMPs before testing (very time consuming), then I don't need VPI and can simply use F = file::readbinary("0 - 1.BMP").


I do not what to display an image, I simply need access to the binary data that comes from a BMP format. if only BMP formats can be loaded, I have a slight problem as my source files for testing are JPGs.


Is there any more information about pictLoad() available, there was nothing on the wiki and the help only has one line.

thanks
P.

What I really need is to read in a JPG file, convert it to a BMP binary so I can work with it and be able to do this in a console app. again, no displaying of image required so I don't need all the GDI+ andpicture canvas support.
AI Rules!
P.

User avatar
Thomas Linder Puls
VIP Member
Posts: 2447
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 18 Jan 2010 22:32

As far as I recall VPI has never been able to handle jpg files. jpg, png, etc. is only handled using gdi_plus, as for example in the imageControl.
Regards Thomas Linder Puls
PDC

Paul Cerkez
VIP Member
Posts: 388
Joined: 6 Mar 2000 0:01

Unread post by Paul Cerkez » 18 Jan 2010 23:07

that's what I was afraid of.

thanks Thomas.

P>
AI Rules!
P.

User avatar
Thomas Linder Puls
VIP Member
Posts: 2447
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 19 Jan 2010 9:45

But if vpi works, then I would also imagine that gdiPlus_native, etc will also work.

By the way, one of the new things to come in Vip7.3 is a large object oriented gdiPlus package (i.e. not just native bindings).
Regards Thomas Linder Puls
PDC

Paul Cerkez
VIP Member
Posts: 388
Joined: 6 Mar 2000 0:01

Unread post by Paul Cerkez » 19 Jan 2010 16:10

I will try the gdi+ native and le tyou know.

new GDI+ package is a good thing ;-)
AI Rules!
P.

Post Reply