Subversion Repositories Kolibri OS

Rev

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