Rev 2163 | Rev 2236 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2000 | mario79 | 1 | ;--------------------------------------------------------------------- |
2 | ; ÓÑÒÀÍÎÂÈÒÜ ÔÎÍ |
||
3 | background: |
||
4 | cmp [soi],0 |
||
5 | je .end |
||
2163 | mario79 | 6 | |
2000 | mario79 | 7 | cmp [bgrmode],dword 2 |
2163 | mario79 | 8 | ja .stretch_crop |
9 | |||
2000 | mario79 | 10 | mov ecx,[img_width] ; øèðèíà |
11 | test ecx,ecx |
||
12 | jz .end |
||
13 | mov edx,[img_high] ; âûñîòà |
||
14 | test edx,edx |
||
15 | jz .end |
||
16 | mcall 15,1 ; set size |
||
17 | |||
18 | mov esi,ecx |
||
19 | imul esi,edx |
||
20 | lea esi,[esi*3] |
||
21 | mov ecx,[soi] |
||
22 | |||
23 | xor edx,edx |
||
24 | |||
25 | cmp [img_resolution],24 |
||
26 | je @f |
||
2163 | mario79 | 27 | |
2000 | mario79 | 28 | push dword image_file |
29 | call [convert_Conv_24b] |
||
2163 | mario79 | 30 | |
2000 | mario79 | 31 | mov ecx,[raw_pointer_2] |
2163 | mario79 | 32 | add ecx,44 |
33 | mcall 15,5 ;15,5 set data |
||
34 | mcall 68,13,[raw_pointer_2] |
||
2000 | mario79 | 35 | jmp .set_mode |
36 | @@: |
||
2163 | mario79 | 37 | mcall 15,5 ; 15,5 set data |
2000 | mario79 | 38 | .set_mode: |
2163 | mario79 | 39 | mcall 15,4,[bgrmode] ; 15,4 set mode |
40 | dec ebx ; 15,3 redraw background |
||
2000 | mario79 | 41 | mcall |
42 | .end: |
||
43 | ret |
||
2163 | mario79 | 44 | ;--------------------------------------------------------------------- |
45 | .stretch_crop: |
||
46 | ; cmp [bgrmode],dword 3 |
||
47 | ; jne .stretch_inscribe |
||
48 | xor eax,eax |
||
49 | mov [stretch_start_coordinates],eax |
||
50 | |||
51 | mcall 14 |
||
52 | |||
53 | mov ebx,eax |
||
54 | and eax,0xffff |
||
55 | inc eax |
||
56 | mov [screen_high],eax |
||
57 | shr ebx,16 |
||
58 | inc ebx |
||
59 | mov [screen_width],ebx |
||
60 | |||
61 | xchg eax,ebx |
||
62 | call calculate_relation |
||
63 | mov [screen_relation],eax |
||
64 | |||
65 | mov eax,[img_width] |
||
66 | mov ebx,[img_high] |
||
67 | call calculate_relation |
||
68 | mov [picture_relation],eax |
||
69 | |||
70 | cmp eax,[screen_relation] |
||
71 | jb @f |
||
72 | ; Y = Yimg |
||
73 | ; X = Yimg*Xscreen/Yscreen |
||
74 | mov eax,[img_high] |
||
75 | mov [stretch_img_high],eax |
||
76 | mov eax,[img_high] |
||
77 | imul eax,dword [screen_width] |
||
78 | mov ebx,[screen_high] |
||
79 | call integer_division |
||
80 | mov [stretch_img_width],eax |
||
81 | jmp .continue |
||
82 | @@: |
||
83 | ; X = Ximg |
||
84 | ; Y = Ximg*Yscreen/Xscreen |
||
85 | mov eax,[img_width] |
||
86 | mov [stretch_img_width],eax |
||
87 | mov eax,[img_width] |
||
88 | imul eax,dword [screen_high] |
||
89 | mov ebx,[screen_width] |
||
90 | call integer_division |
||
91 | mov [stretch_img_high],eax |
||
92 | .continue: |
||
2188 | mario79 | 93 | mov eax,[Stretch_Crop_Corner] |
94 | mov ebx,eax |
||
95 | shr eax,16 |
||
96 | shl eax,2 |
||
97 | mov eax,[eax+call_to_calculate_stretch_start_coordinates_Y] |
||
98 | call eax |
||
99 | and ebx,0xffff |
||
100 | shl ebx,2 |
||
101 | mov ebx,[ebx+call_to_calculate_stretch_start_coordinates_X] |
||
102 | call ebx |
||
103 | |||
2163 | mario79 | 104 | mov ebx,[screen_width] |
105 | shl ebx,16 |
||
106 | add ebx,[screen_high] |
||
107 | |||
108 | mov eax,[stretch_img_width] |
||
109 | shl eax,16 |
||
110 | add eax,[stretch_img_high] |
||
111 | |||
112 | push dword eax ; eax - crop size |
||
113 | push dword 0 ; edi - background color |
||
114 | push dword 1 ; esi - filtering |
||
115 | push dword 0 ; edx - scaling mode |
||
116 | push dword [stretch_start_coordinates] ; ecx - start_coordinates |
||
117 | push ebx ; ebx - new_size |
||
118 | push dword image_file ; eax - convert data table |
||
119 | |||
120 | call [Scaling_Start] |
||
121 | call background_1 |
||
122 | ret |
||
123 | |||
124 | ;--------------------------------------------------------------------- |
||
2188 | mario79 | 125 | call_to_calculate_stretch_start_coordinates_X: |
126 | dd calculate_stretch_start_coordinates_XL |
||
127 | dd calculate_stretch_start_coordinates_XC |
||
128 | dd calculate_stretch_start_coordinates_XR |
||
129 | ;--------------------------------------------------------------------- |
||
130 | call_to_calculate_stretch_start_coordinates_Y: |
||
131 | dd calculate_stretch_start_coordinates_YU |
||
132 | dd calculate_stretch_start_coordinates_YC |
||
133 | dd calculate_stretch_start_coordinates_YD |
||
134 | ;--------------------------------------------------------------------- |
||
135 | calculate_stretch_start_coordinates_XC: |
||
136 | xor ecx,ecx |
||
137 | .1: |
||
138 | mov eax,[img_width] |
||
139 | sub eax,[stretch_img_width] |
||
140 | test ecx,ecx |
||
141 | jnz @f |
||
142 | shr eax,1 |
||
143 | @@: |
||
144 | mov [stretch_start_coordinates.x],ax |
||
145 | calculate_stretch_start_coordinates_XL: |
||
146 | ret |
||
147 | ;--------------------------------------------------------------------- |
||
148 | calculate_stretch_start_coordinates_XR: |
||
149 | xor ecx,ecx |
||
150 | inc ecx |
||
151 | jmp calculate_stretch_start_coordinates_XC.1 |
||
152 | ;--------------------------------------------------------------------- |
||
153 | calculate_stretch_start_coordinates_YC: |
||
154 | xor ecx,ecx |
||
155 | .1: |
||
156 | mov eax,[img_high] |
||
157 | sub eax,[stretch_img_high] |
||
158 | test ecx,ecx |
||
159 | jnz @f |
||
160 | shr eax,1 |
||
161 | @@: |
||
162 | mov [stretch_start_coordinates.y],ax |
||
163 | calculate_stretch_start_coordinates_YU: |
||
164 | ret |
||
165 | ;--------------------------------------------------------------------- |
||
166 | calculate_stretch_start_coordinates_YD: |
||
167 | xor ecx,ecx |
||
168 | inc ecx |
||
169 | jmp calculate_stretch_start_coordinates_YC.1 |
||
170 | ;--------------------------------------------------------------------- |
||
2163 | mario79 | 171 | ;.stretch_inscribe: |
172 | ; ret |
||
173 | ;--------------------------------------------------------------------- |
||
174 | background_1: |
||
175 | mov ecx,[screen_width] ;[crop_img_width] ; øèðèíà |
||
176 | test ecx,ecx |
||
177 | jz .end |
||
178 | mov edx,[screen_high] ;[crop_img_high] ; âûñîòà |
||
179 | test edx,edx |
||
180 | jz .end |
||
181 | mcall 15,1 ; set size |
||
182 | |||
183 | mov esi,ecx |
||
184 | imul esi,edx |
||
185 | lea esi,[esi*3] |
||
186 | mov ecx,[raw_pointer_2] ;[soi] |
||
187 | mov eax,[ecx+28] |
||
188 | add ecx,eax |
||
189 | |||
190 | xor edx,edx |
||
191 | |||
192 | mov eax,[raw_pointer_2] |
||
193 | mov eax,[eax+12] ;overall depth of the pixel |
||
194 | cmp al,24 |
||
195 | je @f |
||
196 | |||
197 | mov eax,[raw_pointer_2] |
||
198 | mov [crop_raw_pointer],eax |
||
199 | |||
200 | push dword crop_image_file |
||
201 | call [convert_Conv_24b] |
||
202 | |||
203 | mov ecx,[crop_raw_pointer_2] |
||
204 | add ecx,44 |
||
205 | mcall 15,5 ;15,5 set data |
||
206 | mcall 68,13,[crop_raw_pointer_2] |
||
207 | jmp .set_mode |
||
208 | @@: |
||
209 | mcall 15,5 ; 15,5 set data |
||
210 | .set_mode: |
||
211 | xor ecx,ecx |
||
212 | inc ecx |
||
213 | ; mov ecx,[bgrmode] |
||
214 | mcall 15,4 ; 15,4 set mode |
||
215 | dec ebx ; 15,3 redraw background |
||
216 | mcall |
||
217 | .end: |
||
218 | mov ecx,[raw_pointer_2] |
||
219 | mcall 68,13 |
||
220 | ret |
||
2000 | mario79 | 221 | ;--------------------------------------------------------------------- |