<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/07/255fe226601684ba4b1d93c50a9288f3"
  from="Matt Gushee &lt;matt@g...&gt;"
  author="Matt Gushee"
  date="2003-07-26T04:21:52"
  subject="Re: [Caml-list] Graphics frustration"
  prev="2003/07/7a76aad66f95ddba57904fe884fec3da"
  next="2003/07/4ba9587cab5f586022bd05fe430dfdd2"
  prev-in-thread="2003/07/7641ec02def276cf16d1a0b8ad7516ee"
  next-in-thread="2003/07/4ba9587cab5f586022bd05fe430dfdd2"
  prev-thread="2003/07/f90a8a17360dae1f3d044706aa82754d"
  next-thread="2003/07/3b506b7bfe65dffafe21cc955de37f7a"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Graphics frustration">
<msg 
  url="2003/07/d9552a523f855e9aec83425fe88835cb"
  from="Matt Gushee &lt;mgushee@h...&gt;"
  author="Matt Gushee"
  date="2003-07-24T04:20:09"
  subject="[Caml-list] Graphics frustration">
<msg 
  url="2003/07/7641ec02def276cf16d1a0b8ad7516ee"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-07-24T12:03:04"
  subject="Re: [Caml-list] Graphics frustration">
<msg 
  url="2003/07/255fe226601684ba4b1d93c50a9288f3"
  from="Matt Gushee &lt;matt@g...&gt;"
  author="Matt Gushee"
  date="2003-07-26T04:21:52"
  subject="Re: [Caml-list] Graphics frustration">
<msg 
  url="2003/07/4ba9587cab5f586022bd05fe430dfdd2"
  from="Alexander V. Voinov &lt;avv@q...&gt;"
  author="Alexander V. Voinov"
  date="2003-07-26T04:34:27"
  subject="Re: [Caml-list] Graphics frustration">
</msg>
</msg>
</msg>
<msg 
  url="2003/07/bc3f5ef6632a216f6fee0f24d33bb3f5"
  from="SooHyoung Oh &lt;shoh@d...&gt;"
  author="SooHyoung Oh"
  date="2003-07-26T01:37:22"
  subject="Re: [Caml-list] Graphics frustration">
<msg 
  url="2003/07/7a76aad66f95ddba57904fe884fec3da"
  from="SooHyoung Oh &lt;shoh@d...&gt;"
  author="SooHyoung Oh"
  date="2003-07-26T01:55:17"
  subject="Re: [Caml-list] Graphics frustration">
</msg>
<msg 
  url="2003/07/0c8511a24573c54fb82b2c72c5bb14b8"
  from="Nicolas Janin &lt;Ninja40@i...&gt;"
  author="Nicolas Janin"
  date="2003-07-26T08:45:18"
  subject="[Caml-list] Re: Graphic frustration">
</msg>
<msg 
  url="2003/07/f88eddb20d9f236f8dd7a6520934210a"
  from="Nicolas Janin &lt;Ninja40@i...&gt;"
  author="Nicolas Janin"
  date="2003-07-26T08:58:25"
  subject="[Caml-list] Re: ">
</msg>
</msg>
</msg>
</thread>

<contents>
First of all, thanks to all who responded. And I have a few responses
for the respondents. First, though, one general remark: although I am
certainly interested in practical solutions to my current problem, in
this instance I was trying to draw attention to what I see as a weak
point in the selection of available libraries. Graphics are a common
need, and I think better graphics libraries would help the popularity of
OCaml.


On Thu, Jul 24, 2003 at 11:22:03AM +0200, Olivier Andrieu wrote:
&gt;  Matt Gushee [Wednesday 23 July 2003] :
&gt;  &gt; So that's a quick summary of my situation. Do others agree with me that
&gt;  &gt; this is a significant problem? Are there any good solutions in the
&gt;  &gt; works?
&gt; 
&gt; I agree with you that libplot isn't fully satisfactory. I haven't much
&gt; to suggest, though. GD seems to have all the features you need 

I agree. However ...

