本文整理汇总了C++中agg::path_storage::arrange_orientations_all_paths方法的典型用法代码示例。如果您正苦于以下问题:C++ path_storage::arrange_orientations_all_paths方法的具体用法?C++ path_storage::arrange_orientations_all_paths怎么用?C++ path_storage::arrange_orientations_all_paths使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类agg::path_storage
的用法示例。
在下文中一共展示了path_storage::arrange_orientations_all_paths方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse_lion
unsigned parse_lion(agg::path_storage& path, agg::rgba8* colors, unsigned* path_idx)
{
// Parse the lion and then detect its bounding
// box and arrange polygons orientations (make all polygons
// oriented clockwise or counterclockwise)
const char* ptr = g_lion;
unsigned npaths = 0;
while(*ptr)
{
if(*ptr != 'M' && isalnum(*ptr))
{
unsigned c = 0;
sscanf(ptr, "%x", &c);
// New color. Every new color creates new path in the path object.
path.close_polygon();
colors[npaths] = agg::rgb8_packed(c);
path_idx[npaths] = path.start_new_path();
npaths++;
while(*ptr && *ptr != '\n') ptr++;
if(*ptr == '\n') ptr++;
}
else
{
float x = 0.0;
float y = 0.0;
while(*ptr && *ptr != '\n')
{
int c = *ptr;
while(*ptr && !isdigit(*ptr)) ptr++;
x = atof(ptr);
while(*ptr && isdigit(*ptr)) ptr++;
while(*ptr && !isdigit(*ptr)) ptr++;
y = atof(ptr);
if(c == 'M')
{
path.close_polygon();
path.move_to(x, y);
}
else
{
path.line_to(x, y);
}
while(*ptr && isdigit(*ptr)) ptr++;
while(*ptr && *ptr != '\n' && !isalpha(*ptr)) ptr++;
}
if(*ptr == '\n') ptr++;
}
}
path.arrange_orientations_all_paths(agg::path_flags_cw);
return npaths;
}