Subversion Repositories Kolibri OS

Compare Revisions

Ignore whitespace Rev 2162 → Rev 2163

/programs/media/zsea/backgrnd.inc
3,10 → 3,10
background:
cmp [soi],0
je .end
 
cmp [bgrmode],dword 2
jbe @f
jmp .end
@@:
ja .stretch_crop
 
mov ecx,[img_width] ; øèðèíà
test ecx,ecx
jz .end
24,20 → 24,149
 
cmp [img_resolution],24
je @f
push dword image_file
call [convert_Conv_24b]
mov ecx,[raw_pointer_2]
mcall 15,5 ;15,5 set data
mov ecx,[raw_pointer_2]
mcall 68,13
add ecx,44
mcall 15,5 ;15,5 set data
mcall 68,13,[raw_pointer_2]
jmp .set_mode
@@:
mcall 15,5 ; 15,5 set data
mcall 15,5 ; 15,5 set data
.set_mode:
mov ecx,[bgrmode]
mcall 15,4 ; 15,4 set mode
dec ebx ; 15,3 redraw background
mcall 15,4,[bgrmode] ; 15,4 set mode
dec ebx ; 15,3 redraw background
mcall
.end:
ret
;---------------------------------------------------------------------
.stretch_crop:
; cmp [bgrmode],dword 3
; jne .stretch_inscribe
xor eax,eax
mov [stretch_start_coordinates],eax
mcall 14
 
mov ebx,eax
and eax,0xffff
inc eax
mov [screen_high],eax
shr ebx,16
inc ebx
mov [screen_width],ebx
xchg eax,ebx
call calculate_relation
mov [screen_relation],eax
mov eax,[img_width]
mov ebx,[img_high]
call calculate_relation
mov [picture_relation],eax
cmp eax,[screen_relation]
jb @f
; Y = Yimg
; X = Yimg*Xscreen/Yscreen
mov eax,[img_high]
mov [stretch_img_high],eax
mov eax,[img_high]
imul eax,dword [screen_width]
mov ebx,[screen_high]
call integer_division
mov [stretch_img_width],eax
mov ebx,[img_width]
sub ebx,eax
shr ebx,1
mov [stretch_start_coordinates.x],bx
jmp .continue
@@:
; X = Ximg
; Y = Ximg*Yscreen/Xscreen
mov eax,[img_width]
mov [stretch_img_width],eax
mov eax,[img_width]
imul eax,dword [screen_high]
mov ebx,[screen_width]
call integer_division
mov [stretch_img_high],eax
mov ebx,[img_high]
sub ebx,eax
shr ebx,1
mov [stretch_start_coordinates.y],bx
.continue:
mov ebx,[screen_width]
shl ebx,16
add ebx,[screen_high]
mov eax,[stretch_img_width]
shl eax,16
add eax,[stretch_img_high]
push dword eax ; eax - crop size
push dword 0 ; edi - background color
push dword 1 ; esi - filtering
push dword 0 ; edx - scaling mode
push dword [stretch_start_coordinates] ; ecx - start_coordinates
push ebx ; ebx - new_size
push dword image_file ; eax - convert data table
 
call [Scaling_Start]
call background_1
ret
;---------------------------------------------------------------------
;.stretch_inscribe:
; ret
;---------------------------------------------------------------------
background_1:
mov ecx,[screen_width] ;[crop_img_width] ; øèðèíà
test ecx,ecx
jz .end
mov edx,[screen_high] ;[crop_img_high] ; âûñîòà 
test edx,edx
jz .end
mcall 15,1 ; set size
 
mov esi,ecx
imul esi,edx
lea esi,[esi*3]
mov ecx,[raw_pointer_2] ;[soi]
mov eax,[ecx+28]
add ecx,eax
 
xor edx,edx
 
mov eax,[raw_pointer_2]
mov eax,[eax+12] ;overall depth of the pixel
cmp al,24
je @f
 
mov eax,[raw_pointer_2]
mov [crop_raw_pointer],eax
push dword crop_image_file
call [convert_Conv_24b]
mov ecx,[crop_raw_pointer_2]
add ecx,44
mcall 15,5 ;15,5 set data
mcall 68,13,[crop_raw_pointer_2]
jmp .set_mode
@@:
mcall 15,5 ; 15,5 set data
.set_mode:
xor ecx,ecx
inc ecx
; mov ecx,[bgrmode]
mcall 15,4 ; 15,4 set mode
dec ebx ; 15,3 redraw background
mcall
.end:
mov ecx,[raw_pointer_2]
mcall 68,13
ret
;---------------------------------------------------------------------
/programs/media/zsea/data.inc
38,7 → 38,7
db 0
;---------------------------------------------------------------------
Authors_text:
.1: db 'zSea version: 1.00 RC3 Date: 24/08/2011',0
.1: db 'zSea version: 1.00 RC4 Date: 07/09/2011',0
.2: db 'Authors:',0
.3: db 'Marat Zakiyanov aka Mario(Mario79)',0
.4: db 'zSea program, modules: cnv_bmp.obj,',0
198,11 → 198,27
dd 5000
 
zoom_factors_old dd 0
 
;---------------------------------------------------------------------
; not change this section!!!
; start section
;---------------------------------------------------------------------
align 4
crop_image_file dd 0 ;+0
crop_raw_pointer dd 0 ;+4
crop_return_code dd 0 ;+8
crop_img_size dd 0 ;+12
crop_deflate_unpack dd 0 ;+16
crop_raw_pointer_2 dd 0 ;+20
;---------------------------------------------------------------------
; end section
;---------------------------------------------------------------------
 
;---------------------------------------------------------------------
; not change this section!!!
; start section
;---------------------------------------------------------------------
align 4
image_file dd 0 ;+0
raw_pointer dd 0 ;+4
return_code dd 0 ;+8
234,23 → 250,36
 
skin_height dd 0
 
RAW1_pointer dd 0
RAW1_size_x dd 0
RAW1_size dd 0
Repeat_N dd 0
Total_Repeat_N dd 1
screen_high dd 0
screen_width dd 0
 
stretch_start_coordinates:
.y dw 0
.x dw 0
 
screen_relation dd 0
picture_relation dd 0
 
stretch_img_high dd 0
stretch_img_width dd 0
 
RAW1_pointer dd 0
RAW1_size_x dd 0
RAW1_size dd 0
Repeat_N dd 0
Total_Repeat_N dd 1
previous_frame_pointer dd 0
Animation_timer dd 0
Frame_delay dw 0
Transp_flag db 0
Animation_timer dd 0
Frame_delay dw 0
Transp_flag db 0
Transp_index db 0
Disposal_Method db 0
RAW1_flag db 0
no_fill db 0
Disposal_Method db 0
RAW1_flag db 0
no_fill db 0
redraw_wallpaper_flag db 0
 
calc_next_value_plus db 0
calc_next_value_minus db 0
calc_next_value_plus db 0
calc_next_value_minus db 0
;---------------------------------------------------------------------
align 4
;plugin dd 0
871,9 → 900,9
.e1:
.2 db 'Stretch'
.e2:
.3 db 'Stretch + V crop'
.3 db 'Stretch + Crop'
.e3:
.4 db 'Stretch + H crop'
.4 db 'Stretch + Inscribe'
.e4:
 
option_group1 dd op1
/programs/media/zsea/plugins/convert/convert.asm
42,449 → 42,448
START:
pushad
mov eax,dword [esp+36]
mov [pointer],eax
mov eax,[eax+4]
mov [image_file],eax
mov esi,[eax+28]
add esi,eax
mov edi,esi
mov ecx,[eax+32]
; xor ebx,ebx
; mov [raw_area],ebx
 
; mov ebx,[pointer]
; movzx eax,word [eax+18]
; mov [ebx+24],eax
; jmp .ret_ok
mov [pointer],eax
mov eax,[eax+4]
mov [image_file],eax
mov esi,[eax+28]
add esi,eax
mov edi,esi
mov ecx,[eax+32]
cmp [eax+16],word 16
je .16b
cmp [eax+12],dword 1
je .1b
cmp [eax+12],dword 2
je .2b
cmp [eax+12],dword 4
je .4b
cmp [eax+16],word 16
je .16b
cmp [eax+12],dword 1
je .1b
cmp [eax+12],dword 2
je .2b
cmp [eax+12],dword 4
je .4b
;---------------------------------------------------------------------
.ret_ok:
; mov ebx,[pointer]
; mov eax,[raw_area]
; mov [ebx+20],eax ; store RAW pointer
; mov [ebx+24],ecx
 
mov ebx,[image_file]
cmp [ebx+18],word 2
jne @f
mov eax,[ebx+12]
shr eax,1
mov [ebx+12],eax
mov ebx,[image_file]
cmp [ebx+18],word 2
jne @f
mov eax,[ebx+12]
shr eax,1
mov [ebx+12],eax
@@:
popad
ret 4
;---------------------------------------------------------------------
.less_8b:
mov edx,[image_file]
mov ecx,[area_size]
add ecx,[edx+28]
mcall 68,20
mov [image_file],eax
mov edx,[image_file]
mov ecx,[area_size]
add ecx,[edx+28]
mcall 68,20
mov [image_file],eax
 
mov ecx,[area_size]
mov eax,ecx
shr ecx,2
test eax,3
jz @f
inc ecx
mov ecx,[area_size]
mov eax,ecx
shr ecx,2
test eax,3
jz @f
inc ecx
@@:
mov esi,[raw_area]
mov edi,[image_file]
add edi,[edi+28]
mov esi,[raw_area]
mov edi,[image_file]
add edi,[edi+28]
cld
rep movsd
mov ecx,[raw_area]
mcall 68,13
mov eax,[image_file]
mov ebx,[pointer]
mov [ebx+4],eax
rep movsd
 
mcall 68,13,[raw_area]
mov eax,[image_file]
mov ebx,[pointer]
mov [ebx+4],eax
popad
ret 4
;---------------------------------------------------------------------
.16b:
cmp [eax+18],word 3
je @f ;.convert_16_in_8
cmp [eax+18],word 4
jne .16b_1
; eax - RAW image_file
cmp [eax+18],word 3
je @f
cmp [eax+18],word 4
jne .16b_1
@@:
xor ebx,ebx
mov bx,[eax+18]
xor ebx,ebx
mov bx,[eax+18]
xchg eax,ecx
xor edx,edx
div ebx
xchg ecx,eax
xchg eax,ecx
xor edx,edx
div ebx
xchg ecx,eax
shr ecx,1
shr ecx,1
mov [eax+16],word 8
mov ebx,[eax+12]
shr ebx,1
mov [eax+12],ebx
mov [eax+16],word 8
mov ebx,[eax+12]
shr ebx,1
mov [eax+12],ebx
 
mov ebx,eax
; jmp .ret_ok
mov ebx,eax
.convert_16_in_8: ; converting 16 bit sample to 8 bit
cld
lodsw
mov al,ah
mov al,ah
stosb
lodsw
mov al,ah
mov al,ah
stosb
lodsw
mov al,ah
mov al,ah
stosb
cmp [ebx+18],word 4
jne @f
cmp [ebx+18],word 4
jne @f
lodsw
mov al,ah
mov al,ah
stosb
@@:
dec ecx
jnz .convert_16_in_8
jmp .16b_end
dec ecx
jnz .convert_16_in_8
jmp .16b_end
;---------------------------------------------------------------------
.16b_1:
cmp [eax+18],word 1
je @f ;.convert_16_in_8_1
cmp [eax+18],word 2
jne .16b_end
; eax - RAW image_file
cmp [eax+18],word 1
je @f
cmp [eax+18],word 2
jne .16b_end
@@:
shr ecx,1
shr ecx,1
mov [eax+16],word 8
mov ebx,[eax+12]
shr ebx,1
mov [eax+12],ebx
mov [eax+16],word 8
mov ebx,[eax+12]
shr ebx,1
mov [eax+12],ebx
.convert_16_in_8_1:
cld
lodsw
; shr ax,8
; mov al,ah
stosb
dec ecx
jnz .convert_16_in_8_1
dec ecx
jnz .convert_16_in_8_1
;---------------------------------------------------------------------
.16b_end:
xor eax,eax
mov [raw_area],eax
jmp .ret_ok
xor eax,eax
mov [raw_area],eax
jmp .ret_ok
;---------------------------------------------------------------------
.4b:
call .get_memory
mov edx,ebx
inc ebx
shr ebx,1
call .get_memory
mov edx,ebx
inc ebx
shr ebx,1
.4b_1:
push ebx edi
push ebx edi
@@:
cld
lodsb
shl eax,8
mov al,ah
and ah,0xf
shr al,4
shl eax,8
mov al,ah
and ah,0xf
shr al,4
stosw
dec ebx
jnz @b
pop edi ebx
add edi,edx
dec ecx
jnz .4b_1
dec ebx
jnz @b
pop edi ebx
add edi,edx
dec ecx
jnz .4b_1
jmp .less_8b ;.ret_ok
jmp .less_8b
;---------------------------------------------------------------------
.2b:
call .get_memory
; jmp .ret_ok
; shr ecx,1
mov edx,ebx
mov eax,ebx
shr ebx,2
test eax,3
jz @f
inc ebx
call .get_memory
mov edx,ebx
mov eax,ebx
shr ebx,2
test eax,3
jz @f
inc ebx
@@:
mov ebp,ebx
mov ebp,ebx
.2b_1:
push ebp edi
push ebp edi
@@:
cld
lodsb
mov bl,al
mov bl,al
and al,11b
shl ax,8
and al,11b
shl ax,8
mov al,bl
shr al,2
and al,11b
shl eax,8
mov al,bl
shr al,2
and al,11b
shl eax,8
mov al,bl
shr al,4
and al,11b
shl eax,8
mov al,bl
shr al,4
and al,11b
shl eax,8
mov al,bl
shr al,6
and al,11b
mov al,bl
shr al,6
and al,11b
stosd
 
dec ebp
jnz @b
pop edi ebp
dec ebp
jnz @b
pop edi ebp
add edi,edx
dec ecx
jnz .2b_1
add edi,edx
dec ecx
jnz .2b_1
jmp .less_8b ;.ret_ok
jmp .less_8b
;---------------------------------------------------------------------
.1b:
call .get_memory
mov edx,ebx
mov eax,ebx
shr ebx,3
test eax,7
jz @f
inc ebx
call .get_memory
mov edx,ebx
mov eax,ebx
shr ebx,3
test eax,7
jz @f
inc ebx
@@:
mov ebp,ebx
mov ebp,ebx
.1b_1:
push ebp edi
push ebp edi
@@:
cld
lodsb
mov bl,al
shr al,4
and al,1b
shl ax,8
mov bl,al
shr al,4
and al,1b
shl ax,8
mov al,bl
shr al,5
and al,1b
shl eax,8
mov al,bl
shr al,5
and al,1b
shl eax,8
mov al,bl
shr al,6
and al,1b
shl eax,8
mov al,bl
shr al,6
and al,1b
shl eax,8
mov al,bl
shr al,7
; and al,1b
; shl eax,8
mov al,bl
shr al,7
stosd
mov al,bl
and al,1b
shl ax,8
mov al,bl
and al,1b
shl ax,8
mov al,bl
shr al,1
and al,1b
shl eax,8
mov al,bl
shr al,1
and al,1b
shl eax,8
 
mov al,bl
shr al,2
and al,1b
shl eax,8
mov al,bl
shr al,2
and al,1b
shl eax,8
mov al,bl
shr al,3
and al,1b
mov al,bl
shr al,3
and al,1b
stosd
dec ebp
jnz @b
pop edi ebp
dec ebp
jnz @b
pop edi ebp
add edi,edx
dec ecx
jnz .1b_1
jmp .less_8b ;.ret_ok
add edi,edx
dec ecx
jnz .1b_1
 
jmp .less_8b
;---------------------------------------------------------------------
.get_memory:
mov ebx,dword 8
mov [eax+16],bx
mov [eax+12],ebx
; mov esi,[eax+28]
; add esi,eax
; push ecx
mov ecx,[eax+4]
imul ecx,[eax+8]
push eax
mov [area_size],ecx
mcall 68,12
; pop ecx
mov [raw_area],eax
mov edi,eax
pop eax
mov ebx,[eax+4]
mov ecx,[eax+8]
; eax - RAW image_file
mov ebx,dword 8
mov [eax+16],bx
mov [eax+12],ebx
mov ecx,[eax+4]
imul ecx,[eax+8]
push eax
mov [area_size],ecx
mcall 68,12
mov [raw_area],eax
mov edi,eax
pop eax
mov ebx,[eax+4]
mov ecx,[eax+8]
ret
;---------------------------------------------------------------------
Convert24b:
pushad
mov eax,dword [esp+36]
mov [pointer],eax
mov eax,[eax+4]
mov [image_file],eax
mov [pointer],eax
mov eax,[eax+4]
mov [image_file],eax
 
mov esi,[eax+28]
add esi,eax
mov esi,[eax+28]
add esi,eax
 
