From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA04932; Thu, 2 May 2002 14:36:33 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA04924 for ; Thu, 2 May 2002 14:36:32 +0200 (MET DST) Received: from moutng0.schlund.de (moutng0.kundenserver.de [212.227.126.170]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g42CaVD22422; Thu, 2 May 2002 14:36:31 +0200 (MET DST) Received: from [212.227.126.160] (helo=mrelayng0.kundenserver.de) by moutng0.schlund.de with esmtp (Exim 3.22 #2) id 173Fp0-0005cZ-00; Thu, 02 May 2002 14:36:30 +0200 Received: from [80.129.98.108] (helo=gate.gerd-stolpmann.de) by mrelayng0.kundenserver.de with asmtp (Exim 3.22 #2) id 173Fp0-000563-00; Thu, 02 May 2002 14:36:30 +0200 Received: from ice.gerd-stolpmann.de (ice.gerd-stolpmann.de [192.168.0.13]) by gate.gerd-stolpmann.de (Postfix) with ESMTP id D35D9CCCF; Thu, 2 May 2002 14:36:28 +0200 (CEST) Received: from ice (localhost [127.0.0.1]) by ice.gerd-stolpmann.de (Postfix) with ESMTP id C1ED81AD70; Thu, 2 May 2002 14:36:27 +0200 (MEST) Date: Thu, 2 May 2002 14:36:27 +0200 From: Gerd Stolpmann To: "Jun P.FURUSE" Cc: Jose.deAbreuNunes@anthro.unige.ch, caml-list@inria.fr Subject: Re: [Caml-list] Graphics without open_graph? Message-ID: <20020502143627.A569@ice.gerd-stolpmann.de> References: <1020332791.483.46.camel@sophnee> <20020502.124404.115933918.Jun.Furuse@inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit In-Reply-To: <20020502.124404.115933918.Jun.Furuse@inria.fr>; from Jun.Furuse@inria.fr on Thu, May 02, 2002 at 12:44:04 +0200 X-Mailer: Balsa 1.2.4 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On 2002.05.02 12:44 Jun P.FURUSE wrote: > Hello, > > > I've written a caml-top program whose output includes graphics generated > > via Graphics module and camlimages. > > I'm making this program accessible through a web site and I would like > > to also include the graphic output. The problem is that the program will > > be running non-interactive under a non graphic environment. > > So the question is: would it be possible to use the same graphics code? > > what to adapt? > > I guess that you want to use drawing functions (lines, circles...) > available inside Graphics, without opening the graphic window, and > obtain results as some graphic file format. > > If my guess is correct, unfortunatelly, the drawing function of the > Graphics library highly depends on those of the window system (X on > Unix, for example). Using these functions without windowing systems is > impossible at this moment. I suppose it will never be possible, because the drawing functions simply call the drawing primitives of the windowing system. One way out would be a virtual X11 server that is not connected to any hardware device but has a "screen" that only exists in memory (e.g. http://www.xfree.org/4.2.0/Xvfb.1.html). A quick test shows that it really works: $ Xvfb :1 -screen 0 32x32x8 -nolisten tcp -ac & $ ocaml Objective Caml version 3.04 # #load "graphics.cma";; # open Graphics;; # open_graph ":1 50x50";; - : unit = () # fill_circle 25 25 25;; - : unit = () # let img = get_image 0 0 50 50;; val img : Graphics.image = # dump_image img;; - : Graphics.color array array = [|[|16777215; 16777215; ... |]|] Note that the window is even bigger (50x50 pixels) than the server screen (32x32 pixels). The memory requirements of the virtual server seem to be moderate, but I don't know what happens in the long turn. Maybe this is an option for you. Gerd -- ---------------------------------------------------------------------------- Gerd Stolpmann Telefon: +49 6151 997705 (privat) Viktoriastr. 45 64293 Darmstadt EMail: gerd@gerd-stolpmann.de Germany ---------------------------------------------------------------------------- ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners