8 static const VGfloat white_color
[4] = {1.0, 1.0, 1.0, 1.0};
13 VGColorRampSpreadMode spread
= VG_COLOR_RAMP_SPREAD_PAD
;
18 static const VGubyte sqrCmds
[5] = {VG_MOVE_TO_ABS
, VG_HLINE_TO_ABS
, VG_VLINE_TO_ABS
, VG_HLINE_TO_ABS
, VG_CLOSE_PATH
};
19 static const VGfloat sqrCoords
[5] = {0.0f
, 0.0f
, 400.0f
, 400.0f
, 0.0f
};
21 VGfloat rampStop
[] = {0.00f
, 1.0f
, 1.0f
, 1.0f
, 1.0f
,
22 0.33f
, 1.0f
, 0.0f
, 0.0f
, 1.0f
,
23 0.66f
, 0.0f
, 1.0f
, 0.0f
, 1.0f
,
24 1.00f
, 0.0f
, 0.0f
, 1.0f
, 1.0f
};
25 VGfloat linearGradient
[4] = {100.0f
, 100.0f
, 300.0f
, 300.0f
};
27 path
= vgCreatePath(VG_PATH_FORMAT_STANDARD
, VG_PATH_DATATYPE_F
, 1, 0, 0, 0,
28 VG_PATH_CAPABILITY_APPEND_TO
);
29 vgAppendPathData(path
, 5, sqrCmds
, sqrCoords
);
31 fill
= vgCreatePaint();
32 vgSetPaint(fill
, VG_FILL_PATH
);
34 vgSetParameteri(fill
, VG_PAINT_TYPE
, VG_PAINT_TYPE_LINEAR_GRADIENT
);
35 vgSetParameteri(fill
, VG_PAINT_COLOR_RAMP_SPREAD_MODE
, spread
);
36 vgSetParameterfv(fill
, VG_PAINT_LINEAR_GRADIENT
, 4, linearGradient
);
37 vgSetParameterfv(fill
, VG_PAINT_COLOR_RAMP_STOPS
, 20, rampStop
);
39 vgSetfv(VG_CLEAR_COLOR
, 4, white_color
);
42 /* new window size or exposure */
52 vgClear(0, 0, window_width(), window_height());
54 vgDrawPath(path
, VG_FILL_PATH
);
60 int main(int argc
, char **argv
)
63 const char *arg
= argv
[1];
64 if (!strcmp("-pad", arg
))
65 spread
= VG_COLOR_RAMP_SPREAD_PAD
;
66 else if (!strcmp("-repeat", arg
))
67 spread
= VG_COLOR_RAMP_SPREAD_REPEAT
;
68 else if (!strcmp("-reflect", arg
))
69 spread
= VG_COLOR_RAMP_SPREAD_REFLECT
;
73 case VG_COLOR_RAMP_SPREAD_PAD
:
74 printf("Using spread mode: pad\n");
76 case VG_COLOR_RAMP_SPREAD_REPEAT
:
77 printf("Using spread mode: repeat\n");
79 case VG_COLOR_RAMP_SPREAD_REFLECT
:
80 printf("Using spread mode: reflect\n");
83 set_window_size(400, 400);
85 return run(argc
, argv
, init
, reshape
,