-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocalColorTableTest.c
More file actions
86 lines (69 loc) · 3.51 KB
/
Copy pathlocalColorTableTest.c
File metadata and controls
86 lines (69 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "main.h"
#include "array.h"
#include "GIFColorTable.h"
#include "GIFInterface.h"
#include "GIFEncode.h"
#include "GIFTransformations.h"
STATUS_CODE gif_createLocalColorTableTest() {
STATUS_CODE status;
// Create canvas
GIFCanvas *canvas = gif_canvasCreate(33, 17);
CANVAS_NULL_CHECK(canvas);
status = gif_canvasSetFileName(canvas, "testGIF_LocalColorTable.gif");
CHECKSTATUS(status);
u8 tempIndexStream[] =
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,
0,2,0,0,1,1,0,0,1,1,0,0,1,1,0,0,2,1,1,0,0,1,1,0,0,1,1,0,0,1,1,2,0,
0,2,0,0,1,1,0,0,1,1,0,0,1,1,0,0,2,1,1,0,0,1,1,0,0,1,1,0,0,1,1,2,0,
0,2,2,2,2,1,0,0,1,1,0,0,1,1,0,0,2,1,1,0,0,1,1,0,0,1,1,0,2,2,2,2,0,
0,2,0,0,2,1,0,0,1,1,0,0,1,1,0,0,2,1,1,0,0,1,1,0,0,1,1,0,2,1,1,2,0,
0,2,0,0,2,1,0,0,1,1,0,0,1,1,0,2,2,2,1,0,0,1,1,0,0,1,1,0,2,1,1,2,0,
0,2,0,0,2,1,0,0,1,1,0,0,1,1,2,0,2,1,2,0,0,1,1,0,0,1,1,0,2,1,1,2,0,
0,2,0,0,2,1,0,0,1,1,0,0,1,1,2,0,2,1,2,0,0,1,1,0,0,1,1,0,2,1,1,2,0,
0,2,0,0,2,1,0,0,1,1,0,0,1,1,2,0,2,1,2,0,0,1,1,0,0,1,1,0,2,1,1,2,0,
0,2,0,0,2,1,0,0,1,1,0,0,1,1,0,2,2,2,1,0,0,1,1,0,0,1,1,0,2,1,1,2,0,
0,2,0,0,2,1,0,0,1,1,0,0,1,1,0,0,2,1,1,0,0,1,1,0,0,1,1,0,2,1,1,2,0,
0,2,2,2,2,1,0,0,1,1,0,0,1,1,0,0,2,1,1,0,0,1,1,0,0,1,1,0,2,2,2,2,0,
0,2,0,0,1,1,0,0,1,1,0,0,1,1,0,0,2,1,1,0,0,1,1,0,0,1,1,0,0,1,1,2,0,
0,2,0,0,1,1,0,0,1,1,0,0,1,1,0,0,2,1,1,0,0,1,1,0,0,1,1,0,0,1,1,2,0,
0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
{
// First frame
GIFFrame *frameOne = gif_frameCreate(33, 17, 0, 0);
status = gif_frameAddIndexStreamFromArray(frameOne, tempIndexStream, sizeof(tempIndexStream));
CHECKSTATUS(status);
// First frame local color table
status = gif_frameCreateLocalColorTable(frameOne); CHECKSTATUS(status);
status = gif_frameAddColorToColorTable(frameOne, 45, 133, 79); CHECKSTATUS(status);
status = gif_frameAddColorToColorTable(frameOne, 47, 158, 90); CHECKSTATUS(status);
status = gif_frameAddColorToColorTable(frameOne, 255, 255, 255); CHECKSTATUS(status);
status = gif_frameAddGraphicsControlInfo(frameOne, 0, 100);
CHECKSTATUS(status);
status = gif_canvasAddFrame(canvas, frameOne);
CHECKSTATUS(status);
}
{
// Second frame
GIFFrame *frameTwo = gif_frameCreate(33, 17, 0, 0);
status = gif_frameAddIndexStreamFromArray(frameTwo, tempIndexStream, sizeof(tempIndexStream));
CHECKSTATUS(status);
// Second frame local color table
status = gif_frameCreateLocalColorTable(frameTwo); CHECKSTATUS(status);
status = gif_frameAddColorToColorTable(frameTwo, 47, 98, 153); CHECKSTATUS(status);
status = gif_frameAddColorToColorTable(frameTwo, 46, 89, 135); CHECKSTATUS(status);
status = gif_frameAddColorToColorTable(frameTwo, 0, 0, 0); CHECKSTATUS(status);
status = gif_frameAddGraphicsControlInfo(frameTwo, 0, 100);
CHECKSTATUS(status);
status = gif_canvasAddFrame(canvas, frameTwo);
CHECKSTATUS(status);
}
u32 widthMuliplier = 10; u32 heightMuliplier = 10;
gif_expandCanvas(canvas, widthMuliplier, heightMuliplier);
gif_createGIF(canvas, true, true);
return OPERATION_SUCCESS;
}