Example #1
0
        private string CompositeEmblemIcon(String emblem)
        {
            if (emblem == null)
            {
                return("internal:bookmark.png");
            }

            if (!File.Exists(emblem))
            {
                return("internal:bookmark.png");
            }

            // Composite an icon...
            Gdk.Pixbuf icon     = new Pixbuf(emblem);
            Gdk.Pixbuf bookmark =
                new Pixbuf(GetImage("bookmark.png"));
            Gdk.Pixbuf white =
                new Pixbuf(GetImage("white.png"));

            white.Composite(bookmark,
                            0, 0,                  // dest x,y
                            48, 20,                // height,width
                            0, 0,                  // offset x,y
                            1, 1,                  // scaling x,y
                            Gdk.InterpType.Bilinear,
                            127);                  // Alpha

            // I just want to make the icon be 16x16.
            // This does it for me!
            Gdk.Pixbuf small_icon = icon.ScaleSimple(16, 16,              // x,y
                                                     Gdk.InterpType.Bilinear);

            small_icon.Composite(bookmark,
                                 0, 0,                 // dest x,y
                                 48, 18,               // height,width
                                 31, 2,                // offset x,y
                                 1, 1,                 // scaling x,y
                                 Gdk.InterpType.Bilinear,
                                 255);                 // Alpha

            emblem = System.IO.Path.GetFileName(emblem);
            emblem = PathFinder.AppDataFileName("transient:WebLinkHitRenderer",
                                                "emblem-" + emblem);
            bookmark.Savev(emblem, "png", null, null);
            return(emblem);
        }