Assembla home | Assembla project page
 

Changeset 486

Show
Ignore:
Timestamp:
08/16/08 21:54:21 (2 years ago)
Author:
Jucifer
Message:

+ added LjL's cropped zebra -mod (http://chdk.setepontos.com/index.php/topic,1849.msg17467.html#msg17467)
+ added get_time("unit") for Lua, where unit can be Y[ear], M[onth], D[ay], h[our], m[inute] or s[econd] ([]=optional/example)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/juciphox/core/gui_draw.c

    r416 r486  
    4141//------------------------------------------------------------------- 
    4242void draw_pixel(coord x, coord y, color cl) { 
    43     if (x >= screen_width || y >= screen_height) return; 
     43    if (x < 0 || y < 0 || x >= screen_width || y >= screen_height) return; 
    4444    else { 
    4545        register unsigned int offset = y * screen_buffer_width + x; 
     
    196196    // XXX optimize. probably use 4bit -> 32bit lookup table 
    197197    // so 4(8) pixels were drawn at a time 
    198     for (i=0; i<FONT_HEIGHT; i++){ 
    199         for (ii=0; ii<FONT_WIDTH; ii++){ 
    200             draw_pixel(x+ii ,y+i, (sym[i] & (0x80>>ii))? cl&0xff : cl>>8); 
     198    for (i=-1; i<=FONT_HEIGHT; i++){ 
     199        for (ii=-1; ii<=FONT_WIDTH; ii++){ 
     200            int inside_box = (i>=0 && i<FONT_HEIGHT && ii>=0 && ii<FONT_WIDTH); 
     201            if(inside_box && sym[i] & (0x80>>ii)) { 
     202                draw_pixel(x+ii ,y+i, cl&0xff); 
     203            } else { 
     204                if     (i>0             && (sym[i-1] & (0x80>>ii)))   draw_pixel(x+ii, y+i, COLOR_BLACK); 
     205                else if(i<FONT_HEIGHT-1 && (sym[i+1] & (0x80>>ii)))   draw_pixel(x+ii, y+i, COLOR_BLACK); 
     206                else if(ii>0            && (sym[i] & (0x80>>(ii-1)))) draw_pixel(x+ii, y+i, COLOR_BLACK); 
     207                else if(ii<FONT_WIDTH-1 && (sym[i] & (0x80>>(ii+1)))) draw_pixel(x+ii, y+i, COLOR_BLACK); 
     208                else if(inside_box && cl>>8!=COLOR_TRANSPARENT)       draw_pixel(x+ii ,y+i, cl>>8); 
     209            } 
    201210        } 
    202211    } 
  • branches/juciphox/core/gui_osd.c

    r479 r486  
    4747static char osd_buf2[64]; 
    4848static int step; 
    49 static unsigned char *img_buf, *scr_buf
     49static unsigned char *img_buf, *scr_buf, *cur_buf
    5050static int timer = 0; 
    5151static char *buf = NULL; 
     
    195195} 
    196196 
     197int draw_guard_pixel() { 
     198    unsigned char* buffer1 = vid_get_bitmap_fb()+screen_buffer_size/2; 
     199    unsigned char* buffer2 = buffer1+screen_buffer_size; 
     200    int has_disappeared=0; 
     201 
     202    if(*buffer1!=COLOR_GREEN) has_disappeared=1; 
     203    if(*buffer2!=COLOR_GREEN) has_disappeared=2; 
     204    *buffer1 = *buffer2 = COLOR_GREEN; 
     205    return has_disappeared; 
     206} 
     207 
     208 
    197209//------------------------------------------------------------------- 
    198210static void gui_osd_draw_zebra_osd() { 
     211    color old_osd_color=conf.osd_color; 
     212    conf.osd_color=MAKE_COLOR(COLOR_TRANSPARENT, conf.osd_color); 
    199213    switch (conf.zebra_draw_osd) { 
    200214        case ZEBRA_DRAW_NONE: 
     
    241255            break; 
    242256    } 
     257    conf.osd_color=old_osd_color; 
    243258} 
    244259 
     
    267282        buf = malloc(screen_buffer_size); 
    268283        scr_buf = vid_get_bitmap_fb(); 
     284        cur_buf = malloc(screen_buffer_size); 
    269285    } 
    270286 
    271287    if (buf) { 
     288        if(timer==0) { 
     289            draw_guard_pixel(); 
     290            timer=1; 
     291            return 0; 
     292        } 
     293        if(timer==1) { 
     294            short ready; 
     295            static int n=0; 
     296            get_property_case(PROPCASE_SHOOTING, &ready, 4); 
     297            n=draw_guard_pixel(); 
     298            if(!ready || n==0) return 0; 
     299            if(n==1) memcpy(cur_buf, scr_buf, screen_buffer_size); 
     300            else memcpy(cur_buf, scr_buf+screen_buffer_size, screen_buffer_size); 
     301        } 
    272302        ++timer; 
    273303        img_buf=((mode_get()&MODE_MASK) == MODE_PLAY)?vid_get_viewport_fb_d():vid_get_viewport_fb(); 
     
    284314                break; 
    285315            case ZEBRA_MODE_BLINKED_1: 
    286                 f = timer&2;  
     316                f = timer&1;  
    287317                break; 
    288318            case ZEBRA_MODE_BLINKED_3: 
    289                 f = timer&8;  
     319                f = timer&4;  
    290320                break; 
    291321            case ZEBRA_MODE_BLINKED_2: 
    292322            default: 
    293                 f = timer&4;  
     323                f = timer&2;  
    294324                break; 
    295325        } 
     
    316346                        else if (((conf.zebra_mode == ZEBRA_MODE_ZEBRA_1 || conf.zebra_mode == ZEBRA_MODE_ZEBRA_2) && (y-x-timer)&f)) buf[s]=COLOR_TRANSPARENT; 
    317347                             else buf[s]=(yy>over)?cl_over:(yy<conf.zebra_under)?cl_under:COLOR_TRANSPARENT; 
    318                         if (buf[s] != COLOR_TRANSPARENT && !zebra_drawn) zebra_drawn = 1; 
     348                       if (buf[s] != COLOR_TRANSPARENT && !zebra_drawn) zebra_drawn = 1; 
     349                        if(cur_buf[s]!=COLOR_TRANSPARENT) buf[s]=cur_buf[s]; 
     350                        if(conf.zebra_multichannel && cur_buf[s+1]!=COLOR_TRANSPARENT) buf[s+1]=cur_buf[s+1]; 
    319351                    } 
    320352                    s+=screen_buffer_width-screen_width; 
     
    331363                    draw_restore(); 
    332364                } else { 
    333                     memset(buf, COLOR_TRANSPARENT, screen_buffer_size); 
     365                    memcpy(buf, cur_buf, screen_buffer_size); 
    334366                    gui_osd_draw_zebra_osd(); 
    335367                    memcpy(scr_buf, buf, screen_buffer_size); 
     
    392424//------------------------------------------------------------------- 
    393425void gui_osd_draw_histo() { 
     426    static long old_histo_magnification=0; 
    394427    switch (conf.histo_layout) { 
    395428        case OSD_HISTO_LAYOUT_Y: 
     
    442475    } 
    443476    if ((conf.show_overexp ) && kbd_is_key_pressed(KEY_SHOOT_HALF) && (under_exposed || over_exposed)) 
    444       draw_string(conf.histo_pos.x+HISTO_WIDTH-FONT_WIDTH*3, conf.histo_pos.y-FONT_HEIGHT, "EXP", conf.histo_color); 
     477      draw_string(conf.histo_pos.x+HISTO_WIDTH-FONT_WIDTH*3, conf.histo_pos.y-FONT_HEIGHT, "EXP", conf.osd_color); 
    445478    if (conf.histo_auto_ajust){ 
    446479      if (histo_magnification) { 
    447480        sprintf(osd_buf, " %d.%02dx ", histo_magnification/1000, histo_magnification/10%100); 
    448         draw_string(conf.histo_pos.x, conf.histo_pos.y-FONT_HEIGHT, osd_buf, conf.histo_color); 
     481        draw_string(conf.histo_pos.x, conf.histo_pos.y-FONT_HEIGHT, osd_buf, conf.osd_color); 
    449482      } else if (gui_get_mode()==GUI_MODE_OSD){ 
    450483        draw_string(conf.histo_pos.x, conf.histo_pos.y-FONT_HEIGHT, " 9.99x ", conf.histo_color); 
    451       } else
     484      } else if (old_histo_magnification)
    452485        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)); 
    453486      } 
    454487    } 
     488    old_histo_magnification=histo_magnification; 
    455489} 
    456490 
  • branches/juciphox/core/luascript.c

    r479 r486  
    1010#include "shot_histogram.h" 
    1111#include "ubasic.h" 
     12#include "stdlib.h" 
    1213 
    1314static int luaCB_shoot( lua_State* L ) 
     
    634635  } 
    635636  lua_pushnumber( L, temp ); 
     637  return 1; 
     638} 
     639 
     640static int luaCB_get_time( lua_State* L ) 
     641{ 
     642  int r = -1; 
     643  unsigned long t2 = time(NULL); 
     644  static struct tm *ttm; 
     645  ttm = localtime(&t2); 
     646  const char *t = luaL_checkstring( L, 1 ); 
     647  if (strncmp("s", t, 1)==0) r = ( L, ttm->tm_sec ); 
     648  else if (strncmp("m", t, 1)==0) r = ( L, ttm->tm_min ); 
     649  else if (strncmp("h", t, 1)==0) r = ( L, ttm->tm_hour ); 
     650  else if (strncmp("D", t, 1)==0) r = ( L, ttm->tm_mday ); 
     651  else if (strncmp("M", t, 1)==0) r = ( L, ttm->tm_mon+1 ); 
     652  else if (strncmp("Y", t, 1)==0) r = ( L, 1900+ttm->tm_year ); 
     653  lua_pushnumber( L, r ); 
    636654  return 1; 
    637655} 
     
    832850  FUNC(bitnot); 
    833851 
    834 
     852  FUNC(get_time); 
     853
  • branches/juciphox/doc/version.txt

    r484 r486  
    55 
    66log 
     7 
     8486 / 0.3.6 
     9Jucifer 
     10 
     11+ added LjL's cropped zebra -mod (http://chdk.setepontos.com/index.php/topic,1849.msg17467.html#msg17467) 
     12+ added get_time("unit") for Lua, where unit can be Y[ear], M[onth], D[ay], h[our], m[inute] or s[econd] ([]=optional/example) 
     13 
    714 
    8150.3.5 / PP 
  • branches/juciphox/version.inc

    r484 r486  
    1 BUILD_NUMBER := 0.3.5 
     1BUILD_NUMBER := 0.3.6