mov ebp,[eax+20]
add ebp,eax
mov ebp,[eax+20]
add ebp,eax
mov ecx,[eax+4]
imul ecx,[eax+8]
push eax ecx
lea ecx,[ecx*3]
mcall 68,12
mov [raw_area],eax
mov edi,eax
pop ecx eax
mov ecx,[eax+4]
imul ecx,[eax+8]
push eax ecx
lea ecx,[ecx*3]
mov edx,ecx
add ecx,44 ; header
mcall 68,12 ;get new RAW area
mov [raw_area],eax
mov edi,eax
push esi
mov esi,[image_file]
mov ecx,3
cld
rep movsd ;copy the 3 first dword for the structure of RAW
pop esi
sub edi,12
mov [edi+12],dword 24 ;overall depth of the pixel
mov [edi+16],word 8 ;channel depth of the pixel
xor eax,eax
mov [edi+20],eax ;palette area pointer
mov [edi+24],eax ;palette area size
mov [edi+28],dword 44 ;rgb area pointer
mov [edi+32],edx ;rgb area size
mov [edi+36],eax ;transparency area pointer
mov [edi+40],eax ;transparency area size
pop ecx eax
add edi,44
 
cmp [eax+12],dword 32
je .32b
cmp [eax+12],dword 16
je .16b
cmp [eax+12],dword 15
je .15b
cmp [eax+12],dword 8
je .8b
cmp [eax+12],dword 32
je .32b
cmp [eax+12],dword 16
je .16b
cmp [eax+12],dword 15
je .15b
cmp [eax+12],dword 8
je .8b
.ret_ok:
mov ebx,[pointer]
mov eax,[raw_area]
mov [ebx+20],eax ; store RAW pointer
mov ebx,[pointer]
mov eax,[raw_area]
mov [ebx+20],eax ; store RAW pointer
popad
ret 4
 
;---------------------------------------------------------------------
.32b:
cld
lodsd
stosw
shr eax,16
shr eax,16
stosb
dec ecx
jnz .32b
dec ecx
jnz .32b
jmp .ret_ok
jmp .ret_ok
;---------------------------------------------------------------------
.16b:
cld
lodsw
xor ebx,ebx
ror ax,11
mov bl,al
and bl,11111b
shl bl,3
shl ebx,8
rol ax,6
mov bl,al
and bl,111111b
shl bl,2
shl ebx,8
rol ax,5
mov bl,al
and bl,11111b
shl bl,3
mov eax,ebx
xor ebx,ebx
ror ax,11
mov bl,al
and bl,11111b
shl bl,3
shl ebx,8
rol ax,6
mov bl,al
and bl,111111b
shl bl,2
shl ebx,8
rol ax,5
mov bl,al
and bl,11111b
shl bl,3
mov eax,ebx
cld
stosw
shr eax,16
shr eax,16
stosb
dec ecx
jnz .16b
dec ecx
jnz .16b
jmp .ret_ok
jmp .ret_ok
;---------------------------------------------------------------------
.15b:
cld
lodsw
xor ebx,ebx
ror ax,10
mov bl,al
and bl,11111b
shl bl,3
shl ebx,8
rol ax,5
mov bl,al
and bl,11111b
shl bl,3
shl ebx,8
rol ax,5
mov bl,al
and bl,11111b
shl bl,3
mov eax,ebx
xor ebx,ebx
ror ax,10
mov bl,al
and bl,11111b
shl bl,3
shl ebx,8
rol ax,5
mov bl,al
and bl,11111b
shl bl,3
shl ebx,8
rol ax,5
mov bl,al
and bl,11111b
shl bl,3
mov eax,ebx
cld
stosw
shr eax,16
shr eax,16
stosb
dec ecx
jnz .15b
dec ecx
jnz .15b
jmp .ret_ok
jmp .ret_ok
;---------------------------------------------------------------------
.8b:
xor eax,eax
xor eax,eax
cld
lodsb
shl eax,2
mov eax,[eax+ebp]
shl eax,2
mov eax,[eax+ebp]
cld
stosw
shr eax,16
shr eax,16
stosb
dec ecx
jnz .8b
dec ecx
jnz .8b
jmp .ret_ok
jmp .ret_ok
;---------------------------------------------------------------------
align 16
EXPORTS:
dd szStart, START
dd szVersion, 0x00010002
dd szConv_24b, Convert24b
dd 0
dd szStart, START
dd szVersion, 0x00010003
dd szConv_24b, Convert24b
dd 0
 
szStart db 'START',0
szVersion db 'version',0
/programs/media/zsea/plugins/scaling/scaling.asm
38,173 → 38,168
;---------------------------------------------------------------------
START:
pushad
mov edi,dword [esp+56]
mov esi,dword [esp+52]
mov edx,dword [esp+48]
mov ecx,dword [esp+44]
mov ebx,dword [esp+40]
mov eax,dword [esp+36]
mov [pointer],eax
test bx,bx
jnz @f
inc bx
mov eax,dword [esp+60] ; eax - crop size
mov ebx,eax
and eax,0xffff
shr ebx,16
mov [crop_x],ebx
mov [crop_y],eax
mov edi,dword [esp+56] ; edi - background color
mov esi,dword [esp+52] ; esi - filtering
mov edx,dword [esp+48] ; edx - scaling mode
mov ecx,dword [esp+44] ; ecx - start_coordinates
mov ebx,dword [esp+40] ; ebx - new_size
mov eax,dword [esp+36] ; eax - convert data table
mov [pointer],eax
test bx,bx
jnz @f
inc bx
@@:
ror ebx,16
test bx,bx
jnz @f
inc bx
ror ebx,16
test bx,bx
jnz @f
inc bx
@@:
rol ebx,16
mov [new_size],ebx
mov [start_coordinates],ecx
mov [scaling_mode],edx
mov [filtering],esi
mov [background_color],edi
mov eax,[eax+4]
mov [image_file],eax
rol ebx,16
mov [new_size],ebx
mov [start_coordinates],ecx
mov [scaling_mode],edx
mov [filtering],esi
mov [background_color],edi
mov eax,[eax+4]
mov [image_file],eax
 
