caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Graphics without open_graph?
@ 2002-05-02  9:46 José Manuel Nunes
  2002-05-02 10:44 ` Jun P.FURUSE
  0 siblings, 1 reply; 6+ messages in thread
From: José Manuel Nunes @ 2002-05-02  9:46 UTC (permalink / raw)
  To: caml list


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 believe this means to use Graphics without actually opening the
graphics window.
I "feel" this should be feasible but have no idea of how to do it. Am I
wrong?






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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] Graphics without open_graph?
  2002-05-02  9:46 [Caml-list] Graphics without open_graph? José Manuel Nunes
@ 2002-05-02 10:44 ` Jun P.FURUSE
  2002-05-02 12:36   ` Gerd Stolpmann
  0 siblings, 1 reply; 6+ messages in thread
From: Jun P.FURUSE @ 2002-05-02 10:44 UTC (permalink / raw)
  To: Jose.deAbreuNunes; +Cc: caml-list

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.

Jun
-------------------
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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] Graphics without open_graph?
  2002-05-02 10:44 ` Jun P.FURUSE
@ 2002-05-02 12:36   ` Gerd Stolpmann
  2002-05-02 15:19     ` José Manuel Nunes
  2002-05-02 22:13     ` Oliver Bandel
  0 siblings, 2 replies; 6+ messages in thread
From: Gerd Stolpmann @ 2002-05-02 12:36 UTC (permalink / raw)
  To: Jun P.FURUSE; +Cc: Jose.deAbreuNunes, caml-list


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 = <abstr>
# 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] Graphics without open_graph?
  2002-05-02 12:36   ` Gerd Stolpmann
@ 2002-05-02 15:19     ` José Manuel Nunes
  2002-05-02 22:13     ` Oliver Bandel
  1 sibling, 0 replies; 6+ messages in thread
From: José Manuel Nunes @ 2002-05-02 15:19 UTC (permalink / raw)
  To: caml list

On Thu, 2002-05-02 at 14:36, Gerd Stolpmann wrote:
> ...
> > 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.
> 
>...
> 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:
> 
Thanks a lot!
There is even a convenient script xvfb-run (at least on debian) that
allows a command to be run inside such a X virtual server.


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] Graphics without open_graph?
  2002-05-02 12:36   ` Gerd Stolpmann
  2002-05-02 15:19     ` José Manuel Nunes
@ 2002-05-02 22:13     ` Oliver Bandel
  2002-05-12 20:50       ` Pierre Weis
  1 sibling, 1 reply; 6+ messages in thread
From: Oliver Bandel @ 2002-05-02 22:13 UTC (permalink / raw)
  To: Gerd Stolpmann; +Cc: Jun P.FURUSE, Jose.deAbreuNunes, caml-list


On Thu, 2 May 2002, Gerd Stolpmann wrote:

> 
> 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.

That is not correct: The Graphics-Library is independent
of X11. It's especially designed to be independent and
therefore provides a platform-independent graphic.
And that's the reason, why the set of available functions
is limited to a small subset.
This then can be used on Unix-, Windows-, Mac-Systems.
No X11 (or X11-emulators) is (are) required.

But on unix-systems it maybe is only available
on X11 right now.



> 
> I suppose it will never be possible, because the drawing functions simply
> call the drawing primitives of the windowing system. 

Interesting in the Graphics-Lib is, that the names of the
graphics-functions are the same as in PostScript.
It would be nice to have the possibility to directly
write PostScript-Files with that Library too. :)

Ciao,
   Oliver

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] Graphics without open_graph?
  2002-05-02 22:13     ` Oliver Bandel
@ 2002-05-12 20:50       ` Pierre Weis
  0 siblings, 0 replies; 6+ messages in thread
From: Pierre Weis @ 2002-05-12 20:50 UTC (permalink / raw)
  To: Oliver Bandel; +Cc: info, Jun.Furuse, Jose.deAbreuNunes, caml-list

> Interesting in the Graphics-Lib is, that the names of the
> graphics-functions are the same as in PostScript.
> It would be nice to have the possibility to directly
> write PostScript-Files with that Library too. :)
> 
> Ciao,
>    Oliver

Hi,

This possibility exists since 1 or 2 years with the Graphps module
which is distributed in the Caml bazar.

Furthermore this library has a (tiny) website of its own!
(Have a look to http://pauillac.inria.fr/graphps/)

It is fully documented and can be used as a replacement of the
Graphics module; then your program will generate a postscript (or
encapsulated postscript file) instead of drawing on the screen.

Get the library at the used place, file graphps-1.0.tgz:

ftp.inria.fr/lang/caml-light/bazar-ocaml/

(Caml Light users may find it in .../bazar-cl/graphps/graphps-1.0.tgz)

Hence, with Graphps, a program using the Graphics library not only can
work without any window manager, but it can even work on a computer
without screen! (Not a crazy idea by the way: I've done it once to
generate images from home, telneting on an INRIA destop that was
running a program using graphps :)

The library is mature, but any new idea, remark, enhancement, or, even
better, any code contribution is warmly welcomed.

Enjoy!

PS: Sorry for the late answer, I don't have time to read the Caml-list
these days!

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-05-12 20:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-02  9:46 [Caml-list] Graphics without open_graph? José Manuel Nunes
2002-05-02 10:44 ` Jun P.FURUSE
2002-05-02 12:36   ` Gerd Stolpmann
2002-05-02 15:19     ` José Manuel Nunes
2002-05-02 22:13     ` Oliver Bandel
2002-05-12 20:50       ` Pierre Weis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).