File: utils.h

package info (click to toggle)
xmorph 1%3A20150712-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,404 kB
  • sloc: ansic: 24,887; sh: 7,755; cpp: 1,231; makefile: 524; sed: 16
file content (201 lines) | stat: -rw-r--r-- 4,094 bytes parent folder | download | duplicates (9)
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#ifndef __UTILS_H__
#define __UTILS_H__
#include "main.h"

gchar * compute_title (int j);

GtkWidget * create_menu_of_images(int avoid, GtkSignalFunc  callback ,
				  gboolean avoid_diffs);

//CHE CRETINO CHE SONO #define dstmesh  (&(sp->im_mesh[MAIN_WIN]))

void set_sensitive(GtkWidget * widget, gboolean flag);


/* void */
/* flash_point(GdkDrawable  *drawable, */
/* 	    int x,int y	    ); */

void
destroy_image_win_pixbufs(int lp, int what);
void
destroy_image_win_data(int lp);

void
alloc_image_win_data(int lp, int what);

void
create_and_show_image_win(int lp);

/* void */
/* init_image_win_data_and_set_all(int lp); /\* the slot where the data are put */
/* 					   in the arrays in sp-> *\/ */

void
editview_callback(int i);

void
set_editview(int lp, /* window number */
	     int status);



void
pixbuf_to_rrrgggbb(GdkPixbuf *pb, guint8 *r, guint8 *g, guint8 *b);


/* void */
/* rrrgggbbb_add_to_pixbuf(GdkPixbuf *pb, /\* destination *\/ */
/* 			const guint8 *r, const  guint8 *g, const guint8 *b, */
/* 			/\* source *\/ */
/* 			double factor /\* dissolving factor *\/ */
/* 			); */

void
do_warp_an_image_old(int lp); //, char * r, char *g, char * b);

void
do_warp_an_image_new(int lp);

#define do_warp_an_image do_warp_an_image_new

/**********   showerr()
 *  shows libc error 
 */

inline  void 
showerr(const char *file, const  char *msg);





/**********************************************************
 * accepts new backing pixmap of the appropriate size 
 *  save it in the data of the top window 
 * and in the sp-> structure
 * resizes the viewport
*/

gboolean
set_backing_pixmap        (GtkWidget       *widget,
		   GdkPixmap *newpixmap,
		   int width, int height);



/********************************************************************
		loads image from pixbuf to pixmap for image window "lp"
		you should unref the pixbuf   when it exists
		
		copies its data to r,g,b,
*/


void scale_loaded_pixbuf_to_pixmap_et_rrggbb(
					     // GdkPixbuf      *impixold,
		 int lp //image number
		 );



/****************************************************************************
 promote meshes to have same lines and columns 
***************************************************************************/

void promote_meshes();
/***********************************************************************
 which image are we displaying? 

   */
enum what_display{ PIXLOADED=0, PIXSUBIMAGE=1, 
		   PIXWARPED=2};

GdkPixbuf **
which_pixbuf_is_visible(int lp);

GdkPixmap **
which_pixmap_is_visible(int lp);

GdkPixbuf **
which_pixbuf(int lp, enum what_display what);

GdkPixmap **
which_pixmap(int lp, enum what_display what);


void
destroy_pixbuf(int lp, enum what_display what);

void
destroy_pixmap(int lp, enum what_display what);

#define PIXLOADEDBORDER 100
#define PIXEDITBORDER 30

static inline void
which_pixbuf_size(int lp, enum what_display what, int *w, int *h)
{
  *w=sp->resulting_width; *h=sp->resulting_height;
  if(what == PIXLOADED)
    { *w=sp->im_width[lp] ;  *h=sp->im_height[lp]; }
}


void
create__pixbuf(int lp, enum what_display what);

void
create__pixmap(int lp, enum what_display what);

static inline void
which_pixbuf_size_is_visible(int lp, int *w, int *h)
{
  which_pixbuf_size( lp,sp->which_pix[lp] , w, h);
}


void 
render_pixmap(int lp, enum what_display what);

/***************************************************************

 *		drawing area bookkeeping

 ***********************************************************
*/ 


/* creates new backing pixmap of the appropriate size 
   save it in the data of the top window

   it uses: the image filename, to load the image, or, if none
   it creates a black pixmap

   it sets what is necessary for properly displaying the
   drawing area*/


void
drawingarea_configure (int i);


void
setup_handlebox_factors();
void
setup_handlebox_factor(int lp, int force);



void   set_frame_label(int i);

void set_info_label(gchar *t);



/* #ifdef GDK_PIXBUF_MAJOR /\* interfaces accepting GdkPixbufs *\/ */
/* #include "libmorph/warp2.h" */

/* #endif */

#endif //__UTILS_H__