mov esi,[eax+28]
add esi,eax
mov esi,[eax+28]
add esi,eax
mov ebx,[eax+20]
add ebx,eax
mov [palette],ebx
mov ebx,[eax+20]
add ebx,eax
mov [palette],ebx
mov ebx,[eax+12]
mov [resolution],ebx
cmp ebx,32
jne @f
mov ebp,dword START.32
jmp .1
mov ebx,[eax+12]
mov [resolution],ebx
cmp ebx,32
jne @f
mov ebp,dword START.32
jmp .1
@@:
cmp ebx,24
jne @f
mov ebp,dword START.24
jmp .1
cmp ebx,24
jne @f
mov ebp,dword START.24
jmp .1
@@:
cmp ebx,16
jne @f
mov ebp,dword START.16
jmp .1
cmp ebx,16
jne @f
mov ebp,dword START.16
jmp .1
@@:
cmp ebx,15
jne @f
inc ebx
mov ebp,dword START.16
jmp .1
cmp ebx,15
jne @f
inc ebx
mov ebp,dword START.16
jmp .1
@@:
cmp ebx,8
jne @f
mov ebp,dword START.8
cmp ebx,8
jne @f
mov ebp,dword START.8
@@:
.1:
shr ebx,3
mov [bytes_to_pixel],ebx
shr ebx,3
mov [bytes_to_pixel],ebx
mov ebx,[eax+8]
mov [y],ebx
mov ebx,[eax+4]
mov [x],ebx
imul ebx,[bytes_to_pixel]
mov [size_x],ebx
mov ebx,[eax+8]
mov [y],ebx
mov ebx,[eax+4]
mov [x],ebx
imul ebx,[bytes_to_pixel]
mov [size_x],ebx
mov eax,100
shl eax,12
mov ebx,[scaling_mode]
test ebx,ebx
jnz @f
inc ebx
mov eax,[crop_y]
test eax,eax
jz @f
mov [y],eax
@@:
xor edx,edx
div ebx
mov [scaling_delta],eax
call .get_memory
cmp [scaling_mode],0
jne @f
call .scaling
jmp .ret_ok
mov eax,[crop_x]
test eax,eax
jz @f
mov [x],eax
@@:
call .scaling_2
mov eax,100
shl eax,12
mov ebx,[scaling_mode]
test ebx,ebx
jnz @f
inc ebx
@@:
xor edx,edx
div ebx
mov [scaling_delta],eax
call .get_memory
call .scaling
;---------------------------------------------------------------------
.ret_ok:
mcall 68,13,[area_for_x]
mov ebx,[pointer]
mov eax,[raw_area]
mov [ebx+20],eax ; store RAW pointer
; movzx eax,word [new_size.x1]
; mov [ebx+24],esi ;eax
; movzx eax,word [new_size.y1]
; mov [ebx+28],eax
; mov eax,[size_x]
; mov [ebx+32],eax
; mov eax,[bytes_to_pixel]
; mov [ebx+36],eax
; mov eax,[x]
; mov [ebx+40],eax
; mov eax,[y]
; mov [ebx+44],eax
mcall 68,13,[area_for_x]
mov ebx,[pointer]
mov eax,[raw_area]
mov [ebx+20],eax ; store RAW pointer
; movzx eax,word [new_size.x1]
; mov [ebx+24],esi ;eax
; movzx eax,word [new_size.y1]
; mov [ebx+28],eax
; mov eax,[size_x]
; mov [ebx+32],eax
; mov eax,[bytes_to_pixel]
; mov [ebx+36],eax
; mov eax,[x]
; mov [ebx+40],eax
; mov eax,[y]
; mov [ebx+44],eax
.exit:
popad
ret 24
ret 28
;---------------------------------------------------------------------
align 4
.scaling:
xor ecx,ecx
.y:
xor ebx,ebx
;-------------------------
.x:
call ebp
inc ebx
cmp bx,[new_size.x1]
jb .x
;-------------------------
inc ecx
cmp cx,[new_size.y1]
jb .y
ret
;---------------------------------------------------------------------
align 4
.scaling_2:
xor eax,eax
mov ax,[start_coordinates.y]
imul eax,[size_x]
add esi,eax
xor eax,eax
mov ax,[start_coordinates.x]
imul eax,[bytes_to_pixel]
add esi,eax
xor eax,eax
mov ax,[start_coordinates.y]
imul eax,[size_x]
add esi,eax
xor eax,eax
mov ax,[start_coordinates.x]
imul eax,[bytes_to_pixel]
add esi,eax
xor eax,eax
dec eax
mov [temp_y],eax
xor eax,eax
dec eax
mov [temp_y],eax
xor ecx,ecx
xor ecx,ecx
align 4
.y_2:
xor ebx,ebx
xor ebx,ebx
;-------------------------
align 4
.x_2:
call ebp
inc ebx
cmp bx,[new_size.x1]
jb .x_2
call ebp
inc ebx
cmp bx,[new_size.x1]
jb .x_2
;-------------------------
inc ecx
cmp cx,[new_size.y1]
jb .y_2
inc ecx
cmp cx,[new_size.y1]
jb .y_2
ret
;---------------------------------------------------------------------
align 4
.32:
push ecx ebx
call .calculate_pixel
mov eax,[ecx]
call .check_filtering_32
pop ebx ecx
push ecx ebx
call .calculate_pixel
mov eax,[ecx]
call .check_filtering_32
pop ebx ecx
cld
stosd
ret
211,14 → 206,14
;---------------------------------------------------------------------
align 4
.24:
push ecx ebx
call .calculate_pixel
mov eax,[ecx]
call .check_filtering_24
push ecx ebx
call .calculate_pixel
mov eax,[ecx]
call .check_filtering_24
cld
stosw
shr eax,16
pop ebx ecx
shr eax,16
pop ebx ecx
cld
stosb
ret
225,12 → 220,12
;---------------------------------------------------------------------
align 4
.16:
push ecx ebx
call .calculate_pixel
xor eax,eax
mov ax,[ecx]
call .check_filtering_16
pop ebx ecx
push ecx ebx
call .calculate_pixel
xor eax,eax
mov ax,[ecx]
call .check_filtering_16
pop ebx ecx
cld
stosw
ret
237,21 → 232,21
;---------------------------------------------------------------------
align 4
.8:
push ecx ebx
call .calculate_pixel
cmp [filtering],0
jne @f
mov al,[ecx]
pop ebx ecx
push ecx ebx
call .calculate_pixel
cmp [filtering],0
jne @f
mov al,[ecx]
pop ebx ecx
cld
stosb
ret
@@:
call .check_filtering_8
call .check_filtering_8
cld
stosw
shr eax,16
pop ebx ecx
shr eax,16
pop ebx ecx
cld
stosb
ret
259,172 → 254,231
;---------------------------------------------------------------------
align 4
.calculate_pixel:
test ecx,ecx
jz .offset_x
test ecx,ecx
jz .offset_x
;.offset_y:
mov eax,ecx
mov eax,ecx
mov ecx,[temp_y]
cmp eax,ecx
jne .new_y
mov eax,[temp_y_offset]
mov ecx,eax
jmp .offset_x
mov ecx,[temp_y]
cmp eax,ecx
jne .new_y
mov eax,[temp_y_offset]
mov ecx,eax
jmp .offset_x
;--------------------------------
align 4
.new_y:
mov [temp_y],eax
 
