Rev 111 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | lang equ ru |
2 | |||
3 | ; |
||
4 | ; Assembler |
||
5 | ; SMALL |
||
6 | ; CODE |
||
7 | ; Graphics |
||
8 | ; Libary |
||
9 | ; |
||
10 | ; Ver 0.18 By Pavlushin Evgeni (RUSSIA) |
||
11 | ; www.waptap@mail.ru |
||
12 | |||
13 | ;InfoList |
||
14 | ;0.01 LoadImage |
||
15 | ;0.02 SetBmp |
||
16 | ;0.03 Bmptoimg, Setimg ~01.03.2004 |
||
17 | ;0.04 Bug deleted, copyimg ~03.05.2004 |
||
18 | ;0.05 fullimg, collimg ~05.05.2004 |
||
19 | ;0.06 getimg ~09.05.2004 |
||
20 | ;0.07 convbmp ~13.05.2004 |
||
21 | ;0.08 fps ~14.05.2004 |
||
22 | ;0.09 drawfbox ~03.06.2004 |
||
131 | diamond | 23 | ;0.10 all macros optimized by Halyavin A., add at ~07.06.2004 |
24 | ;0.11 many macros optimized by Halyavin A., add at ~30.08.2004 |
||
31 | halyavin | 25 | ;0.12 bmptoimg ~07.09.2004 |
26 | ;0.13 imgtoimg ~08.09.2004 |
||
27 | ;0.14 imgtoimg modify not brake bmp pict! ~09.09.2004 |
||
28 | ;0.15 giftoimg, giftoani ~10.09.2004 |
||
29 | ;0.16 setframe, rgbtobgr, setbmp deleted ~20.09.2004 |
||
30 | ;0.17 modification giftoimg, giftoani, getframeoff ~01.10.2004 |
||
31 | ;0.18 aframetoimg,aimgtoimg,frametoimg ~03.10.2004 |
||
32 | |||
33 | aframetoimg_use_count=0 |
||
34 | macro aframetoimg img, x, y, canvas,acol |
||
35 | { |
||
36 | local loo,loo2,acolor |
||
37 | aframetoimg_use_count=aframetoimg_use_count+1 |
||
38 | if aframetoimg_use_count = 1 |
||
39 | |||
40 | jmp end_aframetoimg_proc |
||
41 | |||
42 | acolor dd 0 |
||
43 | aframetoimg_proc: |
||
44 | ;getout coord |
||
45 | mov [acolor],ebp |
||
46 | |||
47 | mov edx,ebx ;img ;xsize |
||
48 | movzx eax,word [edx] |
||
49 | add eax,esi ;y cor |
||
50 | |||
51 | ; mov eax,esi ;y cor |
||
52 | mul dword [ecx] ;canvas xsize |
||
53 | add eax,edi ;x cor |
||
54 | |||
55 | mov ebp,ebx ;img ;xsize |
||
56 | movzx edx,word [ebp] |
||
57 | add eax,edx |
||
58 | |||
59 | mov ebp,eax |
||
60 | shl eax,1 |
||
61 | add ebp,eax |
||
62 | add ebp,ecx ;canvas+8;start |
||
63 | add ebp,8 |
||
64 | ;get img size |
||
65 | add ebx,4 |
||
66 | mov eax,ebx ;img ;xsize |
||
67 | movzx esi,word [eax] |
||
68 | movzx edi,word [eax+2] |
||
69 | add ebx,4 |
||
70 | mov edx,ebx ;img+8 |
||
71 | loo2: |
||
72 | push esi |
||
73 | loo: |
||
74 | ;test on alpha color |
||
75 | mov eax,[edx] |
||
76 | shl eax,8 |
||
77 | shr eax,8 |
||
78 | cmp eax,[acolor] |
||
79 | jne yx |
||
80 | add edx,3 |
||
81 | add ebp,3 |
||
82 | jmp nx |
||
83 | yx: |
||
84 | |||
85 | mov al,byte [edx] |
||
86 | mov byte [ebp],al |
||
87 | inc ebp |
||
88 | inc edx |
||
89 | mov al,byte [edx] |
||
90 | mov byte [ebp],al |
||
91 | inc ebp |
||
92 | inc edx |
||
93 | mov al,byte [edx] |
||
94 | mov byte [ebp],al |
||
95 | inc ebp |
||
96 | inc edx |
||
97 | nx: |
||
98 | dec esi |
||
99 | jnz loo |
||
100 | pop esi |
||
101 | sub ebp,3 |
||
102 | mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) |
||
103 | sub eax,esi |
||
104 | add ebp,eax |
||
105 | shl eax,1 |
||
106 | add ebp,eax |
||
107 | |||
108 | add ebp,3 |
||
109 | |||
110 | dec edi |
||
111 | jnz loo2 |
||
112 | ret |
||
113 | end_aframetoimg_proc: |
||
114 | end if |
||
115 | push img |
||
116 | push canvas |
||
117 | push x |
||
118 | push y |
||
119 | push acol |
||
120 | pop ebp |
||
121 | pop esi |
||
122 | pop edi |
||
123 | pop ecx |
||
124 | pop ebx |
||
125 | call aframetoimg_proc |
||
126 | } |
||
127 | |||
128 | frametoimg_use_count=0 |
||
129 | macro frametoimg img, x, y, canvas |
||
130 | { |
||
131 | local loo,loo2 |
||
132 | frametoimg_use_count=frametoimg_use_count+1 |
||
133 | if frametoimg_use_count = 1 |
||
134 | |||
135 | jmp end_frametoimg_proc |
||
136 | |||
137 | frametoimg_proc: |
||
138 | ;getout coord |
||
139 | mov edx,ebx ;img ;xsize |
||
140 | movzx eax,word [edx] |
||
141 | add eax,esi ;y cor |
||
142 | |||
143 | ; mov eax,esi ;y cor |
||
144 | mul dword [ecx] ;canvas xsize |
||
145 | add eax,edi ;x cor |
||
146 | |||
147 | mov ebp,ebx ;img ;xsize |
||
148 | movzx edx,word [ebp] |
||
149 | add eax,edx |
||
150 | |||
151 | mov ebp,eax |
||
152 | shl eax,1 |
||
153 | add ebp,eax |
||
154 | add ebp,ecx ;canvas+8;start |
||
155 | add ebp,8 |
||
156 | ;get img size |
||
157 | add ebx,4 |
||
158 | mov eax,ebx ;img ;xsize |
||
159 | movzx esi,word [eax] |
||
160 | movzx edi,word [eax+2] |
||
161 | add ebx,4 |
||
162 | mov edx,ebx ;img+8 |
||
163 | loo2: |
||
164 | push esi |
||
165 | loo: |
||
166 | mov al,byte [edx] |
||
167 | mov byte [ebp],al |
||
168 | inc ebp |
||
169 | inc edx |
||
170 | mov al,byte [edx] |
||
171 | mov byte [ebp],al |
||
172 | inc ebp |
||
173 | inc edx |
||
174 | mov al,byte [edx] |
||
175 | mov byte [ebp],al |
||
176 | inc ebp |
||
177 | inc edx |
||
178 | |||
179 | dec esi |
||
180 | jnz loo |
||
181 | pop esi |
||
182 | sub ebp,3 |
||
183 | mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) |
||
184 | sub eax,esi |
||
185 | add ebp,eax |
||
186 | shl eax,1 |
||
187 | add ebp,eax |
||
188 | |||
189 | add ebp,3 |
||
190 | |||
191 | dec edi |
||
192 | jnz loo2 |
||
193 | ret |
||
194 | end_frametoimg_proc: |
||
195 | end if |
||
196 | push img |
||
197 | push canvas |
||
198 | push x |
||
199 | push y |
||
200 | pop esi |
||
201 | pop edi |
||
202 | pop ecx |
||
203 | pop ebx |
||
204 | call frametoimg_proc |
||
205 | } |
||
206 | |||
207 | |||
208 | aimgtoimg_use_count=0 |
||
209 | macro aimgtoimg img, x, y, canvas,acol |
||
210 | { |
||
211 | local loo,loo2,acolor |
||
212 | aimgtoimg_use_count=aimgtoimg_use_count+1 |
||
213 | if aimgtoimg_use_count = 1 |
||
214 | |||
215 | jmp end_aimgtoimg_proc |
||
216 | |||
217 | acolor dd 0 |
||
218 | aimgtoimg_proc: |
||
219 | ;getout coord |
||
220 | mov [acolor],ebp |
||
221 | |||
222 | mov eax,esi ;y cor |
||
223 | mul dword [ecx] ;canvas xsize |
||
224 | add eax,edi ;x cor |
||
225 | mov ebp,eax |
||
226 | shl eax,1 |
||
227 | add ebp,eax |
||
228 | add ebp,ecx ;canvas+8;start |
||
229 | add ebp,8 |
||
230 | ;get img size |
||
231 | mov eax,ebx ;img ;xsize |
||
232 | mov esi,[eax] |
||
233 | add ebx,4 |
||
234 | mov eax,ebx ; img+4 ;ysize |
||
235 | mov edi,[eax] |
||
236 | add ebx,4 |
||
237 | mov edx,ebx ;img+8 |
||
238 | loo2: |
||
239 | push esi |
||
240 | loo: |
||
241 | |||
242 | ;test on alpha color |
||
243 | mov eax,[edx] |
||
244 | shl eax,8 |
||
245 | shr eax,8 |
||
246 | cmp eax,[acolor] |
||
247 | jne yx |
||
248 | add edx,3 |
||
249 | add ebp,3 |
||
250 | jmp nx |
||
251 | yx: |
||
252 | |||
253 | mov al,byte [edx] |
||
254 | mov byte [ebp],al |
||
255 | inc ebp |
||
256 | inc edx |
||
257 | mov al,byte [edx] |
||
258 | mov byte [ebp],al |
||
259 | inc ebp |
||
260 | inc edx |
||
261 | mov al,byte [edx] |
||
262 | mov byte [ebp],al |
||
263 | inc ebp |
||
264 | inc edx |
||
265 | nx: |
||
266 | dec esi |
||
267 | jnz loo |
||
268 | pop esi |
||
269 | sub ebp,3 |
||
270 | mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) |
||
271 | sub eax,esi |
||
272 | add ebp,eax |
||
273 | shl eax,1 |
||
274 | add ebp,eax |
||
275 | |||
276 | add ebp,3 |
||
277 | |||
278 | dec edi |
||
279 | jnz loo2 |
||
280 | ret |
||
281 | end_aimgtoimg_proc: |
||
282 | end if |
||
283 | push img |
||
284 |