Skip to content

Instantly share code, notes, and snippets.

@sidorares
Created August 30, 2011 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sidorares/1179813 to your computer and use it in GitHub Desktop.
Save sidorares/1179813 to your computer and use it in GitHub Desktop.
Render api for node-x11
var picture = X.AllocID();
RenderCreatePicture(picture, win, rgb24, { polyEdge: 1, polyMode: 0 } );
var pixmap = X.AllocID();
X.CreatePixmap(pixmap, win, 32, 500, 500);
var pix_pict = X.AllocID();
RenderCreatePicture(pix_pict, pixmap, rgba32, { polyEdge: 1, polyMode: 0 });
var pic_grad = X.AllocID();
RenderLinearGradient(pic_grad, [0,0], [1000,100],
[
[0, [0,0,0,0x3000 ] ],
[0.1, [0xfff, 0, 0xffff, 0x1000] ] ,
[0.25, [0xffff, 0, 0xfff, 0x3000] ] ,
[0.5, [0xffff, 0, 0xffff, 0x4000] ] ,
[1, [0xffff, 0xffff, 0, 0x8000] ]
]);
var pic_grad1 = X.AllocID();
RenderConicalGradient(pic_grad1, [250,250], 10,
[
[0, [0,0,0,0x5000 ] ],
[0.1, [0xfff, 0, 0xffff, 0x3000] ] ,
[0.25, [0xffff, 0, 0xfff, 0x2000] ] ,
[0.5, [0xffff, 0, 0xffff, 0x1000] ] ,
[1, [0xffff, 0xffff, 0, 0x8000] ]
]);
var pic_grad2 = X.AllocID();
RenderRadialGradient(pic_grad2, [250,250], [250,250], 0, 250,
[
[0, [0,0,0,0x5000 ] ],
[1, [0xffff, 0xffff, 0, 0xffff] ]
]);
RenderFillRectangles(1, pix_pict, [0xffff, 0xffff, 0xffff, 0xffff], [0, 0, 500, 500]);
RenderComposite(3, pic_grad, 0, pix_pict, 0, 0, 0, 0, 0, 0, 500, 500);
RenderComposite(3, pic_grad1, 0, pix_pict, X.x1, X.x1, 0, 0, 0, 0, 500, 500);
RenderComposite(3, pic_grad2, 0, pix_pict, X.x2, X.y2, 0, 0, 0, 0, 500, 500);
RenderComposite(3, pix_pict, 0, picture, 0, 0, 0, 0, 0, 0, 500, 500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment