92,8 → 92,43 |
pop esi |
@@: |
ret |
;endp |
|
;input: |
; ebx = coord x |
; ecx = coord y |
; edi = pointer to buffer struct |
;output: |
; eax = 梥â â®çª¨ |
; ¢ á«ãç ¥ ®è¨¡ª¨ eax = 0xffffffff |
align 4 |
get_pixel_24: |
mov eax,0xffffffff |
|
bt ebx,31 |
jc @f |
bt ecx,31 |
jc @f |
cmp ebx,buf2d_w |
jge @f |
cmp ecx,buf2d_h |
jge @f |
push esi |
mov esi,buf2d_w ;size x |
imul esi,ecx ;size_x*y |
add esi,ebx ;size_x*y+x |
lea esi,[esi+esi*2] ;(size_x*y+x)*3 |
add esi,buf2d_data ;ptr+(size_x*y+x)*3 |
|
xor eax,eax |
mov ax,word[esi] ;copy pixel color |
ror eax,16 |
mov al,byte[esi+2] |
ror eax,16 |
pop esi |
@@: |
ret |
|
|
;ᮧ¤ ¨¥ ¡ãä¥à |
align 4 |
proc buf_create, buf_struc:dword |
1002,15 → 1037,13 |
align 4 |
proc buf_line_h, buf_struc:dword, coord_x0:dword, coord_y0:dword, coord_x1:dword, color:dword |
pushad |
mov edx,dword[color] |
|
mov eax,edi |
mov edi,[buf_struc] |
cmp buf2d_bits,24 |
jne @f |
jne .end24 |
|
mov ebx,dword[coord_x0] |
mov ecx,dword[coord_y0] |
mov edx,dword[color] |
mov esi,dword[coord_x1] |
|
@@: ;for (x=x0 ; x<x1; x++) ;------------------------------------ |
1020,6 → 1053,7 |
jge @f |
jmp @b |
@@: |
.end24: |
popad |
ret |
endp |
1139,7 → 1173,142 |
ret |
endp |
|
;äãªæ¨ï ¤«ï § «¨¢ª¨ ®¡« á⨠¢ë¡à ë¬ æ¢¥â®¬ |
align 4 |
proc buf_flood_fill, buf_struc:dword, coord_x:dword, coord_y:dword, mode:dword, color_f:dword, color_b:dword |
pushad |
mov edi,[buf_struc] |
cmp buf2d_bits,24 |
jne .end24 |
|
mov ebx,dword[coord_x] |
mov ecx,dword[coord_y] |
mov edx,dword[color_f] |
mov esi,dword[color_b] |
|
cmp dword[mode],1 ;¢ § ¢¨á¨¬®á⨠®â 'mode' ®¯à¥¤¥«ï¥¬ ª ª¨¬ «£®à¨â¬®¬ ¡ã¤¥¬ ¯®«ì§®¢ âìáï |
je @f |
call buf_flood_fill_recurs_0 ;§ «¨¢ ¥¬ ¤® ¯¨ªá¥«¥© 梥â esi |
jmp .end24 |
@@: |
call buf_flood_fill_recurs_1 ;§ «¨¢ ¥¬ ¯¨ªá¥«¨ ¨¬¥î騥 梥â esi |
|
.end24: |
popad |
ret |
endp |
|
;input: |
; ebx = coord_x |
; ecx = coord_y |
; edx = 梥⠧ «¨¢ª¨ |
; esi = æ¢¥â £à ¨æë, ¤® ª®â®à®© ¡ã¤¥â ¨â¨ § «¨¢ª |
; edi = buf_struc |
;output: |
; eax = ¯®àâ¨âáï |
align 4 |
buf_flood_fill_recurs_0: |
call get_pixel_24 |
cmp eax,0xffffffff ;if error coords |
je .end_fun |
cmp eax,edx ;¥á«¨ 梥⠯¨ªá¥«ï ᮢ¯ « á 梥⮬ § «¨¢ª¨, § ç¨â § «¨¢ª ¢ í⮩ ®¡« á⨠㦥 ¡ë« ᤥ« |
je .end_fun |
|
call draw_pixel |
|
dec ebx |
call get_pixel_24 |
cmp eax,esi |
je @f |
call buf_flood_fill_recurs_0 |
@@: |
inc ebx |
|
|
inc ebx |
call get_pixel_24 |
cmp eax,esi |
je @f |
call buf_flood_fill_recurs_0 |
@@: |
dec ebx |
|
dec ecx |
call get_pixel_24 |
cmp eax,esi |
je @f |
call buf_flood_fill_recurs_0 |
@@: |
inc ecx |
|
inc ecx |
call get_pixel_24 |
cmp eax,esi |
je @f |
call buf_flood_fill_recurs_0 |
@@: |
dec ecx |
|
.end_fun: |
ret |
|
;input: |
; ebx = coord_x |
; ecx = coord_y |
; edx = 梥⠧ «¨¢ª¨ |
; esi = 梥⠯¨ªá¥«¥©, ¯® ª®â®àë¬ ¡ã¤¥â ¨â¨ § «¨¢ª |
; edi = buf_struc |
;output: |
; eax = ¯®àâ¨âáï |
align 4 |
buf_flood_fill_recurs_1: |
call get_pixel_24 |
cmp eax,0xffffffff ;if error coords |
je .end_fun |
cmp eax,edx ;¥á«¨ 梥⠯¨ªá¥«ï ᮢ¯ « á 梥⮬ § «¨¢ª¨, § ç¨â § «¨¢ª ¢ í⮩ ®¡« á⨠㦥 ¡ë« ᤥ« |
je .end_fun |
cmp eax,esi ;¥á«¨ 梥⠯¨ªá¥«ï ¥ ᮢ¯ « á § «¨¢ ¥¬ë¬ 梥⮬ § «¨¢ª¨, â® ¯à¥ªà é ¥¬ § «¨¢ªã |
jne .end_fun |
|
call draw_pixel |
|
dec ebx |
call get_pixel_24 |
cmp eax,esi |
jne @f |
call buf_flood_fill_recurs_1 |
@@: |
inc ebx |
|
|
inc ebx |
call get_pixel_24 |
cmp eax,esi |
jne @f |
call buf_flood_fill_recurs_1 |
@@: |
dec ebx |
|
dec ecx |
call get_pixel_24 |
cmp eax,esi |
jne @f |
call buf_flood_fill_recurs_1 |
@@: |
inc ecx |
|
inc ecx |
call get_pixel_24 |
cmp eax,esi |
jne @f |
call buf_flood_fill_recurs_1 |
@@: |
dec ecx |
|
.end_fun: |
ret |
|
align 4 |
proc buf_img_wdiv2, buf_struc:dword |
pushad |
mov edi,dword[buf_struc] |
2136,6 → 2305,7 |
dd sz_buf2d_draw_text, buf_draw_text |
dd sz_buf2d_crop_color, buf_crop_color |
dd sz_buf2d_offset_h, buf_offset_h |
dd sz_buf2d_flood_fill, buf_flood_fill |
dd 0,0 |
sz_lib_init db 'lib_init',0 |
sz_buf2d_create db 'buf2d_create',0 |
2159,3 → 2329,5 |
sz_buf2d_draw_text db 'buf2d_draw_text',0 |
sz_buf2d_crop_color db 'buf2d_crop_color',0 |
sz_buf2d_offset_h db 'buf2d_offset_h',0 |
sz_buf2d_flood_fill db 'buf2d_flood_fill',0 |
|