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