2 //cc scalegear.c -framework Accelerate -g -Wall */
6 #include <Accelerate/Accelerate.h>
8 #include "../../../pexpert/pexpert/GearImage.h"
10 int main(int argc
, char * argv
[])
18 vs
.width
= kGearWidth
* 2;
19 vs
.height
= kGearHeight
* 2 * kGearFrames
;
20 vs
.rowBytes
= vs
.width
* sizeof(uint32_t);
21 vs
.data
= malloc(vs
.height
* vs
.rowBytes
);
23 vd
.width
= 1.5 * vs
.width
;
24 vd
.height
= 1.5 * vs
.height
;
25 vd
.rowBytes
= vd
.width
* sizeof(uint32_t);
26 vd
.data
= malloc(vd
.height
* vd
.rowBytes
);
28 for (i
= 0; i
< vs
.width
* vs
.height
; i
++)
30 data32
= gGearPict2x
[i
];
31 data32
= (0xFF000000 | (data32
<< 16) | (data32
<< 8) | data32
);
32 ((uint32_t *)vs
.data
)[i
] = data32
;
35 verr
= vImageScale_ARGB8888(&vs
, &vd
, NULL
, kvImageHighQualityResampling
);
37 if (kvImageNoError
!= verr
) exit(1);
39 printf("const unsigned char gGearPict3x[9*kGearFrames*kGearWidth*kGearHeight] = {");
41 for (i
= 0; i
< vd
.width
* vd
.height
; i
++)
43 data32
= ((uint32_t *)vd
.data
)[i
];
44 data8
= (0xFF & data32
);
45 if (data32
!= (0xFF000000 | (data8
<< 16) | (data8
<< 8) | data8
)) exit(1);
47 if (0 == (15 & i
)) printf("\n ");
48 printf("0x%02x,", data8
);