]> git.saurik.com Git - apple/xnu.git/blob - osfmk/console/art/scalegear.c
xnu-3789.70.16.tar.gz
[apple/xnu.git] / osfmk / console / art / scalegear.c
1 //
2 //cc scalegear.c -framework Accelerate -g -Wall */
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <Accelerate/Accelerate.h>
7
8 #include "../../../pexpert/pexpert/GearImage.h"
9
10 int main(int argc, char * argv[])
11 {
12 vImage_Buffer vs;
13 vImage_Buffer vd;
14 vImage_Error verr;
15 uint32_t i, data32;
16 uint8_t data8;
17
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);
22
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);
27
28 for (i = 0; i < vs.width * vs.height; i++)
29 {
30 data32 = gGearPict2x[i];
31 data32 = (0xFF000000 | (data32 << 16) | (data32 << 8) | data32);
32 ((uint32_t *)vs.data)[i] = data32;
33 }
34
35 verr = vImageScale_ARGB8888(&vs, &vd, NULL, kvImageHighQualityResampling);
36
37 if (kvImageNoError != verr) exit(1);
38
39 printf("const unsigned char gGearPict3x[9*kGearFrames*kGearWidth*kGearHeight] = {");
40
41 for (i = 0; i < vd.width * vd.height; i++)
42 {
43 data32 = ((uint32_t *)vd.data)[i];
44 data8 = (0xFF & data32);
45 if (data32 != (0xFF000000 | (data8 << 16) | (data8 << 8) | data8)) exit(1);
46
47 if (0 == (15 & i)) printf("\n ");
48 printf("0x%02x,", data8);
49 }
50 printf("\n};\n");
51
52 exit(0);
53 }