Added very useful and convenient macro for parsing attribute IDs
[AROS.git] / test / patchrgbconv_rgb16oe.h
blob36656ac42a8ec58abd4bb961cdf161723c0c06d6
1 CONVERTFUNC(RGB16OE,RGB15) /* Untested */
3 CONVERTFUNC_INIT
5 UWORD *src = (UWORD *)srcPixels;
6 UWORD *dst = (UWORD *)dstPixels;
7 ULONG x, y;
9 for(y = 0; y < height; y++)
11 for(x = 0; x < width; x++)
13 UWORD s = INV16(src[x]);
15 dst[x] = ((s >> 1) & (RGB15_RMASK | RGB15_GMASK)) | (s & RGB15_BMASK);
17 src = (UWORD *)(((UBYTE *)src) + srcMod);
18 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
21 return 1;
23 CONVERTFUNC_EXIT
26 CONVERTFUNC(RGB16OE,BGR16) /* Untested */
28 CONVERTFUNC_INIT
30 SWAP16OE16CODE
32 CONVERTFUNC_EXIT
35 CONVERTFUNC(RGB16OE,BGR15) /* Untested */
37 CONVERTFUNC_INIT
39 SWAP16OE15CODE
41 CONVERTFUNC_EXIT
44 CONVERTFUNC(RGB16OE,RGB16) /* Untested */
46 CONVERTFUNC_INIT
48 SWAP16CODE
50 CONVERTFUNC_EXIT
53 CONVERTFUNC(RGB16OE,ARGB32) /* Untested */
55 CONVERTFUNC_INIT
57 UWORD *src = (UWORD *)srcPixels;
58 ULONG *dst = (ULONG *)dstPixels;
59 ULONG x, y;
61 for(y = 0; y < height; y++)
63 for(x = 0; x < width; x++)
65 ULONG s = INV16(src[x]);
67 dst[x] = UPSHIFT16(s, RGB16, ARGB32);
69 src = (UWORD *)(((UBYTE *)src) + srcMod);
70 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
73 return 1;
75 CONVERTFUNC_EXIT
78 CONVERTFUNC(RGB16OE,BGRA32) /* Untested */
80 CONVERTFUNC_INIT
82 UWORD *src = (UWORD *)srcPixels;
83 ULONG *dst = (ULONG *)dstPixels;
84 ULONG x, y;
86 for(y = 0; y < height; y++)
88 for(x = 0; x < width; x++)
90 ULONG s = INV16(src[x]);
92 dst[x] = UPSHIFT16(s, RGB16, BGRA32);
94 src = (UWORD *)(((UBYTE *)src) + srcMod);
95 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
98 return 1;
100 CONVERTFUNC_EXIT
103 CONVERTFUNC(RGB16OE,RGBA32) /* Untested */
105 CONVERTFUNC_INIT
107 UWORD *src = (UWORD *)srcPixels;
108 ULONG *dst = (ULONG *)dstPixels;
109 ULONG x, y;
111 for(y = 0; y < height; y++)
113 for(x = 0; x < width; x++)
115 ULONG s = INV16(src[x]);
117 dst[x] = UPSHIFT16(s, RGB16, RGBA32);
119 src = (UWORD *)(((UBYTE *)src) + srcMod);
120 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
123 return 1;
125 CONVERTFUNC_EXIT
129 CONVERTFUNC(RGB16OE,ABGR32) /* Untested */
131 CONVERTFUNC_INIT
133 UWORD *src = (UWORD *)srcPixels;
134 ULONG *dst = (ULONG *)dstPixels;
135 ULONG x, y;
137 for(y = 0; y < height; y++)
139 for(x = 0; x < width; x++)
141 ULONG s = INV16(src[x]);
143 dst[x] = UPSHIFT16(s, RGB16, ABGR32);
145 src = (UWORD *)(((UBYTE *)src) + srcMod);
146 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
149 return 1;
151 CONVERTFUNC_EXIT
154 CONVERTFUNC(RGB16OE,RGB24) /* Untested */
156 CONVERTFUNC_INIT
158 UWORD *src = (UWORD *)srcPixels;
159 UBYTE *dst = (UBYTE *)dstPixels;
160 ULONG x, y;
162 for(y = 0; y < height; y++)
164 for(x = 0; x < width; x++)
166 ULONG s = INV16(src[x]);
168 s = UPSHIFT16(s, RGB16, RGB24);
170 PUT24(dst, COMP8(s, 1), COMP8(s, 2), COMP8(s, 3))
172 src = (UWORD *)(((UBYTE *)src) + srcMod);
173 dst = (UBYTE *)(((UBYTE *)dst) + dstMod);
176 return 1;
178 CONVERTFUNC_EXIT
181 CONVERTFUNC(RGB16OE,BGR24) /* Untested */
183 CONVERTFUNC_INIT
185 UWORD *src = (UWORD *)srcPixels;
186 UBYTE *dst = (UBYTE *)dstPixels;
187 ULONG x, y;
189 for(y = 0; y < height; y++)
191 for(x = 0; x < width; x++)
193 ULONG s = INV16(src[x]);
195 s = UPSHIFT16(s, RGB16, BGR24);
197 PUT24(dst, COMP8(s, 1), COMP8(s, 2), COMP8(s, 3))
199 src = (UWORD *)(((UBYTE *)src) + srcMod);
200 dst = (UBYTE *)(((UBYTE *)dst) + dstMod);
203 return 1;
205 CONVERTFUNC_EXIT
209 CONVERTFUNC(RGB16OE,RGB15OE) /* Untested */
211 CONVERTFUNC_INIT
213 UWORD *src = (UWORD *)srcPixels;
214 UWORD *dst = (UWORD *)dstPixels;
215 ULONG x, y;
217 for(y = 0; y < height; y++)
219 for(x = 0; x < width; x++)
221 UWORD s = INV16(src[x]);
223 s = ((s >> 1) & (RGB15_RMASK | RGB15_GMASK)) | (s & RGB15_BMASK);
224 dst[x] = INV16(s);
226 src = (UWORD *)(((UBYTE *)src) + srcMod);
227 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
230 return 1;
232 CONVERTFUNC_EXIT
235 CONVERTFUNC(RGB16OE,BGR16OE) /* Untested */
237 CONVERTFUNC_INIT
239 SWAP16OE16OECODE
241 CONVERTFUNC_EXIT
244 CONVERTFUNC(RGB16OE,BGR15OE) /* Untested */
246 CONVERTFUNC_INIT
248 SWAP16OE15OECODE
250 CONVERTFUNC_EXIT
253 CONVERTFUNC(RGB16OE,XRGB32) /* Untested */
255 CONVERTFUNC_INIT
257 UWORD *src = (UWORD *)srcPixels;
258 ULONG *dst = (ULONG *)dstPixels;
259 ULONG x, y;
261 for(y = 0; y < height; y++)
263 for(x = 0; x < width; x++)
265 ULONG s = INV16(src[x]);
267 dst[x] = UPSHIFT16(s, RGB16, ARGB32);
269 src = (UWORD *)(((UBYTE *)src) + srcMod);
270 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
273 return 1;
275 CONVERTFUNC_EXIT
278 CONVERTFUNC(RGB16OE,BGRX32) /* Untested */
280 CONVERTFUNC_INIT
282 UWORD *src = (UWORD *)srcPixels;
283 ULONG *dst = (ULONG *)dstPixels;
284 ULONG x, y;
286 for(y = 0; y < height; y++)
288 for(x = 0; x < width; x++)
290 ULONG s = INV16(src[x]);
292 dst[x] = UPSHIFT16(s, RGB16, BGRA32);
294 src = (UWORD *)(((UBYTE *)src) + srcMod);
295 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
298 return 1;
300 CONVERTFUNC_EXIT
303 CONVERTFUNC(RGB16OE,RGBX32) /* Untested */
305 CONVERTFUNC_INIT
307 UWORD *src = (UWORD *)srcPixels;
308 ULONG *dst = (ULONG *)dstPixels;
309 ULONG x, y;
311 for(y = 0; y < height; y++)
313 for(x = 0; x < width; x++)
315 ULONG s = INV16(src[x]);
317 dst[x] = UPSHIFT16(s, RGB16, RGBA32);
319 src = (UWORD *)(((UBYTE *)src) + srcMod);
320 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
323 return 1;
325 CONVERTFUNC_EXIT
329 CONVERTFUNC(RGB16OE,XBGR32) /* Untested */
331 CONVERTFUNC_INIT
333 UWORD *src = (UWORD *)srcPixels;
334 ULONG *dst = (ULONG *)dstPixels;
335 ULONG x, y;
337 for(y = 0; y < height; y++)
339 for(x = 0; x < width; x++)
341 ULONG s = INV16(src[x]);
343 dst[x] = UPSHIFT16(s, RGB16, ABGR32);
345 src = (UWORD *)(((UBYTE *)src) + srcMod);
346 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
349 return 1;
351 CONVERTFUNC_EXIT