mov ebx,[scaling_mode]
test ebx,ebx
jz @f
imul eax,[scaling_delta]
mov [temp_y],eax
mov ebx,[scaling_mode]
test ebx,ebx
jz @f
imul eax,[scaling_delta]
;--------------------------------
push ebx
mov ebx,eax
shr eax,12
and ebx,0xFFF
shl ebx,7 ;multiply 128
shr ebx,12
mov [next_pixel_y],ebx
pop ebx
push ebx
mov ebx,eax
shr eax,12
and ebx,0xFFF
shl ebx,7 ;multiply 128
shr ebx,12
mov [next_pixel_y],ebx
pop ebx
;--------------------------------
jmp .ex_1
jmp .ex_1
;--------------------------------
align 4
@@:
imul eax,dword [y]
;--------------------------------
imul eax,dword [y]
mov bx,word [new_size.y1]
align 4
@@:
mov bx,word [new_size.y1]
;--------------------------------
align 4
.y_div:
test ebx,ebx
jnz @f
inc ebx
test ebx,ebx
jnz @f
inc ebx
;--------------------------------
align 4
@@:
xor edx,edx
div ebx
xor edx,edx
div ebx
;--------------------------------
push eax
mov eax,edx
shl eax,7 ;multiply 128
xor edx,edx
div ebx
mov [next_pixel_y],eax
pop eax
push eax
mov eax,edx
shl eax,7 ;multiply 128
xor edx,edx
div ebx
mov [next_pixel_y],eax
pop eax
;--------------------------------
align 4
.ex_1:
mov [temp_y1],eax
imul eax,[size_x]
mov [temp_y1],eax
imul eax,[size_x]
 
