Advertisement
Guest User

No transparent background for clutter

a guest
Nov 1st, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 1.71 KB | None | 0 0
  1. public class Application : Gtk.Window {
  2.  
  3.     private GtkClutter.Embed embed;
  4.    
  5.     public Application () {
  6.         Gtk.Settings.get_default().gtk_application_prefer_dark_theme = true;
  7.         this.window_position = Gtk.WindowPosition.CENTER;
  8.         this.set_default_size (350, 70);
  9.  
  10.         this.destroy.connect (() => {
  11.             Gtk.main_quit ();
  12.         });
  13.  
  14.         embed = new GtkClutter.Embed ();
  15.  
  16.         var stage = embed.get_stage () as Clutter.Stage;
  17.         var color = Clutter.Color().init(255,0,0,100);
  18.         //stage.background_color = color;
  19.         //stage.layout_manager = new Clutter.BinLayout();
  20.        
  21.         Gtk.IconTheme theme = Gtk.IconTheme.get_default();
  22.         Gdk.Pixbuf? pixbuf = theme.load_icon_for_scale("media-optical-cd-audio", 128, 1, 0);
  23.        
  24.         Clutter.Image image = new Clutter.Image();  
  25.         image.set_data(pixbuf.get_pixels(),
  26.                     pixbuf.has_alpha ? Cogl.PixelFormat.RGBA_8888 : Cogl.PixelFormat.RGB_888,
  27.                     pixbuf.width, pixbuf.height, pixbuf.rowstride);
  28.        
  29.         var actor = new Clutter.Actor();
  30.         actor.content = image;
  31.         actor.set_size(pixbuf.width, pixbuf.height);
  32.        
  33.         stage.add_child(actor);
  34.         stage.opacity = 122;
  35.        
  36.         embed.opacity = 0.5;
  37.         embed.halign = Gtk.Align.START;
  38.         embed.valign = Gtk.Align.START;
  39.         embed.width_request = 100;
  40.         embed.height_request = 100;
  41.        
  42.         this.add(embed);
  43.        
  44.         stdout.printf("BG %s\n", stage.background_color_set?"Ja" : "NEIN");
  45.     }
  46.  
  47.     public static int main (string[] args) {
  48.         Gtk.init (ref args);
  49.         GtkClutter.init (ref args);
  50.         Application app = new Application ();
  51.         app.show_all ();
  52.         Gtk.main ();
  53.         return 0;
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement