kolibrios/programs/media/palitra/branch/draw_palitra.inc
Kirill Lipatov (Leency) 7b02f7b61d Palitra: update by Vaicheslav97
git-svn-id: svn://kolibrios.org@9541 a494cfbc-eb01-0410-851d-a64ba20cac60
2021-12-31 20:07:08 +00:00

270 lines
10 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

draw_palitra:
; ”ã­ªæ¨ï 13 - ­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª
;mcall SF_DRAW_RECT, 110 shl 16+148, 9 shl 16+148, [sc.work]
cmp [renmode],2
je cyrcle_draw
;cmp [renmode],1
;je picker_draw
cmp [renmode],0
je sheme_draw
ret
;.................................................................................................
; Žâà¨á®¢ª  ªà㣮¢®© ¤¨ £à ¬¬ë
;.................................................................................................
cyrcle_draw:
;mov eax,13
;mov edx,0x666666
;mov ebx,108*65536+152
;mov ecx,125*65536+33
;mcall
;mov edx,0xF3F3F3
;mov ebx,109*65536+150
;mov ecx,126*65536+31
;mcall
;mov eax,4 ; 4 - ¢ë¢¥á⨠áâபã ⥪áâ  ¢ ®ª­®
;mov ebx,115 shl 16+131 ; [ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [ª®®à¤¨­ â  ¯® ®á¨ y]
;mov ecx,0x666666 ; 0xX0RRGGBB (RR, GG, BB § ¤ îâ 梥â ⥪áâ )
;mov edx,hint ; 㪠§ â¥«ì ­  ­ ç «® áâப¨
;mov esi,24 ; ¢ë¢®¤¨âì esi ᨬ¢®«®¢
;mcall
;mov ebx,125 shl 16+144 ; [ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [ª®®à¤¨­ â  ¯® ®á¨ y]
;mov edx,hint2 ; 㪠§ â¥«ì ­  ­ ç «® áâப¨
;mov esi,21 ; ¢ë¢®¤¨âì esi ᨬ¢®«®¢
;mcall
;mov edx,[color]
;mov ebx,109*65536+150
;mov ecx, 10*65536+150
;mcall
call mouse_local ; ¯®«ãç ¥¬ ª®®à¤¨­ âë ¬ëè¨ ®â­®á¨â¥«ì­® ®ª­ 
mov ecx, [mouse_x] ; § ­®á¨¬ ¢ ॣ¨áâà
mov edx, [mouse_y] ; § ­®á¨¬ ¢ ॣ¨áâà
cmp ecx, WIN_W-10
jg cyrcle_draw_2
cmp edx, WIN_H
jle end_cyrcle_draw
cyrcle_draw_2:
mcall SF_SLEEP,10
call desktop_get
call mouse_global
mov ebx,112*65536+11
mov esi,0 ; counter=8
circle_loop:
mov ecx, 10*65536+11
mov edi,0
circle_loop2:
call circle_pixel_read
mcall SF_DRAW_RECT
add ecx,11 shl 16
inc edi
cmp edi,13
jne circle_loop2
add ebx,11 shl 16
inc esi
cmp esi,13
jne circle_loop
mcall SF_DRAW_RECT, 177*65536+13, 76*65536+13, 0
mov ecx, [mouse_x]
mov edx, [mouse_y]
inc ecx
inc edx
mov ebx, edx
imul ebx, [desctop_w]
add ebx, ecx
mcall SF_GET_PIXEL
mov edx,eax
mcall SF_DRAW_RECT, 178*65536+11, 77*65536+11
ret
end_cyrcle_draw:
mcall SF_DRAW_RECT, 111*65536+145, 9*65536+145, 0x666666
ret
circle_pixel_read:
push ecx ebx
mov ecx, [mouse_x]
mov edx, [mouse_y]
inc ecx
add ecx, esi
cmp ecx, 6
jl _cpr_exit
sub ecx, 6
inc edx
add edx, edi
cmp edx, 6
jl _cpr_exit
sub edx, 6
mov ebx, edx
imul ebx, [desctop_w]
add ebx, ecx
mcall SF_GET_PIXEL
mov edx,eax
pop ebx ecx
ret
_cpr_exit:
xor edx,edx
pop ebx ecx
ret
;picker_draw:
;ret
;.................................................................................................
; Žâà¨á®¢ª  ä®­  ¯®¤ ª­®¯ª¨
;.................................................................................................
sheme_draw:
mov eax,SF_DRAW_RECT ; ”ã­ªæ¨ï 13 - ­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª
mov edx,0x222222 ; 梥â
mov ecx, palitra_yw ; <EFBFBD> ç «ì­ë¥ ª®®à¤¨­ âë ¯® y [ª-â  y]*65536 + [à §¬¥à]
mov esi,2 ; ‘ç¥â稪 «¨­¨© ¯®¤«®¦¥ª
re_draw:
mov ebx,palitra_xw ; <EFBFBD> ç «ì­ë¥ ª®®à¤¨­ âë ¯® x [ª-â  x]*65536 + [à §¬¥à]
mov edi,2 ; ‘ç¥â稪 ª®«¨ç¥á⢠ ¯®¤«®¦¥ª
for_fon_loop:
int 0x40 ; <EFBFBD>à¥à뢠­¨¥
add ebx,(palitra_w+2) shl 16 ; ‘¬¥é ¥¬ ¯®«®¦¥­¨¥ «¨­¨¨ ¯® å
dec edi ; “¬¥­ìè ¥¬ áç¥â稪 ª­®¯®ª
cmp edi,0 ; ‘à ¢­¨¢ ¥¬ á ­ã«¥¬
jnz for_fon_loop ; …᫨ ­¥ ­®«ì â® ¢ ­ ç «® 横« 
dec esi ; “¬¥­ìè ¥¬ ¥£®
cmp esi,0 ; ‘à ¢­¨¢ ¥¬ á ­ã«¥¬
mov ecx,(palitra_w+DRAWY+3) shl 16+palitra_w ; <EFBFBD> ç «ì­ë¥ ª®®à¤¨­ âë ¯® y [ª-â  y]*65536 + [à §¬¥à]
jnz re_draw ; …᫨ ­¥ ­®«ì â® ¢ ­ ç «® 横« 
;.................................................................................................
; Žâà¨á®¢ª  ª­®¯®ª ¯® 横«ã
;.................................................................................................
mov eax,SF_DRAW_RECT ; ”ã­ªæ¨ï 13 - ­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª
mov edx,0x0FFFFFFF ; 梥â
mov esi,4 ; ‘ç¥â稪 ª®«¨ç¥á⢠  ¡§ æ¥¢ (#4,8)
mov ebx,(palitra_x-CELLW-3) shl 16+CELLW ; <EFBFBD> ç «ì­ë¥ ª®®à¤¨­ âë ¯® x [ª-â  x]*65536 + [à §¬¥à]
for_abz:
;;push esi ; ‘®å࠭塞 §­ ç¥­¨¥ áç¥â稪  «¨­¨© ¢ á⥪
cmp esi,2
jne x2_line
mov ebx,(palitra_x-CELLW-3) shl 16+CELLW
x2_line:
add ebx,3 shl 16 ; ‘¬¥é ¥¬ ¯®«®¦¥­¨¥ «¨­¨¨ ¯® x
mov edi,8 ; ‘ç¥â稪 ª®«¨ç¥á⢠ ª­®¯®ª ¢ áâப¥
for_stolbik:
push edi ; ‘®å࠭塞 §­ ç¥­¨¥ áç¥â稪  «¨­¨© ¢ á⥪
mov edi,8 ; ‘ç¥â稪 ª®«¨ç¥á⢠ ª­®¯®ª ¢ áâப¥
mov ecx, (1-CELLW/3) shl 16+CELLW ; <EFBFBD> ç «ì­ë¥ ª®®à¤¨­ âë ¯® y [ª-â  y]*65536 + [à §¬¥à]
cmp esi,2
jg y2_line ; …᫨ ¡®«ìè¥ 4 â® ¨£­®à¨¬
mov ecx,(palitra_w+4-(CELLW/3)) shl 16+CELLW
y2_line:
add ebx,(CELLW+1) shl 16 ; ‘¬¥é ¥¬ ¯®«®¦¥­¨¥ «¨­¨¨ ¯® x
for_loop:
add ecx,(CELLW+1) shl 16 ; ‘¬¥é ¥¬ ¯®«®¦¥­¨¥ «¨­¨¨ ¯® y
int 0x40 ; <EFBFBD>à¥à뢠­¨¥
call sub_red
dec edi ; “¬¥­ìè ¥¬ áç¥â稪 ª­®¯®ª
cmp edi,0 ; ‘à ¢­¨¢ ¥¬ á ­ã«¥¬
jnz for_loop ; …᫨ ­¥ ­®«ì â® ¢ ­ ç «® 横« 
call sub_green
pop edi ; ˆ­ ç¥ ¢®ááâ ­ ¢«¨¢ ¥¬ áç¥â稪 «¨­¨©
dec edi ; “¬¥­ìè ¥¬ ¥£®
cmp edi,0 ; ‘à ¢­¨¢ ¥¬ á ­ã«¥¬
jnz for_stolbik ; …᫨ ­¥ ­®«ì â® ¢ ­ ç «® 横« 
call sub_blue
;;pop esi ; ˆ­ ç¥ ¢®ááâ ­ ¢«¨¢ ¥¬ áç¥â稪 «¨­¨©
dec esi ; “¬¥­ìè ¥¬ ¥£®
cmp esi,0 ; ‘à ¢­¨¢ ¥¬ á ­ã«¥¬
jnz for_abz ; …᫨ ­¥ ­®«ì â® ¢ ­ ç «® 横« 
ret ; ‚®§¢à é ¥¬ ã¯à ¢«¥­¨¥
;end_draw_palitra-------------------------------------------------------------------------------------
sub_red:
;.................................................................................................
; <EFBFBD> áçñâ ᬥ饭¨© ªà á­®£® æ¢¥â  ¢ £¥­¥à æ¨¨ æ¢¥â  ¯ «¨âàë
;.................................................................................................
push eax
mov eax,[pnext]
;sub_red_0 ; palitra
cmp al,0
jne sub_red_1
sub edx,0x40
jmp sub_red_e
sub_red_1: ; random
cmp al,1
jne sub_red_2
sub edx,0x20
jmp sub_red_e
sub_red_2: ; gree
cmp al,2
jne sub_red_3
sub edx,0x010101
jmp sub_red_e
sub_red_3: ; red
cmp al,3
jne sub_red_4
sub edx,0x0101
jmp sub_red_e
sub_red_4: ; green
cmp al,4
jne sub_red_5
sub edx,0x010001
jmp sub_red_e
sub_red_5: ; blue
cmp al,5
jne sub_red_e
sub edx,0x010100
jmp sub_red_e
sub_red_e:
pop eax
ret ; ‚®§¢à é ¥¬ ã¯à ¢«¥­¨¥
;end_sub_red------------------------------------------------------------------------------------------
sub_green:
;.................................................................................................
; <EFBFBD> áçñâ ᬥ饭¨© ªà á­®£® æ¢¥â  ¢ £¥­¥à æ¨¨ æ¢¥â  ¯ «¨âàë
;.................................................................................................
push eax
mov eax,[pnext]
;sub_green_0
cmp al,0
jne sub_green_1
sub edx,0x4000
jmp sub_green_e
sub_green_1:
cmp al,1
jne sub_green_e
sub edx,0x2000
;jmp sub_green_e
sub_green_e:
pop eax
ret ; ‚®§¢à é ¥¬ ã¯à ¢«¥­¨¥
;end_sub_green----------------------------------------------------------------------------------------
sub_blue:
;.................................................................................................
; <EFBFBD> áçñâ ᬥ饭¨© ªà á­®£® æ¢¥â  ¢ £¥­¥à æ¨¨ æ¢¥â  ¯ «¨âàë
;.................................................................................................
push eax
mov eax,[pnext]
;sub_blue_0
cmp al,0
jne sub_blue_1
sub edx,0x600000
jmp sub_blue_e
sub_blue_1:
cmp al,1
jne sub_blue_e
sub edx,0x400000
;jmp sub_blue_e
sub_blue_e:
pop eax
ret ; ‚®§¢à é ¥¬ ã¯à ¢«¥­¨¥
;end_sub_blue-----------------------------------------------------------------------------------------