Subversion Repositories Kolibri OS

Rev

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

  1. macro square_width_put
  2. {
  3. local .no_put_to_screen
  4. local .next_color_put
  5. local .vertical_width_put
  6. local .horizontal_width_put
  7.  
  8.         mov ebx,[ReserveArray]
  9.         mov eax,[ebx]
  10.         test eax,eax
  11.         jz .no_put_to_screen
  12.         mov ecx,[ebx]
  13.         add ebx,4
  14.         xor ebp,ebp
  15.  
  16.         .next_color_put:
  17.         ;put saved pixels in ReserveArray
  18.         push ecx
  19.         mov [counter2],5
  20.         mov edi,[ebx]
  21.         push edi
  22.         .vertical_width_put:
  23.                 mov [counter],5
  24.  
  25.                 .horizontal_width_put:
  26.                         mov edx,[ebx+4807*4+ebp]
  27.                         ;and edx,0xffffff
  28.                         mov [edi],dx
  29.                         shr edx,16
  30.                         mov [edi+2],dl
  31.  
  32.                 add edi,3
  33.                 add ebp,4
  34.                 dec [counter]
  35.                 jnz .horizontal_width_put
  36.  
  37.                 mov ecx,[Picture_SizeX]
  38.                 sub ecx,5
  39.                 lea ecx,[ecx+ecx*2]
  40.                 add edi,ecx
  41.         dec [counter2]
  42.         jnz .vertical_width_put
  43.         pop edi
  44.         pop ecx
  45.  
  46.         add ebx,4
  47.         dec ecx
  48.         jnz .next_color_put
  49.  
  50.         .no_put_to_screen:
  51. }
  52.  
  53. macro square_width_save
  54. {
  55. local .next_color_save
  56. local .vertical_width_save
  57. local .horizontal_width_save
  58.         mov ebx,[ReserveArray]
  59.         mov [ebx],eax
  60.         mov ecx,eax
  61.         add ebx,4
  62.         xor ebp,ebp
  63.  
  64.         .next_color_save:
  65.         ;save color of pixel in ReserveArray
  66.         push ecx
  67.         mov [counter2],5
  68.         mov edi,[ebx]
  69.         .vertical_width_save:
  70.                 mov [counter],5
  71.  
  72.                 .horizontal_width_save:
  73.                         mov eax,edi
  74.                         mov edx,[eax]
  75.                         ;and edx,0xffffff
  76.                         mov [ebx+4807*4+ebp],dx
  77.                         shr edx,16
  78.                         mov [ebx+4807*4+2+ebp],dl
  79.  
  80.                 add edi,3
  81.                 add ebp,4
  82.                 dec [counter]
  83.                 jnz .horizontal_width_save
  84.  
  85.                 mov ecx,[Picture_SizeX]
  86.                 sub ecx,5
  87.                 lea ecx,[ecx+ecx*2]
  88.                 add edi,ecx
  89.         dec [counter2]
  90.         jnz .vertical_width_save
  91.         pop ecx
  92.  
  93.         add ebx,4
  94.         dec ecx
  95.         jnz .next_color_save
  96. }
  97.  
  98. macro draw_calc_pixels brush
  99. {
  100. local .next_pixel_put
  101. local .vertical_width
  102. local .horizontal_width
  103. local .no_draw_pixel
  104.  
  105.         mov ebx,[ReserveArray]
  106.         mov ecx,[ebx]
  107.         mov edx,[Color]
  108.         mov esi,[Color]
  109.         shr edx,16
  110.         add ebx,4
  111.         mov edi,[line_width]
  112.         dec edi
  113.         imul edi,25
  114.         add edi,brush
  115.         .next_pixel_put:
  116.  
  117.         mov eax,[ebx]
  118.         push eax
  119.         push ecx
  120.         xor ebp,ebp
  121.         mov [counter2],5
  122.  
  123.         .vertical_width:
  124.                 mov [counter],5
  125.  
  126.                 .horizontal_width:
  127.                 xor ecx,ecx
  128.                 mov cl,byte[edi+ebp]
  129.                 test cl,cl
  130.                 jz .no_draw_pixel
  131.                         mov [eax],si
  132.                         mov [eax+2],dl
  133.                 .no_draw_pixel:
  134.                 add eax,3
  135.                 inc ebp
  136.                 dec [counter]
  137.                 jnz .horizontal_width
  138.  
  139.                 mov ecx,[Picture_SizeX]
  140.                 sub ecx,5
  141.                 lea ecx,[ecx+ecx*2]
  142.                 add eax,ecx
  143.         dec [counter2]
  144.         jnz .vertical_width
  145.  
  146.         pop ecx
  147.         pop eax
  148.         add ebx,4
  149.         dec ecx
  150.         jnz .next_pixel_put
  151. }
  152.  
  153. ;-----------------------------------------------------------
  154. ;-----instruments of panel(icon's instruments)--------------
  155. ;-----------------------------------------------------------
  156. ;input:
  157. ; [Current_instrument] - instrument code
  158. ;
  159. ; *** instrument codes ***
  160. ;10 - pensil
  161. ;11 - draw brush
  162. ;12 - spray
  163. ;13 - lastik
  164. ;14 - flood fill
  165. ;15 - pipetka
  166. ;16 - draw line
  167. ;17 - draw rectangle
  168. ;18 - draw circle
  169. ;19 - draw ellips
  170. ;20 - draw hard contour
  171. ;21 - allocation of a countour
  172. ;23 - reflection from left to right
  173. ;24 - reflection from up to down
  174. ;40 - brush 1
  175. ;41 - brush 2
  176. ;42 - brush 3
  177. ;43 - brush 4
  178. ;44 - brush 5
  179. ;45 - zoom 1
  180. ;46 - zoom 2
  181. ;47 - zoom 3
  182. ;48 - zoom 4
  183. ;49 - zoom 8
  184. ;50 - zoom 16
  185. ;51 - palette
  186.  
  187. align 4
  188. TakeButtonInstruments:
  189.         mov eax,[Current_instrument]
  190.  
  191.         ;*************************brush 1***********************
  192.         cmp eax,40
  193.         jne no_brush1
  194.  
  195.         mov [Brush_SizeX],4
  196.         mov [Brush_SizeY],4
  197.         mov [Number_Brush],0
  198.         mov ebx,[Last_instrument]
  199.         mov [Current_instrument],ebx
  200.  
  201.         mov [line_width],1
  202.         ret
  203.         no_brush1:
  204.  
  205.         ;*************************brush 2***********************
  206.         cmp eax,41
  207.         jne no_brush2
  208.  
  209.         mov [Brush_SizeX],6
  210.         mov [Brush_SizeY],4
  211.         mov [Number_Brush],1
  212.         mov ebx,[Last_instrument]
  213.         mov [Current_instrument],ebx
  214.  
  215.         mov [line_width],2
  216.         ret
  217.         no_brush2:
  218.  
  219.         ;*************************brush 3***********************
  220.         cmp eax,42
  221.         jne no_brush3
  222.  
  223.         mov [Brush_SizeX],8
  224.         mov [Brush_SizeY],7
  225.         mov [Number_Brush],2
  226.         mov ebx,[Last_instrument]
  227.         mov [Current_instrument],ebx
  228.  
  229.         mov [line_width],3
  230.         ret
  231.         no_brush3:
  232.  
  233.         ;*************************brush 4***********************
  234.         cmp eax,43
  235.         jne no_brush4
  236.  
  237.         mov [Brush_SizeX],14
  238.         mov [Brush_SizeY],14
  239.         mov [Number_Brush],3
  240.         mov ebx,[Last_instrument]
  241.         mov [Current_instrument],ebx
  242.  
  243.         mov [line_width],4
  244.         ret
  245.         no_brush4:
  246.  
  247.         ;*************************brush 5***********************
  248.         cmp eax,44
  249.         jne no_brush5
  250.  
  251.         mov [Brush_SizeX],6
  252.         mov [Brush_SizeY],6
  253.         mov [Number_Brush],4
  254.         mov ebx,[Last_instrument]
  255.         mov [Current_instrument],ebx
  256.  
  257.         mov [line_width],5
  258.         ret
  259.         no_brush5:
  260.  
  261.         ;*************************pensil************************
  262.         cmp eax,10
  263.         jne no_pensil
  264.  
  265.         mov al,[exit_from_work_arrea]
  266.  
  267.         test al,al
  268.         jz no_exit_from_work_arrea
  269.  
  270.         and [Activate_instrument],0
  271.         and [exit_from_work_arrea],0
  272.  
  273.         no_exit_from_work_arrea:
  274.  
  275.         mov al,[Activate_instrument]
  276.  
  277.         test al,al
  278.         jnz no_activated_later
  279.  
  280.         call GetScreenCordinats
  281.         mov eax,[ScreenX]
  282.         mov ebx,[ScreenY]
  283.         add eax,[PosX]
  284.         add ebx,[PosY]
  285.         mov [OldX],eax
  286.         mov [OldY],ebx
  287.  
  288.         no_activated_later:
  289.  
  290.         mov eax,[PointerToPicture]
  291.         mov ebx,[ReserveArray]
  292.         mov ecx,[Picture_SizeX]
  293.         mov edx,[OldX]
  294.         shl edx,16
  295.         add edx,[OldY]
  296.         mov esi,[ScreenX]
  297.         mov edi,[ScreenY]
  298.         add esi,[PosX]
  299.         add edi,[PosY]
  300.         call calculate_line
  301.  
  302.         mov ecx,eax
  303.         mov edx,[Color]
  304.         mov esi,[Color]
  305.         shr edx,16
  306.         xor ebx,ebx
  307.         mov eax,[ReserveArray]
  308.  
  309.         pensil_next_pixel_draw:
  310.  
  311.           mov ebx,[eax]
  312.           mov [ebx],si
  313.           mov [ebx+2],dl
  314.           add eax,4
  315.  
  316.         dec ecx
  317.         jnz pensil_next_pixel_draw
  318.  
  319.         mov eax,[ScreenX]
  320.         mov ebx,[ScreenY]
  321.         add eax,[PosX]
  322.         add ebx,[PosY]
  323.         mov [OldX],eax
  324.         mov [OldY],ebx
  325.  
  326.         call MovePictureToWorkScreen
  327.         mov [Activate_instrument],1
  328.         ret
  329.         no_pensil:
  330.  
  331.         ;*************************draw brush********************
  332.         cmp eax,11
  333.         jne no_brush
  334.  
  335.         mov [Last_instrument],eax
  336.  
  337.         jmp no_lastik_
  338.  
  339.         lastik_in:
  340.         mov eax,[Color]
  341.         mov [SColor],eax
  342.         mov [Color],0xffffff
  343.         no_lastik_:
  344.  
  345.         mov eax,[ScreenX]
  346.         mov ebx,[ScreenY]
  347.         mov ecx,[Brush_SizeX]
  348.         mov edx,[Brush_SizeY]
  349.         add eax,[PosX]
  350.         add ebx,[PosY]
  351.         add eax,ecx
  352.         add ebx,edx
  353.  
  354.         cmp eax,[Picture_SizeX]
  355.         jl no_max_pos_x
  356.         mov eax,[Picture_SizeX]
  357.         no_max_pos_x:
  358.  
  359.         cmp ebx,[Picture_SizeY]
  360.         jl no_max_pos_y
  361.         mov ebx,[Picture_SizeY]
  362.         no_max_pos_y:
  363.  
  364.         cmp eax,ecx
  365.         ja no_min_pos_x
  366.         mov eax,[Brush_SizeX]
  367.         no_min_pos_x:
  368.  
  369.         cmp ebx,edx
  370.         ja no_min_pos_y
  371.         mov ebx,[Brush_SizeY]
  372.         no_min_pos_y:
  373.  
  374.         sub eax,[Brush_SizeX]
  375.         sub ebx,[Brush_SizeY]
  376.  
  377.         mov [x],eax
  378.         mov [y],ebx
  379.  
  380.         mov al,[exit_from_work_arrea]
  381.         test al,al
  382.         jz no_exit_from_work_arrea_brush
  383.         and [Activate_instrument],0
  384.         and [exit_from_work_arrea],0
  385.         no_exit_from_work_arrea_brush:
  386.  
  387.         mov al,[Activate_instrument]
  388.         test al,al
  389.         jnz no_new_brush_xy
  390.         mov eax,[x]
  391.         mov ebx,[y]
  392.         mov [OldX],eax
  393.         mov [OldY],ebx
  394.         mov [Activate_instrument],1
  395.         no_new_brush_xy:
  396.  
  397.         mov eax,[PointerToPicture]
  398.         mov ebx,[ReserveArray]
  399.         add ebx,4
  400.         mov ecx,[Picture_SizeX]
  401.         mov edx,[OldX]
  402.         shl edx,16
  403.         add edx,[OldY]
  404.         mov esi,[x]
  405.         mov edi,[y]
  406.  
  407.         call calculate_line
  408.  
  409.         mov ebx,[ReserveArray]
  410.         mov [ebx],eax
  411.  
  412.         ;procedure drawing of brush
  413.         mov ebx,[ReserveArray]
  414.         mov ecx,[ebx]
  415.         mov edx,[Color]
  416.         mov esi,[Color]
  417.         shr edx,16
  418.         add ebx,4
  419.         mov edi,[Number_Brush]
  420.         imul edi,20*20
  421.  
  422.         next_pixel_put_brush:
  423.  
  424.         mov eax,[ebx]
  425.         push eax
  426.         push ecx
  427.         xor ebp,ebp
  428.         and [counter2],0
  429.  
  430.         vertical_width_brush:
  431.            and [counter],0
  432.  
  433.            horizontal_width_brush:
  434.            xor ecx,ecx
  435.            mov cl,byte[Brush_color+edi+ebp]
  436.            test cl,cl
  437.              jz no_draw_pixel_brush
  438.               mov [eax],si
  439.               mov [eax+2],dl
  440.              no_draw_pixel_brush:
  441.            add eax,3
  442.            inc ebp
  443.            inc [counter]
  444.            cmp [counter],20
  445.            jne horizontal_width_brush
  446.  
  447.            mov ecx,[Picture_SizeX]
  448.            sub ecx,20
  449.            lea ecx,[ecx+ecx*2]
  450.            add eax,ecx
  451.         inc [counter2]
  452.         cmp [counter2],20
  453.         jne vertical_width_brush
  454.  
  455.         pop ecx
  456.         pop eax
  457.         add ebx,4
  458.         dec ecx
  459.         jnz next_pixel_put_brush
  460.  
  461.         mov eax,[x]
  462.         mov ebx,[y]
  463.         mov [OldX],eax
  464.         mov [OldY],ebx
  465.  
  466.         mov al,[lastik_is_active]
  467.         test al,al
  468.         jz no_lastik_active
  469.  
  470.         mov eax,[SColor]
  471.         mov [Color],eax
  472.         and [lastik_is_active],0
  473.         no_lastik_active:
  474.  
  475.         call MovePictureToWorkScreen
  476.         mov eax,[Current_instrument]
  477.         mov [Last_instrument],eax
  478.  
  479.         ret
  480.         no_brush:
  481.  
  482.         ;*************************pipetka***********************
  483.         cmp eax,15
  484.         jne no_pipetka
  485.  
  486.         mov eax,[ScreenY]
  487.         mov ebx,[Picture_SizeX]
  488.         add eax,[PosY]
  489.         imul eax,ebx
  490.         add eax,[ScreenX]
  491.         add eax,[PosX]
  492.         lea eax,[eax+eax*2]
  493.         add eax,[PointerToPicture]
  494.         mov ebx,[eax]
  495.         and ebx,0xffffff
  496.         mov [Color],ebx
  497.  
  498.         mcall SF_DRAW_RECT, ((ci_panel_x_pos+130) shl 16)+21,\
  499.                 ((ci_panel_y_pos+28) shl 16)+21, [Color]
  500.  
  501.         ret
  502.         no_pipetka:
  503.  
  504.         ;************************lastik*************************
  505.         cmp eax,13
  506.         jne no_lastik
  507.  
  508.         mov [Last_instrument],eax
  509.         mov [lastik_is_active],1
  510.         jmp lastik_in
  511.         no_lastik:
  512.  
  513.         ;************************Flood Fill*********************
  514.         cmp eax,14
  515.         jne no_FloodFill
  516.  
  517.         mov eax,[PointerToPicture]
  518.         mov ebx,[PointerToEditBufer]
  519.  
  520.         mov ecx,[Picture_SizeX]
  521.         imul ecx,[Picture_SizeY]
  522.         lea ecx,[ecx+ecx*2]
  523.         shl ecx,1
  524.  
  525.         cmp ecx,mem_flood_f
  526.         ja normal_size_of_bufer
  527.  
  528.         mov ebx,[ReserveArray]
  529.  
  530.         normal_size_of_bufer:
  531.  
  532.         add ebx,4
  533.         mov ecx,[Picture_SizeX]
  534.         mov edx,[ScreenX]
  535.         add edx,[PosX]
  536.         shl edx,16
  537.         add edx,[ScreenY]
  538.         add edx,[PosY]
  539.         mov esi,[Picture_SizeX]
  540.         dec esi
  541.         shl esi,16
  542.         add esi,[Picture_SizeY]
  543.         dec esi
  544.         mov edi,[Color]
  545.  
  546.         call flood_fill
  547.         call MovePictureToWorkScreen
  548.         ret
  549.         no_FloodFill:
  550.  
  551.         ;************************spray**************************
  552.         cmp eax,12
  553.         jne no_spray
  554.  
  555.         cmp [Activate_instrument],0
  556.         jne no_null_spray
  557.         mov [Activate_instrument],1
  558.         ret
  559.         no_null_spray:
  560.  
  561.         mov eax,[ScreenX]
  562.         mov ebx,[ScreenY]
  563.         mov ecx,[Brush_SizeX]
  564.         mov edx,[Brush_SizeY]
  565.         add eax,[PosX]
  566.         add ebx,[PosY]
  567.         add eax,ecx
  568.         add ebx,edx
  569.  
  570.         cmp eax,[Picture_SizeX]
  571.         jl no_max_pos_x_spray
  572.         mov eax,[Picture_SizeX]
  573.         no_max_pos_x_spray:
  574.  
  575.         cmp ebx,[Picture_SizeY]
  576.         jl no_max_pos_y_spray
  577.         mov ebx,[Picture_SizeY]
  578.         no_max_pos_y_spray:
  579.  
  580.         cmp eax,ecx
  581.         ja no_min_pos_x_spray
  582.         mov eax,[Brush_SizeX]
  583.         no_min_pos_x_spray:
  584.  
  585.         cmp ebx,edx
  586.         ja no_min_pos_y_spray
  587.         mov ebx,[Brush_SizeY]
  588.         no_min_pos_y_spray:
  589.  
  590.         sub eax,[Brush_SizeX]
  591.         sub ebx,[Brush_SizeY]
  592.         mov edi,0;[Number_Brush]
  593.         imul edi,20*20
  594.  
  595.         mov [x],eax
  596.         mov [y],ebx
  597.         mov ebp,[Picture_SizeX]
  598.         xor edx,edx
  599.         brush_y_spray:
  600.           xor ecx,ecx
  601.           brush_x_spray:
  602.            ;calculate position in array of spray
  603.            mov esi,edx
  604.            lea esi,[esi+esi*4] ;esi=esi*5
  605.            shl esi,2           ;esi=(esi*3)*4
  606.            add esi,ecx
  607.            add esi,edi
  608.            ;read byte from array
  609.            xor eax,eax
  610.            mov al,[Spray_color+esi]
  611.            test eax,eax
  612.            jz no_color_spray
  613.            mov eax,[x]
  614.            mov ebx,[y]
  615.            add eax,ecx
  616.            add ebx,edx
  617.            imul ebx,ebp; ebp=[Picture_SizeX]
  618.            add eax,ebx
  619.            lea eax,[eax+eax*2]
  620.            add eax,[PointerToPicture]
  621.            mov ebx,[Color]
  622.            mov [eax],bx
  623.            shr ebx,16
  624.            mov [eax+2],bl
  625.            no_color_spray:
  626.            inc ecx
  627.            cmp ecx,20
  628.           jl brush_x_spray
  629.         inc edx
  630.         cmp edx,20
  631.         jl brush_y_spray
  632.  
  633.         call MovePictureToWorkScreen
  634.         ret
  635.         no_spray:
  636.  
  637.         ;************************palette************************
  638.         cmp eax,51
  639.         jne no_palette
  640.  
  641.         mov eax,20
  642.         mov ebx,ci_palete_y_pos
  643.         mov ecx,32*10+32*5+7
  644.         mov edx,140
  645.         mov  esi,1
  646.         call draw_volume_rectangle
  647.         mov [x],20+5
  648.         mov [y],ci_palete_y_pos+10
  649.         mov edi,256
  650.         xor esi,esi
  651.         next_rectangle:
  652.         mov ebx,[x]
  653.         mov ecx,[y]
  654.         mov edx,[palitra+esi]
  655.         and edx,0xffffff
  656.         shl ebx,16
  657.         shl ecx,16
  658.         add ebx,13
  659.         add ecx,13
  660.         mcall SF_DRAW_RECT
  661.         add [x],15
  662.         cmp [x],20+15*32
  663.         jl no_new_line
  664.         mov [x],20+5
  665.         add [y],15
  666.         no_new_line:
  667.         add esi,4
  668.         dec edi
  669.         jnz next_rectangle
  670.  
  671.         wait_events:
  672.         mcall SF_WAIT_EVENT
  673.  
  674.         cmp eax,1
  675.         jne @f
  676.                 ret
  677.         @@:
  678.         cmp eax,2
  679.         jne no_keys
  680.                 mcall SF_GET_KEY
  681.                 jmp wait_events
  682.         no_keys:
  683.         cmp eax,3
  684.         jne no_buttons
  685.                 mcall SF_GET_BUTTON
  686.                 jmp wait_events
  687.         no_buttons:
  688.         cmp eax,6
  689.         jne wait_events
  690.  
  691.         call GetMouseClick
  692.  
  693.         test eax,eax
  694.         jz wait_events
  695.         call GetMouseCoordinats
  696.         mov [x],20+5
  697.         mov [y],ci_palete_y_pos+10
  698.         mov [counter],0
  699.         next_rectangle_column:
  700.         mov eax,[x]
  701.         mov ebx,[y]
  702.         mov ecx,[MouseX]
  703.         mov edx,[MouseY]
  704.         mov esi,13
  705.         mov edi,13
  706.         call columnus
  707.         test eax,eax
  708.         jz no_columnus_color
  709.  
  710.         mov eax,[counter]
  711.         shl eax,2
  712.         mov ebx,[palitra+eax]
  713.         and ebx,0xffffff
  714.         mov [Color],ebx
  715.         no_columnus_color:
  716.  
  717.         add [x],15
  718.  
  719.         cmp [x],20+15*32
  720.         jl no_new_line_column
  721.  
  722.         mov [x],20+5
  723.         add [y],15
  724.         no_new_line_column:
  725.  
  726.         inc [counter]
  727.  
  728.         cmp [counter],257
  729.         jne next_rectangle_column
  730.  
  731.         mcall SF_SLEEP,10
  732.  
  733.         call drawwin
  734.  
  735.         mov eax,[Last_instrument]
  736.         mov [Current_instrument],eax
  737.         ret
  738.         no_palette:
  739.  
  740.         ;************************draw line**********************
  741.         cmp eax,16
  742.         jne no_line
  743.  
  744.         mov [Last_instrument],eax
  745.  
  746.         mov al,[Activate_instrument]
  747.         test al,al
  748.         jnz no_new_line_xy
  749.         mov eax,[ScreenX]
  750.         mov ebx,[ScreenY]
  751.         add eax,[PosX]
  752.         add ebx,[PosY]
  753.         mov [OldX],eax
  754.         mov [OldY],ebx
  755.         mov [Activate_instrument],1
  756.         xor eax,eax
  757.         mov ecx,mem_flood_f/4
  758.         mov edi,[ReserveArray]
  759.         cld
  760.         rep stosd
  761.         ret
  762.         no_new_line_xy:
  763.  
  764.         ;put saved pixels
  765.         square_width_put
  766.  
  767.         ;calculate line
  768.         mov ebx,[ReserveArray]
  769.         add ebx,4
  770.         mov eax,[PointerToPicture]
  771.         mov ecx,[Picture_SizeX]
  772.         mov edx,[OldX]
  773.         shl edx,16
  774.         add edx,[OldY]
  775.         mov esi,[ScreenX]
  776.         mov edi,[ScreenY]
  777.         add esi,[PosX]
  778.         add edi,[PosY]
  779.  
  780.         mov ebp,[Picture_SizeX]
  781.         sub ebp,[line_width]
  782.         cmp esi,ebp
  783.         jl no_minimum_x_line
  784.         mov esi,ebp
  785.         no_minimum_x_line:
  786.  
  787.         mov ebp,[Picture_SizeY]
  788.         sub ebp,[line_width]
  789.         cmp edi,ebp
  790.         jl no_minimum_y_line
  791.         mov edi,ebp
  792.         no_minimum_y_line:
  793.  
  794.         call calculate_line
  795.  
  796.         ;save color pixels in ReserveArray
  797.         square_width_save
  798.  
  799.         ;draw calculated pixels on work arrea
  800.         draw_calc_pixels width_pixels
  801.  
  802.         call MovePictureToWorkScreen
  803.         ret
  804.         no_line:
  805.  
  806.         ;************************draw rectangle*****************
  807.         cmp eax,17
  808.         jne no_rectangle
  809.  
  810.         mov [Last_instrument],eax
  811.  
  812.         mov al,[Activate_instrument]
  813.         test al,al
  814.         jnz no_new_rectangle_xy
  815.         mov eax,[ScreenX]
  816.         mov ebx,[ScreenY]
  817.         add eax,[PosX]
  818.         add ebx,[PosY]
  819.         mov [OldX],eax
  820.         mov [OldY],ebx
  821.         mov [Activate_instrument],1
  822.         xor eax,eax
  823.         mov ecx,mem_flood_f/4
  824.         mov edi,[ReserveArray]
  825.         cld
  826.         rep stosd
  827.         ret
  828.         no_new_rectangle_xy:
  829.  
  830.         ;put saved pixels
  831.         square_width_put
  832.  
  833.         ;calculate line
  834.         mov ebx,[ReserveArray]
  835.         add ebx,4
  836.         mov eax,[PointerToPicture]
  837.         mov ecx,[Picture_SizeX]
  838.         mov edx,[OldX]
  839.         shl edx,16
  840.         add edx,[OldY]
  841.         mov esi,[ScreenX]
  842.         mov edi,[ScreenY]
  843.         add esi,[PosX]
  844.         add edi,[PosY]
  845.  
  846.         mov ebp,[Picture_SizeX]
  847.         sub ebp,[line_width]
  848.         cmp esi,ebp
  849.         jl no_minimum_x_rectangle
  850.         mov esi,ebp
  851.         no_minimum_x_rectangle:
  852.  
  853.         mov