| 1 | #include "camera.h" |
|---|
| 2 | #include "stdlib.h" |
|---|
| 3 | #include "keyboard.h" |
|---|
| 4 | #include "platform.h" |
|---|
| 5 | #include "histogram.h" |
|---|
| 6 | #include "core.h" |
|---|
| 7 | #include "lang.h" |
|---|
| 8 | #include "conf.h" |
|---|
| 9 | #include "gui.h" |
|---|
| 10 | #include "gui_draw.h" |
|---|
| 11 | #include "gui_lang.h" |
|---|
| 12 | #include "gui_batt.h" |
|---|
| 13 | #include "gui_space.h" |
|---|
| 14 | #include "gui_grid.h" |
|---|
| 15 | #include "gui_osd.h" |
|---|
| 16 | |
|---|
| 17 | //------------------------------------------------------------------- |
|---|
| 18 | typedef struct { |
|---|
| 19 | int title; |
|---|
| 20 | OSD_pos *pos; |
|---|
| 21 | OSD_pos size; |
|---|
| 22 | } OSD_elem; |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | static OSD_elem osd[]={ |
|---|
| 28 | {LANG_OSD_LAYOUT_EDITOR_HISTO, &conf.histo_pos, {HISTO_WIDTH+2, HISTO_HEIGHT} }, |
|---|
| 29 | {LANG_OSD_LAYOUT_EDITOR_DOF_CALC, &conf.dof_pos, {23*FONT_WIDTH, 2*FONT_HEIGHT} }, |
|---|
| 30 | {LANG_OSD_LAYOUT_EDITOR_STATES, &conf.mode_state_pos, {12*FONT_WIDTH, 4*FONT_HEIGHT} }, |
|---|
| 31 | {LANG_OSD_LAYOUT_EDITOR_RAW, &conf.mode_raw_pos, {7*FONT_WIDTH, FONT_HEIGHT} }, |
|---|
| 32 | {LANG_OSD_LAYOUT_EDITOR_MISC, &conf.values_pos, {9*FONT_WIDTH, 9*FONT_HEIGHT} }, |
|---|
| 33 | {LANG_OSD_LAYOUT_EDITOR_BAT_ICON, &conf.batt_icon_pos, {28, 12} }, |
|---|
| 34 | {LANG_OSD_LAYOUT_EDITOR_SPACE_ICON, &conf.space_icon_pos, {23, 15} }, |
|---|
| 35 | {LANG_OSD_LAYOUT_EDITOR_SPACE_ICON, &conf.space_ver_pos, {3, 50} }, |
|---|
| 36 | {LANG_OSD_LAYOUT_EDITOR_SPACE_ICON, &conf.space_hor_pos, {50, 3} }, |
|---|
| 37 | {LANG_OSD_LAYOUT_EDITOR_BAT_TEXT, &conf.batt_txt_pos, {5*FONT_WIDTH, FONT_HEIGHT} }, |
|---|
| 38 | {LANG_OSD_LAYOUT_EDITOR_SPACE_TEXT, &conf.space_txt_pos, {5*FONT_WIDTH, FONT_HEIGHT} }, |
|---|
| 39 | {LANG_OSD_LAYOUT_EDITOR_CLOCK, &conf.clock_pos, {5*FONT_WIDTH, FONT_HEIGHT} }, |
|---|
| 40 | {LANG_OSD_LAYOUT_EDITOR_TEMP, &conf.temp_pos, {9*FONT_WIDTH, FONT_HEIGHT} }, |
|---|
| 41 | {LANG_OSD_LAYOUT_EDITOR_VIDEO, &conf.mode_video_pos, {9*FONT_WIDTH, 4*FONT_HEIGHT} }, |
|---|
| 42 | {LANG_OSD_LAYOUT_EDITOR_EV, &conf.mode_ev_pos, {12*FONT_WIDTH, FONT_HEIGHT} }, |
|---|
| 43 | #if CAM_EV_IN_VIDEO |
|---|
| 44 | {LANG_OSD_LAYOUT_EDITOR_EV_VIDEO, &conf.ev_video_pos, {70,24}}, |
|---|
| 45 | #endif |
|---|
| 46 | {0} |
|---|
| 47 | }; |
|---|
| 48 | static int osd_to_draw; |
|---|
| 49 | static int curr_item; |
|---|
| 50 | static char osd_buf[64]; |
|---|
| 51 | static char osd_buf2[10]; |
|---|
| 52 | static char osd_buf3[10]; |
|---|
| 53 | static char osd_buf4[10]; |
|---|
| 54 | |
|---|
| 55 | static int step; |
|---|
| 56 | static unsigned char *img_buf, *scr_buf; |
|---|
| 57 | static int timer = 0; |
|---|
| 58 | static char *buf = NULL; |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | static DOF_TYPE dof; |
|---|
| 62 | static EXPO_TYPE expo; |
|---|
| 63 | |
|---|
| 64 | #define OSD_STATE 0 |
|---|
| 65 | #define OSD_MISC 1 |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | //------------------------------------------------------------------- |
|---|
| 70 | void gui_osd_init() { |
|---|
| 71 | osd_to_draw = 1; |
|---|
| 72 | curr_item = 0; |
|---|
| 73 | step = 10; |
|---|
| 74 | draw_restore(); |
|---|
| 75 | } |
|---|
| 76 | |
|---|
| 77 | //------------------------------------------------------------------- |
|---|
| 78 | void gui_osd_draw() { |
|---|
| 79 | if (osd_to_draw) { |
|---|
| 80 | int i; |
|---|
| 81 | draw_restore(); |
|---|
| 82 | gui_osd_draw_histo(); |
|---|
| 83 | gui_osd_draw_dof(); |
|---|
| 84 | gui_batt_draw_osd(); |
|---|
| 85 | gui_space_draw_osd(); |
|---|
| 86 | gui_osd_draw_state(); |
|---|
| 87 | gui_osd_draw_raw_info(); |
|---|
| 88 | gui_osd_draw_values(); |
|---|
| 89 | gui_osd_draw_clock(); |
|---|
| 90 | gui_osd_draw_temp(); |
|---|
| 91 | #if CAM_EV_IN_VIDEO |
|---|
| 92 | gui_osd_draw_ev_video(1); |
|---|
| 93 | #endif |
|---|
| 94 | for (i=1; i<=2; ++i) { |
|---|
| 95 | draw_rect((osd[curr_item].pos->x>=i)?osd[curr_item].pos->x-i:0, (osd[curr_item].pos->y>=i)?osd[curr_item].pos->y-i:0, |
|---|
| 96 | osd[curr_item].pos->x+osd[curr_item].size.x+i-1, osd[curr_item].pos->y+osd[curr_item].size.y+i-1, |
|---|
| 97 | COLOR_GREEN); |
|---|
| 98 | } |
|---|
| 99 | sprintf(osd_buf, " %s: x:%d y:%d s:%d ", lang_str(osd[curr_item].title), osd[curr_item].pos->x, osd[curr_item].pos->y, step); |
|---|
| 100 | draw_string(0, (osd[curr_item].pos->x<strlen(osd_buf)*FONT_WIDTH+4 && osd[curr_item].pos->y<FONT_HEIGHT+4)?screen_height-FONT_HEIGHT:0, |
|---|
| 101 | osd_buf, MAKE_COLOR(COLOR_RED, COLOR_WHITE)); |
|---|
| 102 | osd_to_draw = 0; |
|---|
| 103 | } |
|---|
| 104 | } |
|---|
| 105 | |
|---|
| 106 | //------------------------------------------------------------------- |
|---|
| 107 | void gui_osd_kbd_process() { |
|---|
| 108 | switch (kbd_get_autoclicked_key()) { |
|---|
| 109 | case KEY_LEFT: |
|---|
| 110 | if (osd[curr_item].pos->x > 0) { |
|---|
| 111 | osd[curr_item].pos->x-=(osd[curr_item].pos->x>=step)?step:osd[curr_item].pos->x; |
|---|
| 112 | osd_to_draw = 1; |
|---|
| 113 | } |
|---|
| 114 | break; |
|---|
| 115 | case KEY_RIGHT: |
|---|
| 116 | if (osd[curr_item].pos->x < screen_width-osd[curr_item].size.x) { |
|---|
| 117 | osd[curr_item].pos->x+=(screen_width-osd[curr_item].size.x-osd[curr_item].pos->x>step)?step:screen_width-osd[curr_item].size.x-osd[curr_item].pos->x; |
|---|
| 118 | osd_to_draw = 1; |
|---|
| 119 | } else |
|---|
| 120 | osd[curr_item].pos->x = screen_width-osd[curr_item].size.x; |
|---|
| 121 | break; |
|---|
| 122 | case KEY_UP: |
|---|
| 123 | if (osd[curr_item].pos->y > 0) { |
|---|
| 124 | osd[curr_item].pos->y-=(osd[curr_item].pos->y>=step)?step:osd[curr_item].pos->y; |
|---|
| 125 | osd_to_draw = 1; |
|---|
| 126 | } |
|---|
| 127 | break; |
|---|
| 128 | case KEY_DOWN: |
|---|
| 129 | if (osd[curr_item].pos->y < screen_height-osd[curr_item].size.y) { |
|---|
| 130 | osd[curr_item].pos->y+=(screen_height-osd[curr_item].size.y-osd[curr_item].pos->y>step)?step:screen_height-osd[curr_item].size.y-osd[curr_item].pos->y; |
|---|
| 131 | osd_to_draw = 1; |
|---|
| 132 | } else |
|---|
| 133 | osd[curr_item].pos->y = screen_height-osd[curr_item].size.y; |
|---|
| 134 | break; |
|---|
| 135 | case KEY_SET: |
|---|
| 136 | ++curr_item; |
|---|
| 137 | if (!osd[curr_item].pos) |
|---|
| 138 | curr_item = 0; |
|---|
| 139 | osd_to_draw = 1; |
|---|
| 140 | break; |
|---|
| 141 | case KEY_DISPLAY: |
|---|
| 142 | step=(step==1)?10:1; |
|---|
| 143 | osd_to_draw = 1; |
|---|
| 144 | break; |
|---|
| 145 | } |
|---|
| 146 | } |
|---|
| 147 | |
|---|
| 148 | //------------------------------------------------------------------- |
|---|
| 149 | static void gui_osd_draw_single_histo(int hist, coord x, coord y, int small) { |
|---|
| 150 | register unsigned int i, v, threshold; |
|---|
| 151 | register color cl, cl_over, cl_bg=conf.histo_color>>8; |
|---|
| 152 | coord w=HISTO_WIDTH, h=HISTO_HEIGHT; |
|---|
| 153 | |
|---|
| 154 | switch (hist) { |
|---|
| 155 | case HISTO_R: |
|---|
| 156 | cl=COLOR_RED; |
|---|
| 157 | break; |
|---|
| 158 | case HISTO_G: |
|---|
| 159 | cl=COLOR_GREEN; |
|---|
| 160 | break; |
|---|
| 161 | case HISTO_B: |
|---|
| 162 | cl=((mode_get()&MODE_MASK) == MODE_REC)?0xDF:0xCC; |
|---|
| 163 | break; |
|---|
| 164 | case HISTO_RGB: |
|---|
| 165 | case HISTO_Y: |
|---|
| 166 | default: |
|---|
| 167 | cl=conf.histo_color; |
|---|
| 168 | break; |
|---|
| 169 | } |
|---|
| 170 | |
|---|
| 171 | if (small) { |
|---|
| 172 | h>>=1; w>>=1; |
|---|
| 173 | for (i=0; i<w; ++i) { |
|---|
| 174 | threshold = (histogram[hist][i<<1]+histogram[hist][(i<<1)+1])>>2; |
|---|
| 175 | |
|---|
| 176 | for (v=1; v<h-1; ++v) |
|---|
| 177 | draw_pixel(x+1+i, y+h-v, (v<=threshold)?cl:cl_bg); |
|---|
| 178 | cl_over = (threshold==h && conf.show_overexp)?conf.histo_color2>>8:cl; |
|---|
| 179 | for (; v<h; ++v) |
|---|
| 180 | draw_pixel(x+1+i, y+h-v, (v<=threshold)?cl_over:cl_bg); |
|---|
| 181 | } |
|---|
| 182 | } else { |
|---|
| 183 | for (i=0; i<w; ++i) { |
|---|
| 184 | threshold = histogram[hist][i]; |
|---|
| 185 | |
|---|
| 186 | for (v=1; v<h-3; ++v) |
|---|
| 187 | draw_pixel(x+1+i, y+h-v, (v<=threshold)?cl:cl_bg); |
|---|
| 188 | cl_over = (threshold==h && conf.show_overexp)?conf.histo_color2>>8:cl; |
|---|
| 189 | for (; v<h; ++v) |
|---|
| 190 | draw_pixel(x+1+i, y+h-v, (v<=threshold)?cl_over:cl_bg); |
|---|
| 191 | } |
|---|
| 192 | } |
|---|
| 193 | |
|---|
| 194 | draw_rect(x, y, x+1+w, y+h, conf.histo_color2&0xFF); |
|---|
| 195 | //Vertical Lines |
|---|
| 196 | if (conf.histo_show_ev_grid) for (i=1;i<=4;i++) draw_line(x+(1+w)*i/5, y, x+(1+w)*i/5, y+h, conf.histo_color2&0xFF); |
|---|
| 197 | } |
|---|
| 198 | |
|---|
| 199 | //------------------------------------------------------------------- |
|---|
| 200 | void gui_osd_zebra_init() { |
|---|
| 201 | timer = 0; |
|---|
| 202 | } |
|---|
| 203 | |
|---|
| 204 | //------------------------------------------------------------------- |
|---|
| 205 | static void draw_pixel_buffered(unsigned int offset, color cl) { |
|---|
| 206 | buf[offset] = cl; |
|---|
| 207 | } |
|---|
| 208 | |
|---|
| 209 | //------------------------------------------------------------------- |
|---|
| 210 | static void gui_osd_draw_zebra_osd() { |
|---|
| 211 | switch (conf.zebra_draw_osd) { |
|---|
| 212 | case ZEBRA_DRAW_NONE: |
|---|
| 213 | break; |
|---|
| 214 | case ZEBRA_DRAW_OSD: |
|---|
| 215 | if (conf.show_osd) { |
|---|
| 216 | draw_set_draw_proc(draw_pixel_buffered); |
|---|
| 217 | if ((mode_get()&MODE_MASK) == MODE_REC) { |
|---|
| 218 | if (conf.show_dof != DOF_DONT_SHOW) gui_osd_calc_dof(); |
|---|
| 219 | if (conf.show_grid_lines) { |
|---|
| 220 | gui_grid_draw_osd(1); |
|---|
| 221 | } |
|---|
| 222 | if (conf.show_dof == DOF_SHOW_IN_DOF) { |
|---|
| 223 | gui_osd_draw_dof(); |
|---|
| 224 | } |
|---|
| 225 | if (conf.show_state) { |
|---|
| 226 | gui_osd_draw_state(); |
|---|
| 227 | } |
|---|
| 228 | if (conf.show_remaining_raw) { |
|---|
| 229 | gui_osd_draw_raw_info(); |
|---|
| 230 | } |
|---|
| 231 | if (conf.show_values) { |
|---|
| 232 | gui_osd_draw_values(); |
|---|
| 233 | } |
|---|
| 234 | } |
|---|
| 235 | gui_batt_draw_osd(); |
|---|
| 236 | gui_space_draw_osd(); |
|---|
| 237 | if (conf.show_clock) { |
|---|
| 238 | gui_osd_draw_clock(); |
|---|
| 239 | } |
|---|
| 240 | if (conf.show_temp>0) { |
|---|
| 241 | gui_osd_draw_temp(); |
|---|
| 242 | } |
|---|
| 243 | draw_set_draw_proc(NULL); |
|---|
| 244 | } |
|---|
| 245 | /* no break here */ |
|---|
| 246 | case ZEBRA_DRAW_HISTO: |
|---|
| 247 | default: |
|---|
| 248 | if (conf.show_histo) { |
|---|
| 249 | draw_set_draw_proc(draw_pixel_buffered); |
|---|
| 250 | gui_osd_draw_histo(); |
|---|
| 251 | draw_set_draw_proc(NULL); |
|---|
| 252 | } |
|---|
| 253 | break; |
|---|
| 254 | } |
|---|
| 255 | } |
|---|
| 256 | |
|---|
| 257 | |
|---|
| 258 | //------------------------------------------------------------------- |
|---|
| 259 | int gui_osd_draw_zebra() { |
|---|
| 260 | unsigned int v, s, x, y, f, over; |
|---|
| 261 | color cl_under=conf.zebra_color>>8, cl_over=conf.zebra_color&0xFF; |
|---|
| 262 | static int need_restore=0; |
|---|
| 263 | int viewport_height; |
|---|
| 264 | int m = ((mode_get()&MODE_MASK) == MODE_REC); |
|---|
| 265 | int zebra_drawn=0; |
|---|
| 266 | color cls[] = { |
|---|
| 267 | COLOR_TRANSPARENT, |
|---|
| 268 | (m)?0xDF:0xCC, |
|---|
| 269 | COLOR_GREEN, |
|---|
| 270 | (m)?COLOR_BLUE_LT:0x99, |
|---|
| 271 | COLOR_RED, |
|---|
| 272 | (m)?0x66:0xE2, |
|---|
| 273 | (m)?COLOR_YELLOW:0x66, |
|---|
| 274 | COLOR_BLACK |
|---|
| 275 | }; |
|---|
| 276 | |
|---|
| 277 | |
|---|
| 278 | if (!buf) { |
|---|
| 279 | buf = malloc(screen_buffer_size); |
|---|
| 280 | scr_buf = vid_get_bitmap_fb(); |
|---|
| 281 | } |
|---|
| 282 | |
|---|
| 283 | if (buf) { |
|---|
| 284 | ++timer; |
|---|
| 285 | // Try to get the best viewport buffer. In playmode its the _d one, in |
|---|
| 286 | // record mode we try to get the fast live one first |
|---|
| 287 | if( (mode_get() & MODE_MASK) == MODE_PLAY ) { |
|---|
| 288 | img_buf = vid_get_viewport_fb_d(); |
|---|
| 289 | } |
|---|
| 290 | else { |
|---|
| 291 | img_buf = vid_get_viewport_live_fb(); |
|---|
| 292 | if( !img_buf ) { |
|---|
| 293 | img_buf = vid_get_viewport_fb(); |
|---|
| 294 | } |
|---|
| 295 | } |
|---|
| 296 | viewport_height = vid_get_viewport_height(); |
|---|
| 297 | switch (conf.zebra_mode) { |
|---|
| 298 | case ZEBRA_MODE_ZEBRA_1: |
|---|
| 299 | f = 4; |
|---|
| 300 | break; |
|---|
| 301 | case ZEBRA_MODE_ZEBRA_2: |
|---|
| 302 | f = 8; |
|---|
| 303 | break; |
|---|
| 304 | case ZEBRA_MODE_SOLID: |
|---|
| 305 | f = 1; |
|---|
| 306 | break; |
|---|
| 307 | case ZEBRA_MODE_BLINKED_1: |
|---|
| 308 | f = timer&2; |
|---|
| 309 | break; |
|---|
| 310 | case ZEBRA_MODE_BLINKED_3: |
|---|
| 311 | f = timer&8; |
|---|
| 312 | break; |
|---|
| 313 | case ZEBRA_MODE_BLINKED_2: |
|---|
| 314 | default: |
|---|
| 315 | f = timer&4; |
|---|
| 316 | break; |
|---|
| 317 | } |
|---|
| 318 | if (f) { |
|---|
| 319 | int step_x, step_v; |
|---|
| 320 | over = 255-conf.zebra_over; |
|---|
| 321 | if (conf.zebra_multichannel) {step_x=2; step_v=6;} else {step_x=1; step_v=3;} |
|---|
| 322 | for (s=0, y=1, v=0; y<=viewport_height; ++y) { |
|---|
| 323 | for (x=0; x<screen_width; x+=step_x, s+=step_x, v+=step_v) { |
|---|
| 324 | register int yy, uu, vv; |
|---|
| 325 | int sel; |
|---|
| 326 | yy = img_buf[v+1]; |
|---|
| 327 | if (conf.zebra_multichannel) { |
|---|
| 328 | uu = (signed char)img_buf[v]; |
|---|
| 329 | vv = (signed char)img_buf[v+2]; |
|---|
| 330 | sel=0; |
|---|
| 331 | if (!((conf.zebra_mode == ZEBRA_MODE_ZEBRA_1 || conf.zebra_mode == ZEBRA_MODE_ZEBRA_2) && (y-x-timer)&f)) { |
|---|
| 332 | if (((yy<<12) + vv*5743 + 2048)>>12>over) sel = 4; // R |
|---|
| 333 | if (((yy<<12) - uu*1411 - vv*2925 + 2048)>>12>over) sel |= 2; // G |
|---|
| 334 | if (((yy<<12) + uu*7258 + 2048)>>12>over) sel |= 1; // B |
|---|
| 335 | } |
|---|
| 336 | buf[s]=buf[s+1]=cls[sel]; |
|---|
| 337 | } |
|---|
| 338 | else if (((conf.zebra_mode == ZEBRA_MODE_ZEBRA_1 || conf.zebra_mode == ZEBRA_MODE_ZEBRA_2) && (y-x-timer)&f)) buf[s]=COLOR_TRANSPARENT; |
|---|
| 339 | else buf[s]=(yy>over)?cl_over:(yy<conf.zebra_under)?cl_under:COLOR_TRANSPARENT; |
|---|
| 340 | if (buf[s] != COLOR_TRANSPARENT && !zebra_drawn) zebra_drawn = 1; |
|---|
| 341 | } |
|---|
| 342 | s+=screen_buffer_width-screen_width; |
|---|
| 343 | if (y*screen_height/viewport_height == (s+screen_buffer_width)/screen_buffer_width) { |
|---|
| 344 | memcpy(buf+s, buf+s-screen_buffer_width, screen_buffer_width); |
|---|
| 345 | s+=screen_buffer_width; |
|---|
| 346 | } |
|---|
| 347 | } |
|---|
| 348 | if (!zebra_drawn) f=0; |
|---|
| 349 | } |
|---|
| 350 | if (!f) { |
|---|
| 351 | if (need_restore) { |
|---|
| 352 | if (conf.zebra_restore_screen || conf.zebra_restore_osd) { |
|---|
| 353 | draw_restore(); |
|---|
| 354 | } else { |
|---|
| 355 | memset(buf, COLOR_TRANSPARENT, screen_buffer_size); |
|---|
| 356 | gui_osd_draw_zebra_osd(); |
|---|
| 357 | memcpy(scr_buf, buf, screen_buffer_size); |
|---|
| 358 | memcpy(scr_buf+screen_buffer_size, buf, screen_buffer_size); |
|---|
| 359 | } |
|---|
| 360 | need_restore=0; |
|---|
| 361 | } |
|---|
| 362 | return !(conf.zebra_restore_screen && conf.zebra_restore_osd); |
|---|
| 363 | } else { |
|---|
| 364 | |
|---|
| 365 | |
|---|
| 366 | gui_osd_draw_zebra_osd(); |
|---|
| 367 | memcpy(scr_buf, buf, screen_buffer_size); |
|---|
| 368 | memcpy(scr_buf+screen_buffer_size, buf, screen_buffer_size); |
|---|
| 369 | |
|---|
| 370 | need_restore=1; |
|---|
| 371 | return 1; |
|---|
| 372 | } |
|---|
| 373 | } |
|---|
| 374 | return 0; |
|---|
| 375 | } |
|---|
| 376 | |
|---|
| 377 | //------------------------------------------------------------------- |
|---|
| 378 | static void gui_osd_draw_blended_histo(coord x, coord y) { |
|---|
| 379 | register unsigned int i, v, red, grn, blu, sel; |
|---|
| 380 | int m = ((mode_get()&MODE_MASK) == MODE_REC); |
|---|
| 381 | color cls[] = { |
|---|
| 382 | conf.histo_color>>8, |
|---|
| 383 | (m)?0xDF:0xCC, |
|---|
| 384 | COLOR_GREEN, |
|---|
| 385 | (m)?COLOR_BLUE_LT:0x99, |
|---|
| 386 | COLOR_RED, |
|---|
| 387 | (m)?0x66:0xE2, |
|---|
| 388 | (m)?COLOR_YELLOW:0x66, |
|---|
| 389 | COLOR_WHITE |
|---|
| 390 | }; |
|---|
| 391 | |
|---|
| 392 | for (i=0; i<HISTO_WIDTH; ++i) { |
|---|
| 393 | red = histogram[HISTO_R][i]; |
|---|
| 394 | grn = histogram[HISTO_G][i]; |
|---|
| 395 | blu = histogram[HISTO_B][i]; |
|---|
| 396 | |
|---|
| 397 | for (v=1; v<HISTO_HEIGHT; ++v) { |
|---|
| 398 | sel = 0; |
|---|
| 399 | |
|---|
| 400 | if (v < red) sel = 4; |
|---|
| 401 | if (v < grn) sel |= 2; |
|---|
| 402 | if (v < blu) sel |= 1; |
|---|
| 403 | |
|---|
| 404 | draw_pixel(x+1+i, y+HISTO_HEIGHT-v, cls[sel]); |
|---|
| 405 | } |
|---|
| 406 | } |
|---|
| 407 | |
|---|
| 408 | draw_rect(x, y, x+1+HISTO_WIDTH, y+HISTO_HEIGHT, conf.histo_color2&0xFF); |
|---|
| 409 | //Vertical lines |
|---|
| 410 | if (conf.histo_show_ev_grid) for (i=1;i<=4;i++) draw_line(x+(1+HISTO_WIDTH)*i/5, y, x+(1+HISTO_WIDTH)*i/5, y+HISTO_HEIGHT, conf.histo_color2&0xFF); |
|---|
| 411 | |
|---|
| 412 | } |
|---|
| 413 | |
|---|
| 414 | //------------------------------------------------------------------- |
|---|
| 415 | void gui_osd_draw_histo() { |
|---|
| 416 | switch (conf.histo_layout) { |
|---|
| 417 | case OSD_HISTO_LAYOUT_Y: |
|---|
| 418 | gui_osd_draw_single_histo(HISTO_Y, conf.histo_pos.x, conf.histo_pos.y, 0); |
|---|
| 419 | break; |
|---|
| 420 | case OSD_HISTO_LAYOUT_A_Y: |
|---|
| 421 | gui_osd_draw_single_histo(HISTO_RGB, conf.histo_pos.x, conf.histo_pos.y, 0); |
|---|
| 422 | gui_osd_draw_single_histo(HISTO_Y, conf.histo_pos.x, conf.histo_pos.y+HISTO_HEIGHT, 0); |
|---|
| 423 | break; |
|---|
| 424 | case OSD_HISTO_LAYOUT_R_G_B: |
|---|
| 425 | gui_osd_draw_single_histo(HISTO_R, conf.histo_pos.x, conf.histo_pos.y, 0); |
|---|
| 426 | gui_osd_draw_single_histo(HISTO_G, conf.histo_pos.x, conf.histo_pos.y+HISTO_HEIGHT, 0); |
|---|
| 427 | gui_osd_draw_single_histo(HISTO_B, conf.histo_pos.x, conf.histo_pos.y+HISTO_HEIGHT*2, 0); |
|---|
| 428 | break; |
|---|
| 429 | case OSD_HISTO_LAYOUT_A_yrgb: |
|---|
| 430 | gui_osd_draw_single_histo(HISTO_RGB, conf.histo_pos.x, conf.histo_pos.y, 0); |
|---|
| 431 | gui_osd_draw_single_histo(HISTO_Y, conf.histo_pos.x, conf.histo_pos.y+HISTO_HEIGHT, 1); |
|---|
| 432 | gui_osd_draw_single_histo(HISTO_R, conf.histo_pos.x+HISTO_WIDTH/2+1, conf.histo_pos.y+HISTO_HEIGHT, 1); |
|---|
| 433 | gui_osd_draw_single_histo(HISTO_G, conf.histo_pos.x, conf.histo_pos.y+HISTO_HEIGHT+HISTO_HEIGHT/2, 1); |
|---|
| 434 | gui_osd_draw_single_histo(HISTO_B, conf.histo_pos.x+HISTO_WIDTH/2+1, conf.histo_pos.y+HISTO_HEIGHT+HISTO_HEIGHT/2, 1); |
|---|
| 435 | break; |
|---|
| 436 | case OSD_HISTO_LAYOUT_Y_argb: |
|---|
| 437 | gui_osd_draw_single_histo(HISTO_Y, conf.histo_pos.x, conf.histo_pos.y, 0); |
|---|
| 438 | gui_osd_draw_single_histo(HISTO_RGB, conf.histo_pos.x, conf.histo_pos.y+HISTO_HEIGHT, 1); |
|---|
| 439 | gui_osd_draw_single_histo(HISTO_R, conf.histo_pos.x+HISTO_WIDTH/2+1, conf.histo_pos.y+HISTO_HEIGHT, 1); |
|---|
| 440 | gui_osd_draw_single_histo(HISTO_G, conf.histo_pos.x, conf.histo_pos.y+HISTO_HEIGHT+HISTO_HEIGHT/2, 1); |
|---|
| 441 | gui_osd_draw_single_histo(HISTO_B, conf.histo_pos.x+HISTO_WIDTH/2+1, conf.histo_pos.y+HISTO_HEIGHT+HISTO_HEIGHT/2, 1); |
|---|
| 442 | break; |
|---|
| 443 | case OSD_HISTO_LAYOUT_BLEND: |
|---|
| 444 | gui_osd_draw_blended_histo(conf.histo_pos.x, conf.histo_pos.y); |
|---|
| 445 | break; |
|---|
| 446 | case OSD_HISTO_LAYOUT_BLEND_Y: |
|---|
| 447 | gui_osd_draw_blended_histo(conf.histo_pos.x, conf.histo_pos.y); |
|---|
| 448 | gui_osd_draw_single_histo(HISTO_Y, conf.histo_pos.x, conf.histo_pos.y+HISTO_HEIGHT, 0); |
|---|
| 449 | break; |
|---|
| 450 | case OSD_HISTO_LAYOUT_A: |
|---|
| 451 | default: |
|---|
| 452 | gui_osd_draw_single_histo(HISTO_RGB, conf.histo_pos.x, conf.histo_pos.y, 0); |
|---|
| 453 | break; |
|---|
| 454 | } |
|---|
| 455 | |
|---|
| 456 | if (conf.histo_layout != OSD_HISTO_LAYOUT_R_G_B) { |
|---|
| 457 | if (under_exposed && conf.show_overexp) { |
|---|
| 458 | draw_filled_ellipse(conf.histo_pos.x+5, conf.histo_pos.y+5, 3, 3, MAKE_COLOR(conf.histo_color2>>8, conf.histo_color2>>8)); |
|---|
| 459 | } |
|---|
| 460 | |
|---|
| 461 | if (over_exposed && conf.show_overexp) { |
|---|
| 462 | draw_filled_ellipse(conf.histo_pos.x+HISTO_WIDTH-5, conf.histo_pos.y+5, 3, 3, MAKE_COLOR(conf.histo_color2>>8, conf.histo_color2>>8)); |
|---|
| 463 | } |
|---|
| 464 | } |
|---|
| 465 | if ((conf.show_overexp ) && kbd_is_key_pressed(KEY_SHOOT_HALF) && (under_exposed || over_exposed)) |
|---|
| 466 | draw_string(conf.histo_pos.x+HISTO_WIDTH-FONT_WIDTH*3, conf.histo_pos.y-FONT_HEIGHT, "EXP", conf.histo_color); |
|---|
| 467 | if (conf.histo_auto_ajust){ |
|---|
| 468 | if (histo_magnification) { |
|---|
| 469 | sprintf(osd_buf, " %d.%02dx ", histo_magnification/1000, histo_magnification/10%100); |
|---|
| 470 | draw_string(conf.histo_pos.x, conf.histo_pos.y-FONT_HEIGHT, osd_buf, conf.histo_color); |
|---|
| 471 | } else if (gui_get_mode()==GUI_MODE_OSD){ |
|---|
| 472 | draw_string(conf.histo_pos.x, conf.histo_pos.y-FONT_HEIGHT, " 9.99x ", conf.histo_color); |
|---|
| 473 | } else { |
|---|
| 474 | draw_filled_rect(conf.histo_pos.x, conf.histo_pos.y-FONT_HEIGHT, conf.histo_pos.x+8*FONT_WIDTH, conf.histo_pos.y-1, MAKE_COLOR(COLOR_TRANSPARENT, COLOR_TRANSPARENT)); |
|---|
| 475 | } |
|---|
| 476 | } |
|---|
| 477 | } |
|---|
| 478 | |
|---|
| 479 | //------------------------------------------------------------------- |
|---|
| 480 | static void sprintf_dist(char *buf, float dist) { |
|---|
| 481 | // length of printed string is always 4 |
|---|
| 482 | if (dist<=0 || dist>=MAX_DIST) { |
|---|
| 483 | sprintf(buf, " inf"); |
|---|
| 484 | } else if (dist<1000) { |
|---|
| 485 | sprintf(buf, ".%03d", (int)dist); |
|---|
| 486 | } else if (dist<10000) { |
|---|
| 487 | sprintf(buf, "%d.%02d", (int)(dist/1000), (int)(dist/10)%100); |
|---|
| 488 | } else if (dist<100000) { |
|---|
| 489 | sprintf(buf, "%02d.%d", (int)(dist/1000), (int)(dist/100)%10); |
|---|
| 490 | } else { |
|---|
| 491 | sprintf(buf, "%4d", (int)(dist/1000)); |
|---|
| 492 | } |
|---|
| 493 | } |
|---|
| 494 | |
|---|
| 495 | static void sprintf_canon_values(char *buf, short dist) |
|---|
| 496 | { |
|---|
| 497 | short v=((dist<0)?-dist:dist); |
|---|
| 498 | sprintf(buf, "%s%d.%02d", ((dist<0)?"-":""), v/96, v%96); |
|---|
| 499 | } |
|---|
| 500 | |
|---|
| 501 | |
|---|
| 502 | //------------------------------------------------------------------- |
|---|
| 503 | |
|---|
| 504 | void gui_osd_calc_dof() { |
|---|
| 505 | |
|---|
| 506 | int av, av_min, c_of_c, fl, v, v1, m; |
|---|
| 507 | //long lfpfl=lens_get_focus_pos_fl(); |
|---|
| 508 | |
|---|
| 509 | #if CAM_HAS_IRIS_DIAPHRAGM |
|---|
| 510 | av=shooting_get_real_aperture(); |
|---|
| 511 | #else |
|---|
| 512 | av=shooting_get_min_real_aperture(); |
|---|
| 513 | #endif |
|---|
| 514 | fl=get_focal_length(lens_get_zoom_point()); |
|---|
| 515 | dof.far_limit=-1.0; |
|---|
| 516 | dof.near_limit=-1.0; |
|---|
| 517 | dof.depth_of_field=-1.0; |
|---|
| 518 | dof.hyperfocal_distance=-1.0; |
|---|
| 519 | dof.subject_distance=-1.0; |
|---|
| 520 | |
|---|
| 521 | if ((av!=0) && (fl!=0)) { |
|---|
| 522 | if (conf.dof_subj_dist_as_near_limit) { |
|---|
| 523 | v1=(fl*fl); |
|---|
| 524 | dof.near_limit=shooting_get_canon_subject_distance(); |
|---|
| 525 | av_min=shooting_get_min_real_aperture(); |
|---|
| 526 | c_of_c=circle_of_confusion*10; |
|---|
| 527 | if ((av_min!=0) && (c_of_c!=0)) dof.hyperfocal_distance=v1/(c_of_c*av_min); |
|---|
| 528 | if ((dof.near_limit>0) && (dof.near_limit<MAX_DIST)) { |
|---|
| 529 | v=(dof.hyperfocal_distance-dof.near_limit); |
|---|
| 530 | m=dof.hyperfocal_distance*dof.near_limit; |
|---|
| 531 | if ((v>0) && (m>0)) dof.subject_distance=m/v; |
|---|
| 532 | } |
|---|
| 533 | dof.hyperfocal_distance=v1/(c_of_c*av); |
|---|
| 534 | if ((dof.subject_distance>0) && (dof.subject_distance<MAX_DIST)) { |
|---|
| 535 | v = (dof.hyperfocal_distance-dof.subject_distance); |
|---|
| 536 | m=dof.hyperfocal_distance*dof.subject_distance; |
|---|
| 537 | if ((v>0) && (m>0)) dof.far_limit=m/v; |
|---|
| 538 | dof.depth_of_field=dof.far_limit-dof.near_limit; |
|---|
| 539 | } |
|---|
| 540 | } |
|---|
| 541 | else { |
|---|
| 542 | dof.subject_distance=shooting_get_canon_subject_distance(); |
|---|
| 543 | dof.hyperfocal_distance=(fl*fl)/(10*circle_of_confusion*av); |
|---|
| 544 | if (dof.subject_distance>0 && dof.subject_distance<MAX_DIST) { |
|---|
| 545 | m = dof.hyperfocal_distance*dof.subject_distance; |
|---|
| 546 | v = (dof.hyperfocal_distance+dof.subject_distance); |
|---|
| 547 | if ((v>0) && (m>0)) dof.near_limit=m/v; |
|---|
| 548 | v = (dof.hyperfocal_distance-dof.subject_distance); |
|---|
| 549 | if ((v>0) && (m>0)) dof.far_limit=m/v; |
|---|
| 550 | dof.depth_of_field=dof.far_limit-dof.near_limit; |
|---|
| 551 | } |
|---|
| 552 | } |
|---|
| 553 | } |
|---|
| 554 | if (conf.dof_dist_from_lens) { |
|---|
| 555 | int h=shooting_get_lens_to_focal_plane_width(); |
|---|
| 556 | if (dof.subject_distance>0) dof.subject_distance-=h; |
|---|
| 557 | if (dof.far_limit>0) dof.far_limit-=h; |
|---|
| 558 | if (dof.near_limit>0) dof.near_limit-=h; |
|---|
| 559 | if (dof.hyperfocal_distance>0) dof.hyperfocal_distance-=h; |
|---|
| 560 | } |
|---|
| 561 | } |
|---|
| 562 | |
|---|
| 563 | void gui_osd_calc_expo_param() { |
|---|
| 564 | |
|---|
| 565 | expo.av96=shooting_get_av96(); |
|---|
| 566 | expo.tv96=shooting_get_tv96(); |
|---|
| 567 | expo.sv96=shooting_get_sv96(); |
|---|
| 568 | expo.iso=shooting_get_iso_real(); |
|---|
| 569 | expo.sv96_market=shooting_get_svm96(); |
|---|
| 570 | expo.iso_market=shooting_get_iso_market(); |
|---|
| 571 | expo.bv96_measured=shooting_get_bv96(); |
|---|
| 572 | expo.ev96_seted=expo.tv96+expo.av96; //Tv96+Av96 |
|---|
| 573 | expo.ev96_measured=expo.bv96_measured+expo.sv96;//Bv96+Sv96 |
|---|
| 574 | expo.dev96=expo.ev96_measured-expo.ev96_seted;// Ev96_external-Ev96_internal |
|---|
| 575 | expo.bv96_seted=expo.ev96_seted-expo.sv96; |
|---|
| 576 | expo.dev96_canon=shooting_get_canon_overexposure_value(); |
|---|
| 577 | expo.b=shooting_get_luminance(); |
|---|
| 578 | } |
|---|
| 579 | |
|---|
| 580 | void gui_osd_draw_dof() { |
|---|
| 581 | |
|---|
| 582 | //gui_osd_calc_dof(); |
|---|
| 583 | //strcpy(osd_buf, ""); |
|---|
| 584 | draw_string(conf.dof_pos.x, conf.dof_pos.y, "S/R1/R2:", conf.osd_color); |
|---|
| 585 | sprintf_dist(osd_buf, dof.subject_distance); |
|---|
| 586 | int i=strlen(osd_buf); |
|---|
| 587 | osd_buf[i]='/'; |
|---|
| 588 | sprintf_dist(osd_buf+i+1, dof.near_limit); |
|---|
| 589 | i=strlen(osd_buf); |
|---|
| 590 | osd_buf[i]='/'; |
|---|
| 591 | sprintf_dist(osd_buf+i+1, dof.far_limit); |
|---|
| 592 | draw_string(conf.dof_pos.x+8*FONT_WIDTH, conf.dof_pos.y, osd_buf, conf.osd_color); |
|---|
| 593 | |
|---|
| 594 | draw_string(conf.dof_pos.x, conf.dof_pos.y+FONT_HEIGHT, "DOF/HYP:", conf.osd_color); |
|---|
| 595 | sprintf_dist(osd_buf, dof.depth_of_field); |
|---|
| 596 | int j=strlen(osd_buf); |
|---|
| 597 | osd_buf[j]='/'; |
|---|
| 598 | sprintf_dist(osd_buf+j+1, dof.hyperfocal_distance); |
|---|
| 599 | draw_string(conf.dof_pos.x+8*FONT_WIDTH, conf.dof_pos.y+FONT_HEIGHT, osd_buf, conf.osd_color); |
|---|
| 600 | |
|---|
| 601 | } |
|---|
| 602 | |
|---|
| 603 | static short n, m; //string number |
|---|
| 604 | |
|---|
| 605 | void gui_print_osd_state_string_int(const char * title, int value) { |
|---|
| 606 | strcpy(osd_buf, title); |
|---|
| 607 | sprintf(osd_buf+strlen(osd_buf), "%d", value); |
|---|
| 608 | sprintf(osd_buf+strlen(osd_buf), "%12s", ""); |
|---|
| 609 | osd_buf[12]=0; |
|---|
| 610 | draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf, conf.osd_color_override); |
|---|
| 611 | n+=FONT_HEIGHT; |
|---|
| 612 | } |
|---|
| 613 | |
|---|
| 614 | void gui_print_osd_state_string_chr(const char *title, const char *value) { |
|---|
| 615 | strcpy(osd_buf, title); |
|---|
| 616 | sprintf(osd_buf+strlen(osd_buf), "%s", value); |
|---|
| 617 | sprintf(osd_buf+strlen(osd_buf), "%12s", ""); |
|---|
| 618 | osd_buf[12]=0; |
|---|
| 619 | draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf, conf.osd_color_override); |
|---|
| 620 | n+=FONT_HEIGHT; |
|---|
| 621 | } |
|---|
| 622 | |
|---|
| 623 | void gui_print_osd_state_string_float(const char * title, const char * fmt, int divisor, int value) { |
|---|
| 624 | strcpy(osd_buf, title); |
|---|
| 625 | sprintf(osd_buf+strlen(osd_buf), fmt, (int)(value/divisor), (int)(value%divisor)); |
|---|
| 626 | sprintf(osd_buf+strlen(osd_buf), "%12s", ""); |
|---|
| 627 | osd_buf[12]=0; |
|---|
| 628 | draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf, conf.osd_color_override); |
|---|
| 629 | n+=FONT_HEIGHT; |
|---|
| 630 | } |
|---|
| 631 | |
|---|
| 632 | void gui_print_osd_misc_string_int(const char * title, int value) { |
|---|
| 633 | strcpy(osd_buf, title); |
|---|
| 634 | sprintf(osd_buf+strlen(osd_buf), "%d", value); |
|---|
| 635 | sprintf(osd_buf+strlen(osd_buf), "%9s", ""); |
|---|
| 636 | osd_buf[9]=0; |
|---|
| 637 | draw_string(conf.values_pos.x, conf.values_pos.y+m, osd_buf, conf.osd_color); |
|---|
| 638 | m+=FONT_HEIGHT; |
|---|
| 639 | } |
|---|
| 640 | |
|---|
| 641 | /* |
|---|
| 642 | void gui_print_osd_misc_string_float(const char * title, const char * fmt, int divisor, int value) { |
|---|
| 643 | char s[16]; |
|---|
| 644 | strcpy(osd_buf, title); |
|---|
| 645 | sprintf(s, fmt, (int)(value/divisor), (int)(value%divisor)); |
|---|
| 646 | sprintf(osd_buf+strlen(osd_buf), "%6s", s); |
|---|
| 647 | //osd_buf[8]=0; |
|---|
| 648 | draw_string(conf.values_pos.x, conf.values_pos.y+m, osd_buf, conf.osd_color); |
|---|
| 649 | m+=FONT_HEIGHT; |
|---|
| 650 | } |
|---|
| 651 | */ |
|---|
| 652 | |
|---|
| 653 | void gui_print_osd_misc_string_float(const char * title, const char * fmt, int divisor, int value) { |
|---|
| 654 | strcpy(osd_buf, title); |
|---|
| 655 | sprintf(osd_buf+strlen(osd_buf), fmt, (int)(value/divisor), (int)(value%divisor)); |
|---|
| 656 | sprintf(osd_buf+strlen(osd_buf), "%9s", ""); |
|---|
| 657 | osd_buf[9]=0; |
|---|
| 658 | draw_string(conf.values_pos.x, conf.values_pos.y+m, osd_buf, conf.osd_color); |
|---|
| 659 | m+=FONT_HEIGHT; |
|---|
| 660 | } |
|---|
| 661 | |
|---|
| 662 | |
|---|
| 663 | void gui_print_osd_misc_string_dist(const char * title, int value) { |
|---|
| 664 | strcpy(osd_buf, title); |
|---|
| 665 | sprintf_dist(osd_buf+strlen(osd_buf), (float)value); |
|---|
| 666 | sprintf(osd_buf+strlen(osd_buf), "%9s", ""); |
|---|
| 667 | osd_buf[9]=0; |
|---|
| 668 | draw_string(conf.values_pos.x, conf.values_pos.y+m, osd_buf, conf.osd_color); |
|---|
| 669 | m+=FONT_HEIGHT; |
|---|
| 670 | } |
|---|
| 671 | |
|---|
| 672 | void gui_print_osd_misc_string_canon_values(const char * title, short value) { |
|---|
| 673 | strcpy(osd_buf, title); |
|---|
| 674 | sprintf_canon_values(osd_buf+strlen(osd_buf), value); |
|---|
| 675 | sprintf(osd_buf+strlen(osd_buf), "%9s", ""); |
|---|
| 676 | osd_buf[9]=0; |
|---|
| 677 | draw_string(conf.values_pos.x, conf.values_pos.y+m, osd_buf, conf.osd_color); |
|---|
| 678 | m+=FONT_HEIGHT; |
|---|
| 679 | } |
|---|
| 680 | |
|---|
| 681 | //------------------------------------------------------------------- |
|---|
| 682 | void gui_osd_draw_raw_info() |
|---|
| 683 | { |
|---|
| 684 | int x, m=(mode_get()&MODE_SHOOTING_MASK); |
|---|
| 685 | static int b; |
|---|
| 686 | |
|---|
| 687 | |
|---|
| 688 | if ((!((movie_status > 1) && conf.save_raw_in_video )) && (!((m==MODE_SPORTS) && conf.save_raw_in_sports)) && (!((shooting_get_prop(PROPCASE_DRIVE_MODE)==1) && conf.save_raw_in_burst && !(m==MODE_SPORTS))) && (!((shooting_get_prop(PROPCASE_DRIVE_MODE)>=2) && conf.save_raw_in_timer)) && (!((shooting_get_prop(PROPCASE_BRACKET_MODE)==1) && conf.save_raw_in_ev_bracketing)) ) |
|---|
| 689 | { |
|---|
| 690 | if (conf.show_remaining_raw) |
|---|
| 691 | { |
|---|
| 692 | int raw_count=GetRawCount(); |
|---|
| 693 | if (raw_count>conf.remaining_raw_treshold) |
|---|
| 694 | { |
|---|
| 695 | sprintf(osd_buf, "RAW:%3d", raw_count); |
|---|
| 696 | draw_string(conf.mode_raw_pos.x, conf.mode_raw_pos.y, osd_buf, conf.osd_color); |
|---|
| 697 | } |
|---|
| 698 | else |
|---|
| 699 | { |
|---|
| 700 | |
|---|
| 701 | sprintf(osd_buf, "RAW:%3d", raw_count); |
|---|
| 702 | |
|---|
| 703 | if (b > 6) |
|---|
| 704 | { |
|---|
| 705 | draw_string(conf.mode_raw_pos.x, conf.mode_raw_pos.y, osd_buf, conf.osd_color_warn); |
|---|
| 706 | b = (b>12) ? 0 : b+1; |
|---|
| 707 | } |
|---|
| 708 | else |
|---|
| 709 | { |
|---|
| 710 | draw_string(conf.mode_raw_pos.x, conf.mode_raw_pos.y, osd_buf, conf.osd_color); |
|---|
| 711 | b = b+1; |
|---|
| 712 | } |
|---|
| 713 | } |
|---|
| 714 | } |
|---|
| 715 | else draw_string(conf.mode_raw_pos.x, conf.mode_raw_pos.y, "RAW", conf.osd_color); |
|---|
| 716 | } |
|---|
| 717 | else if (conf.raw_exceptions_warn) |
|---|
| 718 | { |
|---|
| 719 | gui_print_osd_state_string_chr("RAW Disabled",""); |
|---|
| 720 | } |
|---|
| 721 | |
|---|
| 722 | |
|---|
| 723 | } |
|---|
| 724 | //------------------------------------------------------------------- |
|---|
| 725 | void gui_osd_draw_state() { |
|---|
| 726 | int a, gui_mode=gui_get_mode(), m=(mode_get()&MODE_SHOOTING_MASK); |
|---|
| 727 | long t; |
|---|
| 728 | |
|---|
| 729 | n=0; |
|---|
| 730 | /////////////////////////// |
|---|
| 731 | //sprintf(osd_buf,"%s",get_debug()); |
|---|
| 732 | //draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+6*FONT_HEIGHT, osd_buf, conf.osd_color); |
|---|
| 733 | //////////////////////////// |
|---|
| 734 | |
|---|
| 735 | |
|---|
| 736 | if ((((conf.tv_enum_type) || (conf.tv_override_value)) && (conf.tv_override_koef) && !(conf.override_disable==1)) || gui_mode==GUI_MODE_OSD){ |
|---|
| 737 | if(kbd_is_key_pressed(KEY_SHOOT_HALF)) |
|---|
| 738 | { |
|---|
| 739 | t=(int)(shooting_get_shutter_speed_from_tv96(shooting_get_tv96())*100000); |
|---|
| 740 | gui_print_osd_state_string_float("TV:", "%d.%05d ", 100000, t); |
|---|
| 741 | } |
|---|
| 742 | else |
|---|
| 743 | { |
|---|
| 744 | if (conf.tv_enum_type) |
|---|
| 745 | gui_print_osd_state_string_chr("TV:",shooting_get_tv_override_value()); |
|---|
| 746 | else |
|---|
| 747 | { |
|---|
| 748 | t=(int)(shooting_get_shutter_speed_override_value()*100000); |
|---|
| 749 | gui_print_osd_state_string_float("TV:", "%d.%05d ", 100000, t); |
|---|
| 750 | } |
|---|
| 751 | } |
|---|
| 752 | } |
|---|
| 753 | if ((conf.av_override_value && !(conf.override_disable==1))|| gui_mode==GUI_MODE_OSD) |
|---|
| 754 | gui_print_osd_state_string_float("AV:", "%d.%02d ", 100, shooting_get_aperture_from_av96(shooting_get_av96_override_value())); |
|---|
| 755 | #if CAM_HAS_ND_FILTER |
|---|
| 756 | if ((conf.nd_filter_state && !(conf.override_disable==1))|| gui_mode==GUI_MODE_OSD) |
|---|
| 757 | gui_print_osd_state_string_chr("NDFILTER:", ((conf.nd_filter_state==1)?"IN":"OUT")); |
|---|
| 758 | #endif |
|---|
| 759 | if ((conf.autoiso_enable && shooting_get_iso_mode()<=0 && !(m==MODE_M || m==MODE_TV) && shooting_get_flash_mode() && (!(conf.override_disable==1 && conf.override_disable_all))) || gui_mode==GUI_MODE_OSD) |
|---|
| 760 | gui_print_osd_state_string_chr("AUTOISO:", ((conf.autoiso_enable==1)?"ON":"OFF")); |
|---|
| 761 | if ((conf.subj_dist_override_value && conf.subj_dist_override_koef && shooting_can_focus() && !(conf.override_disable==1)) || ((gui_mode==GUI_MODE_ALT) && shooting_get_common_focus_mode()) || gui_mode==GUI_MODE_OSD) { |
|---|
| 762 | gui_print_osd_state_string_int("SD:",shooting_get_subject_distance_override_value()); |
|---|
| 763 | if (gui_mode==GUI_MODE_ALT) |
|---|
| 764 | gui_print_osd_state_string_int("FACTOR:",shooting_get_subject_distance_override_koef()); |
|---|
| 765 | } |
|---|
| 766 | if ((conf.iso_override_value && conf.iso_override_koef && !(conf.override_disable==1)) || gui_mode==GUI_MODE_OSD) |
|---|
| 767 | gui_print_osd_state_string_int("ISO:", shooting_get_iso_override_value()); |
|---|
| 768 | if ((gui_mode==GUI_MODE_OSD) || (shooting_get_drive_mode())) { |
|---|
| 769 | if ((conf.tv_bracket_value && !(conf.override_disable==1 && conf.override_disable_all)) || (conf.av_bracket_value && !(conf.override_disable==1 && conf.override_disable_all)) || (conf.iso_bracket_value && conf.iso_bracket_koef && !(conf.override_disable==1 && conf.override_disable_all)) || ((conf.subj_dist_bracket_value) && (conf.subj_dist_bracket_koef) && (shooting_can_focus() && !(conf.override_disable==1 && conf.override_disable_all)))) |
|---|
| 770 | gui_print_osd_state_string_chr("BRACKET:", shooting_get_bracket_type()); |
|---|
| 771 | if (conf.tv_bracket_value && !(conf.override_disable==1 && conf.override_disable_all)) |
|---|
| 772 | gui_print_osd_state_string_chr("TV:", shooting_get_tv_bracket_value()); |
|---|
| 773 | else if (conf.av_bracket_value && !(conf.override_disable==1 && conf.override_disable_all)) |
|---|
| 774 | gui_print_osd_state_string_chr("AV:", shooting_get_av_bracket_value()); |
|---|
| 775 | else if (conf.iso_bracket_value && conf.iso_bracket_koef && !(conf.override_disable==1 && conf.override_disable_all)) |
|---|
| 776 | gui_print_osd_state_string_int("ISO:", shooting_get_iso_bracket_value()); |
|---|
| 777 | else if ((conf.subj_dist_bracket_value && !(conf.override_disable==1 && conf.override_disable_all)) && (conf.subj_dist_bracket_koef) && (shooting_can_focus())) |
|---|
| 778 | gui_print_osd_state_string_int("SD:",shooting_get_subject_distance_bracket_value()); |
|---|
| 779 | } |
|---|
| 780 | #ifdef OPT_CURVES |
|---|
| 781 | if (conf.curve_enable || gui_mode==GUI_MODE_OSD) { |
|---|
| 782 | if (conf.curve_enable==1) gui_print_osd_state_string_chr("CURVES:", "CSTM"); |
|---|
| 783 | else if (conf.curve_enable==4) gui_print_osd_state_string_chr("CURVES:", "AUTO"); |
|---|
| 784 | else if (conf.curve_enable==3) gui_print_osd_state_string_chr("CURVES:", "+2EV"); |
|---|
| 785 | else if (conf.curve_enable==2) gui_print_osd_state_string_chr("CURVES:", "+1EV"); |
|---|
| 786 | } |
|---|
| 787 | #endif |
|---|
| 788 | if (conf.override_disable == 1) gui_print_osd_state_string_chr("NO ", "OVERRIDES"); |
|---|
| 789 | /* |
|---|
| 790 | draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, get_debug(), conf.osd_color); |
|---|
| 791 | n+=FONT_HEIGHT;*/ |
|---|
| 792 | } |
|---|
| 793 | |
|---|
| 794 | //------------------------------------------------------------------- |
|---|
| 795 | void gui_osd_draw_values(int showtype) { |
|---|
| 796 | int iso_mode=shooting_get_iso_mode(); |
|---|
| 797 | float s=-1.0f; |
|---|
| 798 | |
|---|
| 799 | m=0; |
|---|
| 800 | |
|---|
| 801 | //gui_osd_calc_expo_param(); |
|---|
| 802 | |
|---|
| 803 | if (conf.values_show_zoom) { |
|---|
| 804 | int fl, zp=lens_get_zoom_point(), fl1=get_focal_length(zp); |
|---|
| 805 | switch (conf.zoom_value) { |
|---|
| 806 | case ZOOM_SHOW_FL: |
|---|
| 807 | sprintf(osd_buf, "Z:%d.%dmm%8s", fl1/1000, fl1%1000/100, ""); |
|---|
| 808 | break; |
|---|
| 809 | case ZOOM_SHOW_EFL: |
|---|
| 810 | fl=get_effective_focal_length(zp); |
|---|
| 811 | // scale by users adapter lens eg. Canon Wide .42 or Canon Tele 1.75 |
|---|
| 812 | fl = fl * conf.zoom_scale / 100; |
|---|
| 813 | sprintf(osd_buf, "Z:%3dmm%8s", fl/1000, ""); |
|---|
| 814 | break; |
|---|
| 815 | case ZOOM_SHOW_X: |
|---|
| 816 | default: |
|---|
| 817 | fl=get_zoom_x(zp); |
|---|
| 818 | sprintf(osd_buf, "Z:%ld/%d.%dx%8s", zp, fl/10, fl%10, ""); |
|---|
| 819 | break; |
|---|
| 820 | } |
|---|
| 821 | osd_buf[9]=0; |
|---|
| 822 | draw_string(conf.values_pos.x, conf.values_pos.y, osd_buf, conf.osd_color); |
|---|
| 823 | m+=FONT_HEIGHT; |
|---|
| 824 | } |
|---|
| 825 | |
|---|
| 826 | |
|---|
| 827 | if ((conf.values_show_real_aperture) && (showtype==1)) |
|---|
| 828 | gui_print_osd_misc_string_float("Av :", "%d.%02d ", 100, shooting_get_real_aperture()); |
|---|
| 829 | if ((conf.show_dof==DOF_SHOW_IN_MISC) && (showtype)) { |
|---|
| 830 | //if (kbd_is_key_pressed(KEY_SHOOT_HALF) && (mode_photo || (m&MODE_SHOOTING_MASK)==MODE_STITCH)) |
|---|
| 831 | //gui_osd_calc_dof(); |
|---|
| 832 | if (conf.dof_subj_dist_in_misc) gui_print_osd_misc_string_dist("SD :", dof.subject_distance); |
|---|
| 833 | if (conf.dof_near_limit_in_misc) gui_print_osd_misc_string_dist("NL :", dof.near_limit); |
|---|
| 834 | if (conf.dof_far_limit_in_misc) gui_print_osd_misc_string_dist("FL :", dof.far_limit); |
|---|
| 835 | if (conf.dof_depth_in_misc) gui_print_osd_misc_string_dist("DOF:", dof.depth_of_field); |
|---|
| 836 | if (conf.dof_hyperfocal_in_misc) gui_print_osd_misc_string_dist("HYP:", dof.hyperfocal_distance); |
|---|
| 837 | } |
|---|
| 838 | if (showtype==1) { |
|---|
| 839 | if ((iso_mode <= 0) || !(conf.values_show_iso_only_in_autoiso_mode)) { |
|---|
| 840 | if (conf.values_show_real_iso) gui_print_osd_misc_string_int("I-R:", expo.iso); |
|---|
| 841 | if (conf.values_show_market_iso) gui_print_osd_misc_string_int("I-M:", expo.iso_market); |
|---|
| 842 | } |
|---|
| 843 | if (conf.values_show_bv_measured) gui_print_osd_misc_string_canon_values("Bvm:", expo.bv96_measured ); |
|---|
| 844 | if (conf.values_show_bv_seted) gui_print_osd_misc_string_canon_values("Bvs:", expo.bv96_seted ); |
|---|
| 845 | if (conf.values_show_ev_measured) gui_print_osd_misc_string_canon_values("Evm:", expo.ev96_measured); |
|---|
| 846 | if (conf.values_show_ev_seted ) gui_print_osd_misc_string_canon_values("Evs:", expo.ev96_seted ); |
|---|
| 847 | if (conf.values_show_overexposure) gui_print_osd_misc_string_canon_values("dE :", expo.dev96); |
|---|
| 848 | if (conf.values_show_canon_overexposure ) gui_print_osd_misc_string_canon_values("dEc:", expo.dev96_canon); |
|---|
| 849 | if (conf.values_show_luminance) gui_print_osd_misc_string_float("B :", "%d.%02d ", 100, expo.b); |
|---|
| 850 | |
|---|
| 851 | } |
|---|
| 852 | |
|---|
| 853 | } |
|---|
| 854 | |
|---|
| 855 | #define CLOCK_FORMAT_24 0 |
|---|
| 856 | #define CLOCK_FORMAT_12 1 |
|---|
| 857 | #define CLOCK_WITHOUT_SEC 1 |
|---|
| 858 | #define CLOCK_WITH_SEC 2 |
|---|
| 859 | |
|---|
| 860 | //------------------------------------------------------------------- |
|---|
| 861 | void gui_osd_draw_clock() { |
|---|
| 862 | unsigned long t; |
|---|
| 863 | static struct tm *ttm; |
|---|
| 864 | int w = 0; |
|---|
| 865 | int z; |
|---|
| 866 | static char am[4]; |
|---|
| 867 | static char pm[4]; |
|---|
| 868 | static char curr[4]; |
|---|
| 869 | t = time(NULL); |
|---|
| 870 | ttm = localtime(&t); |
|---|
| 871 | unsigned int hour=(ttm->tm_hour); |
|---|
| 872 | if (conf.clock_format == CLOCK_FORMAT_12) { |
|---|
| 873 | switch(conf.clock_indicator) |
|---|
| 874 | { |
|---|
| 875 | case 1: |
|---|
| 876 | sprintf(pm, "P"); |
|---|
| 877 | sprintf(am, "A"); |
|---|
| 878 | w = 1; |
|---|
| 879 | break; |
|---|
| 880 | case 2: |
|---|
| 881 | sprintf(pm, "."); |
|---|
| 882 | sprintf(am, " "); |
|---|
| 883 | w = 1; |
|---|
| 884 | break; |
|---|
| 885 | default: |
|---|
| 886 | sprintf(pm, " PM"); |
|---|
| 887 | sprintf(am, " AM"); |
|---|
| 888 | w = 3; |
|---|
| 889 | break; |
|---|
| 890 | } |
|---|
| 891 | sprintf(curr,((hour>=12)?pm:am)); |
|---|
| 892 | if ((ttm->tm_hour)==00) hour=12; |
|---|
| 893 | else if ((ttm->tm_hour)>12) hour=hour-12; |
|---|
| 894 | } |
|---|
| 895 | switch(conf.show_clock) |
|---|
| 896 | { |
|---|
| 897 | case CLOCK_WITHOUT_SEC: |
|---|
| 898 | if (conf.clock_format == CLOCK_FORMAT_24) |
|---|
| 899 | sprintf(osd_buf, "%2u:%02u", hour, ttm->tm_min); |
|---|
| 900 | else |
|---|
| 901 | sprintf(osd_buf, "%2u:%02u%s", hour, ttm->tm_min,curr); |
|---|
| 902 | z=0; |
|---|
| 903 | break; |
|---|
| 904 | case CLOCK_WITH_SEC: |
|---|
| 905 | default: |
|---|
| 906 | if (conf.clock_format == CLOCK_FORMAT_24) |
|---|
| 907 | sprintf(osd_buf, "%2u:%02u:%02u", hour, ttm->tm_min,ttm->tm_sec); |
|---|
| 908 | else |
|---|
| 909 | sprintf(osd_buf, "%2u:%02u:%02u%s", hour, ttm->tm_min,ttm->tm_sec,curr); |
|---|
| 910 | z=3; |
|---|
| 911 | break; |
|---|
| 912 | } |
|---|
| 913 | if ((conf.show_clock==CLOCK_WITH_SEC || (conf.clock_format==CLOCK_FORMAT_12)) && (conf.clock_pos.x>=(z+w)*FONT_WIDTH) ) |
|---|
| 914 | draw_string(conf.clock_pos.x-(z+w)*FONT_WIDTH, conf.clock_pos.y, osd_buf, conf.osd_color); |
|---|
| 915 | else |
|---|
| 916 | draw_string(conf.clock_pos.x, conf.clock_pos.y, osd_buf, conf.osd_color); |
|---|
| 917 | } |
|---|
| 918 | |
|---|
| 919 | |
|---|
| 920 | void gui_osd_draw_seconds() { |
|---|
| 921 | unsigned long t; |
|---|
| 922 | static struct tm *ttm; |
|---|
| 923 | |
|---|
| 924 | t = time(NULL); |
|---|
| 925 | ttm = localtime(&t); |
|---|
| 926 | sprintf(osd_buf, "%02u", ttm->tm_sec); |
|---|
| 927 | if (conf.clock_pos.x<4*FONT_WIDTH){ |
|---|
| 928 | draw_string(conf.clock_pos.x, conf.clock_pos.y, osd_buf, conf.osd_color); |
|---|
| 929 | } |
|---|
| 930 | else |
|---|
| 931 | { |
|---|
| 932 | draw_string(conf.clock_pos.x+(3*FONT_WIDTH), conf.clock_pos.y, osd_buf, conf.osd_color); |
|---|
| 933 | } |
|---|
| 934 | |
|---|
| 935 | |
|---|
| 936 | } |
|---|
| 937 | |
|---|
| 938 | void gui_osd_draw_movie_time_left() { |
|---|
| 939 | |
|---|
| 940 | static int card_used, init_space, elapsed, avg_use, time_left; |
|---|
| 941 | static long init_time; |
|---|
| 942 | static int record_running = 0; |
|---|
| 943 | static int init = 0; |
|---|
| 944 | static unsigned int skipcalls = 1; |
|---|
| 945 | unsigned int hour=0, min=0, sec=0; |
|---|
| 946 | int mode_video = MODE_IS_VIDEO(m); |
|---|
| 947 | |
|---|
| 948 | |
|---|
| 949 | if (mode_video || movie_status > 1) { |
|---|
| 950 | // if manual adjust, show the field item to be adjusted |
|---|
| 951 | // if any value overriden, show the override value |
|---|
| 952 | if ((conf.video_mode == 0 && conf.fast_movie_quality_control==1) || conf.video_bitrate != VIDEO_DEFAULT_BITRATE) { |
|---|
| 953 | // gui_print_osd_state_string_chr("Bitrate: ",video_bitrate_strings[conf.video_bitrate]); |
|---|
| 954 | sprintf(osd_buf3, "Bit:%5s",video_bitrate_strings[conf.video_bitrate]); |
|---|
| 955 | draw_string( conf.mode_video_pos.x, conf.mode_video_pos.y+2*FONT_HEIGHT, osd_buf3, conf.osd_color); |
|---|
| 956 | } |
|---|
| 957 | if ((conf.video_mode == 1 && conf.fast_movie_quality_control==1) || conf.video_quality != VIDEO_DEFAULT_QUALITY) { |
|---|
| 958 | // gui_print_osd_state_string_int("Quality: ",conf.video_quality); |
|---|
| 959 | sprintf(osd_buf4, "Qual:%2i",conf.video_quality); |
|---|
| 960 | draw_string( conf.mode_video_pos.x, conf.mode_video_pos.y+3*FONT_HEIGHT, osd_buf4, conf.osd_color); |
|---|
| 961 | } |
|---|
| 962 | // everything else is for stills |
|---|
| 963 | if(mode_video) |
|---|
| 964 | return; |
|---|
| 965 | } |
|---|
| 966 | |
|---|
| 967 | if (movie_reset == 1) |
|---|
| 968 | { |
|---|
| 969 | init = 0; |
|---|
| 970 | movie_reset = 0; |
|---|
| 971 | } |
|---|
| 972 | if (movie_status > 1) record_running = 1; |
|---|
| 973 | else |
|---|
| 974 | {record_running = 0; |
|---|
| 975 | init = 0; |
|---|
| 976 | } |
|---|
| 977 | |
|---|
| 978 | if (record_running == 1 && init == 0) |
|---|
| 979 | { |
|---|
| 980 | init = 1; |
|---|
| 981 | init_space = GetFreeCardSpaceKb(); |
|---|
| 982 | init_time = get_tick_count(); |
|---|
| 983 | } |
|---|
| 984 | if (init == 1) |
|---|
| 985 | { |
|---|
| 986 | |
|---|
| 987 | card_used = init_space - GetFreeCardSpaceKb(); |
|---|
| 988 | elapsed = (int) ( get_tick_count() - init_time ) / 1000; |
|---|
| 989 | avg_use = card_used / elapsed; // running average Kb/sec |
|---|
| 990 | time_left = (GetFreeCardSpaceKb() / avg_use); |
|---|
| 991 | hour = time_left / 3600; |
|---|
| 992 | min = (time_left % 3600) / 60; |
|---|
| 993 | sec = (time_left % 3600) % 60; |
|---|
| 994 | |
|---|
| 995 | if (elapsed<1) |
|---|
| 996 | { |
|---|
| 997 | sprintf(osd_buf, "Calc..."); |
|---|
| 998 | draw_string( conf.mode_video_pos.x, conf.mode_video_pos.y, osd_buf, conf.osd_color); |
|---|
| 999 | } |
|---|
| 1000 | |
|---|
| 1001 | if (--skipcalls ==0) { |
|---|
| 1002 | if (elapsed>1) |
|---|
| 1003 | { |
|---|
| 1004 | if (conf.show_movie_time == 3){ |
|---|
| 1005 | sprintf(osd_buf, "%04d KB/s", avg_use); |
|---|
| 1006 | draw_string( conf.mode_video_pos.x, conf.mode_video_pos.y, osd_buf, conf.osd_color); |
|---|
| 1007 | sprintf(osd_buf2, "-%02d:%02d:%02d", hour, min, sec); |
|---|
| 1008 | draw_string( conf.mode_video_pos.x, conf.mode_video_pos.y+FONT_HEIGHT, osd_buf2, conf.osd_color); |
|---|
| 1009 | } |
|---|
| 1010 | if (conf.show_movie_time == 2) |
|---|
| 1011 | {sprintf(osd_buf, "%04d KB/s", avg_use); |
|---|
| 1012 | draw_string( conf.mode_video_pos.x, conf.mode_video_pos.y, osd_buf, conf.osd_color); |
|---|
| 1013 | } |
|---|
| 1014 | if (conf.show_movie_time == 1) |
|---|
| 1015 | { |
|---|
| 1016 | sprintf(osd_buf, "-%02d:%02d:%02d", hour, min, sec); |
|---|
| 1017 | draw_string( conf.mode_video_pos.x, conf.mode_video_pos.y, osd_buf, conf.osd_color); |
|---|
| 1018 | } |
|---|
| 1019 | } |
|---|
| 1020 | |
|---|
| 1021 | skipcalls = conf.show_movie_refresh*5; |
|---|
| 1022 | } |
|---|
| 1023 | } |
|---|
| 1024 | } |
|---|
| 1025 | |
|---|
| 1026 | void gui_osd_draw_ev() { |
|---|
| 1027 | #if (CAM_PROPSET == 1) |
|---|
| 1028 | sprintf(osd_buf, "EV: %+d,%2d", shooting_get_prop(25)/96,shooting_get_prop(25)%96); |
|---|
| 1029 | #elif (CAM_PROPSET == 2) |
|---|
| 1030 | sprintf(osd_buf, "EV: %+d,%2d", shooting_get_prop(107)/96,shooting_get_prop(107)%96); |
|---|
| 1031 | #endif |
|---|
| 1032 | |
|---|
| 1033 | draw_string(conf.mode_ev_pos.x, conf.mode_ev_pos.y, osd_buf, conf.osd_color); |
|---|
| 1034 | |
|---|
| 1035 | } |
|---|
| 1036 | |
|---|
| 1037 | |
|---|
| 1038 | void gui_osd_draw_temp() { |
|---|
| 1039 | if (conf.show_temp == 1) |
|---|
| 1040 | { |
|---|
| 1041 | if (conf.temperature_unit == 0) |
|---|
| 1042 | { |
|---|
| 1043 | sprintf(osd_buf," opt: %i°",get_optical_temp()); |
|---|
| 1044 | } |
|---|
| 1045 | else |
|---|
| 1046 | { |
|---|
| 1047 | sprintf(osd_buf,"opt: %i°",(get_optical_temp()*18+320)/10); |
|---|
| 1048 | } |
|---|
| 1049 | draw_string(conf.temp_pos.x, conf.temp_pos.y, osd_buf, conf.osd_color); |
|---|
| 1050 | } |
|---|
| 1051 | if (conf.show_temp==2) |
|---|
| 1052 | { |
|---|
| 1053 | if (conf.temperature_unit == 0) |
|---|
| 1054 | { |
|---|
| 1055 | sprintf(osd_buf," ccd: %i°",get_ccd_temp()); |
|---|
| 1056 | } |
|---|
| 1057 | else |
|---|
| 1058 | { |
|---|
| 1059 | sprintf(osd_buf,"ccd: %i°",(get_ccd_temp()*18+320)/10); |
|---|
| 1060 | } |
|---|
| 1061 | draw_string(conf.temp_pos.x, conf.temp_pos.y, osd_buf, conf.osd_color); |
|---|
| 1062 | } |
|---|
| 1063 | if (conf.show_temp==3) |
|---|
| 1064 | { |
|---|
| 1065 | if (conf.temperature_unit == 0) |
|---|
| 1066 | { |
|---|
| 1067 | sprintf(osd_buf," batt:%i°",get_battery_temp()); |
|---|
| 1068 | } |
|---|
| 1069 | else |
|---|
| 1070 | { |
|---|
| 1071 | sprintf(osd_buf,"batt:%i°",(get_battery_temp()*18+320)/10); |
|---|
| 1072 | } |
|---|
| 1073 | draw_string(conf.temp_pos.x, conf.temp_pos.y, osd_buf, conf.osd_color); |
|---|
| 1074 | } |
|---|
| 1075 | if (conf.show_temp==4) |
|---|
| 1076 | { |
|---|
| 1077 | if (conf.temperature_unit == 0) |
|---|
| 1078 | { |
|---|
| 1079 | sprintf(osd_buf," opt: %i°",get_optical_temp()); |
|---|
| 1080 | draw_string(conf.temp_pos.x, conf.temp_pos.y, osd_buf, conf.osd_color); |
|---|
| 1081 | sprintf(osd_buf," ccd: %i°",get_ccd_temp()); |
|---|
| 1082 | draw_string(conf.temp_pos.x, conf.temp_pos.y+FONT_HEIGHT, osd_buf, conf.osd_color); |
|---|
| 1083 | sprintf(osd_buf," batt:%i°",get_battery_temp()); |
|---|
| 1084 | draw_string(conf.temp_pos.x, conf.temp_pos.y+2*FONT_HEIGHT, osd_buf, conf.osd_color); |
|---|
| 1085 | } |
|---|
| 1086 | else |
|---|
| 1087 | { |
|---|
| 1088 | sprintf(osd_buf,"opt: %i°",(get_optical_temp()*18+320)/10); |
|---|
| 1089 | draw_string(conf.temp_pos.x, conf.temp_pos.y, osd_buf, conf.osd_color); |
|---|
| 1090 | sprintf(osd_buf,"ccd: %i°",(get_ccd_temp()*18+320)/10); |
|---|
| 1091 | draw_string(conf.temp_pos.x, conf.temp_pos.y+FONT_HEIGHT, osd_buf, conf.osd_color); |
|---|
| 1092 | sprintf(osd_buf,"batt:%i°",(get_battery_temp()*18+320)/10); |
|---|
| 1093 | draw_string(conf.temp_pos.x, conf.temp_pos.y+2*FONT_HEIGHT, osd_buf, conf.osd_color); |
|---|
| 1094 | } |
|---|
| 1095 | } |
|---|
| 1096 | } |
|---|
| 1097 | |
|---|
| 1098 | |
|---|
| 1099 | |
|---|
| 1100 | //------------------------------------------------------------------- |
|---|
| 1101 | #if CAM_EV_IN_VIDEO |
|---|
| 1102 | void gui_osd_draw_ev_video(int visible){ |
|---|
| 1103 | int x0=conf.ev_video_pos.x, y0=conf.ev_video_pos.y; |
|---|
| 1104 | int i, deltax; |
|---|
| 1105 | |
|---|
| 1106 | draw_filled_rect(x0,y0,x0+70,y0+24, visible? ((conf.osd_color&0xFF00))|(conf.osd_color>>8): COLOR_TRANSPARENT); |
|---|
| 1107 | |
|---|
| 1108 | if (!visible) { return; } |
|---|
| 1109 | |
|---|
| 1110 | for (i=0;i<9;i++) draw_line(x0+2+i*8, y0+12, x0+2+i*8, y0+12-(i&1 ? 5 : 10), conf.osd_color); |
|---|
| 1111 | for (i=0;i<9;i++) draw_line(x0+2+i*8+1, y0+12, x0+2+i*8+1, y0+12-(i&1 ? 5 : 10), conf.osd_color); |
|---|
| 1112 | |
|---|
| 1113 | deltax=8*get_ev_video(); |
|---|
| 1114 | |
|---|
| 1115 | x0+=deltax; |
|---|
| 1116 | |
|---|
| 1117 | draw_line(x0+34,y0+16,x0+34,y0+22,conf.osd_color); |
|---|
| 1118 | draw_line(x0+35,y0+16,x0+35,y0+22,conf.osd_color); |
|---|
| 1119 | |
|---|
| 1120 | draw_line(x0+32,y0+19,x0+32,y0+22,conf.osd_color); |
|---|
| 1121 | draw_line(x0+33,y0+18,x0+33,y0+22,conf.osd_color); |
|---|
| 1122 | draw_line(x0+36,y0+18,x0+36,y0+22,conf.osd_color); |
|---|
| 1123 | draw_line(x0+37,y0+19,x0+37,y0+22,conf.osd_color); |
|---|
| 1124 | |
|---|
| 1125 | } |
|---|
| 1126 | #endif |
|---|