mov [temp_y_offset],eax
mov ecx,eax
mov [temp_y_offset],eax
mov ecx,eax
align 4
.offset_x:
test ebx,ebx
jz .finish
mov eax,[esp+4] ;ebx
test ebx,ebx
jz .finish
mov eax,[esp+4] ;ebx
mov edx,[esp+8]
test edx,edx
jz .continue
shl eax,3
add eax,[area_for_x]
mov edx,[eax+4]
mov [next_pixel_x],edx
mov eax,[eax]
jmp .ex_3
mov edx,[esp+8]
test edx,edx
jz .continue
shl eax,3
add eax,[area_for_x]
mov edx,[eax+4]
mov [next_pixel_x],edx
mov eax,[eax]
jmp .ex_3
;--------------------------------
align 4
.continue:
mov ebx,[scaling_mode]
test ebx,ebx
jz @f
imul eax,[scaling_delta]
mov ebx,[scaling_mode]
test ebx,ebx
jz @f
imul eax,[scaling_delta]
;--------------------------------
mov ebx,eax
shr eax,12
and ebx,0xFFF
shl ebx,7 ;multiply 128
shr ebx,12
mov [next_pixel_x],ebx
mov ebx,eax
shr eax,12
and ebx,0xFFF
shl ebx,7 ;multiply 128
shr ebx,12
mov [next_pixel_x],ebx
;--------------------------------
jmp .ex_2
jmp .ex_2
;--------------------------------
align 4
@@:
imul eax,dword [x]
mov bx,word [new_size.x1]
imul eax,dword [x]
;--------------------------------
align 4
@@:
mov bx,word [new_size.x1]
;--------------------------------
align 4
.x_div:
test ebx,ebx
jnz @f
inc ebx
test ebx,ebx
jnz @f
inc ebx
align 4
@@:
xor edx,edx
div ebx
xor edx,edx
div ebx
;--------------------------------
push eax
mov eax,edx
shl eax,7 ;multiply 128
xor edx,edx
div ebx
mov [next_pixel_x],eax
pop eax
push eax
mov eax,edx
shl eax,7 ;multiply 128
xor edx,edx
div ebx
mov [next_pixel_x],eax
pop eax
;--------------------------------
align 4
.ex_2:
mov edx,[bytes_to_pixel]
mov ebx,eax
xor eax,eax
mov edx,[bytes_to_pixel]
mov ebx,eax
xor eax,eax
align 4
@@:
add eax,ebx
dec edx
jnz @r
add eax,ebx
dec edx
jnz @r
mov ebx,[esp+4]
shl ebx,3
add ebx,[area_for_x]
mov [ebx],eax
mov edx,[next_pixel_x]
mov [ebx+4],edx
mov ebx,[esp+4]
shl ebx,3
add ebx,[area_for_x]
mov [ebx],eax
mov edx,[next_pixel_x]
mov [ebx+4],edx
align 4
.ex_3:
mov [temp_x1],eax
add ecx,eax
mov [temp_x1],eax
add ecx,eax
align 4
.finish:
add ecx,esi
add ecx,esi
ret
;---------------------------------------------------------------------
align 4
.get_memory:
xor ecx,ecx
mov cx,[new_size.x1]
shl ecx,3
mcall 68,12
mov [area_for_x],eax
xor ecx,ecx
mov ebx,[new_size]
mov cx,bx
shr ebx,16
imul ecx,ebx ;[eax+8]
mov eax,[bytes_to_pixel]
cmp eax,1
jne @f
mov eax,3
@@:
imul ecx,eax
mov edx,ecx
add ecx,44
mov eax,[image_file]
add ecx,[eax+24] ;palette area size
mcall 68,12
mov [raw_area],eax
mov edi,eax
; create RAW header
push esi
mov esi,[image_file]
mov ecx,44/4
cld
rep movsd ;copy the 3 first dword for the structure of RAW
mov edi,[raw_area]
movzx eax,word [new_size.x1]
mov [edi+4],eax
movzx eax,word [new_size.y1]
mov [edi+8],eax
mov [edi+32],edx ;rgb area size
xor eax,eax
mov [edi+36],eax ;transparency area pointer
mov [edi+40],eax ;transparency area size
cmp [filtering],eax ;0 or 1
je @f
 
xor ecx,ecx
mov cx,[new_size.x1]
shl ecx,3
mcall 68,12
mov [area_for_x],eax
mov [edi+20],eax ;palette area pointer
mov [edi+24],eax ;palette area size
mov [edi+28],dword 44 ;rgb area pointer
cmp [edi+12],dword 8 ;overall depth of the pixel
ja .not_overall_depth_8
xor ecx,ecx
mov ebx,[new_size]
mov cx,bx
shr ebx,16
imul ecx,ebx ;[eax+8]
mov eax,[bytes_to_pixel]
cmp eax,1
jne @f
mov eax,3
mov [edi+12],dword 24 ;overall depth of the pixel
mov [edi+16],word 8 ;channel depth of the pixel
.not_overall_depth_8:
add edi,44
jmp .end
@@:
imul ecx,eax
mcall 68,12
mov [raw_area],eax
mov edi,eax
mov eax,[edi+24]
add edi,44
test eax,eax ;palette area is present?
jz @f
sub esi,44
mov ecx,[esi+24]
shr ecx,2
add esi,[esi+20]
cld
rep movsd ;copy palette area
@@:
 
.end:
pop esi
ret
;---------------------------------------------------------------------
include 'b_filter.inc'
431,9 → 485,9
;---------------------------------------------------------------------
align 4
EXPORTS:
dd szStart, START
dd szVersion, 0x00010002
dd 0
dd szStart, START
dd szVersion, 0x00010003
dd 0
 
szStart db 'START',0
szVersion db 'version',0
442,14 → 496,17
pointer dd 0
image_file dd 0
new_size:
.y1: dw 0
.x1: dw 0
.y1: dw 0
.x1: dw 0
 
x: dd 0
y: dd 0
x: dd 0
y: dd 0
 
crop_x dd 0
crop_y dd 0
 
size_x dd 0
bytes_to_pixel dd 0
bytes_to_pixel dd 0
 
start_coordinates:
.y dw 0
457,31 → 514,31
 
scaling_mode dd 0
raw_area dd 0
scaling_delta dd 0
scaling_delta dd 0
 
area_for_x dd 0
area_for_x dd 0
 
temp_y dd 0
temp_y_offset dd 0
temp_y dd 0
temp_y_offset dd 0
 
resolution dd 0
resolution dd 0
 
filtering dd 0
filtering dd 0
 
next_pixel_y dd 0
next_pixel_x dd 0
next_pixel_y dd 0
next_pixel_x dd 0
 
temp_y1 dd 0
temp_x1 dd 0
temp_y1 dd 0
temp_x1 dd 0
 
B_sample dd 0
G_sample dd 0
R_sample dd 0
B_sample dd 0
G_sample dd 0
R_sample dd 0
 
B_sample_1 dd 0
G_sample_1 dd 0
R_sample_1 dd 0
B_sample_1 dd 0
G_sample_1 dd 0
R_sample_1 dd 0
 
palette dd 0
palette dd 0
 
background_color dd 0
background_color dd 0
/programs/media/zsea/win_bcgr.inc
44,9 → 44,23
jmp .still
;---------------------------------------------------------------------
@@:
cmp [option_group1],op2
jne @f
mov [bgrmode],dword 2
jmp .still
;---------------------------------------------------------------------
@@:
cmp [option_group1],op3
jne @f
mov [bgrmode],dword 3
jmp .still
;---------------------------------------------------------------------
@@:
; cmp [option_group1],op4
; jne .still
mov [bgrmode],dword 4
jmp .still
;---------------------------------------------------------------------
.key:
mcall
cmp ah,27
/programs/media/zsea/win_info.inc
77,6 → 77,7
add edx,10
mcall ,,[Total_Repeat_N]
 
