123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- #include "sys-defines.h"
- #include "extern.h"
- bool
- _pl_x_begin_page (S___(Plotter *_plotter))
- {
- Window root1, root2;
- int x, y;
- unsigned int border_width, depth1, depth2;
- unsigned int width1, height1, width2, height2;
- unsigned int width, height, depth;
- const char *double_buffer_s;
- if (_plotter->x_dpy == (Display *)NULL)
-
- {
- _plotter->error (R___(_plotter) "the Plotter cannot be opened, as the XDRAWABLE_DISPLAY parameter is null");
- return false;
- }
-
- _plotter->x_max_polyline_len = XMaxRequestSize(_plotter->x_dpy) / 2;
-
- if (_plotter->x_drawable1)
- XGetGeometry (_plotter->x_dpy, _plotter->x_drawable1,
- &root1, &x, &y, &width1, &height1, &border_width, &depth1);
- if (_plotter->x_drawable2)
- XGetGeometry (_plotter->x_dpy, _plotter->x_drawable2,
- &root2, &x, &y, &width2, &height2, &border_width, &depth2);
-
- if (_plotter->x_drawable1 && _plotter->x_drawable2)
-
- {
- if (width1 != width2 || height1 != height2
- || depth1 != depth2 || root1 != root2)
- {
- _plotter->error(R___(_plotter) "the Plotter cannot be opened, as the X drawables have unequal parameters");
- return false;
- }
- }
-
- if (_plotter->x_drawable1)
- {
- width = width1;
- height = height1;
- depth = depth1;
- }
- else if (_plotter->x_drawable2)
- {
- width = width2;
- height = height2;
- depth = depth1;
- }
- else
-
- {
- width = 1;
- height = 1;
- depth = 1;
- }
- _plotter->data->imin = 0;
- _plotter->data->imax = width - 1;
-
- _plotter->data->jmin = height - 1;
- _plotter->data->jmax = 0;
-
-
- _compute_ndc_to_device_map (_plotter->data);
-
- _pl_x_add_gcs_to_first_drawing_state (S___(_plotter));
-
- if (_plotter->x_drawable1 || _plotter->x_drawable2)
- {
- double_buffer_s =
- (const char *)_get_plot_param (_plotter->data, "USE_DOUBLE_BUFFERING");
- if (strcmp (double_buffer_s, "yes") == 0
-
- || strcmp (double_buffer_s, "fast") == 0)
-
- {
- _plotter->x_double_buffering = X_DBL_BUF_BY_HAND;
- _plotter->x_drawable3
- = XCreatePixmap(_plotter->x_dpy,
-
- _plotter->x_drawable1 ?
- _plotter->x_drawable1 : _plotter->x_drawable2,
- (unsigned int)width,
- (unsigned int)height,
- (unsigned int)depth);
-
- XFillRectangle (_plotter->x_dpy, _plotter->x_drawable3,
- _plotter->drawstate->x_gc_bg,
-
- 0, 0,
- (unsigned int)width, (unsigned int)height);
- }
- }
-
- return true;
- }
- void
- _pl_x_add_gcs_to_first_drawing_state (S___(Plotter *_plotter))
- {
- Drawable drawable;
-
-
- 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;
-
-
- {
- XGCValues gcv_fg, gcv_fill, gcv_bg;
-
-
- gcv_fg.plane_mask = AllPlanes;
- gcv_fg.function = GXcopy;
- gcv_fg.line_width = _default_drawstate.x_gc_line_width;
- gcv_fg.line_style = LineSolid;
- gcv_fg.join_style = _default_drawstate.x_gc_join_style;
- gcv_fg.cap_style = _default_drawstate.x_gc_cap_style;
- gcmask_fg &= ~(GCFont);
- gcmask_fg &= ~(GCForeground);
-
-
- gcv_fill.plane_mask = AllPlanes;
- gcv_fill.function = GXcopy;
- gcv_fill.arc_mode = ArcChord;
- gcv_fill.fill_rule = _default_drawstate.x_gc_fill_rule;
- gcmask_fill &= ~(GCForeground);
-
-
- gcv_bg.plane_mask = AllPlanes;
- gcv_bg.function = GXcopy;
- gcmask_bg &= ~(GCForeground);
-
-
- _plotter->drawstate->x_gc_fg =
- XCreateGC (_plotter->x_dpy, drawable, gcmask_fg, &gcv_fg);
- _plotter->drawstate->x_gc_fill =
- XCreateGC (_plotter->x_dpy, drawable, gcmask_fill, &gcv_fill);
- _plotter->drawstate->x_gc_bg =
- XCreateGC (_plotter->x_dpy, drawable, gcmask_bg, &gcv_bg);
-
-
- _plotter->drawstate->x_gc_line_width = gcv_fg.line_width;
- _plotter->drawstate->x_gc_line_style = gcv_fg.line_style;
- _plotter->drawstate->x_gc_join_style = gcv_fg.join_style;
- _plotter->drawstate->x_gc_cap_style = gcv_fg.cap_style;
- _plotter->drawstate->x_gc_dash_list = (char *)NULL;
- _plotter->drawstate->x_gc_dash_list_len = 0;
- _plotter->drawstate->x_gc_dash_offset = 0;
- _plotter->drawstate->x_gc_fill_rule = gcv_fill.fill_rule;
-
-
- _pl_x_set_pen_color (S___(_plotter));
- _pl_x_set_fill_color (S___(_plotter));
- _pl_x_set_bg_color (S___(_plotter));
-
-
- }
- }
- }
- void
- _pl_x_maybe_get_new_colormap (S___(Plotter *_plotter))
- {
- return;
- }
- void
- _pl_x_maybe_handle_x_events(S___(Plotter *_plotter))
- {
- return;
- }
|