Subversion Repositories Kolibri OS

Rev

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