forked from KolibriOS/kolibrios
zSea - background image to the proportional stretching with inscribing
git-svn-id: svn://kolibrios.org@2236 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
1a1680f416
commit
7f3443a0b9
@ -43,8 +43,8 @@ background:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
.stretch_crop:
|
||||
; cmp [bgrmode],dword 3
|
||||
; jne .stretch_inscribe
|
||||
cmp [bgrmode],dword 3
|
||||
jne .stretch_inscribe
|
||||
xor eax,eax
|
||||
mov [stretch_start_coordinates],eax
|
||||
|
||||
@ -120,7 +120,186 @@ background:
|
||||
call [Scaling_Start]
|
||||
call background_1
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
.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]
|
||||
ja @f
|
||||
; Y = Yimg
|
||||
; X = Yimg*Xscreen/Yscreen
|
||||
mov eax,[screen_high] ;[img_high]
|
||||
mov [stretch_img_high],eax
|
||||
mov eax,[screen_high] ;[img_high]
|
||||
imul eax,dword [img_width] ;[screen_width]
|
||||
mov ebx,[img_high] ;[screen_high]
|
||||
call integer_division
|
||||
mov [stretch_img_width],eax
|
||||
jmp .continue_1
|
||||
@@:
|
||||
; X = Ximg
|
||||
; Y = Ximg*Yscreen/Xscreen
|
||||
mov eax,[screen_width] ;[img_width]
|
||||
mov [stretch_img_width],eax
|
||||
mov eax,[screen_width] ;[img_width]
|
||||
imul eax,dword [img_high] ;[screen_high]
|
||||
mov ebx,[img_width] ;[screen_width]
|
||||
call integer_division
|
||||
mov [stretch_img_high],eax
|
||||
.continue_1:
|
||||
; mov ebx,[screen_width]
|
||||
; shl ebx,16
|
||||
; add ebx,[screen_high]
|
||||
|
||||
mov ebx,[stretch_img_width]
|
||||
shl ebx,16
|
||||
add ebx,[stretch_img_high]
|
||||
|
||||
|
||||
push dword 0 ; 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]
|
||||
|
||||
mov eax,[raw_pointer_2]
|
||||
mov [crop_raw_pointer],eax
|
||||
mov [crop_raw_pointer_2],eax
|
||||
|
||||
mov eax,[raw_pointer_2]
|
||||
mov eax,[eax+12] ;overall depth of the pixel
|
||||
cmp al,24
|
||||
je @f
|
||||
|
||||
push dword crop_image_file
|
||||
call [convert_Conv_24b]
|
||||
|
||||
mov ecx,[raw_pointer_2]
|
||||
mcall 68,13
|
||||
@@:
|
||||
mov ecx,[screen_width]
|
||||
imul ecx,[screen_high]
|
||||
lea ecx,[ecx*3]
|
||||
add ecx,44
|
||||
|
||||
; mcall 68,20,,[crop_raw_pointer_2]
|
||||
; mov [crop_raw_pointer_2],eax
|
||||
mov eax,[crop_raw_pointer_2]
|
||||
mov [crop_raw_pointer],eax
|
||||
|
||||
mcall 68,12
|
||||
mov [crop_raw_pointer_2],eax
|
||||
|
||||
; fill of color
|
||||
sub ecx,44
|
||||
mov edi,eax
|
||||
add edi,44
|
||||
mov eax,0xaaaaaa
|
||||
cld
|
||||
@@:
|
||||
stosb
|
||||
ror eax,8
|
||||
stosb
|
||||
ror eax,8
|
||||
stosb
|
||||
rol eax,16
|
||||
sub ecx,2
|
||||
loop @b
|
||||
|
||||
; copy of data
|
||||
mov eax,[screen_width]
|
||||
sub eax,[stretch_img_width]
|
||||
mov ebx,eax
|
||||
lea eax,[eax*3]
|
||||
shr ebx,1
|
||||
lea ebx,[ebx*3]
|
||||
|
||||
mov edi,[screen_high]
|
||||
sub edi,[stretch_img_high]
|
||||
shr edi,1
|
||||
imul edi,[screen_width]
|
||||
lea edi,[edi*3]
|
||||
add edi,[crop_raw_pointer_2]
|
||||
add edi,44
|
||||
add edi,ebx
|
||||
|
||||
mov esi,[crop_raw_pointer]
|
||||
add esi,44
|
||||
|
||||
mov ebx,[stretch_img_width]
|
||||
lea ebx,[ebx*3]
|
||||
|
||||
mov ecx,[stretch_img_high]
|
||||
@@:
|
||||
push ecx
|
||||
mov ecx,ebx
|
||||
rep movsb
|
||||
pop ecx
|
||||
add edi,eax
|
||||
loop @b
|
||||
|
||||
; header
|
||||
mov esi,[crop_raw_pointer]
|
||||
mov edi,[crop_raw_pointer_2]
|
||||
mov ecx,44/4
|
||||
rep stosd
|
||||
|
||||
mcall 68,13,[crop_raw_pointer]
|
||||
;set the background
|
||||
mov eax,[crop_raw_pointer_2]
|
||||
mov ebx,[screen_width]
|
||||
mov [eax+4],ebx
|
||||
mov ebx,[screen_high]
|
||||
mov [eax+8],ebx
|
||||
|
||||
mov ecx,[screen_width] ; øèðèíà
|
||||
test ecx,ecx
|
||||
jz @f
|
||||
mov edx,[screen_high] ; âûñîòà
|
||||
test edx,edx
|
||||
jz @f
|
||||
mcall 15,1 ; set size
|
||||
|
||||
mov esi,ecx
|
||||
imul esi,edx
|
||||
lea esi,[esi*3]
|
||||
|
||||
xor edx,edx
|
||||
mov ecx,[crop_raw_pointer_2]
|
||||
add ecx,44
|
||||
mcall 15,5 ;15,5 set data
|
||||
xor ecx,ecx
|
||||
inc ecx
|
||||
mcall 15,4 ; 15,4 set mode
|
||||
dec ebx ; 15,3 redraw background
|
||||
mcall
|
||||
@@:
|
||||
mcall 68,13,[crop_raw_pointer_2]
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
call_to_calculate_stretch_start_coordinates_X:
|
||||
dd calculate_stretch_start_coordinates_XL
|
||||
@ -168,9 +347,6 @@ calculate_stretch_start_coordinates_YD:
|
||||
inc ecx
|
||||
jmp calculate_stretch_start_coordinates_YC.1
|
||||
;---------------------------------------------------------------------
|
||||
;.stretch_inscribe:
|
||||
; ret
|
||||
;---------------------------------------------------------------------
|
||||
background_1:
|
||||
mov ecx,[screen_width] ;[crop_img_width] ; øèðèíà
|
||||
test ecx,ecx
|
||||
@ -179,7 +355,7 @@ background_1:
|
||||
test edx,edx
|
||||
jz .end
|
||||
mcall 15,1 ; set size
|
||||
|
||||
.1:
|
||||
mov esi,ecx
|
||||
imul esi,edx
|
||||
lea esi,[esi*3]
|
||||
|
Loading…
Reference in New Issue
Block a user