/* * ***************************************************************** * * * * * Copyright (c) Fast Corporation, 1997 * * * * * * All Rights Reserved. Unpublished rights reserved under * * * the copyright laws of the Japan. * * * * * * The software contained on this media is proprietary to * * * and embodies the confidential technology of Fast * * * Corporation. Possession, use, duplication or * * * dissemination of the software and media is authorized only * * * pursuant to a valid written license from Fast Corporation. * * * * * ***************************************************************** */ /* CSC90X ウインド内平均濃度波形/微分波形表示     BIBNWAVE.C */ /*[作成者]H.Yagi */ /* 目的: 関数: 履歴: Ver 1.0 97/08/15 注記:m_menu.hをインクルードして下さい。 m_menu.c及びm_note.cをリンクして下さい。 */ /* * Include compiler runtime library */ #include #include /* * Include CSC90X library */ #include "f_stdlib.h" #include "f_time.h" #include "f_gui.h" #include "f_stdio.h" #include "f_graph.h" #include "f_image.h" #include "f_pinf.h" #include "f_video.h" #include "f_system.h" /* * Include CSC90X common local */ #include "m_menu.h" /* * プロトタイプ宣言 */ void main( void ); void main_menu_disp( void ); void disp_help( void ); void set( int *, int *, int *, int * ); void wind_set( int *, int *, int *, int * ); void exec( int, int, int, int ); void bibun( int *, int *, int ); extern int message_note( void ); /* * メニュー項目 */ #define LANG_N 2 #define MAIN_MENU_N 4 static const char *str_main_menu[MAIN_MENU_N][LANG_N] = { { " SET ", " 設 定 " }, { " EXEC ", " 実 行 " }, { " PROC3 ", " 処理3 " }, { " PROC4 ", " 処理4 " } }; #define INIT_CUR_POS_X 255 #define INIT_CUR_POS_Y 239 /* * メイン */ void main( void ) { int sts; int xpos; int ypos; int s_xpos; int s_ypos; int xs, ys, xe, ye; /* 初期メッセージ表示 */ if( NORMAL_RETURN != message_note() ) return; /* パラメタ初期化 */ xpos = INIT_CUR_POS_X; ypos = INIT_CUR_POS_Y; s_xpos = INIT_CUR_POS_X; s_ypos = INIT_CUR_POS_Y; xs=0; ys=0; xe=511; ye=479; /* 入力ビデオ制御 */ Lib_input_video_control( GRAY_PLANE ); /* ビデオ出力表示項目制御 */ Lib_display_control( GRAY_PLANE | LINE_PLANE | CHAR_PLANE ); /* ビデオ表示項目クリア */ Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); /* カーソル初期化 */ Lib_init_cursor(); /* メインメニューの表示 */ main_menu_disp(); /* マウスカーソルの表示 */ Lib_draw_cursor( INIT_CUR_POS_X, INIT_CUR_POS_Y ); /* メニュー制御 */ for (;;) { sts = 0; /* マウス位置読みとり */ sts = Lib_see_current_position( &xpos, &ypos ); if ( s_xpos != xpos || s_ypos != ypos ) { /* マウス表示位置移動 */ Lib_move_cursor( xpos, ypos ); s_xpos = xpos; s_ypos = ypos; } /* 処理振り分け */ if( CURSOR_EXECUTE == sts ) { if ( xpos > MENU_1_XS && xpos < MENU_1_XE && ypos > MENU_1_YS && ypos < MENU_1_YE ) { Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); set( &xs, &ys, &xe, &ye ); /*設定*/ main_menu_disp(); } else if ( xpos > MENU_2_XS && xpos < MENU_2_XE && ypos > MENU_2_YS && ypos < MENU_2_YE ) { Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); exec( xs, ys, xe, ye ); /*実行*/ main_menu_disp(); } else if ( xpos > MENU_H_XS && xpos < MENU_H_XE && ypos > MENU_H_YS && ypos < MENU_H_YE ) { Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); disp_help(); /* ヘルプ */ main_menu_disp(); } else if ( xpos > MENU_E_XS && xpos < MENU_E_XE && ypos > MENU_E_YS && ypos < MENU_E_YE ) { break; /* 終了 */ } } } } /* * メインメニュー表示 */ static void main_menu_disp( void ) { int iLanguage; /* 日本語/英語表示文字列切替情報取得 */ iLanguage = Lib_get_disp_language(); /* 整列キー表示 -> ( m_menu.c ) */ SUB_menu_disp4he( (char *)str_main_menu[0][iLanguage], (char *)str_main_menu[1][iLanguage], (char *)NULL, (char *)NULL ); } /* * ヘルプ表示 */ static void disp_help( void ) { Lib_chrdisp( 10, 8, "【機能\概要】 BIBNWAVE" ); Lib_chrdisp( 11, 10, "ウインド内平均濃度波形/微分波形表\示" ); } /*********************************************************************/ /*  設定                              */ /*********************************************************************/ void set( xs, ys, xe, ye ) int *xs, *ys, *xe, *ye; { wind_set( xs, ys, xe, ye ); } /*********************************************************************/ /*  ウインド設定                          */ /*********************************************************************/ void wind_set( xs, ys, xe, ye ) int *xs, *ys, *xe, *ye; /*入出力:ウインド位置*/ { int pad_level_wind; PVAL value[2]; int no; int x_size,y_size; pad_level_wind = Lib_view_open(); Lib_view_set_title( pad_level_wind, "処理範囲" ); x_size = *xe - *xs + 1; y_size = *ye - *ys + 1; Lib_view_set_box( pad_level_wind, 5, 5, "始点" , *xs , *ys , 3, 1, 0 ); Lib_view_set_box( pad_level_wind, 5, 35, "サイズ", x_size, y_size, 3, 0, 1 ); Lib_view_set_size( pad_level_wind, 80, 80, 5, 5 ); Lib_draw_menu( pad_level_wind ); if( ERROR_RETURN != ( no = Lib_process_menu( pad_level_wind, value ) ) ) { switch( no ) { case 101: /*「実行」が選択された */ *xs = value[0].box_type.x; *ys = value[0].box_type.y; *xe = value[0].box_type.x + value[1].box_type.x - 1; *ye = value[0].box_type.y + value[1].box_type.y - 1; break; case 102: /*「取り消し」が選択された */ break; } } Lib_erase_menu( pad_level_wind ); Lib_view_close( pad_level_wind ); } /*********************************************************************/ /*  実行                              */ /*********************************************************************/ void exec( xs, ys, xe, ye ) int xs, ys, xe, ye; { register int i,a; char *base; char *wind_base; char *wb2; static int sum[513]; static int shaei_y[513]; static int shaei_bibun[513]; static int kasan[513]; int s_shaei_y; int windx; int windy; windx = xe - xs - 1; /* ウインド枠内サイズX */ windy = ye - ys - 1; /* ウインド枠内サイズY */ Lib_freeze( TRANSMIT ); base = Lib_adrs_gray_memory( CURRENT_MEMORY ); wind_base = base + (ys+1) * 512 + (xs+1); Lib_box( xs, ys, xe, ye, SOLID_LINE ); for ( i=0; i xs+1 ) { Lib_drawline( i-1, s_shaei_y, i, shaei_y[a] ); } s_shaei_y = shaei_y[a]; } Lib_display_keyinput( 430,0," 確認 " ); Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); for ( i=xs+1,a=0; i xs+1 ) { Lib_erasline( i-1, s_shaei_y, i, shaei_y[a] ); } s_shaei_y = shaei_y[a]; } Lib_box( xs, ys, xe, ye, SOLID_LINE ); Lib_chrdisp( 1, 1, "微分波形" ); bibun( shaei_y, shaei_bibun, windx ); for ( i=xs+1,a=0; i xs+1 ) { Lib_drawline( i-1, s_shaei_y, i, shaei_bibun[a]+355 ); } s_shaei_y = shaei_bibun[a]+355; } Lib_display_keyinput( 430,0," 確認 " ); Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); Lib_freerun(); } /************************************************************************/ /* 微分( 隣の画素との差 ) */ /************************************************************************/ void bibun( in_ss, ot_ss, pitch ) int *in_ss; /* 入力配列(濃度配列)の先頭アドレス */ int *ot_ss; /* 出力配列(微分配列)の先頭アドレス */ int pitch; /* 処理配列数 */ { int i, sa; int *pp, *ff; pp = in_ss; ff = in_ss + 1; for ( i = 0; i