|Newbie questions about Pliant
On drawing graphs on Web sites
|Message posted by marcus on 2003/09/29 18:28:49
|A pliant http server currently hosts the Web site of the Ion Storm project at the
Centre for Atmosphere and Space Science at the Utah State University.
A friend of mine, one of the researchers involved in the project, is currently
interested in hosting pages with graphs that are built on-the-fly. Something along
the lines of what the gd library does.
The gd library creates jpeg and other image formats on the fly. See
Question: Do we have such functionality in the graphic tools in the current
release? If not, would we have it in the future?
|Message posted by hubert.tonneau on 2003/09/29 18:52:53
|Yes, we do have a very very powerfull bitmap library in Pliant,
and it's very well interfaced with the HTTP server.
Just try the following code in a .page:
var Link:ImagePixmap img :> new ImagePixmap
img setup (image_prototype 0 0 100 100 256 256 color_gamut:"rgb") ""
for (var Int y) 0 255
for (var Int x) 0 255
(img pixel x y) map ColorRGB888 := color rgb x y 0
draw img position # position option means display the cursor position in the status bar
# this bloc is optional and will be called if the user clics in the image or select an area in the image
# ... provided his browser is resonably working
selected (var Float x0) (var Float y0) (var Float x1) (var Float y1) # get the selected area
text "you selected area "+string:x0+" "+string:y0+" "+string:x1+" "+string:y1
|Message posted by marcus on 2003/09/29 19:21:35
|Message posted by hubert.tonneau on 2003/09/30 00:20:56
|The vector drawing library is under construction.
It should be stable in a fiew monthes.
|Message posted by maybe Marcus on 2003/10/01 16:28:54
Would it be possible to use the functions that handle server-side rendered
fonts to put text on a location (x,y) on an image? Any hints on how to do that?
|Message posted by hubert.tonneau on 2003/10/01 17:13:33
|The module for loading fonts and drawing text is /pliant/graphic/vector/font.pli
also it's the low level engine.
A sample usage of it is in function 'draw_text' in module
Also, I would not recommend using it right now (as opposed to the bitmap
interface) because the Pliant high level drawing part is still under
If what you expect is a simple way to tell to Pliant, ok I want an image of
10 cm by 10, and I want to draw a line of this color, some text of that color,
etc, in order for exemple to draw a pie graph,
then my answer is ... wait a bit.
It's possible to do that right now, but the high level interface is not yet