8
static const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
13
VGColorRampSpreadMode spread = VG_COLOR_RAMP_SPREAD_PAD;
18
VGubyte commands[5] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_CLOSE_PATH};
19
VGfloat coords[8] = {0.0f,0.0f, 32.0f,0.0f, 32.0f,32.0f, 0.0f,32.0f };
21
VGfloat rampStop[20] = {-0.5f, 1.0f, 1.0f, 1.0f, 1.0f,
22
0.25f, 1.0f, 0.0f, 0.0f, 1.0f,
23
0.75f, 0.0f, 0.0f, 1.0f, 1.0f,
24
1.5f, 0.0f, 0.0f, 0.0f, 0.0f};
26
VGfloat defaultColor[] = {1.0f, 1.0f, 1.0f, 1.0f};
27
VGfloat linearGradient[4] = {0.0f, 0.0f, 0.0f, 32.0f};
29
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
30
1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
31
if (path == VG_INVALID_HANDLE)
34
fill = vgCreatePaint();
35
if (fill == VG_INVALID_HANDLE) {
40
vgSetfv(VG_CLEAR_COLOR, 4, defaultColor);
41
vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_NONANTIALIASED);
43
vgAppendPathData(path, 5, commands, coords);
45
vgSetPaint(fill, VG_FILL_PATH);
46
vgSetParameteri(fill, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT);
47
vgSetParameteri(fill, VG_PAINT_COLOR_RAMP_SPREAD_MODE,
48
VG_COLOR_RAMP_SPREAD_REPEAT);
49
vgSetParameterfv(fill, VG_PAINT_LINEAR_GRADIENT, 4, linearGradient);
50
vgSetParameterfv(fill, VG_PAINT_COLOR_RAMP_STOPS, 20, rampStop);
53
/* new window size or exposure */
63
vgClear(0, 0, window_width(), window_height());
65
vgDrawPath(path, VG_FILL_PATH);
71
int main(int argc, char **argv)
74
const char *arg = argv[1];
75
if (!strcmp("-pad", arg))
76
spread = VG_COLOR_RAMP_SPREAD_PAD;
77
else if (!strcmp("-repeat", arg))
78
spread = VG_COLOR_RAMP_SPREAD_REPEAT;
79
else if (!strcmp("-reflect", arg))
80
spread = VG_COLOR_RAMP_SPREAD_REFLECT;
84
case VG_COLOR_RAMP_SPREAD_PAD:
85
printf("Using spread mode: pad\n");
87
case VG_COLOR_RAMP_SPREAD_REPEAT:
88
printf("Using spread mode: repeat\n");
90
case VG_COLOR_RAMP_SPREAD_REFLECT:
91
printf("Using spread mode: reflect\n");
94
set_window_size(200, 200);
96
return run(argc, argv, init, reshape,