本文整理汇总了C++中PixelShader::SetTokensFromPath方法的典型用法代码示例。如果您正苦于以下问题:C++ PixelShader::SetTokensFromPath方法的具体用法?C++ PixelShader::SetTokensFromPath怎么用?C++ PixelShader::SetTokensFromPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PixelShader
的用法示例。
在下文中一共展示了PixelShader::SetTokensFromPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Rect
int
main (int argc, char **argv)
{
cairo_t *cr;
cairo_surface_t *dst, *src;
CustomEffect *effect;
PixelShader *shader;
int stride = width * 4;
Rect bounds = Rect (0, 0, width, height);
gpointer data;
bool status;
if (argc < 2) {
printf ("usage: %s SHADERFILE\n", argv[0]);
return 1;
}
gtk_init (&argc, &argv);
runtime_init_desktop ();
data = g_malloc0 (height * stride);
dst = cairo_image_surface_create_for_data ((unsigned char *) data,
CAIRO_FORMAT_ARGB32,
width, height, stride);
src = cairo_surface_create_similar (dst,
CAIRO_CONTENT_COLOR_ALPHA,
width, height);
cr = cairo_create (dst);
effect = new CustomEffect ();
shader = new PixelShader ();
shader->SetTokensFromPath (argv[1]);
effect->SetPixelShader (shader);
status = effect->Render (cr, src, NULL, 0, 0, width, height);
effect->unref ();
shader->unref ();
cairo_destroy (cr);
cairo_surface_destroy (src);
cairo_surface_destroy (dst);
g_free (data);
runtime_shutdown ();
return status != true;
}