File: main.h

package info (click to toggle)
xmorph 1%3A20011220
  • links: PTS
  • area: main
  • in suites: woody
  • size: 3,468 kB
  • ctags: 1,534
  • sloc: ansic: 16,401; sh: 2,651; makefile: 556; tcl: 516
file content (154 lines) | stat: -rw-r--r-- 3,876 bytes parent folder | download
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#ifndef _XMORPH_GTK_MAIN_H_
#define _XMORPH_GTK_MAIN_H_

#define MAX_WINS 12

extern GtkWidget *menuFile_g;
extern GtkWidget *menuEdit_g;
extern GtkWidget *menuMorph_g;
extern GtkWidget *menuSettings_g;
extern GtkWidget *menuHelp_g;
extern GtkFileSelection *imageselection1_g; 
extern guint fileselection1_for_image_num_g;
extern GtkWidget *dialogwarning_g; 
/* the text of the warning */
/* extern char dialogwarning_text[]; */


#include "../libmorph/mesh.h"

#include "settings.h"

#include "gtk_subimagesel.h"

/********** the current status is
  in a "structure of arrays " (see main.h)

  why not an "array of structures"?
  because many subroutines work on the
  arrays, and they would become unnecessarily complicated

  on the other end, a  "array of structures"
  may be easily modified to add new images... this
  way, the program will have to be recompiled to add new images;
  but hopefully MAX_WINS may be set to a value that is sufficient 
  in 99.9% of cases

  */

typedef struct _morph_factors_t morph_factors_t;

struct  _morph_factors_t {
  double im_warp_factor[MAX_WINS+2];
  double im_dissolve_factor[MAX_WINS+2];
};

 
typedef struct _gtkmorph_status_t gtkmorph_status_t;

struct  _gtkmorph_status_t {
 
  int max_wins;

  int resulting_width;
  int resulting_height;

  /* standard size of meshes; it is augmented when other meshes are loaded */
  int meshes_x;
  int meshes_y;

  /* what is in the spinbuttons */
  int resulting_width_sp;
  int resulting_height_sp;

  /* the size of the loaded image (and not of the subimage) */
  int im_width[MAX_WINS+2];
  int im_height[MAX_WINS+2];
  
  /* the filename of the loaded image */
  char *im_filename[MAX_WINS+2];

  char *im_mesh_filename[MAX_WINS+2];
  
  MeshT im_mesh[MAX_WINS+2];

  morph_factors_t mf;

  /* record the value of the "edit mesh/ show warp" choice
   */

  editshow_t im_editshow[MAX_WINS+2];

  /** this is the position of the 'eyes&mouth' : 3 points that we use
      to put all images in the same positions
  **/

  gtk_subimage_sel_t  subimasel[MAX_WINS+2];

  //private

  GtkWidget * im_widget[MAX_WINS+2];
  GtkWidget * im_drawingarea_widget[MAX_WINS+2];

  /* special window for warped images*/
  GtkWidget * im_warped_widget[MAX_WINS+2];

  /*** this records the settings for the image */
  gpointer * im_settings[MAX_WINS+2];
  GtkWidget * im_menu_settings[MAX_WINS+2];

  /* which image are we displaying? 
     0 loaded
     1 subimage
     2 warped
   */
  int which_pix[MAX_WINS+2];

  /* stores the loaded image, (and not not its subimage).
   *  To save memory,
   * we should not use it , we reload the image when a new subimage is
   *  requested */
  GdkPixbuf  *im_loaded_pixbuf[MAX_WINS+2]; 
  /*     it would have size    im_width[lp]    im_height[lp]  */
  /* and its rendered version */
  GdkPixmap  *im_loaded_pixmap[MAX_WINS+2]; 

  /* stores the zoomed subimage. 
      has size    resulting_width  resulting_height
   */
  GdkPixbuf  *im_subimage_pixbuf[MAX_WINS+2]; 
  /* backing pixmap of subimage image 
      has size    resulting_width  resulting_height
   */
  GdkPixmap * im_subimage_pixmap[MAX_WINS+2];

  /* original rr  gg bb buffers, coming from the above subimage pixbuf 
    used to do the warps 
  */
  guint8 *red[MAX_WINS+2], *green[MAX_WINS+2], * blue[MAX_WINS+2];

  /* morphed: we dont use these, otherwise we use too much memory
     guint8 *mred[MAX_WINS+2], *mgreen[MAX_WINS+2], * mblue[MAX_WINS+2];
  */

  /* stores the warped version 
      has size    resulting_width  resulting_height
  */
  GdkPixbuf * im_warped_pixbuf[MAX_WINS+2]; 

  /* backing pixmap, the warped version 
     has size    resulting_width  resulting_height
  */
  GdkPixmap * im_warped_pixmap[MAX_WINS+2];

}  ;



//struct gtkmorph_undo {
//  gtkmorph_status_t undos[1000];
//};

extern gtkmorph_status_t settings, *sp;

#endif _XMORPH_GTK_MAIN_H_