home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume19 / xfig / part19 < prev    next >
Encoding:
Text File  |  1993-05-26  |  40.1 KB  |  1,046 lines

  1. Newsgroups: comp.sources.x
  2. From: envbvs@epb9.lbl.gov (Brian V. Smith)
  3. Subject: v19i131:  xfig - Draw amd manipulate objects in an X-Window, Part19/27
  4. Message-ID: <1993May21.021646.7033@sparky.imd.sterling.com>
  5. X-Md4-Signature: 25398c7a76dcb530b0ef54e88b3344da
  6. Sender: chris@sparky.imd.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Fri, 21 May 1993 02:16:46 GMT
  9. Approved: chris@sparky.imd.sterling.com
  10.  
  11. Submitted-by: envbvs@epb9.lbl.gov (Brian V. Smith)
  12. Posting-number: Volume 19, Issue 131
  13. Archive-name: xfig/part19
  14. Environment: X11
  15. Supersedes: xfig: Volume 16, Issue 6-30,39
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 19 (of 27)."
  24. # Contents:  w_drawprim.c
  25. # Wrapped by envbvs@epb9.lbl.gov.lbl.gov on Mon May  3 12:06:03 1993
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f 'w_drawprim.c' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'w_drawprim.c'\"
  29. else
  30. echo shar: Extracting \"'w_drawprim.c'\" \(37827 characters\)
  31. sed "s/^X//" >'w_drawprim.c' <<'END_OF_FILE'
  32. X/*
  33. X * FIG : Facility for Interactive Generation of figures
  34. X * Copyright (c) 1985 by Supoj Sutanthavibul
  35. X * Copyright (c) 1992 by Brian V. Smith
  36. X *
  37. X * "Permission to use, copy, modify, distribute, and sell this software and its
  38. X * documentation for any purpose is hereby granted without fee, provided that
  39. X * the above copyright notice appear in all copies and that both the copyright
  40. X * notice and this permission notice appear in supporting documentation. 
  41. X * No representations are made about the suitability of this software for 
  42. X * any purpose.  It is provided "as is" without express or implied warranty."
  43. X */
  44. X
  45. X/*
  46. X * This file provides some drawing primitives which make use of the
  47. X * underlying low-level windowing system operations.
  48. X *
  49. X * The file is divided into routines for:
  50. X *
  51. X * GRAPHICS CONTEXTS (which are used by all the following)
  52. X * FONTS
  53. X * LINES
  54. X * SHADING
  55. X */
  56. X
  57. X/* IMPORTS */
  58. X
  59. X#include "fig.h"
  60. X#include "figx.h"
  61. X#include "resources.h"
  62. X#include "paintop.h"
  63. X#include "mode.h"
  64. X#include "object.h"
  65. X#include "u_fonts.h"
  66. X#include "w_canvas.h"
  67. X#include "w_drawprim.h"
  68. X#include "w_icons.h"        /* for none_ic in init_fill_pm */
  69. X#include "w_indpanel.h"
  70. X#include "w_setup.h"
  71. X#include "w_util.h"
  72. X#include "w_zoom.h"
  73. X
  74. Xextern struct _xfstruct x_fontinfo[NUM_X_FONTS];
  75. Xextern struct _fstruct ps_fontinfo[];    /* font names */
  76. Xextern choice_info fillstyle_choices[];
  77. X
  78. X/* EXPORTS */
  79. X
  80. XPIX_FONT    bold_font;
  81. XPIX_FONT    roman_font;
  82. XPIX_FONT    button_font;
  83. XPIX_ROT_FONT    canvas_font;
  84. X
  85. X/* LOCAL */
  86. X
  87. Xstatic Pixel    gc_color[NUMOPS];
  88. Xstatic XRectangle clip[1];
  89. Xstatic pr_size    pfx_textwidth();
  90. Xstatic int    parsesize();
  91. X
  92. X#define MAXNAMES 35
  93. X
  94. Xstatic struct {
  95. X    char       *fn;
  96. X    int            s;
  97. X}        flist[MAXNAMES];
  98. X
  99. Xinit_font()
  100. X{
  101. X    struct xfont   *newfont, *nf;
  102. X    int            f, count, i, p, ss;
  103. X    char        template[200];
  104. X    char      **fontlist, **fname;
  105. X
  106. X    if (appres.boldFont == NULL || *appres.boldFont == '\0')
  107. X    appres.boldFont = BOLD_FONT;
  108. X    if (appres.normalFont == NULL || *appres.normalFont == '\0')
  109. X    appres.normalFont = NORMAL_FONT;
  110. X    if (appres.buttonFont == NULL || *appres.buttonFont == '\0')
  111. X    appres.buttonFont = BUTTON_FONT;
  112. X
  113. X    roman_font = XLoadQueryFont(tool_d, appres.normalFont);
  114. X    hidden_text_length = 4 * roman_font->max_bounds.width;
  115. X    if ((bold_font = XLoadQueryFont(tool_d, appres.boldFont)) == 0) {
  116. X    fprintf(stderr, "Can't load font: %s, using %s\n",
  117. X        appres.boldFont, appres.normalFont);
  118. X    bold_font = XLoadQueryFont(tool_d, appres.normalFont);
  119. X    }
  120. X    if ((button_font = XLoadQueryFont(tool_d, appres.buttonFont)) == 0) {
  121. X    fprintf(stderr, "Can't load font: %s, using %s\n",
  122. X        appres.buttonFont, appres.normalFont);
  123. X    button_font = XLoadQueryFont(tool_d, appres.normalFont);
  124. X    }
  125. X    /*
  126. X     * Now initialize the font structure for the X fonts corresponding to the
  127. X     * Postscript fonts for the canvas.     OpenWindows can use any LaserWriter
  128. X     * fonts at any size, so we don't need to load anything if we are using
  129. X     * it.
  130. X     */
  131. X
  132. X#ifndef OPENWIN
  133. X    /* if the user asked for scalable fonts, check that the server 
  134. X       really has them by checking for font of 0-0 size */
  135. X    if (appres.SCALABLEFONTS) {
  136. X    strcpy(template,x_fontinfo[0].template);  /* just check the first font */
  137. X    strcat(template,"0-0-*-*-*-*-*-*");
  138. X    if ((fontlist = XListFonts(tool_d, template, 1, &count))==0)
  139. X        appres.SCALABLEFONTS = False;    /* none, turn off request for them */
  140. X    }
  141. X
  142. X    /* X11R5 has scalable fonts - skip next section in that case */
  143. X    if (!appres.SCALABLEFONTS) {
  144. X    for (f = 0; f < NUM_X_FONTS; f++) {
  145. X        nf = NULL;
  146. X        strcpy(template,x_fontinfo[f].template);
  147. X        strcat(template,"*-*-*-*-*-*-");
  148. X        /* add ISO8859 (if not Symbol font or ZapfDingbats) to font name */
  149. X        if (strstr(template,"symbol") == NULL && 
  150. X        strstr(template,"zapfdingbats") == NULL)
  151. X            strcat(template,"ISO8859-*");
  152. X        else
  153. X        strcat(template,"*-*");
  154. X        /* don't free the Fontlist because we keep pointers into it */
  155. X        p = 0;
  156. X        if ((fontlist = XListFonts(tool_d, template, MAXNAMES, &count))==0) {
  157. X        /* no fonts by that name found, substitute the -normal font name */
  158. X        flist[p].fn = appres.normalFont;
  159. X        flist[p++].s = 12;    /* just set the size to 12 */
  160. X        } else {
  161. X        fname = fontlist; /* go through the list finding point
  162. X                   * sizes */
  163. X        while (count--) {
  164. X        ss = parsesize(*fname);    /* get the point size from
  165. X                     * the name */
  166. X        flist[p].fn = *fname++;    /* save name of this size
  167. X                     * font */
  168. X        flist[p++].s = ss;    /* and save size */
  169. X        }
  170. X        }
  171. X        for (ss = 4; ss <= 50; ss++) {
  172. X        for (i = 0; i < p; i++)
  173. X            if (flist[i].s == ss)
  174. X                break;
  175. X        if (i < p && flist[i].s == ss) {
  176. X            newfont = (struct xfont *) malloc(sizeof(struct xfont));
  177. X            if (nf == NULL)
  178. X                x_fontinfo[f].xfontlist = newfont;
  179. X            else
  180. X                nf->next = newfont;
  181. X            nf = newfont;    /* keep current ptr */
  182. X            nf->size = ss;    /* store the size here */
  183. X            nf->fname = flist[i].fn;    /* keep actual name */
  184. X            nf->list = NULL;
  185. X            nf->next = NULL;
  186. X            }
  187. X        } /* next size */
  188. X    } /* next font, f */
  189. X    } /* !appres.SCALABLEFONTS */
  190. X#endif /* OPENWIN */
  191. X}
  192. X
  193. X/* parse the point size of font 'name' */
  194. X/* e.g. -adobe-courier-bold-o-normal--10-100-75-75-m-60-ISO8859-1 */
  195. X
  196. Xstatic int
  197. Xparsesize(name)
  198. X    char       *name;
  199. X{
  200. X    int            s;
  201. X    char       *np;
  202. X
  203. X    for (np = name; *(np + 1); np++)
  204. X    if (*np == '-' && *(np + 1) == '-')    /* look for the -- */
  205. X        break;
  206. X    s = 0;
  207. X    if (*(np + 1)) {
  208. X    np += 2;        /* point past the -- */
  209. X    s = atoi(np);        /* get the point size */
  210. X    } else
  211. X    fprintf(stderr, "Can't parse '%s'\n", name);
  212. X    return s;
  213. X}
  214. X
  215. X/*
  216. X * Lookup an X font corresponding to a Postscript font style that is close in
  217. X * size and with angle "angle"
  218. X */
  219. X
  220. XPIX_ROT_FONT
  221. Xlookfont(f, s, angle)
  222. X    int            f, s;
  223. X    float        angle;
  224. X{
  225. X    struct xfont   *xf;
  226. X    PIX_ROT_FONT   fontst;
  227. X    int           dir;
  228. X
  229. X    /*** Must fix the following to actually return the "-normal font" ROTATED font */
  230. X    if (f == DEFAULT)
  231. X    f = 0;        /* pass back the -normal font font */
  232. X    if (s < 0)
  233. X    s = DEF_FONTSIZE;    /* default font size */
  234. X
  235. X#ifdef OPENWIN
  236. X  {
  237. X    /* to search for OpenWindows font - see below */
  238. X    char        fn[128];
  239. X    int            i;
  240. X
  241. X    for (i = 1; i < NUM_PS_FONTS + 1; i++)
  242. X    if (ps_fontinfo[i].xfontnum == f)
  243. X        {
  244. X        sprintf(fn, "%s-%d", ps_fontinfo[i].name, s);
  245. X        break;
  246. X        }
  247. X
  248. X    for (i = strlen(fn) - 1; i >= 0; i--)
  249. X    if (isupper(fn[i]))
  250. X        fn[i] = tolower(fn[i]);
  251. X    if (appres.DEBUG)
  252. X    fprintf(stderr, "Loading font %s\n", fn);
  253. X    set_temp_cursor(wait_cursor);
  254. X    app_flush();
  255. X    fontst = XRotLoadFont(tool_d, fn, angle);
  256. X    if (fontst == NULL) {
  257. X    fprintf(stderr, "xfig: Can't load font %s ?!, using %s\n",
  258. X        fn, appres.normalFont);
  259. X    fontst = XRotLoadFont(tool_d, appres.normalFont, angle);
  260. X    }
  261. X    reset_cursor();
  262. X    return (fontst);
  263. X  }
  264. X
  265. X#else
  266. X  {
  267. X    char        fn[128];
  268. X    char        template[200];
  269. X    Boolean        found;
  270. X    struct xfont   *newfont, *nf, *oldnf;
  271. X    struct flist   *lp, *nlp, *oldlp;
  272. X
  273. X    /* see if we've already loaded that font size 's' at angle 'angle' 
  274. X       from the font family 'f' */
  275. X    /* actually, we've reduced the number of angles to four - 0, 90, 180 and 270 */
  276. X    if (angle < 0.0)
  277. X        angle += 2.0*M_PI;
  278. X    dir = (int)(angle/M_PI_2+0.0001);
  279. X    if (dir > 3)
  280. X        dir -= 4;
  281. X    found = False;
  282. X    /* start with the basic font name (e.g. adobe-times-medium-r-normal-...) */
  283. X    nf = x_fontinfo[f].xfontlist;
  284. X    oldnf = nf;
  285. X    if (nf != NULL) {
  286. X        if (nf->size > s && !appres.SCALABLEFONTS)
  287. X        found = True;
  288. X        else while (nf != NULL){
  289. X        if (nf->size == s || (!appres.SCALABLEFONTS &&
  290. X             (nf->size >= s && oldnf->size <= s ))) {
  291. X        found = True;
  292. X        break;
  293. X        }
  294. X        oldnf = nf;
  295. X        nf = nf->next;
  296. X        }
  297. X    }
  298. X    if (found) {        /* found exact size (or only larger available) */
  299. X        strcpy(fn,nf->fname);  /* put the name in fn */
  300. X        if (s < nf->size)
  301. X        put_msg("Font size %d not found, using larger %d point",s,nf->size);
  302. X    } else if (!appres.SCALABLEFONTS) {    /* not found, use largest available */
  303. X        nf = oldnf;
  304. X        strcpy(fn,nf->fname);  /* put the name in fn */
  305. X        if (s > nf->size)
  306. X        put_msg("Font size %d not found, using smaller %d point",s,nf->size);
  307. X    } else { /* SCALABLE; none yet of that size, alloc one and put it in the list */
  308. X        newfont = (struct xfont *) malloc(sizeof(struct xfont));
  309. X        /* add it on to the end of the list */
  310. X        if (x_fontinfo[f].xfontlist == NULL)
  311. X            x_fontinfo[f].xfontlist = newfont;
  312. X        else
  313. X            oldnf->next = newfont;
  314. X        nf = newfont;        /* keep current ptr */
  315. X        nf->size = s;        /* store the size here */
  316. X        nf->list = NULL;
  317. X        nf->next = NULL;
  318. X
  319. X        /* create a full XLFD font name */
  320. X        strcpy(template,x_fontinfo[f].template);
  321. X        /* attach pointsize to font name */
  322. X        strcat(template,"%d-*-*-*-*-*-");
  323. X        /* add ISO8859 (if not Symbol font or ZapfDingbats) to font name */
  324. X        if (strstr(template,"symbol") == NULL && 
  325. X        strstr(template,"zapfdingbats") == NULL)
  326. X            strcat(template,"ISO8859-*");
  327. X        else
  328. X        strcat(template,"*-*");
  329. X        /* use the pixel field instead of points in the fontname so that the
  330. X        font scales with screen size */
  331. X        sprintf(fn, template, s);
  332. X        /* allocate space for the name and put it in the structure */
  333. X        nf->fname = (char *) malloc(strlen(fn));
  334. X        strcpy(nf->fname, fn);
  335. X    } /* if (!found) */
  336. X    if (appres.DEBUG)
  337. X        fprintf(stderr, "Loading font %s at angle %f (%f)\n", 
  338. X            fn, (float) dir*90.0, angle);
  339. X    lp = nf->list;
  340. X    oldlp = lp;
  341. X    found = False;
  342. X    while (lp) {
  343. X        if (lp->dir == dir) {
  344. X            found = True;
  345. X            break;
  346. X        }
  347. X        oldlp = lp;
  348. X        lp = lp->next;
  349. X    } /* while (lp) */
  350. X    if (!found) {
  351. X        nlp = (struct flist *) malloc(sizeof(struct flist));
  352. X        nlp->next = NULL;
  353. X        if (oldlp)
  354. X            oldlp->next = nlp;    /* add this to the list */
  355. X        else
  356. X            nf->list = nlp;        /* first on the list */
  357. X        nlp->dir = dir;
  358. X        set_temp_cursor(wait_cursor);
  359. X        app_flush();
  360. X        fontst = XRotLoadFont(tool_d, fn, (float) dir*90.0);
  361. X        reset_cursor();
  362. X        if (fontst == NULL) {
  363. X            fprintf(stderr, "xfig: Can't load font %s ?!, using %s\n",
  364. X            fn, appres.normalFont);
  365. X            fontst = XRotLoadFont(tool_d, appres.normalFont, (float) dir*90.0);
  366. X            nf->fname = fn;    /* keep actual name */
  367. X        }
  368. X        /* put the structure in the list */
  369. X        nlp->fstruct = fontst;
  370. X        lp = nlp;
  371. X    } /* if (!found) */
  372. X    fontst = lp->fstruct;
  373. X    return (fontst);
  374. X  }
  375. X
  376. X#endif                /* !OPENWIN */
  377. X
  378. X}
  379. X
  380. X/* print "string" in window "w" using font specified in fstruct at (x,y) */
  381. X
  382. Xpw_text(w, x, y, op, fstruct, string, color)
  383. X    Window        w;
  384. X    int            x, y, op;
  385. X    PIX_ROT_FONT    fstruct;
  386. X    char       *string;
  387. X    Color        color;
  388. X{
  389. X    if (fstruct == NULL)
  390. X    fprintf(stderr,"Error, in pw_text, fstruct==NULL\n");
  391. X    pwx_text(w, x, y, op, fstruct, string, color);
  392. X}
  393. X
  394. Xpwx_text(w, x, y, op, fstruct, string, color)
  395. X    Window        w;
  396. X    int            x, y, op;
  397. X    PIX_ROT_FONT    fstruct;
  398. X    char       *string;
  399. X    Color        color;
  400. X{
  401. X    /* if we're drawing to the bitmap instead of the canvas
  402. X       map colors white => white, all others => black */
  403. X    if (writing_bitmap)
  404. X    {
  405. X    if (color == WHITE)
  406. X        color = 0;
  407. X    else
  408. X        color = 1;
  409. X    }
  410. X    if (writing_bitmap? color != gc_color[op] : x_color(color) != gc_color[op]) {
  411. X        if (op == PAINT) {
  412. X        if (writing_bitmap)
  413. X            XSetForeground(tool_d,gccache[op],color);
  414. X        else
  415. X            set_x_color(gccache[op], color);
  416. X        gc_color[op] = writing_bitmap? color : x_color(color);
  417. X        }
  418. X    }
  419. X    zXRotDrawString(tool_d, w, fstruct, gccache[op], x, y, 
  420. X            string, strlen(string));
  421. X}
  422. X
  423. Xpr_size
  424. Xpf_textwidth(fstruct, n, s)
  425. X    PIX_ROT_FONT    fstruct;
  426. X    int            n;
  427. X    char       *s;
  428. X{
  429. X    pr_size        ret;
  430. X
  431. X    ret.x = XRotTextWidth(fstruct, s, n);
  432. X    ret.y = XRotTextHeight(fstruct, s, n);
  433. X    return (ret);
  434. X}
  435. X
  436. X/* LINES */
  437. X
  438. Xstatic int    gc_thickness[NUMOPS], gc_line_style[NUMOPS];
  439. X
  440. Xstatic        GC
  441. Xmakegc(op, fg, bg)
  442. X    int            op;
  443. X    Pixel        fg;
  444. X    Pixel        bg;
  445. X{
  446. X    register GC        ngc;
  447. X    XGCValues        gcv;
  448. X    unsigned long   gcmask;
  449. X
  450. X    gcv.font = roman_font->fid;
  451. X    gcv.join_style = JoinMiter;
  452. X    gcmask = GCJoinStyle | GCFunction | GCForeground | GCBackground | GCFont;
  453. X    switch (op) {
  454. X    case PAINT:
  455. X    gcv.foreground = fg;
  456. X    gcv.background = bg;
  457. X    gcv.function = GXcopy;
  458. X    break;
  459. X    case ERASE:
  460. X    gcv.foreground = bg;
  461. X    gcv.background = bg;
  462. X    gcv.function = GXcopy;
  463. X    break;
  464. X    case INV_PAINT:
  465. X    gcv.foreground = fg ^ bg;
  466. X    gcv.background = bg;
  467. X    gcv.function = GXxor;
  468. X    break;
  469. X    case MERGE:
  470. X    gcv.foreground = fg;
  471. X    gcv.background = bg;
  472. X    gcv.function = GXor;
  473. X    break;
  474. X    }
  475. X
  476. X    ngc = XCreateGC(tool_d, XtWindow(canvas_sw), gcmask, &gcv);
  477. X    XCopyGC(tool_d, gc, ~(gcmask), ngc);    /* add main gc's values to
  478. X                         * the new one */
  479. X    return (ngc);
  480. X}
  481. X
  482. Xinit_gc()
  483. X{
  484. X    int            i;
  485. X
  486. X    gccache[PAINT] = makegc(PAINT, x_fg_color.pixel, x_bg_color.pixel);
  487. X    gccache[ERASE] = makegc(ERASE, x_fg_color.pixel, x_bg_color.pixel);
  488. X    gccache[INV_PAINT] = makegc(INV_PAINT, x_fg_color.pixel, x_bg_color.pixel);
  489. X    gccache[MERGE] = makegc(MERGE, x_fg_color.pixel, x_bg_color.pixel);
  490. X
  491. X    for (i = 0; i < NUMOPS; i++) {
  492. X    gc_color[i] = -1;
  493. X    gc_thickness[i] = -1;
  494. X    gc_line_style[i] = -1;
  495. X    }
  496. X}
  497. X
  498. X/* create the gc's for fill style (PAINT and ERASE) */
  499. X/* the fill_pm[] and unfill_pm[] must already be created */
  500. X
  501. Xinit_fill_gc()
  502. X{
  503. X    XGCValues        gcv;
  504. X    int            i;
  505. X
  506. X    gcv.fill_style = FillOpaqueStippled;
  507. X    gcv.arc_mode = ArcPieSlice; /* fill mode for arcs */
  508. X    gcv.fill_rule = EvenOddRule /* WindingRule */ ;
  509. X    for (i = 0; i < NUMFILLPATS; i++) {
  510. X    /* make color fill pattern with black bg (fg is set later in set_x_color() */
  511. X    fill_gc[i] = makegc(PAINT, x_fg_color.pixel, x_color(BLACK));
  512. X    un_fill_gc[i] = makegc(ERASE, x_fg_color.pixel, x_color(BLACK));
  513. X    /* make black fill pattern with default background */
  514. X    black_fill_gc[i] = makegc(PAINT, x_fg_color.pixel, x_bg_color.pixel);
  515. X    black_un_fill_gc[i] = makegc(ERASE, x_fg_color.pixel, x_bg_color.pixel);
  516. X    gcv.stipple = fill_pm[i];
  517. X    XChangeGC(tool_d, fill_gc[i],
  518. X          GCStipple | GCFillStyle | GCFillRule | GCArcMode, &gcv);
  519. X    XChangeGC(tool_d, black_fill_gc[i],
  520. X          GCStipple | GCFillStyle | GCFillRule | GCArcMode, &gcv);
  521. X    XChangeGC(tool_d, un_fill_gc[i],
  522. X          GCStipple | GCFillStyle | GCArcMode, &gcv);
  523. X    XChangeGC(tool_d, black_un_fill_gc[i],
  524. X          GCStipple | GCFillStyle | GCArcMode, &gcv);
  525. X    }
  526. X}
  527. X
  528. X/* SHADING */
  529. X
  530. X/* grey images for fill patterns (32x32) */
  531. X
  532. Xstatic unsigned char fill_images[NUMFILLPATS][128] = {
  533. X {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  534. X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  535. X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  536. X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  537. X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  538. X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  539. X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  540. X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  541. X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
  542. X {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x88,
  543. X 0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,
  544. X 0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,
  545. X 0x88,0x88,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  546. X 0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  547. X 0x00,0x88,0x88,0x88,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  548. X 0x00,0x00,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  549. X 0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  550. X 0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08},
  551. X {0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x00,0x00,0x00,
  552. X 0x00,0x01,0x11,0x01,0x11,0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x00,0x00,
  553. X 0x00,0x00,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x00,
  554. X 0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,
  555. X 0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x44,0x44,0x44,
  556. X 0x44,0x00,0x00,0x00,0x00,0x01,0x11,0x01,0x11,0x00,0x00,0x00,0x00,0x44,0x44,
  557. X 0x44,0x44,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x44,
  558. X 0x44,0x44,0x44,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,
  559. X 0x44,0x44,0x44,0x44,0x00,0x00,0x00,0x00},
  560. X {0x00,0x00,0x00,0x00,0x11,0x51,0x11,0x51,0x00,0x00,0x00,0x00,0x44,0x44,0x44,
  561. X 0x44,0x00,0x00,0x00,0x00,0x15,0x15,0x15,0x15,0x00,0x00,0x00,0x00,0x44,0x44,
  562. X 0x44,0x44,0x00,0x00,0x00,0x00,0x51,0x11,0x51,0x11,0x00,0x00,0x00,0x00,0x44,
  563. X 0x44,0x44,0x44,0x00,0x00,0x00,0x00,0x15,0x15,0x15,0x15,0x00,0x00,0x00,0x00,
  564. X 0x44,0x44,0x44,0x44,0x00,0x00,0x00,0x00,0x11,0x51,0x11,0x51,0x00,0x00,0x00,
  565. X 0x00,0x44,0x44,0x44,0x44,0x00,0x00,0x00,0x00,0x15,0x15,0x15,0x15,0x00,0x00,
  566. X 0x00,0x00,0x44,0x44,0x44,0x44,0x00,0x00,0x00,0x00,0x51,0x11,0x51,0x11,0x00,
  567. X 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x00,0x00,0x00,0x00,0x15,0x15,0x15,0x15,
  568. X 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44},
  569. X {0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa,0x00,0x00,0x00,0x00,0x8a,0x88,0x8a,
  570. X 0x88,0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa,0x00,0x00,0x00,0x00,0x88,0x88,
  571. X 0x88,0x88,0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa,0x00,0x00,0x00,0x00,0x8a,
  572. X 0x8a,0x8a,0x8a,0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa,0x00,0x00,0x00,0x00,
  573. X 0x88,0x88,0x88,0x88,0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa,0x00,0x00,0x00,
  574. X 0x00,0x8a,0x88,0x8a,0x88,0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa,0x00,0x00,
  575. X 0x00,0x00,0x88,0x88,0x88,0x88,0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa,0x00,
  576. X 0x00,0x00,0x00,0x8a,0x8a,0x8a,0x8a,0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa,
  577. X 0x00,0x00,0x00,0x00,0x88,0x88,0x88,0x88},
  578. X {0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x55,0x55,0x55,0x55,0x00,0x00,0x00,
  579. X 0x00,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x55,0x55,0x55,0x55,0x00,0x00,
  580. X 0x00,0x00,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x55,0x55,0x55,0x55,0x00,
  581. X 0x00,0x00,0x00,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x55,0x55,0x55,0x55,
  582. X 0x00,0x00,0x00,0x00,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x55,0x55,0x55,
  583. X 0x55,0x00,0x00,0x00,0x00,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x55,0x55,
  584. X 0x55,0x55,0x00,0x00,0x00,0x00,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x55,
  585. X 0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,
  586. X 0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00},
  587. X {0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x55,0x55,0x55,0x55,0x88,0x88,0x88,
  588. X 0x88,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x55,0x55,0x55,0x55,0x80,0x80,
  589. X 0x80,0x80,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x55,0x55,0x55,0x55,0x88,
  590. X 0x88,0x88,0x88,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x55,0x55,0x55,0x55,
  591. X 0x88,0x80,0x88,0x80,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x55,0x55,0x55,
  592. X 0x55,0x88,0x88,0x88,0x88,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x55,0x55,
  593. X 0x55,0x55,0x80,0x80,0x80,0x80,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x55,
  594. X 0x55,0x55,0x55,0x88,0x88,0x88,0x88,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,
  595. X 0x55,0x55,0x55,0x55,0x88,0x80,0x88,0x80},
  596. X {0x22,0x22,0x22,0x22,0x55,0x55,0x55,0x55,0x80,0x80,0x80,0x80,0x55,0x55,0x55,
  597. X 0x55,0x22,0x22,0x22,0x22,0x55,0x55,0x55,0x55,0x88,0x08,0x88,0x08,0x55,0x55,
  598. X 0x55,0x55,0x22,0x22,0x22,0x22,0x55,0x55,0x55,0x55,0x80,0x80,0x80,0x80,0x55,
  599. X 0x55,0x55,0x55,0x22,0x22,0x22,0x22,0x55,0x55,0x55,0x55,0x08,0x08,0x08,0x08,
  600. X 0x55,0x55,0x55,0x55,0x22,0x22,0x22,0x22,0x55,0x55,0x55,0x55,0x80,0x80,0x80,
  601. X 0x80,0x55,0x55,0x55,0x55,0x22,0x22,0x22,0x22,0x55,0x55,0x55,0x55,0x88,0x08,
  602. X 0x88,0x08,0x55,0x55,0x55,0x55,0x22,0x22,0x22,0x22,0x55,0x55,0x55,0x55,0x80,
  603. X 0x80,0x80,0x80,0x55,0x55,0x55,0x55,0x22,0x22,0x22,0x22,0x55,0x55,0x55,0x55,
  604. X 0x08,0x08,0x08,0x08,0x55,0x55,0x55,0x55},
  605. X {0x88,0x88,0x88,0x88,0x55,0x55,0x55,0x55,0x22,0xa2,0x22,0xa2,0x55,0x55,0x55,
  606. X 0x55,0x88,0x88,0x88,0x88,0x55,0x55,0x55,0x55,0x2a,0x2a,0x2a,0x2a,0x55,0x55,
  607. X 0x55,0x55,0x88,0x88,0x88,0x88,0x55,0x55,0x55,0x55,0xa2,0x22,0xa2,0x22,0x55,
  608. X 0x55,0x55,0x55,0x88,0x88,0x88,0x88,0x55,0x55,0x55,0x55,0x2a,0x2a,0x2a,0x2a,
  609. X 0x55,0x55,0x55,0x55,0x88,0x88,0x88,0x88,0x55,0x55,0x55,0x55,0x22,0xa2,0x22,
  610. X 0xa2,0x55,0x55,0x55,0x55,0x88,0x88,0x88,0x88,0x55,0x55,0x55,0x55,0x2a,0x2a,
  611. X 0x2a,0x2a,0x55,0x55,0x55,0x55,0x88,0x88,0x88,0x88,0x55,0x55,0x55,0x55,0xa2,
  612. X 0x22,0xa2,0x22,0x55,0x55,0x55,0x55,0x88,0x88,0x88,0x88,0x55,0x55,0x55,0x55,
  613. X 0x2a,0x2a,0x2a,0x2a,0x55,0x55,0x55,0x55},
  614. X {0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa,0x54,0x54,0x54,
  615. X 0x54,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa,0x44,0x44,
  616. X 0x44,0x44,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa,0x44,
  617. X 0x54,0x44,0x54,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa,
  618. X 0x44,0x44,0x44,0x44,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,
  619. X 0xaa,0x54,0x54,0x54,0x54,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,
  620. X 0xaa,0xaa,0x44,0x44,0x44,0x44,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,
  621. X 0xaa,0xaa,0xaa,0x44,0x54,0x44,0x54,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
  622. X 0xaa,0xaa,0xaa,0xaa,0x44,0x44,0x44,0x44},
  623. X {0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,
  624. X 0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,
  625. X 0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,
  626. X 0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
  627. X 0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,
  628. X 0x55,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa,0x55,0x55,
  629. X 0x55,0x55,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa,0x55,
  630. X 0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa,
  631. X 0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa},
  632. X {0xdd,0xdd,0xdd,0xdd,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,
  633. X 0xaa,0xd5,0xd5,0xd5,0xd5,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,0xaa,
  634. X 0xaa,0xaa,0xdd,0xdd,0xdd,0xdd,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,0xaa,
  635. X 0xaa,0xaa,0xaa,0xdd,0xd5,0xdd,0xd5,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
  636. X 0xaa,0xaa,0xaa,0xaa,0xdd,0xdd,0xdd,0xdd,0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,
  637. X 0x55,0xaa,0xaa,0xaa,0xaa,0xd5,0xd5,0xd5,0xd5,0xaa,0xaa,0xaa,0xaa,0x55,0x55,
  638. X 0x55,0x55,0xaa,0xaa,0xaa,0xaa,0xdd,0xdd,0xdd,0xdd,0xaa,0xaa,0xaa,0xaa,0x55,
  639. X 0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa,0xdd,0xd5,0xdd,0xd5,0xaa,0xaa,0xaa,0xaa,
  640. X 0x55,0x55,0x55,0x55,0xaa,0xaa,0xaa,0xaa},
  641. X {0x77,0x77,0x77,0x77,0xaa,0xaa,0xaa,0xaa,0xd5,0xd5,0xd5,0xd5,0xaa,0xaa,0xaa,
  642. X 0xaa,0x77,0x77,0x77,0x77,0xaa,0xaa,0xaa,0xaa,0xdd,0x5d,0xdd,0x5d,0xaa,0xaa,
  643. X 0xaa,0xaa,0x77,0x77,0x77,0x77,0xaa,0xaa,0xaa,0xaa,0xd5,0xd5,0xd5,0xd5,0xaa,
  644. X 0xaa,0xaa,0xaa,0x77,0x77,0x77,0x77,0xaa,0xaa,0xaa,0xaa,0x5d,0xdd,0x5d,0xdd,
  645. X 0xaa,0xaa,0xaa,0xaa,0x77,0x77,0x77,0x77,0xaa,0xaa,0xaa,0xaa,0xd5,0xd5,0xd5,
  646. X 0xd5,0xaa,0xaa,0xaa,0xaa,0x77,0x77,0x77,0x77,0xaa,0xaa,0xaa,0xaa,0xdd,0x5d,
  647. X 0xdd,0x5d,0xaa,0xaa,0xaa,0xaa,0x77,0x77,0x77,0x77,0xaa,0xaa,0xaa,0xaa,0xd5,
  648. X 0xd5,0xd5,0xd5,0xaa,0xaa,0xaa,0xaa,0x77,0x77,0x77,0x77,0xaa,0xaa,0xaa,0xaa,
  649. X 0x5d,0xdd,0x5d,0xdd,0xaa,0xaa,0xaa,0xaa},
  650. X {0x55,0x55,0x55,0x55,0xbb,0xbb,0xbb,0xbb,0x55,0x55,0x55,0x55,0xfe,0xfe,0xfe,
  651. X 0xfe,0x55,0x55,0x55,0x55,0xbb,0xbb,0xbb,0xbb,0x55,0x55,0x55,0x55,0xee,0xef,
  652. X 0xee,0xef,0x55,0x55,0x55,0x55,0xbb,0xbb,0xbb,0xbb,0x55,0x55,0x55,0x55,0xfe,
  653. X 0xfe,0xfe,0xfe,0x55,0x55,0x55,0x55,0xbb,0xbb,0xbb,0xbb,0x55,0x55,0x55,0x55,
  654. X 0xef,0xef,0xef,0xef,0x55,0x55,0x55,0x55,0xbb,0xbb,0xbb,0xbb,0x55,0x55,0x55,
  655. X 0x55,0xfe,0xfe,0xfe,0xfe,0x55,0x55,0x55,0x55,0xbb,0xbb,0xbb,0xbb,0x55,0x55,
  656. X 0x55,0x55,0xee,0xef,0xee,0xef,0x55,0x55,0x55,0x55,0xbb,0xbb,0xbb,0xbb,0x55,
  657. X 0x55,0x55,0x55,0xfe,0xfe,0xfe,0xfe,0x55,0x55,0x55,0x55,0xbb,0xbb,0xbb,0xbb,
  658. X 0x55,0x55,0x55,0x55,0xef,0xef,0xef,0xef},
  659. X {0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,0x77,0x77,0x77,0x77,0xaa,0xaa,0xaa,
  660. X 0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,0x77,0x7f,0x77,0x7f,0xaa,0xaa,
  661. X 0xaa,0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,0x77,0x77,0x77,0x77,0xaa,
  662. X 0xaa,0xaa,0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,0x7f,0x7f,0x7f,0x7f,
  663. X 0xaa,0xaa,0xaa,0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,0x77,0x77,0x77,
  664. X 0x77,0xaa,0xaa,0xaa,0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,0x77,0x7f,
  665. X 0x77,0x7f,0xaa,0xaa,0xaa,0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,0x77,
  666. X 0x77,0x77,0x77,0xaa,0xaa,0xaa,0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,
  667. X 0x7f,0x7f,0x7f,0x7f,0xaa,0xaa,0xaa,0xaa},
  668. X {0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,
  669. X 0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,
  670. X 0xaa,0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,0xff,0xff,0xff,0xff,0xaa,
  671. X 0xaa,0xaa,0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,0xff,0xff,0xff,0xff,
  672. X 0xaa,0xaa,0xaa,0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,0xff,0xff,0xff,
  673. X 0xff,0xaa,0xaa,0xaa,0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,0xff,0xff,
  674. X 0xff,0xff,0xaa,0xaa,0xaa,0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,0xff,
  675. X 0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,
  676. X 0xff,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa},
  677. X {0x55,0x55,0x55,0x55,0xff,0xff,0xff,0xff,0xdd,0xdd,0xdd,0xdd,0xff,0xff,0xff,
  678. X 0xff,0x55,0x55,0x55,0x55,0xff,0xff,0xff,0xff,0x5d,0xdd,0x5d,0xdd,0xff,0xff,
  679. X 0xff,0xff,0x55,0x55,0x55,0x55,0xff,0xff,0xff,0xff,0xdd,0xdd,0xdd,0xdd,0xff,
  680. X 0xff,0xff,0xff,0x55,0x55,0x55,0x55,0xff,0xff,0xff,0xff,0x5d,0x5d,0x5d,0x5d,
  681. X 0xff,0xff,0xff,0xff,0x55,0x55,0x55,0x55,0xff,0xff,0xff,0xff,0xdd,0xdd,0xdd,
  682. X 0xdd,0xff,0xff,0xff,0xff,0x55,0x55,0x55,0x55,0xff,0xff,0xff,0xff,0x5d,0xdd,
  683. X 0x5d,0xdd,0xff,0xff,0xff,0xff,0x55,0x55,0x55,0x55,0xff,0xff,0xff,0xff,0xdd,
  684. X 0xdd,0xdd,0xdd,0xff,0xff,0xff,0xff,0x55,0x55,0x55,0x55,0xff,0xff,0xff,0xff,
  685. X 0x5d,0x5d,0x5d,0x5d,0xff,0xff,0xff,0xff},
  686. X {0xee,0xee,0xee,0xee,0xff,0xff,0xff,0xff,0xbb,0xba,0xba,0xba,0xff,0xff,0xff,
  687. X 0xff,0xee,0xee,0xee,0xee,0xff,0xff,0xff,0xff,0xab,0xbb,0xab,0xbb,0xff,0xff,
  688. X 0xff,0xff,0xee,0xee,0xee,0xee,0xff,0xff,0xff,0xff,0xbb,0xba,0xba,0xba,0xff,
  689. X 0xff,0xff,0xff,0xee,0xee,0xee,0xee,0xff,0xff,0xff,0xff,0xbb,0xab,0xbb,0xab,
  690. X 0xff,0xff,0xff,0xff,0xee,0xee,0xee,0xee,0xff,0xff,0xff,0xff,0xbb,0xba,0xba,
  691. X 0xba,0xff,0xff,0xff,0xff,0xee,0xee,0xee,0xee,0xff,0xff,0xff,0xff,0xab,0xbb,
  692. X 0xab,0xbb,0xff,0xff,0xff,0xff,0xee,0xee,0xee,0xee,0xff,0xff,0xff,0xff,0xbb,
  693. X 0xba,0xba,0xba,0xff,0xff,0xff,0xff,0xee,0xee,0xee,0xee,0xff,0xff,0xff,0xff,
  694. X 0xbb,0xab,0xbb,0xab,0xff,0xff,0xff,0xff},
  695. X {0xff,0xff,0xff,0xff,0xee,0xee,0xee,0xee,0xff,0xff,0xff,0xff,0xfb,0xfb,0xfb,
  696. X 0xfb,0xff,0xff,0xff,0xff,0xee,0xee,0xee,0xee,0xff,0xff,0xff,0xff,0xbf,0xbb,
  697. X 0xbf,0xbb,0xff,0xff,0xff,0xff,0xee,0xee,0xee,0xee,0xff,0xff,0xff,0xff,0xfb,
  698. X 0xfb,0xfb,0xfb,0xff,0xff,0xff,0xff,0xee,0xee,0xee,0xee,0xff,0xff,0xff,0xff,
  699. X 0xbf,0xbf,0xbf,0xbf,0xff,0xff,0xff,0xff,0xee,0xee,0xee,0xee,0xff,0xff,0xff,
  700. X 0xff,0xfb,0xfb,0xfb,0xfb,0xff,0xff,0xff,0xff,0xee,0xee,0xee,0xee,0xff,0xff,
  701. X 0xff,0xff,0xbf,0xbb,0xbf,0xbb,0xff,0xff,0xff,0xff,0xee,0xee,0xee,0xee,0xff,
  702. X 0xff,0xff,0xff,0xfb,0xfb,0xfb,0xfb,0xff,0xff,0xff,0xff,0xee,0xee,0xee,0xee,
  703. X 0xff,0xff,0xff,0xff,0xbf,0xbf,0xbf,0xbf},
  704. X {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbb,0xbb,0xbb,
  705. X 0xbb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfb,0xfb,
  706. X 0xfb,0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbb,
  707. X 0xbb,0xbb,0xbb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  708. X 0xfb,0xfb,0xfb,0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  709. X 0xff,0xbb,0xbb,0xbb,0xbb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  710. X 0xff,0xff,0xfb,0xfb,0xfb,0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  711. X 0xff,0xff,0xff,0xbb,0xbb,0xbb,0xbb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  712. X 0xff,0xff,0xff,0xff,0xfb,0xfb,0xfb,0xfb},
  713. X {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  714. X 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  715. X 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  716. X 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  717. X 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  718. X 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  719. X 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  720. X 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  721. X 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
  722. X};
  723. X
  724. X/* generate the fill pixmaps */
  725. X
  726. Xinit_fill_pm()
  727. X{
  728. X    int            i;
  729. X
  730. X    for (i = 0; i < NUMFILLPATS + 1; i++) {
  731. X    fillstyle_choices[i].value = i;
  732. X    fillstyle_choices[i].icon = &none_ic;
  733. X    }
  734. X    /* use same colors for "NONE" indicator for black and color */
  735. X    fillstyle_choices[0].normalPM = 
  736. X    fillstyle_choices[0].blackPM = XCreatePixmapFromBitmapData(tool_d,
  737. X            XtWindow(ind_panel), (char *) none_ic.data, none_ic.width,
  738. X            none_ic.height, x_fg_color.pixel, x_bg_color.pixel,
  739. X            DefaultDepthOfScreen(tool_s));
  740. X
  741. X    for (i = 0; i < NUMFILLPATS; i++) {
  742. X    fill_pm[i] = XCreateBitmapFromData(tool_d, XtWindow(canvas_sw),
  743. X                       (char *) fill_images[i], 32, 32);
  744. X    /* create fill style pixmaps for indicator button */
  745. X    fillstyle_choices[i + 1].normalPM = XCreatePixmapFromBitmapData(tool_d,
  746. X         XtWindow(canvas_sw), (char *) fill_images[i], 32, 32, 
  747. X         x_bg_color.pixel,x_fg_color.pixel,DefaultDepthOfScreen(tool_s));
  748. X    fillstyle_choices[i + 1].blackPM = XCreatePixmapFromBitmapData(tool_d,
  749. X         XtWindow(canvas_sw), (char *) fill_images[i], 32, 32, 
  750. X         x_fg_color.pixel,x_bg_color.pixel,DefaultDepthOfScreen(tool_s));
  751. X    }
  752. X}
  753. X
  754. Xpw_vector(w, x1, y1, x2, y2, op, line_width, line_style, style_val, color)
  755. X    Window        w;
  756. X    int            x1, y1, x2, y2, op, line_width, line_style;
  757. X    float        style_val;
  758. X    Color        color;
  759. X{
  760. X    if (line_width == 0)
  761. X    return;
  762. X    set_line_stuff(line_width, line_style, style_val, op, color);
  763. X    if (line_style == PANEL_LINE)
  764. X    XDrawLine(tool_d, w, gccache[op], x1, y1, x2, y2);
  765. X    else
  766. X    zXDrawLine(tool_d, w, gccache[op], x1, y1, x2, y2);
  767. X}
  768. X
  769. Xpw_curve(w, xstart, ystart, xend, yend,
  770. X     op, linewidth, style, style_val, fill_style, color)
  771. X    Window        w;
  772. X    int            xstart, ystart, xend, yend;
  773. X    int            op, linewidth, style, fill_style;
  774. X    float        style_val;
  775. X    Color        color;
  776. X{
  777. X    short        xmin, ymin;
  778. X    unsigned short  wd, ht;
  779. X
  780. X    xmin = (short) min2(xstart, xend);
  781. X    ymin = (short) min2(ystart, yend);
  782. X    wd = (unsigned short) abs(xstart - xend);
  783. X    ht = (unsigned short) abs(ystart - yend);
  784. X
  785. X    /* if it's a fill pat we know about */
  786. X    if (fill_style >= 1 && fill_style <= NUMFILLPATS) {
  787. X    set_fillgc(fill_style, op, color);
  788. X    zXFillArc(tool_d, w, fillgc, xmin, ymin, wd, ht, 0, 360 * 64);
  789. X    }
  790. X    if (linewidth == 0)
  791. X    return;
  792. X    if (op == ERASE) {
  793. X    /* kludge - to speed things up we erase with thick solid lines */
  794. X    set_line_stuff(linewidth + 3, SOLID_LINE, 0.0, op, color);    /* +2 or +3 ok */
  795. X    zXDrawArc(tool_d, w, gccache[op], xmin, ymin, wd, ht, 0, 360 * 64);
  796. X    } else {
  797. X    set_line_stuff(linewidth, style, style_val, op, color);
  798. X    zXDrawArc(tool_d, w, gccache[op], xmin, ymin, wd, ht, 0, 360 * 64);
  799. X    }
  800. X}
  801. X
  802. Xpw_point(w, x, y, line_width, op, color)
  803. X    Window        w;
  804. X    int            x, y;
  805. X    int            op, line_width;
  806. X    Color        color;
  807. X{
  808. X    /* pw_point doesn't use line_style or fill_style - maybe not needed */
  809. X    /* (needs color though - hns) */
  810. X    set_line_stuff(line_width, SOLID_LINE, 0.0, op, color);
  811. X    zXDrawPoint(tool_d, w, gccache[op], x, y);
  812. X}
  813. X
  814. Xpw_arcbox(w, xmin, ymin, xmax, ymax, radius, op,
  815. X      line_width, line_style, style_val, fill_style, color)
  816. X    Window        w;
  817. X    int            xmin, ymin, xmax, ymax, radius;
  818. X    int            op, line_width, line_style, fill_style;
  819. X    float        style_val;
  820. X    Color        color;
  821. X{
  822. X    GC            gc;
  823. X    int            diam = 2 * radius;
  824. X
  825. X    /* if it's a fill pat we know about */
  826. X    if (fill_style >= 1 && fill_style <= NUMFILLPATS) {
  827. X    set_fillgc(fill_style, op, color);
  828. X    /* upper left */
  829. X    zXFillArc(tool_d, w, fillgc, xmin, ymin, diam, diam, 90 * 64, 90 * 64);
  830. X    /* lower left */
  831. X    zXFillArc(tool_d, w, fillgc, xmin, ymax - diam, diam, diam,
  832. X          180 * 64, 90 * 64);
  833. X    /* lower right */
  834. X    zXFillArc(tool_d, w, fillgc, xmax - diam, ymax - diam, diam, diam,
  835. X          270 * 64, 90 * 64);
  836. X    /* upper right */
  837. X    zXFillArc(tool_d, w, fillgc, xmax - diam, ymin, diam, diam,
  838. X          0 * 64, 90 * 64);
  839. X    /* fill strip on left side between upper and lower arcs */
  840. X    if (ymax - ymin - diam > 0)
  841. X        zXFillRectangle(tool_d, w, fillgc, xmin, ymin + radius, radius,
  842. X                ymax - ymin - diam);
  843. X    /* fill middle section */
  844. X    if (xmax - xmin - diam > 0)
  845. X        zXFillRectangle(tool_d, w, fillgc, xmin + radius, ymin,
  846. X                xmax - xmin - diam, ymax - ymin);
  847. X    /* fill strip on right side between upper and lower arcs */
  848. X    if (ymax - ymin - diam > 0)
  849. X        zXFillRectangle(tool_d, w, fillgc, xmax - radius, ymin + radius,
  850. X                radius, ymax - ymin - diam);
  851. X    }
  852. X    if (line_width == 0)
  853. X    return;
  854. X
  855. X    set_line_stuff(line_width, line_style, style_val, op, color);
  856. X    gc = gccache[op];
  857. X    zXDrawArc(tool_d, w, gc, xmin, ymin, diam, diam, 90 * 64, 90 * 64);
  858. X    zXDrawLine(tool_d, w, gc, xmin, ymin + radius, xmin, ymax - radius + 1);
  859. X    zXDrawArc(tool_d, w, gc, xmin, ymax - diam, diam, diam, 180 * 64, 90 * 64);
  860. X    zXDrawLine(tool_d, w, gc, xmin + radius, ymax, xmax - radius + 1, ymax);
  861. X    zXDrawArc(tool_d, w, gc, xmax - diam, ymax - diam,
  862. X          diam, diam, 270 * 64, 90 * 64);
  863. X    zXDrawLine(tool_d, w, gc, xmax, ymax - radius, xmax, ymin + radius - 1);
  864. X    zXDrawArc(tool_d, w, gc, xmax - diam, ymin, diam, diam, 0 * 64, 90 * 64);
  865. X    zXDrawLine(tool_d, w, gc, xmax - radius, ymin, xmin + radius - 1, ymin);
  866. X}
  867. X
  868. Xpw_lines(w, points, npoints, op, line_width, line_style, style_val, fill_style, color)
  869. X    Window        w;
  870. X    int            npoints;
  871. X    XPoint       *points;
  872. X    int            op, line_width, line_style, fill_style;
  873. X    float        style_val;
  874. X    Color        color;
  875. X{
  876. X    /* if it's a fill pat we know about */
  877. X    if (fill_style >= 1 && fill_style <= NUMFILLPATS) {
  878. X    set_fillgc(fill_style, op, color);
  879. X    if (line_style == PANEL_LINE)
  880. X        XFillPolygon(tool_d, w, fillgc, points, npoints,
  881. X             Complex, CoordModeOrigin);
  882. X    else
  883. X        zXFillPolygon(tool_d, w, fillgc, points, npoints,
  884. X              Complex, CoordModeOrigin);
  885. X    }
  886. X    if (line_width == 0)
  887. X    return;
  888. X    set_line_stuff(line_width, line_style, style_val, op, color);
  889. X    if (line_style == PANEL_LINE)
  890. X    XDrawLines(tool_d, w, gccache[op], points, npoints, CoordModeOrigin);
  891. X    else
  892. X    zXDrawLines(tool_d, w, gccache[op], points, npoints, CoordModeOrigin);
  893. X}
  894. X
  895. Xset_clip_window(xmin, ymin, xmax, ymax)
  896. X    int            xmin, ymin, xmax, ymax;
  897. X{
  898. X    clip_xmin = clip[0].x = xmin;
  899. X    clip_ymin = clip[0].y = ymin;
  900. X    clip_xmax = xmax;
  901. X    clip_ymax = ymax;
  902. X    clip_width = clip[0].width = xmax - xmin;
  903. X    clip_height = clip[0].height = ymax - ymin;
  904. X    XSetClipRectangles(tool_d, gccache[PAINT], 0, 0, clip, 1, YXBanded);
  905. X    XSetClipRectangles(tool_d, gccache[INV_PAINT], 0, 0, clip, 1, YXBanded);
  906. X}
  907. X
  908. Xset_zoomed_clip_window(xmin, ymin, xmax, ymax)
  909. X    int            xmin, ymin, xmax, ymax;
  910. X{
  911. X    set_clip_window(ZOOMX(xmin), ZOOMY(ymin), ZOOMX(xmax), ZOOMY(ymax));
  912. X}
  913. X
  914. Xreset_clip_window()
  915. X{
  916. X    set_clip_window(0, 0, CANVAS_WD, CANVAS_HT);
  917. X}
  918. X
  919. Xset_fillgc(fill_style, op, color)
  920. X    int            fill_style;
  921. X    int            op;
  922. X    Color        color;
  923. X{
  924. X    if (op == PAINT) {
  925. X    fillgc = ((color==BLACK || 
  926. X         (color==DEFAULT_COLOR && x_fg_color.pixel==appres.color[BLACK]) ||
  927. X         (!all_colors_available && color!=WHITE))? 
  928. X        black_fill_gc[fill_style - 1]: fill_gc[fill_style - 1]);
  929. X    if (writing_bitmap)
  930. X        {
  931. X        if (color == WHITE)
  932. X        color = 0;
  933. X        else
  934. X        color = 1;
  935. X        XSetForeground(tool_d,fillgc,color);
  936. X        }
  937. X    else
  938. X        set_x_color(fillgc, color);
  939. X    } else
  940. X    fillgc = ((color==BLACK || 
  941. X         (color==DEFAULT_COLOR && x_fg_color.pixel==appres.color[BLACK]) ||
  942. X         (!all_colors_available && color!=WHITE))? 
  943. X        black_un_fill_gc[fill_style - 1]: un_fill_gc[fill_style - 1]);
  944. X    XSetClipRectangles(tool_d, fillgc, 0, 0, clip, 1, YXBanded);
  945. X}
  946. X
  947. Xset_line_stuff(width, style, style_val, op, color)
  948. X    int            width, style, op;
  949. X    float        style_val;
  950. X    Color        color;
  951. X{
  952. X    XGCValues        gcv;
  953. X    unsigned long   mask;
  954. X    static unsigned char dash_list[2] = {-1, -1};
  955. X
  956. X    switch (style) {
  957. X    case RUBBER_LINE:
  958. X    width = 0;
  959. X    break;
  960. X    case PANEL_LINE:
  961. X    break;
  962. X    default:
  963. X    width = round(zoomscale * width);
  964. X    break;
  965. X    }
  966. X
  967. X    /* user zero-width lines for speed with SOLID lines */
  968. X    /* can't do this for dashed lines because server isn't */
  969. X    /* required to draw dashes for zero-width lines */
  970. X    if (width == 1 && style == SOLID_LINE)
  971. X    width = 0;
  972. X
  973. X    /* if we're drawing to the bitmap instead of the canvas
  974. X       map colors white => white, all others => black */
  975. X    if (writing_bitmap)
  976. X    {
  977. X    if (color == WHITE)
  978. X        color = 0;
  979. X    else
  980. X        color = 1;
  981. X    }
  982. X    /* see if all gc stuff is already correct */
  983. X
  984. X    if (width == gc_thickness[op] && style == gc_line_style[op] &&
  985. X    (writing_bitmap? color == gc_color[op] : x_color(color) == gc_color[op]) &&
  986. X    (style != DASH_LINE && style != DOTTED_LINE ||
  987. X     dash_list[1] == (char) round(style_val * zoomscale)))
  988. X    return;            /* no need to change anything */
  989. X
  990. X    gcv.line_width = width;
  991. X    mask = GCLineWidth | GCLineStyle | GCCapStyle;
  992. X    if (op == PAINT)
  993. X    mask |= GCForeground;
  994. X    gcv.line_style = (style == DASH_LINE || style == DOTTED_LINE) ?
  995. X    LineOnOffDash : LineSolid;
  996. X    gcv.cap_style = (style == DOTTED_LINE) ? CapRound : CapButt;
  997. X    gcv.foreground = (writing_bitmap? color : x_color(color));
  998. X
  999. X    XChangeGC(tool_d, gccache[op], mask, &gcv);
  1000. X    if (style == DASH_LINE || style == DOTTED_LINE) {
  1001. X    if (style_val > 0.0) {    /* style_val of 0.0 causes problems */
  1002. X        /* length of ON/OFF pixels */
  1003. X        dash_list[0] = dash_list[1] = (char) round(style_val *zoomscale);
  1004. X        if (dash_list[0]==0)        /* take care for rounding to zero ! */
  1005. X        dash_list[0]=dash_list[1]=1;
  1006. X
  1007. X        if (style == DOTTED_LINE)
  1008. X        dash_list[0] = 1;    /* length of ON pixels for dotted */
  1009. X        XSetDashes(tool_d, gccache[op], 0, (char *) dash_list, 2);
  1010. X    }
  1011. X    }
  1012. X    gc_thickness[op] = width;
  1013. X    gc_line_style[op] = style;
  1014. X    gc_color[op] = writing_bitmap? color : x_color(color);
  1015. X}
  1016. END_OF_FILE
  1017. if test 37827 -ne `wc -c <'w_drawprim.c'`; then
  1018.     echo shar: \"'w_drawprim.c'\" unpacked with wrong size!
  1019. fi
  1020. # end of 'w_drawprim.c'
  1021. fi
  1022. echo shar: End of archive 19 \(of 27\).
  1023. cp /dev/null ark19isdone
  1024. MISSING=""
  1025. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ; do
  1026.     if test ! -f ark${I}isdone ; then
  1027.     MISSING="${MISSING} ${I}"
  1028.     fi
  1029. done
  1030. if test "${MISSING}" = "" ; then
  1031.     echo You have unpacked all 27 archives.
  1032.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1033. else
  1034.     echo You still need to unpack the following archives:
  1035.     echo "        " ${MISSING}
  1036. fi
  1037. ##  End of shell archive.
  1038. exit 0
  1039.  
  1040. exit 0 # Just in case...
  1041. -- 
  1042.   // chris@IMD.Sterling.COM       | Send comp.sources.x submissions to:
  1043. \X/  Amiga - The only way to fly! |    sources-x@imd.sterling.com
  1044.  "It's intuitively obvious to the |
  1045.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  1046.