1 /*****************************************************************************/
2 /* XMangekyou - a kaleidoscope for X                                         */
3 /* Programed by Sakai Hiroaki.                                               */
4 /*                                                                           */
5 /* Copyright (c) 1998 Sakai Hiroaki.                                         */
6 /* All Rights Reserved.                                                      */
7 /*                                                                           */
8 /* XMangekyou is a kaleidoscope. You can see many, many, many patterns,      */
9 /* but, care for yourself from 'trip' filling!                               */
10 /*                                                                           */
11 /* XMangekyou is a free software. You may copy or distribute the original    */
12 /* XMangekyou freely. But, you may not modify or distribute the original     */
13 /* XMangekyou without permission of the author.                              */
14 /*****************************************************************************/
15 
16 #ifndef _XMANGEKYOU_XMANGEKYOU_H_INCLUDED_
17 #define _XMANGEKYOU_XMANGEKYOU_H_INCLUDED_
18 
19 /*****************************************************************************/
20 /* Include Header Files.                                                     */
21 /*****************************************************************************/
22 
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <X11/Xlib.h>
26 #include <X11/Intrinsic.h>
27 #include <X11/StringDefs.h>
28 #include <X11/xpm.h>
29 #include <X11/Xaw/Label.h>
30 
31 #include "configure.h"
32 
33 /*****************************************************************************/
34 /* Structures for XMangekyou.                                                */
35 /*****************************************************************************/
36 
37 typedef struct DoublePoint {
38   double x;
39   double y;
40 } DoublePoint;
41 
42 typedef struct CharPoint {
43   signed char x;
44   signed char y;
45 } CharPoint;
46 
47 typedef struct Line {
48   DoublePoint point_1;
49   DoublePoint point_2;
50   GC gc;
51 } Line;
52 
53 typedef struct Circle {
54   DoublePoint center;
55   int r;
56   GC gc;
57 } Circle;
58 
59 typedef struct PictureLine {
60   CharPoint point_1;
61   CharPoint point_2;
62 } PictureLine;
63 
64 typedef struct PictureCircle {
65   CharPoint center;
66 } PictureCircle;
67 
68 typedef struct SixPoints {
69   DoublePoint point[6];
70 } SixPoints;
71 
72 typedef struct Picture {
73   unsigned long int count;
74   int lines_number;
75   int circles_number;
76   PictureLine * lines;
77   PictureCircle * circles;
78 } Picture;
79 
80 typedef struct Animation {
81   int pictures_number;
82   Picture * pictures;
83 } Animation;
84 
85 typedef struct SourcePixmap {
86   Pixmap pixmap;
87   XPoint center;
88   XPoint width;
89   int size;
90 } SourcePixmap;
91 
92 /*****************************************************************************/
93 /* Static Data.                                                              */
94 /*****************************************************************************/
95 
96 #define COLORS_NUMBER 18
97 extern char * (color_name[COLORS_NUMBER]);
98 
99 #define CLEAR_POINTS_NUMBER 14
100 extern DoublePoint clear_points[CLEAR_POINTS_NUMBER];
101 
102 #define OFFSET 1.4
103 extern DoublePoint clear_points_offset[CLEAR_POINTS_NUMBER];
104 
105 /*****************************************************************************/
106 /* XMangekyou Structure.                                                     */
107 /*****************************************************************************/
108 
109 typedef struct struct_xmangekyou {
110   XtAppContext app_context;
111   Display * display;
112   int screen;
113   Colormap colormap;
114   Widget toplevel, canvas;
115   Window toplevel_window, root_window, canvas_window;
116   Atom atom_1, atom_2;
117   unsigned long int foreground_color;
118   unsigned long int background_color;
119   GC gc_source_clear, gc_source_hex_clear, gc_canvas_clear;
120   GC gc_copy_source_canvas, gc_copy_canvas_canvas;
121   int icon_width, icon_height;
122   Pixmap icon_pixmap;
123 
124   int x, y, width, height, depth;
125   int root_flag, quit_flag;
126   int lines_number, circles_number, line_thickness, circle_size;
127   int size, speed, change, wait;
128   int degree;
129   Line * lines;
130   Circle * circles;
131 
132   SourcePixmap * source_pixmaps;
133   DoublePoint clear_points_rotated[CLEAR_POINTS_NUMBER];
134   DoublePoint clear_points_offset_rotated[CLEAR_POINTS_NUMBER];
135   XPoint clear_points_rotated_int[CLEAR_POINTS_NUMBER];
136   int copy_max, copy_end, copy_number;
137   DoublePoint * copy_points;
138   DoublePoint * copy_points_rotated;
139 
140   char * animation_data_filename;
141   int animations_number;
142   int animation_flag;
143   Animation * animations;
144   unsigned long int animation_picture_start_time;
145   int animation_type, animation_picture;
146   int animation_fix_number;
147 } XMangekyou;
148 
149 extern XMangekyou xmangekyou;
150 
151 #endif
152 
153 /*****************************************************************************/
154 /* End of File.                                                              */
155 /*****************************************************************************/
156