const Cogl = imports.gi.Cogl;
const Clutter = imports.gi.Clutter;
const GdkPixbuf = imports.gi.GdkPixbuf;
const Lang = imports.lang;


Clutter.init(null, null);

let stage = new Clutter.Stage({
    width: 800,
    height: 600,
    background_color: new Clutter.Color({ alpha: 0xff,
                                          red: 0,
                                          green: 0xff,
                                          blue: 0xff, }),
});
stage.show();

let alpha = 120;

let pixbuf = GdkPixbuf.Pixbuf.new_from_file(ARGV[0]);
let image = new Clutter.Image({
    //blend_string: 'RGBA = ADD(SRC_COLOR, 0)',
    blend_string: 'RGBA = ADD(SRC_COLOR * (1 - CONSTANT), DST_COLOR * CONSTANT)',
    blend_color: new Clutter.Color({ alpha: alpha,
                                     red: alpha,
                                     green: alpha,
                                     blue: alpha}),
});
image.set_data(pixbuf.get_pixels(),
               Cogl.PixelFormat.RGB_888,
               pixbuf.get_width(),
               pixbuf.get_height(),
               pixbuf.get_rowstride());



let actor = new Clutter.Actor({
    x: 100,
    y: 100,
    width: 400,
    height: 400,
    content: image,
});
stage.add_child(actor);

Clutter.main();
