home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / julia / init.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-03  |  2.6 KB  |  78 lines

  1. /*************************************************************************
  2.  *                                                                       *
  3.  *  Copyright (c) 1992, 1993 Ronald Joe Record                           *
  4.  *                                                                       *
  5.  *  All rights reserved. No part of this program or publication may be   *
  6.  *  reproduced, transmitted, transcribed, stored in a retrieval system,  *
  7.  *  or translated into any language or computer language, in any form or *
  8.  *  by any means, electronic, mechanical, magnetic, optical, chemical,   *
  9.  *  biological, or otherwise, without the prior written permission of:   *
  10.  *                                                                       *
  11.  *      Ronald Joe Record (408) 458-3718                                 *
  12.  *      212 Owen St., Santa Cruz, California 95062 USA                   *
  13.  *                                                                       *
  14.  *************************************************************************/
  15.  
  16. #include "defines.h"
  17. #include "externs.h"
  18.  
  19. void
  20. init_data()
  21. {
  22.     static int i;
  23.  
  24.     numcolors = XDisplayCells(dpy, XDefaultScreen(dpy));
  25.     displayplanes = DisplayPlanes(dpy, XDefaultScreen(dpy));
  26.     if (numcolors > maxcolor)
  27.         numcolors = maxcolor;
  28.     if (numcolors <= 16) {
  29.         maxcolor = 16; startcolor = 1; 
  30.         color_offset = 0;
  31.     }
  32.     numfreecols = numcolors - startcolor;
  33.     a_inc = a_range / (double)width;
  34.     b_inc = b_range / (double)height;
  35.     if (!restfile) {
  36.         point.x = 0;
  37.         point.y = 0;
  38.         a = rubber_data.p_min = min_a;
  39.         b = rubber_data.q_min = min_b;
  40.     }
  41.     rubber_data.p_max = max_a;
  42.     rubber_data.q_max = max_b;
  43.     if (show)
  44.         show_defaults();
  45.     w2 = width / 2; h2 = height / 2;
  46.     if ((2*w2) == width)
  47.         rem = 1;
  48.     else
  49.         rem = 0;
  50.     if ((center_x == 0.0) && (center_y == 0.0))
  51.         symetrical = 1;
  52.     else if ((func == compmandel) && (center_y == 0.0))
  53.         symetrical = 1;
  54.     else
  55.         symetrical = 0;
  56.     srand48(time(0));
  57. }
  58.  
  59. void
  60. init_canvas()
  61. {
  62.     static int i;
  63.  
  64.     /*
  65.      * create default, writable, graphics contexts for the canvas.
  66.      */
  67.     for (i=0; i<maxcolor; i++) {
  68.         Data_GC[i] = XCreateGC(dpy, DefaultRootWindow(dpy),
  69.                 (unsigned long) 0, (XGCValues *) 0);
  70.         /* set the background to black */
  71.         XSetBackground(dpy,Data_GC[i],BlackPixel(dpy,XDefaultScreen(dpy)));
  72.         /* set the foreground of the ith context to i */
  73.         XSetForeground(dpy, Data_GC[i], i);
  74.     }
  75.     XSetForeground(dpy,Data_GC[0],BlackPixel(dpy,XDefaultScreen(dpy)));
  76.     XSetForeground(dpy,Data_GC[1],WhitePixel(dpy,XDefaultScreen(dpy)));
  77. }
  78.