; mcall 47,0x80000,[PID2],<200, 5>,0xffffff
; mcall 47,0x800a0000,[error_locate],<140,5>,0x10ffffff
mcall 12,2
/programs/media/zsea/zSea.asm
25,7 → 25,7
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
; v.1.0 rñ3 24.08.2011
; v.1.0 rñ4 07.09.2011
;******************************************************************************
use32
org 0x0
/programs/media/zsea/zoom.inc
40,11 → 40,11
push dword image_file
; call [plugin_rotate]
call [rotate_Start]
mov ebx,[raw_pointer]
mov eax,[ebx+4]
mov [img_width],eax
mov eax,[ebx+8]
mov [img_high],eax
mov ebx,[raw_pointer]
mov eax,[ebx+4]
mov [img_width],eax
mov eax,[ebx+8]
mov [img_high],eax
call convert.img_resolution_ok
jmp kopen.1
;---------------------------------------------------------------------
67,10 → 67,6
mov [zoom_factors],dword zoom_factors.100
mov eax,[eax]
jmp zoom_plus.2
; call calculate_arrows_offset
; call draw_zoom_factors
; jmp red
;---------------------------------------------------------------------
scaling:
mov eax,[soi]
114,10 → 110,6
.fill_for_L_R:
cmp [no_fill],1
je @f
; xor eax,eax
; mov [no_fill],al
; ret
;@@:
pusha
mov ebx,[image_start_coordinates]
mov ecx,ebx
130,7 → 122,6
add bx,ax
add bx,[wa_width_2]
mov ax,[wa_width_1]
; add ax,5
sub ax,bx
rol ebx,16
mov bx,ax
142,10 → 133,6
.fill_for_U_D:
cmp [no_fill],1
je @f
; xor eax,eax
; mov [no_fill],al
; ret
;@@:
pusha
mov ebx,[image_start_coordinates]
mov ecx,ebx
222,13 → 209,14
movzx esi,byte [filtering_flag]
; mov edi,[background_color]
 
push dword [background_color] ;edi - background color
push esi ; esi - filtering
push dword [scaling_mode] ;edx - scaling mode
push ecx ; ecx - start_coordinates
push ebx ; ebx - new_size
push dword image_file ;eax - convert data table
push dword 0 ; eax - crop size
push dword [background_color] ; edi - background color
push esi ; esi - filtering
push dword [scaling_mode] ; edx - scaling mode
push ecx ; ecx - start_coordinates
push ebx ; ebx - new_size
push dword image_file ; eax - convert data table
 
; pusha
; mcall 26,9
; mov [test1],eax
255,17 → 243,17
 
mov edx,[image_start_coordinates]
 
mov eax,edx
shl eax,16
mov ax,cx
mov [scroll_bar_data_vertical.y],eax
mov eax,edx
shl eax,16
mov ax,cx
mov [scroll_bar_data_vertical.y],eax
mov eax,edx
mov ebx,ecx
shr ebx,16
mov ax,bx
mov [scroll_bar_data_horizontal.x],eax
 
mov eax,edx
mov ebx,ecx
shr ebx,16
mov ax,bx
mov [scroll_bar_data_horizontal.x],eax
 
; call correct_cur_area
 
; movzx eax,[wa_width_1]
297,18 → 285,24
add edx,eax
call .fill_for_U_D
@@:
mov esi,[img_resolution]
cmp [img_resolution_2],15
jne @f
mov esi,15
@@:
; mov esi,[img_resolution]
; cmp [img_resolution_2],15
; jne @f
; mov esi,15
;@@:
mov eax,[raw_pointer_2]
mov esi,[eax+12]
mov eax,[raw_pointer]
mov edi,[eax+20]
add edi,eax
; mov edi,[img_palette]
 
xor ebp,ebp
 
mov ebx,[raw_pointer_2]
mov eax,[ebx+28]
add ebx,eax
 
mov eax,ecx
test ax,ax
316,13 → 310,13
shr eax,16
test eax,eax
jz .no_draw ;@f
cmp [filtering_flag],0
je @f
cmp esi,8
jne @f
mov esi,24
@@:
 
; cmp [filtering_flag],0
; je @f
; cmp esi,8
; jne @f
; mov esi,24
;@@:
mcall 65
.no_draw:
; mov eax,ecx
341,36 → 335,42
; and eax,0xffff
; mov [test4],eax
 
push ebx
call draw_file_name_to_work_area
pop ebx
mov ecx,ebx ;[raw_pointer_2]
mcall 68,13
mcall 68,13,[raw_pointer_2]
xor eax,eax
mov ax,[wa_width_2]
mov ebx,[img_width]
; imul eax,100
; ÅÀÕ = ÅÀÕ * 100
shl eax,2 ; óìíîæåíèå íà 4
lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
mov ebx,[img_width]
test ebx,ebx
jnz @f
inc ebx
@@:
xor edx,edx
div ebx
shl edx,1
cmp ebx,edx
jb @f
inc eax
@@:
call calculate_relation
mov [zoom_auto_factor],eax
ret
;---------------------------------------------------------------------
calculate_relation:
; relation = X*100/Y
; eax = eax*100/ebx
; ÅÀÕ = ÅÀÕ * 100
shl eax,2 ; óìíîæåíèå íà 4
lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
integer_division:
; eax = eax/ebx
test ebx,ebx
jnz @f
inc ebx
@@:
xor edx,edx
div ebx
; shl edx,1
; cmp ebx,edx
; jb @f
; inc eax
;@@:
ret
;---------------------------------------------------------------------
calculation_next_value_plus:
mov ebx,[zoom_auto_factor]
mov ecx,zoom_factors.min