Rev 999 | Rev 1014 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 999 | Rev 1001 | ||
---|---|---|---|
Line 136... | Line 136... | ||
136 | xor eax, eax |
136 | xor eax, eax |
137 | ret |
137 | ret |
138 | endp |
138 | endp |
Line 139... | Line 139... | ||
139 | 139 | ||
- | 140 | ;;================================================================================================;; |
|
- | 141 | proc img.to_rgb2 _img, _out ;/////////////////////////////////////////////////////////////////////;; |
|
- | 142 | ;;------------------------------------------------------------------------------------------------;; |
|
- | 143 | ;? --- TBD --- ;; |
|
- | 144 | ;;------------------------------------------------------------------------------------------------;; |
|
- | 145 | ;> --- TBD --- ;; |
|
- | 146 | ;;------------------------------------------------------------------------------------------------;; |
|
- | 147 | ;< --- TBD --- ;; |
|
- | 148 | ;;================================================================================================;; |
|
- | 149 | push esi edi |
|
- | 150 | mov esi, [_img] |
|
- | 151 | stdcall img._.validate, esi |
|
- | 152 | or eax, eax |
|
- | 153 | jnz .ret |
|
- | 154 | mov edi, [_out] |
|
- | 155 | call img._.do_rgb |
|
- | 156 | .ret: |
|
- | 157 | pop edi esi |
|
- | 158 | ret |
|
- | 159 | endp |
|
- | 160 | ||
140 | ;;================================================================================================;; |
161 | ;;================================================================================================;; |
141 | proc img.to_rgb _img ;////////////////////////////////////////////////////////////////////////////;; |
162 | proc img.to_rgb _img ;////////////////////////////////////////////////////////////////////////////;; |
142 | ;;------------------------------------------------------------------------------------------------;; |
163 | ;;------------------------------------------------------------------------------------------------;; |
143 | ;? --- TBD --- ;; |
164 | ;? --- TBD --- ;; |
144 | ;;------------------------------------------------------------------------------------------------;; |
165 | ;;------------------------------------------------------------------------------------------------;; |
145 | ;> --- TBD --- ;; |
166 | ;> --- TBD --- ;; |
146 | ;;------------------------------------------------------------------------------------------------;; |
167 | ;;------------------------------------------------------------------------------------------------;; |
147 | ;< eax = 0 / pointer to rgb_data (array of [rgb] triplets) ;; |
168 | ;< eax = 0 / pointer to rgb_data (array of [rgb] triplets) ;; |
148 | ;;================================================================================================;; |
169 | ;;================================================================================================;; |
- | 170 | push esi edi |
|
149 | push esi edi |
171 | mov esi, [_img] |
150 | stdcall img._.validate, [_img] |
172 | stdcall img._.validate, esi |
151 | or eax, eax |
173 | or eax, eax |
Line 152... | Line 174... | ||
152 | jnz .error |
174 | jnz .error |
153 | 175 | ||
Line 163... | Line 185... | ||
163 | push eax |
185 | push eax |
164 | mov eax, [esi + Image.Width] |
186 | mov eax, [esi + Image.Width] |
165 | stosd |
187 | stosd |
166 | mov eax, [esi + Image.Height] |
188 | mov eax, [esi + Image.Height] |
167 | stosd |
189 | stosd |
- | 190 | call img._.do_rgb |
|
- | 191 | pop eax |
|
- | 192 | pop edi esi |
|
- | 193 | ret |
|
- | 194 | ||
- | 195 | .error: |
|
- | 196 | xor eax, eax |
|
- | 197 | pop edi esi |
|
- | 198 | ret |
|
- | 199 | endp |
|
- | 200 | ||
- | 201 | ;;================================================================================================;; |
|
- | 202 | proc img._.do_rgb ;///////////////////////////////////////////////////////////////////////////////;; |
|
- | 203 | ;;------------------------------------------------------------------------------------------------;; |
|
- | 204 | ;? --- TBD --- ;; |
|
- | 205 | ;;------------------------------------------------------------------------------------------------;; |
|
- | 206 | ;> --- TBD --- ;; |
|
- | 207 | ;;------------------------------------------------------------------------------------------------;; |
|
- | 208 | ;< --- TBD --- ;; |
|
- | 209 | ;;================================================================================================;; |
|
- | 210 | mov ecx, [esi + Image.Width] |
|
- | 211 | imul ecx, [esi + Image.Height] |
|
168 | mov eax, [esi + Image.Type] |
212 | mov eax, [esi + Image.Type] |
169 | dec eax |
213 | dec eax |
170 | jz .bpp8 |
214 | jz .bpp8 |
171 | dec eax |
215 | dec eax |
172 | jz .bpp24 |
216 | jz .bpp24 |
173 | dec eax |
- | |
174 | jnz .error_pop |
- | |
175 | ; 32 BPP -> 24 BPP |
217 | ; 32 BPP -> 24 BPP |
176 | mov esi, [esi + Image.Data] |
218 | mov esi, [esi + Image.Data] |
Line 177... | Line 219... | ||
177 | 219 | ||
178 | @@: dec ecx |
220 | @@: dec ecx |
179 | js @f |
221 | js @f |
180 | movsd |
222 | movsd |
181 | dec edi |
223 | dec edi |
Line 182... | Line 224... | ||
182 | jmp @b |
224 | jmp @b |
183 | - | ||
184 | @@: pop eax |
225 | |
Line 185... | Line 226... | ||
185 | pop edi esi |
226 | @@: |
186 | ret |
227 | ret |
187 | 228 | ||
188 | .bpp24: |
229 | .bpp24: |
189 | ; 24 BPP -> 24 BPP |
230 | ; 24 BPP -> 24 BPP |
190 | lea ecx, [ecx*3 + 3] |
231 | lea ecx, [ecx*3 + 3] |
191 | mov esi, [esi + Image.Data] |
- | |
192 | shr ecx, 2 |
- | |
193 | rep movsd |
232 | mov esi, [esi + Image.Data] |
Line 194... | Line 233... | ||
194 | pop eax |
233 | shr ecx, 2 |
195 | pop edi esi |
234 | rep movsd |
196 | ret |
235 | ret |
Line 207... | Line 246... | ||
207 | mov [edi], eax |
246 | mov [edi], eax |
208 | add edi, 3 |
247 | add edi, 3 |
209 | sub ecx, 1 |
248 | sub ecx, 1 |
210 | jnz @b |
249 | jnz @b |
211 | pop ebx |
250 | pop ebx |
212 | pop eax |
- | |
213 | pop edi esi |
- | |
214 | ret |
- | |
215 | - | ||
216 | .error_pop: |
- | |
217 | pop eax |
- | |
218 | - | ||
219 | .error: |
- | |
220 | xor eax, eax |
- | |
221 | pop edi esi |
- | |
222 | ret |
251 | ret |
223 | endp |
252 | endp |
Line 224... | Line 253... | ||
224 | 253 | ||
225 | ;;================================================================================================;; |
254 | ;;================================================================================================;; |
Line 1122... | Line 1151... | ||
1122 | align 4 |
1151 | align 4 |
1123 | @EXPORT: |
1152 | @EXPORT: |
Line 1124... | Line 1153... | ||
1124 | 1153 | ||
1125 | export \ |
1154 | export \ |
1126 | lib_init , 'lib_init' , \ |
1155 | lib_init , 'lib_init' , \ |
1127 | 0x00010001 , 'version' , \ |
1156 | 0x00010002 , 'version' , \ |
1128 | img.is_img , 'img.is_img' , \ |
1157 | img.is_img , 'img.is_img' , \ |
1129 | img.info , 'img.info' , \ |
1158 | img.info , 'img.info' , \ |
1130 | img.from_file , 'img.from_file' , \ |
1159 | img.from_file , 'img.from_file' , \ |
1131 | img.to_file , 'img.to_file' , \ |
1160 | img.to_file , 'img.to_file' , \ |
1132 | img.from_rgb , 'img.from_rgb' , \ |
1161 | img.from_rgb , 'img.from_rgb' , \ |
- | 1162 | img.to_rgb , 'img.to_rgb' , \ |
|
1133 | img.to_rgb , 'img.to_rgb' , \ |
1163 | img.to_rgb2 , 'img.to_rgb2' , \ |
1134 | img.decode , 'img.decode' , \ |
1164 | img.decode , 'img.decode' , \ |
1135 | img.encode , 'img.encode' , \ |
1165 | img.encode , 'img.encode' , \ |
1136 | img.create , 'img.create' , \ |
1166 | img.create , 'img.create' , \ |
1137 | img.destroy , 'img.destroy' , \ |
1167 | img.destroy , 'img.destroy' , \ |