27 XWindowAttributes attrs;
28 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
29 int rect_width = attrs.width;
30 int rect_height = attrs.height;
34 int db_points[] = { -50, -40, -30, -20, -15, -10, -6, -3, 0, 3 };
38 cairo_set_font_size (w->
crb, (
float)rect_width/2);
39 cairo_set_source_rgb(w->
crb, 0.8, 0.8, 0.8);
41 for (
unsigned int i = 0; i <
sizeof (db_points)/
sizeof (db_points[0]); ++i)
43 float fraction =
_log_meter((
double)db_points[i]);
44 cairo_move_to (w->
crb, 0,y0+rect_height - (rect_height * fraction));
45 cairo_line_to (w->
crb, x0+rect_width-3 ,y0+rect_height - (rect_height * fraction));
48 snprintf (buf,
sizeof (buf),
"%d", db_points[i]);
49 cairo_move_to (w->
crb, x0+rect_width*0.1,y0+rect_height - (rect_height * fraction)-3);
53 snprintf (buf,
sizeof (buf),
"%d", db_points[i]);
54 cairo_move_to (w->
crb, x0+rect_width*0.2,y0+rect_height - (rect_height * fraction)-3);
58 snprintf (buf,
sizeof (buf),
" %d", db_points[i]);
59 cairo_move_to (w->
crb, x0+rect_width*0.21,y0+rect_height - (rect_height * fraction)-3);
61 cairo_show_text (w->
crb, buf);
64 cairo_set_source_rgb(w->
crb, 0.6, 0.6, 0.6);
65 cairo_set_line_width(w->
crb, 2.0);
71 XWindowAttributes attrs;
72 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
73 int rect_width = attrs.width;
74 int rect_height = attrs.height;
78 int db_points[] = { -50, -40, -30, -20, -15, -10, -6, -3, 0, 3 };
81 cairo_set_font_size (w->
crb, (
float)rect_height/2);
82 cairo_set_source_rgba(w->
crb, 0.6, 0.6, 0.6, 0.6);
84 for (
unsigned int i = 0; i <
sizeof (db_points)/
sizeof (db_points[0]); ++i)
89 cairo_move_to (w->
crb, x0+(rect_width * fraction),y0+rect_height*0.1);
90 cairo_line_to (w->
crb, x0+(rect_width * fraction) ,y0+rect_height*0.6);
93 snprintf (buf,
sizeof (buf),
"%d", db_points[i]);
94 cairo_move_to (w->
crb, x0+(rect_width * fraction)+3,y0+rect_height);
98 snprintf (buf,
sizeof (buf),
" %d", db_points[i]);
99 cairo_move_to (w->
crb, x0+(rect_width * fraction)+3,y0+rect_height );
101 cairo_show_text (w->
crb, buf);
104 cairo_set_source_rgba(w->
crb, 0.6, 0.6, 0.6, 0.6);
105 cairo_set_line_width(w->
crb, 1.5);
106 cairo_stroke(w->
crb);
114 }
else if (db < -60.0f) {
115 def = (db + 70.0f) * 0.25f;
116 }
else if (db < -50.0f) {
117 def = (db + 60.0f) * 0.5f + 2.5f;
118 }
else if (db < -40.0f) {
119 def = (db + 50.0f) * 0.75f + 7.5f;
120 }
else if (db < -30.0f) {
121 def = (db + 40.0f) * 1.5f + 15.0f;
122 }
else if (db < -20.0f) {
123 def = (db + 30.0f) * 2.0f + 30.0f;
124 }
else if (db < 6.0f) {
125 def = (db + 20.0f) * 2.5f + 50.0f;
140 CAIRO_CONTENT_COLOR_ALPHA, width*2, height);
141 cairo_t *cri = cairo_create (w->
image);
143 cairo_rectangle(cri,0.0, 0.0, width, height);
147 cairo_rectangle(cri,width, 0.0, width, height);
151 cairo_pattern_t *pat = cairo_pattern_create_linear (0, 0, 0.0, height);
152 cairo_pattern_add_color_stop_rgba(pat, 1.0, 0.1, 0.5, 0.1, 0.4);
153 cairo_pattern_add_color_stop_rgba(pat, 0.2, 0.4, 0.4, 0.1, 0.4);
154 cairo_pattern_add_color_stop_rgba(pat, 0.0, 0.5, 0.0, 0.0, 0.4);
155 cairo_set_source(cri, pat);
164 cairo_rectangle(cri,j,i,ci,2);
172 cairo_pattern_destroy (pat);
173 pat = cairo_pattern_create_linear (0, 0, 0.0, height);
174 cairo_pattern_add_color_stop_rgba(pat, 1.0, 0.1, 0.5, 0.1, 1);
175 cairo_pattern_add_color_stop_rgba(pat, 0.2, 0.4, 0.4, 0.1, 1);
176 cairo_pattern_add_color_stop_rgba(pat, 0.0, 0.5, 0.0, 0.0, 1);
177 cairo_set_source(cri, pat);
182 cairo_rectangle(cri,width+j,i,ci,2);
190 cairo_pattern_destroy (pat);
196 CAIRO_CONTENT_COLOR_ALPHA, width, height*2);
197 cairo_t *cri = cairo_create (w->
image);
199 cairo_rectangle(cri,0.0, 0.0, width, height);
203 cairo_rectangle(cri, 0.0, height, width, height);
207 cairo_pattern_t *pat = cairo_pattern_create_linear (0, 0, width, 0.0);
208 cairo_pattern_add_color_stop_rgba(pat, 0.0, 0.1, 0.5, 0.1, 0.4);
209 cairo_pattern_add_color_stop_rgba(pat, 0.8, 0.4, 0.4, 0.1, 0.4);
210 cairo_pattern_add_color_stop_rgba(pat, 1.0, 0.5, 0.0, 0.0, 0.4);
211 cairo_set_source(cri, pat);
220 cairo_rectangle(cri,i,j,2,ci);
228 cairo_pattern_destroy (pat);
229 pat = cairo_pattern_create_linear (0, 0, width, 0.0);
230 cairo_pattern_add_color_stop_rgba(pat, 0.0, 0.1, 0.5, 0.1, 1);
231 cairo_pattern_add_color_stop_rgba(pat, 0.8, 0.4, 0.4, 0.1, 1);
232 cairo_pattern_add_color_stop_rgba(pat, 1.0, 0.5, 0.0, 0.0, 1);
233 cairo_set_source(cri, pat);
238 cairo_rectangle(cri,i,height+j,2,ci);
246 cairo_pattern_destroy (pat);
253 int width = cairo_xlib_surface_get_width(w->
image);
254 int height = cairo_xlib_surface_get_height(w->
image);
258 cairo_set_source_surface (w->
crb, w->
image, 0, 0);
259 cairo_rectangle(w->
crb,0, 0, width/2, height);
261 cairo_set_source_surface (w->
crb, w->
image, -width/2, 0);
262 cairo_rectangle(w->
crb, 0, height, width/2, -height*meterstate);
265 cairo_rectangle(w->
crb, 0, height-height*oldstate, width/2, 3);
273 int width = cairo_xlib_surface_get_width(w->
image);
274 int height = cairo_xlib_surface_get_height(w->
image);
278 cairo_set_source_surface (w->
crb, w->
image, 0, 0);
279 cairo_rectangle(w->
crb,0, 0, width, height/2);
281 cairo_set_source_surface (w->
crb, w->
image, 0, -height/2);
282 cairo_rectangle(w->
crb, 0, 0, width*meterstate, height/2);
285 cairo_rectangle(w->
crb,(width*oldstate)-3, 0, 3, height/2);