&gt; (but I
&gt; don't know the state of the ocaml wrapper).

That's the problem. It's far from being a complete GD interface. And
I've contacted its author, and he doesn't expect to continue developing
it. I may see if I can hack in the remaining functionality myself, but
with my minimal C knowledge I'm not optimistic about that.

&gt; One solution I've been
&gt; thinking about is using libart together with Camlimages. Libart is a
&gt; library for rendering vector graphics (e.g. bezier paths) in
&gt; anti-aliased pixel buffers. It's written by the Ghostscipt maintainer
&gt; I think. It seems very good but it doesn't handle text rendering nor
&gt; saving pixel buffers to file. But I think it should be possible to
&gt; interface it with Camlimages : libart would do the primitives
&gt; rendering and camlimages the text rendering and saving.

Interesting idea. I'd like to know if you do that. By the way, what in
particular do you like about libart?

&gt; Writing a C wrapper seems the easiest and quicker way to do what you
&gt; want though ...

I agree, and I actually would like to learn C. But there is so much to
learn, and so little time to learn it ...


On Thu, Jul 24, 2003 at 01:03:01PM +0100, Richard Jones wrote:
&gt; I did something like this in C++ an eon ago. The program generated
&gt; Postscript directly and piped it into Ghostscript to render it into
&gt; the appropriate format. Postscript is a very powerful language for
&gt; this sort of thing once you get used to it.

Well, I'm reasonably comfortable with PS, and that's pretty much the
approach I'm taking already: as I explained, draw with MLgraph, convert
with Camlimages (which uses Ghostscript to load PS). But the problem I'm
having there is that the antialiasing in the output is unsatisfactory.
If I use Camlimages out-of-the-box, there is no antialiasing, and curves
come out looking horribly jagged. On the other hand, if I hack the
Camlimages source such that Ghostscript is called with
-dGraphicsAlphaBits=4, curves look fine, but vertical and horizontal
lines look blurred and semi-transparent. I've also tried converting the
Postscript with ImageMagick, with results very similar to the latter. So
I'm afraid the root cause may be a limitation of Ghostscript, though I
haven't thoroughly investigated yet.


On Thu, Jul 24, 2003 at 02:25:38PM +0200, Daniel Bünzli wrote:
&gt; Dear Matt,
&gt; 
&gt; Did you consider using OpenGL ?

What an appalling thought!

:-)

Seriously, though, I might end up doing this--when push comes to shove I
care more about making things work than about doing them 'correctly.'
Still, as a general solution to the problem of generating 2D raster
graphics, OpenGL strikes me as being an ugly (and perhaps inefficient?)
approach. But I don't understand OpenGL very well, and perhaps I'd
change my mind if I did.

&gt; But it seems that the FreeType library can give you antialiased pixmaps 
&gt; of given fonts and that CamlImages provides an inteface to the FreeType 
&gt; library (never used that however). So maybe you can make both of them 
&gt; interact smoothly. So I suggest you (though I'm completly misinformed) 
&gt; CamlImages+lablGL.

May be worth trying. How mature and stable is lablGL? I would have to
learn OpenGL, and since I don't have much interest in OpenGL per se,
before I take the time to learn it, I'd like to have some assurance that
it is in fact a reliable means for producing high-quality 2D bitmaps.


On Sat, Jul 26, 2003 at 10:37:20AM +0900, SooHyoung Oh wrote:
&gt; 
&gt; What do you think about SVG (Selective Vector Graphics)?

I'm very interested in SVG, but it's not an appropriate solution in this
case. This is a front-end Web application, and I specifically intend it
to render graphics in a form that is viewable with any mainstream
browser--i.e., PNG, JPEG, and/or GIF. I think it will be several years
before we can reasonably expect clients to have built-in SVG support.

&gt; It uses only text for graphics as postscript so it's not difficult to use
&gt; OCaml for SVG.
&gt; If you interested about that, I'll send you a few examples.

If you mean examples of SVG images, I probably have enough already. But
if you have written code for generating or processing SVG, I would be
interested in seeing what you've done.


On Sat, Jul 26, 2003 at 10:55:19AM +0900, SooHyoung Oh wrote:
&gt; 
&gt; SVG (Scalable Vector Graphics)
&gt; 
&gt; sorry...

No worries. There are so many acronyms floating around these days, I
would be a little scared of someone who could remember them all
correctly.

-- 
Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee@havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)

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

</contents>

</message>

