-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgradientTest.c
More file actions
58 lines (41 loc) · 1.52 KB
/
Copy pathgradientTest.c
File metadata and controls
58 lines (41 loc) · 1.52 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
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "main.h"
#include "array.h"
#include "GIFColorTable.h"
#include "GIFInterface.h"
#include "GIFTransformations.h"
STATUS_CODE gif_createGradientTest() {
STATUS_CODE status;
GIFCanvas *canvas = gif_canvasCreate(254, 1);
CANVAS_NULL_CHECK(canvas);
status = gif_canvasSetFileName(canvas, "testGIF_Gradient.gif");
CHECKSTATUS(status);
status = gif_canvasCreateGlobalColorTable(canvas);
CHECKSTATUS(status);
for (int i = 0; i < 255; i++) {
status = gif_canvasAddColorToColorTable(canvas, 0, i, i);
CHECKSTATUS(status);
}
status = gif_canvasSetBackgroundColorIndex(canvas, 0);
CHECKSTATUS(status);
u8 tempIndexStream[1];
for (int i = 0; i < 254; i++) {
tempIndexStream[0] = i;
GIFFrame *frameOne = gif_frameCreate(1, 1, i, 0);
FRAME_NULL_CHECK(frameOne);
status = gif_frameAddIndexStreamFromArray(frameOne, tempIndexStream, sizeof(tempIndexStream));
CHECKSTATUS(status);
status = gif_frameAddGraphicsControlInfo(frameOne, 1, 0);
CHECKSTATUS(status);
status = gif_frameSetTransparanetColorIndexInColorTable(frameOne, 255);
CHECKSTATUS(status);
status = gif_canvasAddFrame(canvas, frameOne);
CHECKSTATUS(status);
}
u32 widthMuliplier = 20; u32 heightMuliplier = 500;
status = gif_expandCanvas(canvas, widthMuliplier, heightMuliplier);
gif_createGIF(canvas, true, true);
return OPERATION_SUCCESS;
}