Guest User

Untitled

a guest
Jan 12th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 0.32 KB | None | 0 0
  1. public Cairo.ImageSurface pixbuf2imgsurface(Gdk.Pixbuf pb) {
  2.     var fmt = pb.has_alpha ? Cairo.Format.ARGB32 : Cairo.Format.RGB24;
  3.     var imgsurface = new Cairo.ImageSurface(fmt, pb.width, pb.height);
  4.     var ctx = new Cairo.Context(imgsurface);
  5.     Gdk.cairo_set_source_pixbuf(ctx, pb, 0, 0);
  6.     ctx.paint();
  7.     return imgsurface;
  8. }
Add Comment
Please, Sign In to add comment