4 #include <X11/keysym.h>
20 VGfloat lineCoords
[8];
27 VGfloat moveCoords
[2];
35 vgSetfv(VG_CLEAR_COLOR
, 4, bgCol
);
36 vgSeti(VG_RENDERING_QUALITY
, VG_RENDERING_QUALITY_NONANTIALIASED
);
38 stroke
= vgCreatePaint();
50 vgSetPaint(stroke
, VG_STROKE_PATH
);
52 vgSeti(VG_STROKE_CAP_STYLE
, VG_CAP_SQUARE
);
55 VGfloat temp
[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
56 for (i
= 0; i
< 9; i
++)
63 target
= vgCreatePath(VG_PATH_FORMAT_STANDARD
,
64 VG_PATH_DATATYPE_F
, 1, 0, 0, 0, VG_PATH_CAPABILITY_TRANSFORM_TO
);
69 VGubyte temp
[6] = {VG_MOVE_TO_ABS
, VG_VLINE_TO_REL
,
70 VG_MOVE_TO_ABS
, VG_VLINE_TO_REL
,
71 VG_HLINE_TO_REL
, VG_VLINE_TO_REL
};
72 for (i
= 0; i
< 6; i
++)
74 lineCmds
[i
] = temp
[i
];
78 VGfloat temp
[8] = {0.5f
, 0.8f
, -0.6f
, 0.28f
, 0.6f
, -0.4f
, 0.44f
, 0.4f
};
79 for (i
= 0; i
< 8; i
++)
81 lineCoords
[i
] = temp
[i
] * window_width();
86 VGfloat temp
[5] = {0.35f
, 0.15f
, 29, 0.3f
, 0.4f
};
87 for (i
= 0; i
< 5; i
++)
89 arcCoords
[i
] = temp
[i
] * window_width();
95 VGubyte temp
[1] = {VG_SCCWARC_TO_ABS
};
96 for (i
= 0; i
< 1; i
++)
102 VGubyte temp
[1] = {VG_SCWARC_TO_ABS
};
103 for (i
= 0; i
< 1; i
++)
109 VGubyte temp
[1] = {VG_LCCWARC_TO_ABS
};
110 for (i
= 0; i
< 1; i
++)
116 VGubyte temp
[1] = {VG_LCWARC_TO_ABS
};
117 for (i
= 0; i
< 1; i
++)
124 VGubyte temp
[1] = {VG_MOVE_TO_ABS
};
125 for (i
= 0; i
< 1; i
++)
127 moveCmd
[i
] = temp
[i
];
131 VGfloat temp
[2] = {0.7f
, 0.6f
};
132 for (i
= 0; i
< 2; i
++)
134 moveCoords
[i
] = temp
[i
] * window_width();
139 lines
= vgCreatePath(VG_PATH_FORMAT_STANDARD
, VG_PATH_DATATYPE_F
, 1,
141 VG_PATH_CAPABILITY_APPEND_TO
|
142 VG_PATH_CAPABILITY_TRANSFORM_FROM
);
144 vgAppendPathData(lines
, 6, lineCmds
, lineCoords
);
146 vgAppendPathData(lines
, 1, moveCmd
, moveCoords
);
147 vgAppendPathData(lines
, 1, sccCmd
, arcCoords
);
148 vgAppendPathData(lines
, 1, moveCmd
, moveCoords
);
149 vgAppendPathData(lines
, 1, scCmd
, arcCoords
);
150 vgAppendPathData(lines
, 1, moveCmd
, moveCoords
);
151 vgAppendPathData(lines
, 1, lccCmd
, arcCoords
);
152 vgAppendPathData(lines
, 1, moveCmd
, moveCoords
);
153 vgAppendPathData(lines
, 1, lcCmd
, arcCoords
);
157 vgTranslate(0.25f
* window_width(), 0.25f
* window_height());
159 vgTranslate(-0.25f
* window_width(), -0.25f
* window_height());
160 vgTransformPath(target
, lines
);}
162 /* new window size or exposure */
164 reshape(int w
, int h
)
171 vgClear(0, 0, window_width(), window_height());
174 vgTranslate(0.25f
* window_width(), 0.25f
* window_height());
176 vgTranslate(-0.25f
* window_width(), -0.25f
* window_height());
177 vgSetf(VG_STROKE_LINE_WIDTH
, 7);
178 vgSetParameterfv(stroke
, VG_PAINT_COLOR
, 4, color1
);
179 vgDrawPath(lines
, VG_STROKE_PATH
);
182 vgSetParameterfv(stroke
, VG_PAINT_COLOR
, 4, color2
);
183 vgSetf(VG_STROKE_LINE_WIDTH
, 3);
184 vgDrawPath(target
, VG_STROKE_PATH
);
187 static int key_press(unsigned key
)
203 int main(int argc
, char **argv
)
205 return run(argc
, argv
, init
, reshape
,