1995-08-09 08:06:35 -07:00
|
|
|
/***********************************************************************/
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Objective Caml */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* */
|
|
|
|
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Copyright 1996 Institut National de Recherche en Informatique et */
|
1999-11-17 10:59:06 -08:00
|
|
|
/* en Automatique. All rights reserved. This file is distributed */
|
2001-12-07 05:41:02 -08:00
|
|
|
/* under the terms of the GNU Library General Public License, with */
|
|
|
|
/* the special exception on linking described in file ../../LICENSE. */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
1995-05-08 10:04:35 -07:00
|
|
|
#include "libgraph.h"
|
|
|
|
#include <memory.h>
|
|
|
|
|
2004-03-24 07:02:06 -08:00
|
|
|
value caml_gr_fill_rect(value vx, value vy, value vw, value vh)
|
1995-05-08 10:04:35 -07:00
|
|
|
{
|
|
|
|
int x = Int_val(vx);
|
|
|
|
int y = Int_val(vy);
|
|
|
|
int w = Int_val(vw);
|
|
|
|
int h = Int_val(vh);
|
|
|
|
|
2004-03-24 07:02:06 -08:00
|
|
|
caml_gr_check_open();
|
|
|
|
if(caml_gr_remember_modeflag)
|
|
|
|
XFillRectangle(caml_gr_display, caml_gr_bstore.win, caml_gr_bstore.gc,
|
2000-03-13 06:09:28 -08:00
|
|
|
x, Bcvt(y) - h + 1, w, h);
|
2004-03-24 07:02:06 -08:00
|
|
|
if(caml_gr_display_modeflag) {
|
|
|
|
XFillRectangle(caml_gr_display, caml_gr_window.win, caml_gr_window.gc,
|
2000-04-05 11:30:22 -07:00
|
|
|
x, Wcvt(y) - h + 1, w, h);
|
2004-03-24 07:02:06 -08:00
|
|
|
XFlush(caml_gr_display);
|
2000-02-08 06:26:12 -08:00
|
|
|
}
|
1995-05-08 10:04:35 -07:00
|
|
|
return Val_unit;
|
|
|
|
}
|
|
|
|
|
2004-03-24 07:02:06 -08:00
|
|
|
value caml_gr_fill_poly(value array)
|
1995-05-08 10:04:35 -07:00
|
|
|
{
|
|
|
|
XPoint * points;
|
|
|
|
int npoints, i;
|
|
|
|
|
2004-03-24 07:02:06 -08:00
|
|
|
caml_gr_check_open();
|
1995-05-08 10:04:35 -07:00
|
|
|
npoints = Wosize_val(array);
|
|
|
|
points = (XPoint *) stat_alloc(npoints * sizeof(XPoint));
|
|
|
|
for (i = 0; i < npoints; i++) {
|
|
|
|
points[i].x = Int_val(Field(Field(array, i), 0));
|
2000-02-08 06:26:12 -08:00
|
|
|
points[i].y = Bcvt(Int_val(Field(Field(array, i), 1)));
|
1995-05-08 10:04:35 -07:00
|
|
|
}
|
2004-03-24 07:02:06 -08:00
|
|
|
if(caml_gr_remember_modeflag)
|
|
|
|
XFillPolygon(caml_gr_display, caml_gr_bstore.win, caml_gr_bstore.gc, points,
|
2000-03-13 06:09:28 -08:00
|
|
|
npoints, Complex, CoordModeOrigin);
|
2004-03-24 07:02:06 -08:00
|
|
|
if(caml_gr_display_modeflag) {
|
2000-02-08 06:26:12 -08:00
|
|
|
for (i = 0; i < npoints; i++)
|
|
|
|
points[i].y = BtoW(points[i].y);
|
2004-03-24 07:02:06 -08:00
|
|
|
XFillPolygon(caml_gr_display, caml_gr_window.win, caml_gr_window.gc, points,
|
2000-04-05 11:30:22 -07:00
|
|
|
npoints, Complex, CoordModeOrigin);
|
2004-03-24 07:02:06 -08:00
|
|
|
XFlush(caml_gr_display);
|
2000-02-08 06:26:12 -08:00
|
|
|
}
|
1995-05-08 10:04:35 -07:00
|
|
|
stat_free((char *) points);
|
|
|
|
return Val_unit;
|
|
|
|
}
|
|
|
|
|
2004-03-24 07:02:06 -08:00
|
|
|
value caml_gr_fill_arc_nat(value vx, value vy, value vrx, value vry, value va1, value va2)
|
1995-05-08 10:04:35 -07:00
|
|
|
{
|
1995-11-06 05:28:02 -08:00
|
|
|
int x = Int_val(vx);
|
|
|
|
int y = Int_val(vy);
|
|
|
|
int rx = Int_val(vrx);
|
|
|
|
int ry = Int_val(vry);
|
|
|
|
int a1 = Int_val(va1);
|
|
|
|
int a2 = Int_val(va2);
|
|
|
|
|
2004-03-24 07:02:06 -08:00
|
|
|
caml_gr_check_open();
|
|
|
|
if(caml_gr_remember_modeflag)
|
|
|
|
XFillArc(caml_gr_display, caml_gr_bstore.win, caml_gr_bstore.gc,
|
2000-03-13 06:09:28 -08:00
|
|
|
x - rx, Bcvt(y) - ry, rx * 2, ry * 2, a1 * 64, (a2 - a1) * 64);
|
2004-03-24 07:02:06 -08:00
|
|
|
if(caml_gr_display_modeflag) {
|
|
|
|
XFillArc(caml_gr_display, caml_gr_window.win, caml_gr_window.gc,
|
2000-04-05 11:30:22 -07:00
|
|
|
x - rx, Wcvt(y) - ry, rx * 2, ry * 2, a1 * 64, (a2 - a1) * 64);
|
2004-03-24 07:02:06 -08:00
|
|
|
XFlush(caml_gr_display);
|
2000-02-08 06:26:12 -08:00
|
|
|
}
|
1995-05-08 10:04:35 -07:00
|
|
|
return Val_unit;
|
|
|
|
}
|
|
|
|
|
2004-03-24 07:02:06 -08:00
|
|
|
value caml_gr_fill_arc(value *argv, int argc)
|
1995-11-06 05:28:02 -08:00
|
|
|
{
|
2004-03-24 07:02:06 -08:00
|
|
|
return caml_gr_fill_arc_nat(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
|
1995-11-06 05:28:02 -08:00
|
|
|
}
|