files
kolibrios/programs/media/palitra/branch/draw_palitra.inc
leency 9fba11f18c
All checks were successful
Build system / Check kernel codestyle (pull_request) Successful in 33s
Build system / Build (pull_request) Successful in 7m29s
palitra branch: general UI and code refactoring, fix a lot of issues
2025-03-15 22:13:57 +02:00

280 lines
11 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, PALITRA_XW, PALITRA_YW, [sc.work]
cmp [renmode],MODE_PIPET
je cyrcle_draw
;cmp [renmode],1
;je picker_draw
cmp [renmode],MODE_PALITRA
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
PIPET_CELLW = 13
PIPET_AREA_W = PIPET_CELLW*PIPET_CELL_COUNT_X
PIPET_AREA_H = PIPET_CELLW*PIPET_CELL_COUNT_Y
PIPET_CELL_COUNT_X = 15
PIPET_CELL_COUNT_Y = 13
PIPET_SELECTED_X = PIPET_AREA_W/2+PALITRA_X
PIPET_SELECTED_Y = PIPET_AREA_H/2+DRAWY+2
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,PALITRA_X*65536+PIPET_CELLW
mov esi,0 ; counter=8
circle_loop:
mov ecx, (DRAWY+1)*65536+PIPET_CELLW
mov edi,0
circle_loop2:
call circle_pixel_read
mcall SF_DRAW_RECT
add ecx,PIPET_CELLW shl 16
inc edi
cmp edi,PIPET_CELL_COUNT_Y
jne circle_loop2
add ebx,PIPET_CELLW shl 16
inc esi
cmp esi,PIPET_CELL_COUNT_X
jne circle_loop
mcall SF_DRAW_RECT, <PIPET_SELECTED_X-10, PIPET_CELLW+4>, <PIPET_SELECTED_Y-10, PIPET_CELLW+4>, 0xFF0000
mov ecx, [mouse_x]
mov edx, [mouse_y]
inc ecx
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, <PIPET_SELECTED_X-8, PIPET_CELLW>, <PIPET_SELECTED_Y-8, PIPET_CELLW>
ret
end_cyrcle_draw:
mcall SF_DRAW_RECT, <PALITRA_X-1, PIPET_AREA_W+2>, <DRAWY, PIPET_AREA_H+2>, [sc.work_graph]
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-----------------------------------------------------------------------------------------