Subversion Repositories Kolibri OS

Rev

Rev 8036 | Rev 8346 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. use32
  2.         org 0
  3.         db 'MENUET01'
  4.         dd 1,start,i_end,mem,stacktop,openfile_path,sys_path
  5.  
  6. include 'lang.inc'
  7. include '../../macros.inc'
  8. include '../../proc32.inc'
  9. include '../../KOSfuncs.inc'
  10. include '../../load_img.inc'
  11. include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc'
  12. include '../../develop/libraries/TinyGL/asm_fork/zbuffer.inc'
  13. include '../../develop/libraries/libs-dev/libimg/libimg.inc'
  14. include '../../develop/info3ds/info_fun_float.inc'
  15.  
  16. @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
  17. caption db 'Image transform 02.10.20',0 ;¯®¤¯¨áì ®ª­ 
  18.  
  19. BUF_STRUCT_SIZE equ 21
  20. buf2d_data equ dword[edi] ;¤ ­­ë¥ ¡ãä¥à  ¨§®¡à ¦¥­¨ï
  21. buf2d_w equ dword[edi+8] ;è¨à¨­  ¡ãä¥à 
  22. buf2d_h equ dword[edi+12] ;¢ëá®â  ¡ãä¥à 
  23. buf2d_l equ word[edi+4]
  24. buf2d_t equ word[edi+6] ;®âáâ㯠ᢥàåã
  25. buf2d_size_lt equ dword[edi+4] ;®âáâ㯠᫥¢  ¨ á¯à ¢  ¤«ï ¡ãä¥à 
  26. buf2d_color equ dword[edi+16] ;梥â ä®­  ¡ãä¥à 
  27. buf2d_bits equ byte[edi+20] ;ª®«¨ç¥á⢮ ¡¨â ¢ 1-© â®çª¥ ¨§®¡à ¦¥­¨ï
  28.  
  29. NAV_WND_L equ 145
  30. NAV_WND_T equ 1
  31.  
  32. include 'select_points.inc'
  33.  
  34. IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
  35. image_data_toolbar dd 0
  36.  
  37. align 4
  38. start:
  39.         load_libraries l_libs_start,l_libs_end
  40.         ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ¡¨¡«¨®â¥ª 
  41.         mov     ebp,lib_0
  42.         cmp     dword [ebp+ll_struc_size-4],0
  43.         jz      @f
  44.                 mcall SF_TERMINATE_PROCESS
  45.         @@:
  46.         mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
  47.         mcall SF_SET_EVENTS_MASK,0xC0000027
  48.         stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
  49.  
  50.         stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à 
  51.  
  52.         include_image_file '../../../programs/fs/kfar/trunk/font6x9.bmp', image_data_toolbar, buf_font.w,buf_font.h
  53.         stdcall [buf2d_create_f_img], buf_font,[image_data_toolbar] ;ᮧ¤ ¥¬ ¡ãä¥à
  54.         stdcall mem.Free,[image_data_toolbar] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
  55.         stdcall [buf2d_conv_24_to_8], buf_font,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8 ¡¨â
  56.         stdcall [buf2d_convert_text_matrix], buf_font
  57.  
  58.         include_image_file 'toolbar.png', image_data_toolbar
  59.  
  60.         mcall SF_SYSTEM_GET,SSF_TIME_COUNT
  61.         mov [last_time],eax
  62.  
  63.         ;­ áâனª  â®ç¥ª
  64.         call points_init
  65.  
  66.         ;open file from cmd line
  67.         cmp dword[openfile_path],0
  68.         je @f
  69.                 call but_open_file.no_dlg
  70.         @@:
  71.  
  72. align 4
  73. red_win:
  74.         call draw_window
  75.  
  76. align 16
  77. still:
  78.         mcall SF_SYSTEM_GET,SSF_TIME_COUNT
  79.         mov ebx,[last_time]
  80.         add ebx,10 ;§ ¤¥à¦ª 
  81.         cmp ebx,eax
  82.         jge @f
  83.                 mov ebx,eax
  84.         @@:
  85.         sub ebx,eax
  86.         mcall SF_WAIT_EVENT_TIMEOUT
  87.         cmp eax,0
  88.         je timer_funct
  89.  
  90.         cmp al,1
  91.         jz red_win
  92.         cmp al,2
  93.         jz key
  94.         cmp al,3
  95.         jz button
  96.         cmp al,6
  97.         jne @f
  98.                 mcall SF_THREAD_INFO,procinfo,-1
  99.                 cmp ax,word[procinfo.window_stack_position]
  100.                 jne @f ;®ª­® ­¥  ªâ¨¢­®
  101.                 call mouse
  102.         @@:
  103.         jmp still
  104.  
  105. align 4
  106. timer_funct:
  107.         push eax ebx
  108.                 mcall SF_SYSTEM_GET,SSF_TIME_COUNT
  109.                 mov [last_time],eax
  110.         pop ebx eax
  111.         cmp byte[calc],0
  112.         je still
  113.                 call draw_nav_wnd
  114.                 call draw_buffers
  115.         jmp still
  116.  
  117. align 16
  118. draw_window:
  119. pushad
  120.         mcall SF_REDRAW,SSF_BEGIN_DRAW
  121.  
  122.         ; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
  123.         mov edx,[sc.work]
  124.         or  edx,(3 shl 24)+0x30000000
  125.         mcall SF_CREATE_WINDOW,(20 shl 16)+410,(20 shl 16)+520,,,caption
  126.  
  127.         mcall SF_THREAD_INFO,procinfo,-1
  128.         mov eax,dword[procinfo.box.height]
  129.         cmp eax,120
  130.         jge @f
  131.                 mov eax,120 ;min size
  132.         @@:
  133.         sub eax,65
  134.         mov ebx,dword[procinfo.box.width]
  135.         cmp ebx,270
  136.         jge @f
  137.                 mov ebx,270
  138.         @@:
  139.         sub ebx,19
  140.         cmp eax,dword[buf_0.h] ;ᬮâਬ à §¬¥à ¡ãä¥à 
  141.         jne @f
  142.         cmp ebx,dword[buf_0.w]
  143.         jne @f
  144.                 jmp .end0
  145.         @@:
  146.                 stdcall [buf2d_resize],buf_0,ebx,eax,1
  147.                 call calc_nav_params
  148.                 mov eax,[nav_x]
  149.                 call nav_x_corect
  150.                 mov [nav_x],eax
  151.                 mov eax,[nav_y]
  152.                 call nav_y_corect
  153.                 mov [nav_y],eax
  154.                 mov byte[calc],1
  155.         .end0:
  156.  
  157.         ; *** ᮧ¤ ­¨¥ ª­®¯®ª ­  ¯ ­¥«ì ***
  158.         mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3, [sc.work_button]
  159.  
  160.         add ebx,25 shl 16
  161.         mcall ,,,4
  162.         add ebx,30 shl 16
  163.         mcall ,,,5
  164.         add ebx,25 shl 16
  165.         mcall ,,,6
  166.         add ebx,25 shl 16
  167.         mcall ,,,7
  168.  
  169.         ; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
  170.         mov edx,(7 shl 16)+7 ;icon open
  171.         mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16
  172.  
  173.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  174.         add edx,(25 shl 16) ;icon save
  175.         int 0x40
  176.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  177.         add edx,(30 shl 16) ;icon view
  178.         int 0x40
  179.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  180.         add edx,(25 shl 16) ;icon mode
  181.         int 0x40
  182.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  183.         add edx,(25 shl 16) ;
  184.         int 0x40
  185.  
  186.         call draw_nav_wnd
  187.         call draw_buffers
  188.  
  189.         mcall SF_REDRAW,SSF_END_DRAW
  190. popad
  191.         ret
  192.  
  193. ;à¨á®¢ ­¨¥ ­ ¢¨£ æ¨®­­®£® ®ª­ 
  194. align 4
  195. proc draw_nav_wnd
  196.         cmp dword[buf_i0],0
  197.         je .end0
  198.         bt dword[nav_x_min],31
  199.         jnc .end0
  200.         bt dword[nav_y_min],31
  201.         jnc .end0
  202. pushad
  203.                 mov ebx,(NAV_WND_L shl 16)
  204.                 add ebx,[nav_wnd_w]
  205.                 mov ecx,(NAV_WND_T shl 16)
  206.                 add ecx,[nav_wnd_h]
  207.                 mcall SF_DRAW_RECT,,,0 ;¨§®¡à ¦¥­¨¥
  208.                 mov ecx,[nav_wnd_zoom]
  209.                 mov ebx,[nav_x]
  210.                 neg ebx
  211.                 sar ebx,cl
  212.                 add ebx,NAV_WND_L
  213.                 shl ebx,16
  214.                 add ebx,[buf_0.w]
  215.                 shr bx,cl
  216.                 mov edx,[nav_y]
  217.                 neg edx
  218.                 sar edx,cl
  219.                 add edx,NAV_WND_T
  220.                 shl edx,16
  221.                 add edx,[buf_0.h]
  222.                 shr dx,cl
  223.                 mov ecx,edx
  224.                 mcall ,,,0x404080 ;ç áâì ¨§®¡à ¦¥­¨ï ¯®¯ ¤ îé ï ¢ ®ª­®
  225.                
  226.                 mov edi,sel_pt
  227.                 @@:
  228.                         mov ecx,[nav_wnd_zoom]
  229.                         mov ebx,[edi+point2d.x]
  230.                         shr ebx,cl
  231.                         add ebx,NAV_WND_L
  232.                         mov edx,[edi+point2d.y]
  233.                         shr edx,cl
  234.                         add edx,NAV_WND_T
  235.                         mov ecx,edx
  236.                         mcall SF_PUT_PIXEL,,,0xffff00
  237.                         add edi,sizeof.point2d
  238.                         cmp edi,sel_pt+4*sizeof.point2d
  239.                         jl @b
  240. popad
  241.         .end0:
  242.         ret
  243. endp
  244.  
  245. align 4
  246. proc draw_buffers
  247. pushad
  248.         cmp byte[calc],0
  249.         je .end0
  250.                 ; *** ®¡­®¢«¥­¨¥ ¡ãä¥à  ***
  251.                 bt dword[nav_x_min],31
  252.                 jnc .beg0
  253.                 bt dword[nav_y_min],31
  254.                 jc @f
  255.                 .beg0:
  256.                         stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
  257.                 @@:
  258.                 cmp byte[view_b],1
  259.                 je .end1
  260.                         push buf_i0
  261.                         jmp .end2
  262.                 .end1:
  263.                         push buf_ogl
  264.                 .end2:
  265.                 stdcall [buf2d_bit_blt], buf_0, [nav_x],[nav_y] ;,...
  266.  
  267.                 call points_draw
  268.                 xor eax,eax
  269.                 cmp [u_line_v],eax
  270.                 je @f
  271.                         mov eax,[u_line_v]
  272.                         add eax,[nav_x]
  273.                         stdcall [buf2d_line], buf_0, eax,0, eax,[buf_0.h], 0xffffff
  274.                         inc eax
  275.                         stdcall [buf2d_line], buf_0, eax,0, eax,[buf_0.h], 0
  276.                 @@:
  277.                 xor eax,eax
  278.                 cmp [u_line_h],eax
  279.                 je @f
  280.                         mov eax,[u_line_h]
  281.                         add eax,[nav_y]
  282.                         stdcall [buf2d_line], buf_0, 0,eax, [buf_0.w],eax, 0xffffff
  283.                         inc eax
  284.                         stdcall [buf2d_line], buf_0, 0,eax, [buf_0.w],eax, 0
  285.                 @@:
  286.  
  287.                 ; *** ®¡­®¢«¥­¨¥ ¯®¤¯¨á¨ à §¬¥à  ä ©«  ***
  288.                 mov edi,txt_f_size.size
  289.                 mov eax,[open_file_size]
  290.                 mov ebx,txt_pref
  291.                 .cycle:
  292.                         cmp eax,1024
  293.                         jl @f
  294.                         shr eax,10
  295.                         add ebx,4
  296.                         jmp .cycle
  297.                 @@:
  298.                 stdcall convert_int_to_str, 16
  299.                 stdcall str_cat, edi,ebx
  300.                 stdcall str_cat, edi,txt_space ;§ ¢¥àè î騩 ¯à®¡¥«
  301.                 ;è¨à¨­  ¨ ¢ëá®â  ¨§®¡à ¦¥­¨ï
  302.                 mov eax,[buf_i0.w]
  303.                 mov edi,txt_img_w.size
  304.                 stdcall convert_int_to_str, 16
  305.                 mov eax,[buf_i0.h]
  306.                 mov edi,txt_img_h.size
  307.                 stdcall convert_int_to_str, 16
  308.                 mov byte[calc],0
  309.         .end0:
  310.         ; *** à¨á®¢ ­¨¥ ¡ãä¥à  ***
  311.         stdcall [buf2d_draw], buf_0
  312.         ; *** à¨á®¢ ­¨¥ ¯®¤¯¨á¨ à §¬¥à  ä ©«  ***
  313.         mov ecx,[sc.work_text]
  314.         or  ecx,0x80000000 or (1 shl 30)
  315.         mov edi,[sc.work] ;梥â ä®­  ®ª­ 
  316.         mcall SF_DRAW_TEXT,(275 shl 16)+4,,txt_f_size
  317.         add ebx,9
  318.         mcall ,,,txt_img_w
  319.         add ebx,9
  320.         mcall ,,,txt_img_h
  321. popad
  322.         ret
  323. endp
  324.  
  325. align 16
  326. key:
  327.         push eax ebx ecx
  328.         mcall SF_GET_KEY
  329.         cmp byte[view_b],1
  330.         je .end1
  331.         cmp ah,49 ;1
  332.         jne @f
  333.                 mov edi,sel_pt
  334.                 call set_point_coords
  335.                 jmp .end0
  336.         @@:
  337.         cmp ah,50 ;2
  338.         jne @f
  339.                 mov edi,sel_pt+sizeof.point2d
  340.                 call set_point_coords
  341.                 jmp .end0
  342.         @@:
  343.         cmp ah,51 ;3
  344.         jne @f
  345.                 mov edi,sel_pt+sizeof.point2d*2
  346.                 call set_point_coords
  347.                 jmp .end0
  348.         @@:
  349.         cmp ah,52 ;4
  350.         jne @f
  351.                 mov edi,sel_pt+sizeof.point2d*3
  352.                 call set_point_coords
  353.                 jmp .end0
  354.         @@:
  355.         .end1:
  356.  
  357.         cmp ah,178 ;Up
  358.         jne @f
  359.                 call but_img_move_up
  360.                 jmp .end0
  361.         @@:
  362.         cmp ah,177 ;Down
  363.         jne @f
  364.                 call but_img_move_down
  365.                 jmp .end0
  366.         @@:
  367.         cmp ah,176 ;Left
  368.         jne @f
  369.                 call but_img_move_left
  370.                 jmp .end0
  371.         @@:
  372.         cmp ah,179 ;Right
  373.         jne @f
  374.                 call but_img_move_right
  375.                 jmp .end0
  376.         @@:
  377.         cmp ah,104 ;H
  378.         jne @f
  379.                 call set_user_line_h
  380.                 mov byte[calc],1
  381.                 jmp .end0
  382.         @@:
  383.         cmp ah,118 ;V
  384.         jne @f
  385.                 call set_user_line_w
  386.                 mov byte[calc],1
  387.                 jmp .end0
  388.         @@:
  389.  
  390.         mov ecx,eax
  391.         mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS
  392.         bt eax,2 ;left Ctrl
  393.         jc .key_Ctrl
  394.         bt eax,3 ;right Ctrl
  395.         jc .key_Ctrl
  396.         jmp .end0
  397.         .key_Ctrl:
  398.                 cmp ch,15 ;Ctrl+O
  399.                 jne @f
  400.                         call but_open_file
  401.                 @@:
  402.                 cmp ch,19 ;Ctrl+S
  403.                 jne @f
  404.                         call but_save_file
  405.                 @@:
  406.  
  407.         .end0:
  408.         pop ecx ebx eax
  409.         jmp still
  410.  
  411. ;input:
  412. ; edi - 㪠§ â¥«ì ­  áâàãªâãàã point2d
  413. align 4
  414. set_point_coords:
  415.         call buf_get_mouse_coord
  416.         cmp eax,-1
  417.         je .end0
  418.                 sub eax,[nav_x]
  419.                 cmp eax,0
  420.                 jge @f
  421.                         xor eax,eax
  422.                 @@:
  423.                 cmp eax,[buf_i0.w]
  424.                 jle @f
  425.                         mov eax,[buf_i0.w]
  426.                 @@:
  427.                 mov [edi+point2d.x],eax
  428.                 sub ebx,[nav_y]
  429.                 cmp ebx,0
  430.                 jge @f
  431.                         xor ebx,ebx
  432.                 @@:
  433.                 cmp ebx,[buf_i0.h]
  434.                 jle @f
  435.                         mov ebx,[buf_i0.h]
  436.                 @@:
  437.                 mov [edi+point2d.y],ebx
  438.                 call points_update_prop
  439.                 mov byte[calc],1
  440.         .end0:
  441.         ret
  442.  
  443. align 16
  444. button:
  445.         mcall SF_GET_BUTTON
  446.         cmp ah,3
  447.         jne @f
  448.                 call but_open_file
  449.                 jmp still
  450.         @@:
  451.         cmp ah,4
  452.         jne @f
  453.                 call but_save_file
  454.                 jmp still
  455.         @@:
  456.         cmp ah,5
  457.         jne @f
  458.                 call but_2
  459.                 jmp still
  460.         @@:
  461.         cmp ah,6
  462.         jne @f
  463.                 call but_3
  464.                 jmp still
  465.         @@:
  466.         cmp ah,7
  467.         jne @f
  468.                 call but_about
  469.                 jmp still
  470.         @@:
  471.         cmp ah,1
  472.         jne still
  473. .exit:
  474.         stdcall [buf2d_delete],buf_0
  475.         stdcall [buf2d_delete],buf_i0
  476.         ;stdcall [buf2d_delete],buf_ogl
  477.         stdcall mem.Free,[image_data_toolbar]
  478.         stdcall mem.Free,[open_file_img]
  479.         mcall SF_TERMINATE_PROCESS
  480.  
  481. align 4
  482. mouse:
  483.         push eax ebx ecx
  484.         mcall SF_MOUSE_GET,SSF_BUTTON_EXT
  485.         bt eax,8
  486.         jnc @f
  487.                 ;mouse l. but. press
  488.                 call mouse_left_d
  489.                 jmp .end_l
  490.         @@:
  491.         ;bt eax,0
  492.         ;jnc @f
  493.                 ;mouse l. but. move
  494.                 ;call mouse_left_m
  495.                 ;jmp .end_l
  496.         ;@@:
  497.         bt eax,16
  498.         jnc .end_l
  499.                 ;mouse l. but. up
  500.                 call mouse_left_u
  501.                 ;jmp .end_l
  502.         .end_l:
  503.         ;bt eax,9
  504.         ;jnc @f
  505.                 ;mouse r. but. press
  506.                 ;call mouse_right_d
  507.                 ;jmp .end_r
  508.         ;@@:
  509.         ;bt eax,1
  510.         ;jnc @f
  511.                 ;mouse r. but. move
  512.                 ;call mouse_right_m
  513.                 ;jmp .end_r
  514.         ;@@:
  515.         ;.end_r:
  516.  
  517.         pop ecx ebx eax
  518.         ret
  519.  
  520. ;output:
  521. ; eax - buffer coord X (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
  522. ; ebx - buffer coord Y (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
  523. align 4
  524. proc buf_get_mouse_coord
  525.         mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
  526.         cmp ax,word[buf_0.t]
  527.         jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ y
  528.         mov ebx,eax
  529.         shr ebx,16
  530.         cmp bx,word[buf_0.l]
  531.         jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ x
  532.  
  533.         and eax,0xffff ;®áâ ¢«ï¥¬ ª®®à¤¨­ âã y
  534.         sub ax,word[buf_0.t]
  535.         cmp eax,[buf_0.h]
  536.         jg .no_buf
  537.         sub bx,word[buf_0.l]
  538.         cmp ebx,[buf_0.w]
  539.         jg .no_buf
  540.         xchg eax,ebx
  541.         jmp .end_f
  542.         .no_buf:
  543.                 xor eax,eax
  544.                 not eax
  545.                 xor ebx,ebx
  546.                 not ebx
  547.         .end_f:
  548.         ret
  549. endp
  550.  
  551. ;output:
  552. ; eax - buffer coord X (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
  553. ; ebx - buffer coord Y (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
  554. align 4
  555. proc nav_wnd_get_mouse_coord
  556.         mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
  557.         cmp ax,NAV_WND_T
  558.         jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ y
  559.         cmp eax,NAV_WND_L shl 16
  560.         jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ x
  561.         mov ebx,eax
  562.         shr ebx,16
  563.  
  564.         and eax,0xffff ;®áâ ¢«ï¥¬ ª®®à¤¨­ âã y
  565.         sub ax,NAV_WND_T
  566.         cmp eax,[nav_wnd_h]
  567.         jg .no_buf
  568.         sub bx,NAV_WND_L
  569.         cmp ebx,[nav_wnd_w]
  570.         jg .no_buf
  571.         xchg eax,ebx
  572.         jmp .end_f
  573.         .no_buf:
  574.                 xor eax,eax
  575.                 not eax
  576.                 xor ebx,ebx
  577.                 not ebx
  578.         .end_f:
  579.         ret
  580. endp
  581.  
  582. align 4
  583. mouse_left_d:
  584. pushad
  585.         call buf_get_mouse_coord
  586.         cmp eax,-1
  587.         je .end0
  588.                 mov [mouse_down_x],eax
  589.                 mov [mouse_down_y],ebx
  590.                 sub eax,[nav_x]
  591.                 sub ebx,[nav_y]
  592.                
  593.                 mov edi,sel_pt
  594.                 xor ecx,ecx
  595.                 .cycle0:
  596.                         mov edx,[edi+point2d.x]
  597.                         sub edx,eax
  598.                         bt edx,31
  599.                         jnc @f
  600.                                 neg edx
  601.                         @@:
  602.                         cmp edx,5 ;à §¬¥à ¤«ï ¢ë¤¥«¥­¨ï â®çª¨ ¯® ®á¨ x
  603.                         jg .end1
  604.                         mov edx,[edi+point2d.y]
  605.                         sub edx,ebx
  606.                         bt edx,31
  607.                         jnc @f
  608.                                 neg edx
  609.                         @@:
  610.                         cmp edx,5 ;à §¬¥à ¤«ï ¢ë¤¥«¥­¨ï â®çª¨ ¯® ®á¨ y
  611.                         jg .end1
  612.                                 mov [sel_act],ecx
  613.                                 jmp .end0
  614.                         .end1:
  615.                         add edi,sizeof.point2d
  616.                         inc ecx
  617.                         cmp ecx,4
  618.                         jl .cycle0
  619.                         mov dword[sel_act],-1
  620.                 jmp .end2
  621.         .end0:
  622.         call nav_wnd_get_mouse_coord
  623.         cmp eax,-1
  624.         je .end2
  625.                 mov ecx,[nav_wnd_zoom]
  626.                 shl eax,cl
  627.                 shl ebx,cl
  628.                 stdcall nav_to_point, eax,ebx
  629.                 mov byte[calc],1
  630.         .end2:
  631. popad
  632.         ret
  633.  
  634. align 4
  635. proc mouse_left_u uses eax ebx
  636.         call buf_get_mouse_coord
  637.         cmp eax,-1
  638.         je .end0
  639.                 sub [mouse_down_x],eax
  640.                 sub [mouse_down_y],ebx
  641.  
  642.                 cmp dword[sel_act],-1
  643.                 je .end1
  644.                         ;¤¢¨£ ¥¬ â®çª¨
  645.                         mov eax,[sel_act]
  646.                         imul eax,sizeof.point2d
  647.                         add eax,sel_pt
  648.                         ;coord x
  649.                         mov ebx,dword[eax+point2d.x]
  650.                         sub ebx,[mouse_down_x]
  651.                         cmp ebx,0
  652.                         jge @f
  653.                                 xor ebx,ebx
  654.                         @@:
  655.                         cmp ebx,[buf_i0.w]
  656.                         jle @f
  657.                                 mov ebx,[buf_i0.w]
  658.                         @@:
  659.                         mov dword[eax+point2d.x],ebx
  660.                         ;coord y
  661.                         mov ebx,dword[eax+point2d.y]
  662.                         sub ebx,[mouse_down_y]
  663.                         cmp ebx,0
  664.                         jge @f
  665.                                 xor ebx,ebx
  666.                         @@:
  667.                         cmp ebx,[buf_i0.h]
  668.                         jle @f
  669.                                 mov ebx,[buf_i0.h]
  670.                         @@:
  671.                         mov dword[eax+point2d.y],ebx
  672.                         call points_update_prop
  673.                         jmp .end2
  674.                 .end1:
  675.  
  676.                 ;¤¢¨£ ¥¬ ¨§®¡à ¦¥­¨¥
  677.                 mov eax,[nav_y]
  678.                 sub eax,[mouse_down_y]
  679.                 call nav_y_corect
  680.                 mov [nav_y],eax
  681.  
  682.                 mov eax,[nav_x]
  683.                 sub eax,[mouse_down_x]
  684.                 call nav_x_corect
  685.                 mov [nav_x],eax
  686.         .end2:
  687.                 mov byte[calc],1
  688.         .end0:
  689.         ret
  690. endp
  691.  
  692. align 4
  693. set_user_line_h:
  694. pushad
  695.         call buf_get_mouse_coord
  696.         cmp eax,-1
  697.         je .end0
  698.                 mov [mouse_down_y],ebx
  699.                 sub ebx,[nav_y]
  700.                 cmp eax,[buf_i0.h]
  701.                 jle @f
  702.                         mov eax,[buf_i0.h]
  703.                 @@:
  704.                 cmp [u_line_h],ebx
  705.                 jne @f
  706.                         xor ebx,ebx ;line on/off
  707.                 @@:
  708.                 mov [u_line_h],ebx
  709.         .end0:
  710. popad
  711.         ret
  712.  
  713. align 4
  714. set_user_line_w:
  715. pushad
  716.         call buf_get_mouse_coord
  717.         cmp eax,-1
  718.         je .end0
  719.                 mov [mouse_down_x],eax
  720.                 sub eax,[nav_x]
  721.                 cmp eax,[buf_i0.w]
  722.                 jle @f
  723.                         mov eax,[buf_i0.w]
  724.                 @@:
  725.                 cmp [u_line_v],eax
  726.                 jne @f
  727.                         xor eax,eax ;line on/off
  728.                 @@:
  729.                 mov [u_line_v],eax
  730.         .end0:
  731. popad
  732.         ret
  733.  
  734. align 4
  735. proc but_new_file uses eax edi esi
  736.         xor eax,eax
  737.         mov [open_file_size],eax
  738.         mov edi,[open_file_img]
  739.         stosd
  740.         ret
  741. endp
  742.  
  743. align 4
  744. open_file_img dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï ®âªàëâ¨ï ⥪áâãà
  745. open_file_size dd 0 ;à §¬¥à
  746.  
  747. ;¢ëç¨á«¥­¨¥ ¯ à ¬¥â஢ ¤«ï ­ ¢¨£ æ¨¨ ¯® ¨§®¡à ¦¥­¨î
  748. align 4
  749. proc calc_nav_params uses eax ecx edi
  750.         mov dword[nav_x_max],0
  751.         mov edi,buf_0
  752.         mov eax,buf2d_w
  753.         mov [nav_sx],eax
  754.         mov edi,buf_i0
  755.         sub eax,buf2d_w
  756.         bt eax,31
  757.         jc @f
  758.                 mov [nav_x_max],eax
  759.                 xor eax,eax
  760.         @@:
  761.         mov [nav_x_min],eax
  762.         mov edi,buf2d_w
  763.         cmp [nav_sx],edi
  764.         jle @f
  765.                 mov [nav_sx],edi
  766.         @@:
  767.         shr dword[nav_sx],1
  768.  
  769.         mov dword[nav_y_max],0
  770.         mov edi,buf_0
  771.         mov eax,buf2d_h
  772.         mov [nav_sy],eax
  773.         mov edi,buf_i0
  774.         sub eax,buf2d_h
  775.         bt eax,31
  776.         jc @f
  777.                 mov [nav_y_max],eax
  778.                 xor eax,eax
  779.         @@:
  780.         mov [nav_y_min],eax
  781.         mov edi,buf2d_h
  782.         cmp [nav_sy],edi
  783.         jle @f
  784.                 mov [nav_sy],edi
  785.         @@:
  786.         shr dword[nav_sy],1
  787.  
  788.         xor ecx,ecx
  789.         mov [u_line_v],ecx
  790.         mov eax,[buf_i0.w]
  791.         @@:
  792.                 inc ecx
  793.                 shr eax,1
  794.                 cmp eax,100
  795.                 jg @b
  796.         mov [nav_wnd_zoom],ecx
  797.         xor ecx,ecx
  798.         mov [u_line_h],ecx
  799.         mov eax,[buf_i0.h]
  800.         @@:
  801.                 inc ecx
  802.                 shr eax,1
  803.                 cmp eax,32
  804.                 jg @b
  805.         cmp [nav_wnd_zoom],ecx
  806.         jg @f
  807.                 mov [nav_wnd_zoom],ecx
  808.         @@:
  809.         mov ecx,[nav_wnd_zoom]
  810.         mov eax,[buf_i0.w]
  811.         shr eax,cl
  812.         mov [nav_wnd_w],eax
  813.         mov eax,[buf_i0.h]
  814.         shr eax,cl
  815.         mov [nav_wnd_h],eax
  816.         ret
  817. endp
  818.  
  819. align 4
  820. proc but_open_file
  821.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  822.         pushad
  823.         mov [OpenDialog_data.type],0
  824.         stdcall [OpenDialog_Start],OpenDialog_data
  825.         cmp [OpenDialog_data.status],2
  826.         je .end_open_file
  827.         jmp .end0
  828. .no_dlg: ;¥á«¨ ¬¨­ã¥¬ ¤¨ «®£ ®âªàëâ¨ï ä ©« 
  829.                 pushad
  830.                 mov esi,openfile_path
  831.                 stdcall str_len,esi
  832.                 add esi,eax
  833.                 @@: ;横« ¤«ï ¯®¨áª  ­ ç «  ¨¬¥­¨ ä ©« 
  834.                         dec esi
  835.                         cmp byte[esi],'/'
  836.                         je @f
  837.                         cmp byte[esi],0x5c ;'\'
  838.                         je @f
  839.                         cmp esi,openfile_path
  840.                         jg @b
  841.                 @@:
  842.                 inc esi
  843.                 stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;ª®¯¨à㥬 ¨¬ï ä ©«  ¢ ¤¨ «®£ á®åà ­¥­¨ï
  844.         .end0:
  845.  
  846.         mov [run_file_70.Function], SSF_GET_INFO
  847.         mov [run_file_70.Position], 0
  848.         mov [run_file_70.Flags], 0
  849.         mov dword[run_file_70.Count], 0
  850.         mov dword[run_file_70.Buffer], open_b
  851.         mov byte[run_file_70+20], 0
  852.         mov dword[run_file_70.FileName], openfile_path
  853.         mcall SF_FILE,run_file_70
  854.  
  855.         mov ecx,dword[open_b+32] ;+32 qword: à §¬¥à ä ©«  ¢ ¡ ©â å
  856.         mov [open_file_size],ecx
  857.         stdcall mem.ReAlloc,[open_file_img],ecx ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
  858.         mov [open_file_img],eax
  859.  
  860.         mov [run_file_70.Function], SSF_READ_FILE
  861.         mov [run_file_70.Position], 0
  862.         mov [run_file_70.Flags], 0
  863.         m2m [run_file_70.Count], dword[open_file_size]
  864.         m2m [run_file_70.Buffer],dword[open_file_img]
  865.         mov byte[run_file_70+20], 0
  866.         mov [run_file_70.FileName], openfile_path
  867.         mcall SF_FILE,run_file_70
  868.         cmp ebx,0xffffffff
  869.         je .end_0
  870.                 ;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï
  871.                 stdcall [img_decode], [open_file_img],ebx,0
  872.                 or eax,eax
  873.                 jz .end_0 ;¥á«¨ ­ àã襭 ä®à¬ â ä ©« 
  874.                 mov ebx,eax
  875.                
  876.                 mov ecx,[ebx+4] ;+4 = image width
  877.                 mov dword[buf_cop.w],ecx
  878.                 imul ecx,[ebx+8] ;+8 = image height
  879.                 lea ecx,[ecx+ecx*2]
  880.                 mov [open_file_size],ecx
  881.                 stdcall mem.ReAlloc,[open_file_img],ecx
  882.                 mov [open_file_img],eax
  883.                 mov dword[buf_cop],eax
  884.                 mov dword[buf_cop.l],0 ;left = 0, top = 0
  885.                 m2m dword[buf_cop.h],dword[ebx+8]
  886.  
  887.                 ;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
  888.                 stdcall [img_to_rgb2], ebx,[open_file_img]
  889.                 mov edi,buf_i0
  890.                 cmp buf2d_data,0
  891.                 jne .end3
  892.                         stdcall getNextPowerOfTwo,[ebx+8]
  893.                         mov buf2d_h,eax
  894.                         mov edx,eax
  895.                         stdcall getNextPowerOfTwo,[ebx+4]
  896.                         mov buf2d_w,eax
  897.                         cmp edx,[ebx+8]
  898.                         jne @f
  899.                         cmp eax,[ebx+4]
  900.                         jne @f
  901.                                 ;ᮧ¤ ­¨¥ ­®¢®£® ¨§®¡à ¦¥­¨ï ¯® ¨á室­ë¬ à §¬¥à ¬
  902.                                 stdcall [buf2d_create_f_img], edi,[open_file_img]
  903.                                 jmp .end_1
  904.                         @@:
  905.                                 ;ᮧ¤ ­¨¥ ­®¢®£® ¨§®¡à ¦¥­¨ï ¯® ¯à¥®¡à §®¢ ­­ë¬ à §¬¥à ¬
  906.                                 cmp eax,[ebx+4]
  907.                                 jge @f
  908.                                         mov eax,[ebx+4]
  909.                                         mov buf2d_w,eax
  910.                                 @@:
  911.                                 sub eax,[ebx+4]
  912.                                 shr eax,1
  913.                                 mov esi,eax
  914.                                 cmp edx,[ebx+8]
  915.                                 jge @f
  916.                                         mov edx,[ebx+8]
  917.                                         mov buf2d_h,edx
  918.                                 @@:
  919.                                 sub edx,[ebx+8]
  920.                                 shr edx,1
  921.                                 stdcall [buf2d_create], edi
  922.                                 mov [buf_cop.l],si
  923.                                 mov [buf_cop.t],dx
  924.                                 stdcall [buf2d_bit_blt], edi, esi,edx, buf_cop
  925.                                 jmp .end_1
  926.                 .end3:
  927.                         ;¯à¥®¡à §®¢ ­¨¥ ᮧ¤ ­­®£® ¨§®¡à ¦¥­¨ï
  928.                         stdcall getNextPowerOfTwo,[ebx+4]
  929.                         cmp eax,[ebx+4]
  930.                         jg @f
  931.                                 mov eax,[ebx+4]
  932.                         @@:
  933.                         mov ecx,eax ;à §¬¥à ¯® x
  934.                         stdcall getNextPowerOfTwo,[ebx+8]
  935.                         cmp eax,[ebx+8]
  936.                         jg @f
  937.                                 mov eax,[ebx+8]
  938.                         @@:
  939.                         mov edx,eax ;à §¬¥à ¯® y
  940.                         stdcall [buf2d_resize], edi, ecx,edx,1 ;¨§¬¥­ï¥¬ à §¬¥àë ¡ãä¥à 
  941.                         stdcall [buf2d_clear], edi, buf2d_color
  942.                         sub ecx,[ebx+4]
  943.                         shr ecx,1
  944.                         mov [buf_cop.l],cx
  945.                         sub edx,[ebx+8]
  946.                         shr edx,1
  947.                         mov [buf_cop.t],dx
  948.                         stdcall [buf2d_bit_blt], edi, ecx,edx, buf_cop
  949.                 .end_1:
  950.                
  951.                 ;ᮧ¤ ¥¬ ¡ãä¥à ¤«ï ¯à¥®¡à §®¢ ­­®£® ¨§®¡à ¦¥­¨ï
  952.                 mov edi,buf_ogl
  953.                 mov eax,[buf_i0.w]
  954.                 mov buf2d_w,eax
  955.                 mov eax,[buf_i0.h]
  956.                 mov buf2d_h,eax
  957.                 cmp buf2d_data,0
  958.                 jne @f
  959.                         stdcall [kosglMakeCurrent], 0,35,buf2d_w,buf2d_h,ctx1
  960.                         stdcall [glEnable], GL_DEPTH_TEST
  961.                         stdcall [glEnable], GL_NORMALIZE ;¤¥« ¬ ­®à¬ «¨ ®¤¨­ ª®¢®© ¢¥«¨ç¨­ë ¢® ¨§¡¥¦ ­¨¥  àâ¥ä ªâ®¢
  962.                         stdcall [glShadeModel], GL_SMOOTH
  963.                         stdcall [glScalef], 2.0, -2.0, 1.0
  964.                         stdcall [glTranslatef], -0.5, -0.5, 0.0
  965.                         jmp .end_2
  966.                 @@:
  967.                         stdcall reshape, buf2d_w,buf2d_h ;¨§¬¥­ï¥¬ à §¬¥àë ¡ãä¥à  buf_ogl
  968.                 .end_2:
  969.                 mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
  970.                 mov eax,[eax] ;eax -> ZBuffer
  971.                 mov eax,[eax+ZBuffer.pbuf]
  972.                 mov buf2d_data,eax
  973.  
  974.                 stdcall [buf2d_bit_blt], edi, 0,0, buf_i0 ;ª®¯¨à㥬 ¨§®¡à ¦¥­¨¥ ¤«ï ¢®áâ ­®¢«¥­¨ï
  975.  
  976.                 ;* Setup texturing *
  977.                 stdcall [glTexEnvi], GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL
  978.  
  979.                 ;* generate texture object IDs *
  980.                 stdcall [glGenTextures], 1, TexObj
  981.                 stdcall [glBindTexture], GL_TEXTURE_2D, [TexObj]
  982.                 stdcall [glTexImage2D], GL_TEXTURE_2D, 0, 3, [buf_i0.w], [buf_i0.h],\
  983.                         0, GL_RGB, GL_UNSIGNED_BYTE, [buf_i0] ;¤¥« ¥¬ ⥪áâãàã ­  ®á­®¢¥ ¡ãä¥à , á ¬® ¨§®¡à ¦¥­¨¥ ¢ ¡ãä¥à¥ ¬®¦¥â ¨á¯®àâ¨âáï ¯à¨ ¯®¤£®­ª¥ à §¬¥à®¢ ⥪áâãàë
  984.  
  985.                 stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST
  986.                 stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST
  987.                 stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT
  988.                 stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT
  989.                 stdcall [glBindTexture], GL_TEXTURE_2D, [TexObj]
  990.                 stdcall [glEnable], GL_TEXTURE_2D
  991.  
  992.                 stdcall [buf2d_bit_blt], buf_i0, 0,0, edi ;¢®áâ ­ ¢«¨¢ ¥¬ ¨§®¡à ¦¥­¨¥ ¨á¯®à祭®¥ ¯à¨ ãáâ ­®¢ª¥ ⥪áâãàë
  993.  
  994.                 ;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à ¢ ebx
  995.                 stdcall [img_destroy], ebx
  996.                
  997.                 movzx eax,word[buf_cop.l]
  998.                 movzx ebx,word[buf_cop.t]
  999.                 stdcall points_init_2,eax,ebx
  1000.  
  1001.                 call calc_nav_params
  1002.                 stdcall nav_to_point, dword[sel_pt+point2d.x],dword[sel_pt+point2d.y]
  1003.                 mov byte[view_b],0
  1004.                 mov dword[sel_act],-1 ;á­¨¬ ¥¬ ¢ë¤¥«¥­¨¥ á â®ç¥ª
  1005.                 mov byte[calc],1
  1006.         .end_0:
  1007.  
  1008.         .end_open_file:
  1009.         popad
  1010.         ret
  1011. endp
  1012.  
  1013. align 4
  1014. proc nav_to_point, coord_x:dword, coord_y:dword
  1015.         ;coord x
  1016.         mov eax,[nav_x_max]
  1017.         cmp eax,0
  1018.         jle @f
  1019.                 ;¥á«¨ ¬ «¥­ìª®¥ ¨§®¡à ¦¥­¨¥ â® áâ ¢¨¬ ¯® 業âàã
  1020.                 shr eax,1
  1021.                 jmp .end0
  1022.         @@:
  1023.         mov eax,[buf_0.w]
  1024.         shr eax,1
  1025.         sub eax,[coord_x]
  1026.         call nav_x_corect
  1027.         .end0:
  1028.         mov [nav_x],eax
  1029.         ;coord y
  1030.         mov eax,[nav_y_max]
  1031.         cmp eax,0
  1032.         jle @f
  1033.                 ;¥á«¨ ¬ «¥­ìª®¥ ¨§®¡à ¦¥­¨¥ â® áâ ¢¨¬ ¯® 業âàã
  1034.                 shr eax,1
  1035.                 jmp .end1
  1036.         @@:
  1037.         mov eax,[buf_0.h]
  1038.         shr eax,1
  1039.         sub eax,[coord_y]
  1040.         call nav_y_corect
  1041.         .end1:
  1042.         mov [nav_y],eax
  1043.         ret
  1044. endp
  1045.  
  1046. ;input:
  1047. ; eax - navigation coord x
  1048. ;output:
  1049. ; eax - valid coord x
  1050. align 4
  1051. nav_x_corect:
  1052.         cmp eax,[nav_x_min]
  1053.         jge @f
  1054.                 mov eax,[nav_x_min]
  1055.         @@:
  1056.         cmp eax,[nav_x_max]
  1057.         jle @f
  1058.                 mov eax,[nav_x_max]
  1059.         @@:
  1060.         ret
  1061.  
  1062. ;input:
  1063. ; eax - navigation coord y
  1064. ;output:
  1065. ; eax - valid coord y
  1066. align 4
  1067. nav_y_corect:
  1068.         cmp eax,[nav_y_min]
  1069.         jge @f
  1070.                 mov eax,[nav_y_min]
  1071.         @@:
  1072.         cmp eax,[nav_y_max]
  1073.         jle @f
  1074.                 mov eax,[nav_y_max]
  1075.         @@:
  1076.         ret
  1077.  
  1078. align 4
  1079. proc getNextPowerOfTwo uses ebx, n:dword
  1080.         mov ebx,[n]
  1081.         mov eax,8 ;min size
  1082.         cmp ebx,eax
  1083.         jle .set
  1084.         @@:
  1085.                 shl eax,1
  1086.                 cmp ebx,eax
  1087.                 jg @b
  1088.         cmp eax,4096 ;max size
  1089.         jle .set
  1090.                 mov eax,4096
  1091.         .set:
  1092.         ret
  1093. endp
  1094.  
  1095. ; new window size or exposure
  1096. align 4
  1097. proc reshape uses ebx ecx, width:dword, height:dword
  1098.         stdcall [glViewport], 0, 0, [width], [height]
  1099.         stdcall [glMatrixMode], GL_MODELVIEW
  1100.         stdcall [glLoadIdentity]
  1101.         stdcall [glScalef], 2.0, -2.0, 1.0
  1102.         stdcall [glTranslatef], -0.5, -0.5, 0.0
  1103.         ret
  1104. endp
  1105.  
  1106. align 4
  1107. proc but_save_file
  1108. locals
  1109.         png_data dd 0
  1110.         png_size dd 0
  1111. endl
  1112.         pushad
  1113.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  1114.         mov [OpenDialog_data.type],1
  1115.         stdcall [OpenDialog_Set_file_ext],OpenDialog_data,Filter.1 ;.png
  1116.         stdcall [OpenDialog_Start],OpenDialog_data
  1117.         cmp [OpenDialog_data.status],1
  1118.         jne .end_save_file
  1119.                 ;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
  1120.                 mov dword[png_data],0
  1121.  
  1122.                 ;create image struct
  1123.                 stdcall [img_create], [buf_ogl.w], [buf_ogl.h], Image.bpp24
  1124.                 mov ebx,eax
  1125.                 test eax,eax
  1126.                 jz @f
  1127.                         ;copy foto to image buffer
  1128.                         mov edi,[eax+Image.Data]
  1129.                         mov esi,[buf_ogl]
  1130.                         mov ecx,[buf_ogl.w]
  1131.                         mov edx,[buf_ogl.h]
  1132.                         imul ecx,edx
  1133.                         imul ecx,3
  1134.                         shr ecx,2 ;OpenGL buffer align to 4
  1135.                         rep movsd
  1136.  
  1137.                         ;encode image
  1138.                         stdcall [img_encode], eax, LIBIMG_FORMAT_PNG, 0
  1139.                         test eax,eax
  1140.                         jz @f
  1141.                                 mov [png_data],eax
  1142.                                 mov [png_size],ecx
  1143.                 @@:
  1144.                 stdcall [img_destroy],ebx
  1145.  
  1146.         ; § ¯®«­ï¥¬ áâàãªâãàã ¤«ï á®åà ­¥­¨ï ä ©« 
  1147.         mov ebx,run_file_70
  1148.         mov dword[ebx],SSF_CREATE_FILE
  1149.         mov eax,[png_size]
  1150.         mov [ebx+12],eax ;file size
  1151.         mov eax,[png_data]
  1152.         mov [ebx+16],eax
  1153.         mov dword[ebx+FileInfoBlock.FileName], openfile_path
  1154.  
  1155.         mcall SF_FILE,run_file_70
  1156.         test eax,eax
  1157.         jnz .save_error
  1158.                         ;notify_window_run openfile_path
  1159.                         jmp @f
  1160.                 .save_error:
  1161.                         ;á®®¡é¥­¨¥ ® ­¥ã¤ ç­®¬ á®åà ­¥­¨¨
  1162.                         notify_window_run txt_err_save_img_file
  1163.                 @@:
  1164.                 mcall SF_SYS_MISC, SSF_MEM_FREE, [png_data]
  1165.         .end_save_file:
  1166.         popad
  1167.         ret
  1168. endp
  1169.  
  1170. align 4
  1171. but_2:
  1172.         xor byte[view_b],1
  1173.         mov byte[calc],1
  1174.         ret
  1175.  
  1176. align 4
  1177. but_3:
  1178.         xor byte[trans_a],1
  1179.         call points_update_prop
  1180.         mov byte[calc],1
  1181.         ret
  1182.  
  1183. align 4
  1184. but_about:
  1185.         notify_window_run txt_about
  1186.         ret
  1187.  
  1188. align 4
  1189. calc db 0 ;0 - ­¥ ¯¥à¥áç¨â뢠âì ¡ãä¥à, 1 - ¯¥à¥áç¨â âì ¨ ®¡­®¢¨âì ¡ãä¥à
  1190. view_b db 0 ;0 - ¨á室­ë© ¡ãä¥à, 1 - ¯à®á¬®âà १ã«ìâ â 
  1191. trans_a db 0 ;0 - ¯à¥®¡à §®¢ âì ¯® § ¤ ­­®¬ã à §¬¥àã, 1 - ¯à¥®¡à §®¢ âì ­  ¢¥áì ¡ãä¥à
  1192.  
  1193. align 4
  1194. proc but_img_move_up uses eax
  1195.         cmp dword[sel_act],-1
  1196.         je .end0
  1197.                 mov eax,[sel_act]
  1198.                 imul eax,sizeof.point2d
  1199.                 add eax,sel_pt
  1200.                 cmp dword[eax+point2d.y],0
  1201.                 je .end2
  1202.                 dec dword[eax+point2d.y]
  1203.                 call points_update_prop
  1204.                 jmp .end1
  1205.         .end0:
  1206.         mov eax,[nav_y]
  1207.         sub eax,[nav_sy]
  1208.         cmp eax,[nav_y_min]
  1209.         jge @f
  1210.                 mov eax,[nav_y_min]
  1211.         @@:
  1212.         mov [nav_y],eax
  1213.         .end1:
  1214.         mov byte[calc],1
  1215.         .end2:
  1216.         ret
  1217. endp
  1218.  
  1219. align 4
  1220. proc but_img_move_down uses eax edi
  1221.         cmp dword[sel_act],-1
  1222.         je .end0
  1223.                 mov eax,[sel_act]
  1224.                 imul eax,sizeof.point2d
  1225.                 add eax,sel_pt
  1226.                 mov edi,buf_ogl
  1227.                 mov edi,buf2d_h
  1228.                 cmp dword[eax+point2d.y],edi
  1229.                 jge .end2
  1230.                 inc dword[eax+point2d.y]
  1231.                 call points_update_prop
  1232.                 jmp .end1
  1233.         .end0:
  1234.         mov eax,[nav_y]
  1235.         add eax,[nav_sy]
  1236.         cmp eax,[nav_y_max]
  1237.         jle @f
  1238.                 mov eax,[nav_y_max]
  1239.         @@:
  1240.         mov [nav_y],eax
  1241.         .end1:
  1242.         mov byte[calc],1
  1243.         .end2:
  1244.         ret
  1245. endp
  1246.  
  1247. align 4
  1248. proc but_img_move_left uses eax
  1249.         cmp dword[sel_act],-1
  1250.         je .end0
  1251.                 mov eax,[sel_act]
  1252.                 imul eax,sizeof.point2d
  1253.                 add eax,sel_pt
  1254.                 cmp dword[eax+point2d.x],0
  1255.                 je .end2
  1256.                 dec dword[eax+point2d.x]
  1257.                 call points_update_prop
  1258.                 jmp .end1
  1259.         .end0:
  1260.         mov eax,[nav_x]
  1261.         sub eax,[nav_sx]
  1262.         cmp eax,[nav_x_min]
  1263.         jge @f
  1264.                 mov eax,[nav_x_min]
  1265.         @@:
  1266.         mov [nav_x],eax
  1267.         .end1:
  1268.         mov byte[calc],1
  1269.         .end2:
  1270.         ret
  1271. endp
  1272.  
  1273. align 4
  1274. proc but_img_move_right uses eax edi
  1275.         cmp dword[sel_act],-1
  1276.         je .end0
  1277.                 mov eax,[sel_act]
  1278.                 imul eax,sizeof.point2d
  1279.                 add eax,sel_pt
  1280.                 mov edi,buf_ogl
  1281.                 mov edi,buf2d_w
  1282.                 cmp dword[eax+point2d.x],edi
  1283.                 jge .end2
  1284.                 inc dword[eax+point2d.x]
  1285.                 call points_update_prop
  1286.                 jmp .end1
  1287.         .end0:
  1288.         mov eax,[nav_x]
  1289.         add eax,[nav_sx]
  1290.         cmp eax,[nav_x_max]
  1291.         jle @f
  1292.                 mov eax,[nav_x_max]
  1293.         @@:
  1294.         mov [nav_x],eax
  1295.         .end1:
  1296.         mov byte[calc],1
  1297.         .end2:
  1298.         ret
  1299. endp
  1300.  
  1301. ;input:
  1302. ; eax - ç¨á«®
  1303. ; edi - ¡ãä¥à ¤«ï áâப¨
  1304. ; len - ¤«¨­­  ¡ãä¥à 
  1305. ;output:
  1306. align 4
  1307. proc convert_int_to_str, len:dword
  1308. pushad
  1309.         mov esi,[len]
  1310.         add esi,edi
  1311.         dec esi
  1312.         bt eax,31
  1313.         jae @f
  1314.                 ;¥á«¨ ç¨á«® ®âà¨æ â¥«ì­®¥
  1315.                 neg eax
  1316.                 mov byte[edi],'-'
  1317.                 inc edi
  1318.         @@:
  1319.         call .str
  1320. popad
  1321.         ret
  1322. endp
  1323.  
  1324. align 4
  1325. .str:
  1326.         mov ecx,10
  1327.         cmp eax,ecx
  1328.         jb @f
  1329.                 xor edx,edx
  1330.                 div ecx
  1331.                 push edx
  1332.                 ;dec edi  ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
  1333.                 call .str
  1334.                 pop eax
  1335.         @@:
  1336.         cmp edi,esi
  1337.         jge @f
  1338.                 or al,0x30
  1339.                 stosb
  1340.                 mov byte[edi],0 ;¢ ª®­¥æ áâப¨ áâ ¢¨¬ 0, çâ®-¡ë ­¥ ¢ë« §¨« ¬ãá®à
  1341.         @@:
  1342.         ret
  1343.  
  1344. ;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
  1345. align 4
  1346. OpenDialog_data:
  1347. .type                   dd 0 ;0 - ®âªàëâì, 1 - á®åà ­¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
  1348. .procinfo               dd procinfo     ;+4
  1349. .com_area_name          dd communication_area_name      ;+8
  1350. .com_area               dd 0    ;+12
  1351. .opendir_path           dd plugin_path  ;+16
  1352. .dir_default_path       dd default_dir ;+20
  1353. .start_path             dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
  1354. .draw_window            dd draw_window  ;+28
  1355. .status                 dd 0    ;+32
  1356. .openfile_path          dd openfile_path        ;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
  1357. .filename_area          dd filename_area        ;+40
  1358. .filter_area            dd Filter
  1359. .x:
  1360. .x_size                 dw 420 ;+48 ; Window X size
  1361. .x_start                dw 10 ;+50 ; Window X position
  1362. .y:
  1363. .y_size                 dw 320 ;+52 ; Window y size
  1364. .y_start                dw 10 ;+54 ; Window Y position
  1365.  
  1366. default_dir db '/rd/1',0
  1367.  
  1368. communication_area_name:
  1369.         db 'FFFFFFFF_open_dialog',0
  1370. open_dialog_name:
  1371.         db 'opendial',0
  1372. communication_area_default_path:
  1373.         db '/rd/1/File managers/',0
  1374.  
  1375. Filter:
  1376. dd Filter.end - Filter ;.1
  1377. .1:
  1378. db 'PNG',0
  1379. db 'JPG',0
  1380. db 'JPEG',0
  1381. db 'BMP',0
  1382. db 'GIF',0
  1383. .end:
  1384. db 0
  1385.  
  1386. txt_space db ' ',0
  1387.  
  1388. if lang eq ru
  1389.         txt_err_save_img_file db '¥ ¬®£ã á®åà ­¨âì *.png ä ©«.',0
  1390.         txt_about db '"Ž ¯à®£à ¬¬¥',13,10,\
  1391.         '„ ­­ ï ¯à®£à ¬¬  ᤥ« ­  ¤«ï ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨©.',13,10,\
  1392.         '®á«¥ ®âªàëâ¨ï ä ©«  ¨§®¡à ¦¥­¨ï ­ã¦­® 㪠§ âì 4 â®çª¨,',13,10,\
  1393.         'ª®â®àë¥ áâ ­ãâ 㣫 ¬¨ ¯à¥®¡à §®¢ ­®£® ¨§®¡à ¦¥­¨ï." -tI',0
  1394.         txt_pref db ' ¡ ',0,' Š¡',0,' Œ¡',0,' ƒ¡',0 ;¯à¨áâ ¢ª¨: ª¨«®, ¬¥£ , £¨£ 
  1395.         txt_f_size db ' §¬¥à: '
  1396. .size: rb 16
  1397.         txt_img_w db '˜¨à¨­ : '
  1398. .size: rb 16
  1399.         txt_img_h db '‚ëá®â : '
  1400. else
  1401.         txt_err_save_img_file db 'Can',39,'t save *.png file.',0
  1402.         txt_about db '"About',13,10,\
  1403.         'This program is designed to convert images.',13,10,\
  1404.         'After opening the image file, you need to specify 4 points',13,10,\
  1405.         'that will become the corners of the converted image." -tI',0
  1406.         txt_pref db ' b ',0,' Kb',0,' Mb',0,' Gb',0 ;¯à¨áâ ¢ª¨: ª¨«®, ¬¥£ , £¨£ 
  1407.         txt_f_size db 'Size: '
  1408. .size: rb 16
  1409.         txt_img_w db 'Width: '
  1410. .size: rb 16
  1411.         txt_img_h db 'Height: '
  1412. end if
  1413. .size: rb 16
  1414.  
  1415.  
  1416. system_dir_0 db '/sys/lib/'
  1417. lib_name_0 db 'proc_lib.obj',0
  1418. system_dir_1 db '/sys/lib/'
  1419. lib_name_1 db 'libimg.obj',0
  1420. system_dir_2 db '/sys/lib/'
  1421. lib_name_2 db 'buf2d.obj',0
  1422. system_dir_3 db '/sys/lib/'
  1423. lib_name_3 db 'tinygl.obj',0
  1424.  
  1425. align 4
  1426. head_f_i:
  1427. if lang eq ru
  1428. head_f_l db '"‘¨á⥬­ ï ®è¨¡ª ',0
  1429. err_message_found_lib_0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,'" -tE',0
  1430. err_message_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,'" -tE',0
  1431. err_message_found_lib_1 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,'" -tE',0
  1432. err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,'" -tE',0
  1433. err_msg_found_lib_2 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,'" -tE',0
  1434. err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,'" -tE',0
  1435. err_msg_found_lib_3 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'tinygl.obj',39,'" -tE',0
  1436. err_msg_import_3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'tinygl',39,'" -tE',0
  1437. else
  1438. head_f_l db '"System error',0
  1439. err_message_found_lib_0 db 'Sorry I cannot found library ',39,'proc_lib.obj',39,'" -tE',0
  1440. err_message_import_0 db 'Error on load import library ',39,'proc_lib.obj',39,'" -tE',0
  1441. err_message_found_lib_1 db 'Sorry I cannot found library ',39,'libimg.obj',39,'" -tE',0
  1442. err_message_import_1 db 'Error on load import library ',39,'libimg.obj',39,'" -tE',0
  1443. err_msg_found_lib_2 db 'Sorry I cannot found library ',39,'buf2d.obj',39,'" -tE',0
  1444. err_msg_import_2 db 'Error on load import library ',39,'buf2d',39,'" -tE',0
  1445. err_msg_found_lib_3 db 'Sorry I cannot found library ',39,'tinygl.obj',39,'" -tE',0
  1446. err_msg_import_3 db 'Error on load import library ',39,'tinygl',39,'" -tE',0
  1447. end if
  1448.  
  1449. align 4
  1450. l_libs_start:
  1451.         lib_0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\
  1452.                 err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i
  1453.         lib_1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\
  1454.                 err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i
  1455.         lib_2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\
  1456.                 err_msg_found_lib_2,head_f_l,import_buf2d,err_msg_import_2,head_f_i
  1457.         lib_3 l_libs lib_name_3, sys_path, library_path, system_dir_3,\
  1458.                 err_msg_found_lib_3,head_f_l,import_lib_tinygl,err_msg_import_3,head_f_i
  1459. l_libs_end:
  1460.  
  1461. align 4
  1462. import_libimg:
  1463.         dd alib_init1
  1464.         img_is_img  dd aimg_is_img
  1465.         img_info    dd aimg_info
  1466.         img_from_file dd aimg_from_file
  1467.         img_to_file dd aimg_to_file
  1468.         img_from_rgb dd aimg_from_rgb
  1469.         img_to_rgb  dd aimg_to_rgb
  1470.         img_to_rgb2 dd aimg_to_rgb2
  1471.         img_decode  dd aimg_decode
  1472.         img_encode  dd aimg_encode
  1473.         img_create  dd aimg_create
  1474.         img_destroy dd aimg_destroy
  1475.         img_destroy_layer dd aimg_destroy_layer
  1476.         img_count   dd aimg_count
  1477.         img_lock_bits dd aimg_lock_bits
  1478.         img_unlock_bits dd aimg_unlock_bits
  1479.         img_flip    dd aimg_flip
  1480.         img_flip_layer dd aimg_flip_layer
  1481.         img_rotate  dd aimg_rotate
  1482.         img_rotate_layer dd aimg_rotate_layer
  1483.         img_draw    dd aimg_draw
  1484.  
  1485.         dd 0,0
  1486.         alib_init1   db 'lib_init',0
  1487.         aimg_is_img  db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
  1488.         aimg_info    db 'img_info',0
  1489.         aimg_from_file db 'img_from_file',0
  1490.         aimg_to_file db 'img_to_file',0
  1491.         aimg_from_rgb db 'img_from_rgb',0
  1492.         aimg_to_rgb  db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
  1493.         aimg_to_rgb2 db 'img_to_rgb2',0
  1494.         aimg_decode  db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
  1495.         aimg_encode  db 'img_encode',0
  1496.         aimg_create  db 'img_create',0
  1497.         aimg_destroy db 'img_destroy',0
  1498.         aimg_destroy_layer db 'img_destroy_layer',0
  1499.         aimg_count   db 'img_count',0
  1500.         aimg_lock_bits db 'img_lock_bits',0
  1501.         aimg_unlock_bits db 'img_unlock_bits',0
  1502.         aimg_flip    db 'img_flip',0
  1503.         aimg_flip_layer db 'img_flip_layer',0
  1504.         aimg_rotate  db 'img_rotate',0
  1505.         aimg_rotate_layer db 'img_rotate_layer',0
  1506.         aimg_draw    db 'img_draw',0
  1507.  
  1508. align 4
  1509. proclib_import: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
  1510.         OpenDialog_Init dd aOpenDialog_Init
  1511.         OpenDialog_Start dd aOpenDialog_Start
  1512.         OpenDialog_Set_file_name dd aOpenDialog_Set_file_name
  1513.         OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext
  1514. dd 0,0
  1515.         aOpenDialog_Init db 'OpenDialog_init',0
  1516.         aOpenDialog_Start db 'OpenDialog_start',0
  1517.         aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0
  1518.         aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0
  1519.  
  1520. align 4
  1521. import_buf2d:
  1522.         init dd sz_init
  1523.         buf2d_create dd sz_buf2d_create
  1524.         buf2d_create_f_img dd sz_buf2d_create_f_img
  1525.         buf2d_clear dd sz_buf2d_clear
  1526.         buf2d_draw dd sz_buf2d_draw
  1527.         buf2d_delete dd sz_buf2d_delete
  1528.         buf2d_resize dd sz_buf2d_resize
  1529.         buf2d_line dd sz_buf2d_line
  1530.         buf2d_rect_by_size dd sz_buf2d_rect_by_size
  1531.         buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
  1532.         buf2d_circle dd sz_buf2d_circle
  1533.         buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
  1534.         buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
  1535.         buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
  1536.         buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
  1537.         buf2d_bit_blt dd sz_buf2d_bit_blt
  1538.         buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
  1539.         buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
  1540.         buf2d_curve_bezier dd sz_buf2d_curve_bezier
  1541.         buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
  1542.         buf2d_draw_text dd sz_buf2d_draw_text
  1543.         buf2d_crop_color dd sz_buf2d_crop_color
  1544.         buf2d_offset_h dd sz_buf2d_offset_h
  1545.         buf2d_flood_fill dd sz_buf2d_flood_fill
  1546.         buf2d_set_pixel dd sz_buf2d_set_pixel
  1547.         buf2d_get_pixel dd sz_buf2d_get_pixel
  1548.         dd 0,0
  1549.         sz_init db 'lib_init',0
  1550.         sz_buf2d_create db 'buf2d_create',0
  1551.         sz_buf2d_create_f_img db 'buf2d_create_f_img',0
  1552.         sz_buf2d_clear db 'buf2d_clear',0
  1553.         sz_buf2d_draw db 'buf2d_draw',0
  1554.         sz_buf2d_delete db 'buf2d_delete',0
  1555.         sz_buf2d_resize db 'buf2d_resize',0
  1556.         sz_buf2d_line db 'buf2d_line',0
  1557.         sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
  1558.         sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
  1559.         sz_buf2d_circle db 'buf2d_circle',0
  1560.         sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
  1561.         sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
  1562.         sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
  1563.         sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
  1564.         sz_buf2d_bit_blt db 'buf2d_bit_blt',0
  1565.         sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
  1566.         sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
  1567.         sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
  1568.         sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
  1569.         sz_buf2d_draw_text db 'buf2d_draw_text',0
  1570.         sz_buf2d_crop_color db 'buf2d_crop_color',0
  1571.         sz_buf2d_offset_h db 'buf2d_offset_h',0
  1572.         sz_buf2d_flood_fill db 'buf2d_flood_fill',0
  1573.         sz_buf2d_set_pixel db 'buf2d_set_pixel',0
  1574.         sz_buf2d_get_pixel db 'buf2d_get_pixel',0
  1575.  
  1576. align 4
  1577. import_lib_tinygl:
  1578.  
  1579. macro E_LIB n
  1580. {
  1581.         n dd sz_#n
  1582. }
  1583. include '../../../programs/develop/libraries/TinyGL/asm_fork/export.inc'
  1584.         dd 0,0
  1585. macro E_LIB n
  1586. {
  1587.         sz_#n db `n,0
  1588. }
  1589. include '../../../programs/develop/libraries/TinyGL/asm_fork/export.inc'
  1590.  
  1591. align 4
  1592. buf_0: dd 0
  1593. .l: dw 5 ;+4 left
  1594. .t: dw 35 ;+6 top
  1595. .w: dd 6*64 ;+8 w
  1596. .h: dd 7*64 ;+12 h
  1597. .color: dd 0x808080 ;+16 color
  1598.         db 24 ;+20 bit in pixel
  1599.  
  1600. align 4
  1601. buf_font:
  1602.         dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
  1603.         dd 0 ;+4 left,top
  1604. .w: dd 0
  1605. .h: dd 0,0,24
  1606.  
  1607. align 4
  1608. buf_cop: ;¡ãä¥à ¤«ï ª®¯¨à®¢ ­¨ï ⥪áâãàë
  1609.         dd 0
  1610. .l: dw 0 ;+4 left
  1611. .t: dw 0 ;+6 top
  1612. .w: dd 0
  1613. .h: dd 0,0,24
  1614.  
  1615. ;¨á室­®¥ ¨§®¡à ¦¥­¨¥
  1616. align 4
  1617. buf_i0: dd 0,0
  1618. .w: dd 0
  1619. .h: dd 0
  1620. .color: dd 0,24
  1621.  
  1622. ;¯à¥®¡à §®¢ ­®¥ ¨§®¡à ¦¥­¨¥
  1623. align 4
  1624. buf_ogl: dd 0,0
  1625. .w: dd 0
  1626. .h: dd 0
  1627. .color: dd 0,24
  1628.  
  1629. align 16
  1630. i_end:
  1631. ctx1 rb 28 ;sizeof.TinyGLContext = 28
  1632. TexObj dd 0 ;¬ áᨢ 㪠§ â¥«¥© ­  ⥪áâãàë (¢ ¤ ­­®¬ á«ãç ¥ 1 èâ.)
  1633. nav_x_min dd 0 ;¬¨­. ª®®à¤. x ¤«ï ­ ¢¨£ æ¨¨
  1634. nav_y_min dd 0 ;¬¨­. ª®®à¤. y ¤«ï ­ ¢¨£ æ¨¨
  1635. nav_x_max dd 0 ;¬ ªá. ª®®à¤. x
  1636. nav_y_max dd 0 ;¬ ªá. ª®®à¤. y
  1637. nav_x dd 0 ;⥪ãé. ª®®à¤. x ¤«ï ­ ¢¨£ æ¨¨
  1638. nav_y dd 0 ;⥪ãé. ª®®à¤. y ¤«ï ­ ¢¨£ æ¨¨
  1639. nav_sx dd 0 ;áªà®« ¯® x
  1640. nav_sy dd 0 ;áªà®« ¯® y
  1641. nav_wnd_w dd 0 ;è¨à¨­  ®ª­  ­ ¢¨£ æ¨¨
  1642. nav_wnd_h dd 0 ;¢ëá® â  ®ª­  ­ ¢¨£ æ¨¨
  1643. nav_wnd_zoom dd 0
  1644. mouse_down_x dd ?
  1645. mouse_down_y dd ?
  1646. sel_act dd ? ;â®çª  ¢ë¡à ­­ ï ¤«ï । ªâ¨à®¢ ­¨ï á ª« ¢¨ âãàë
  1647. sel_pt rb 8*sizeof.point2d ;â®çª¨ ¤«ï ¢ë¡®à  4-å 㣫®¢
  1648. last_time dd 0
  1649. u_line_v dd 0 ;¢¥à⨪ «ì­ ï «¨­¨ï
  1650. u_line_h dd 0 ;£®à¨§®­â «ì­ ï «¨­¨ï
  1651. txt_buf rb 8
  1652. procinfo process_information
  1653. sc system_colors
  1654. run_file_70 FileInfoBlock
  1655.                 rb 4096
  1656. align 16
  1657. stacktop:
  1658.         sys_path rb 1024
  1659.         file_name:
  1660.                 rb 1024 ;4096
  1661.         library_path rb 1024
  1662.         plugin_path rb 4096
  1663.         openfile_path rb 4096
  1664.         filename_area rb 256
  1665. mem:
  1666.