123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- #include "sys-defines.h"
- #include "extern.h"
- void
- _pl_x_push_state (S___(Plotter *_plotter))
- {
- Drawable drawable;
- XGCValues gcv;
-
-
-
- if (_plotter->x_drawable1)
- drawable = _plotter->x_drawable1;
- else if (_plotter->x_drawable2)
- drawable = _plotter->x_drawable2;
- else
- drawable = (Drawable)NULL;
- if (drawable != (Drawable)NULL)
-
- {
- unsigned long gcmask_fg, gcmask_fill, gcmask_bg;
- gcmask_fg =
-
- GCPlaneMask | GCFunction
-
-
- | GCLineStyle | GCLineWidth | GCJoinStyle | GCCapStyle
-
- | GCForeground | GCFont;
-
- gcmask_fill =
-
- GCPlaneMask | GCFunction | GCArcMode
-
- | GCFillRule
-
- | GCForeground;
-
- gcmask_bg =
-
- GCPlaneMask | GCFunction
-
- | GCForeground;
-
-
-
- XGetGCValues (_plotter->x_dpy, _plotter->drawstate->previous->x_gc_fg,
- gcmask_fg, &gcv);
- _plotter->drawstate->x_gc_fg = XCreateGC (_plotter->x_dpy, drawable,
- gcmask_fg, &gcv);
- if (gcv.line_style != LineSolid)
-
- {
- int i, dash_list_len;
- char *dash_list;
-
-
- XSetDashes (_plotter->x_dpy, _plotter->drawstate->x_gc_fg,
- _plotter->drawstate->previous->x_gc_dash_offset,
- _plotter->drawstate->previous->x_gc_dash_list,
- _plotter->drawstate->previous->x_gc_dash_list_len);
-
-
- dash_list_len =
- _plotter->drawstate->previous->x_gc_dash_list_len;
- dash_list = (char *)_pl_xmalloc (dash_list_len * sizeof(char));
- for (i = 0; i < dash_list_len; i++)
- dash_list[i] =
- _plotter->drawstate->previous->x_gc_dash_list[i];
- _plotter->drawstate->x_gc_dash_list = dash_list;
-
-
- _plotter->drawstate->x_gc_dash_list_len = dash_list_len;
- _plotter->drawstate->x_gc_dash_offset =
- _plotter->drawstate->previous->x_gc_dash_offset;
- }
- else
- {
- _plotter->drawstate->x_gc_dash_list = (char *)NULL;
- _plotter->drawstate->x_gc_dash_list_len = 0;
- _plotter->drawstate->x_gc_dash_offset = 0;
- }
-
-
- XGetGCValues (_plotter->x_dpy, _plotter->drawstate->previous->x_gc_fill,
- gcmask_fill, &gcv);
- _plotter->drawstate->x_gc_fill = XCreateGC (_plotter->x_dpy, drawable,
- gcmask_fill, &gcv);
-
- XGetGCValues (_plotter->x_dpy, _plotter->drawstate->previous->x_gc_bg,
- gcmask_bg, &gcv);
- _plotter->drawstate->x_gc_bg = XCreateGC (_plotter->x_dpy, drawable,
- gcmask_bg, &gcv);
- }
- }
- void
- _pl_x_pop_state (S___(Plotter *_plotter))
- {
-
-
- if (_plotter->x_drawable1 || _plotter->x_drawable2)
- {
-
- if (_plotter->drawstate->x_gc_dash_list_len > 0
- && _plotter->drawstate->x_gc_dash_list != (char *)NULL)
- free ((char *)_plotter->drawstate->x_gc_dash_list);
- XFreeGC (_plotter->x_dpy, _plotter->drawstate->x_gc_fg);
- XFreeGC (_plotter->x_dpy, _plotter->drawstate->x_gc_fill);
- XFreeGC (_plotter->x_dpy, _plotter->drawstate->x_gc_bg);
- }
- }
|