Example #1
0
    static void Main(string [] args)
    {
        Gtk.Application.Init();

        string path = args [0];
        string name = System.IO.Path.GetFileName(path);
        int    type = Int32.Parse(name.Substring(1, 4));


        Console.WriteLine("path {0}, name {1}, id {2}", path, name, type);

        Gdk.Pixbuf thumb = IthmbDb.Load(type,
                                        Int64.Parse(args [1]),
                                        0,
                                        path);

        Gtk.Window win  = new Gtk.Window("iThumbnail Test");
        Gtk.HBox   hbox = new Gtk.HBox();
        Gtk.VBox   vbox = new Gtk.VBox();
        win.Add(hbox);
        hbox.PackStart(vbox);
        Gtk.Image image = new Gtk.Image(thumb);
        vbox.PackStart(image);
        win.ShowAll();

        Gtk.Application.Run();
    }
Example #2
0
    internal static void DisplayItem(iPodSharp.ImageItemRecord item, string basepath)
    {
        Gtk.Window win  = new Gtk.Window("iThumbnail Test");
        Gtk.HBox   hbox = new Gtk.HBox();
        Gtk.VBox   vbox = new Gtk.VBox();
        win.Add(hbox);
        hbox.PackStart(vbox);

        foreach (iPodSharp.ImageDataObjectRecord file in item.Versions)
        {
            if (file.Child.CorrelationID > 1)
            {
                string path = file.Child.Path.Replace(':', '/');
                path = basepath + path;

                Gdk.Pixbuf thumb = IthmbDb.Load(file.Child.CorrelationID,
                                                file.Child.ThumbPosition,
                                                file.Child.ThumbSize,
                                                path);
                Gtk.Image image = new Gtk.Image(thumb);
                vbox.PackStart(image);
            }
        }

        win.ShowAll();
    }
Example #3
0
    public static Gdk.Pixbuf Load(int type, long position, long size, string path)
    {
        IthmbDb db;

        switch (type)
        {
        case 1009:
            db = new IthmbDb(42, 30, Format.Rgb565);
            break;

        case 1013:          // 90 ccw
            db = new IthmbDb(176, 220, Format.Rgb565);
            break;

        case 1015:
            db = new IthmbDb(130, 88, Format.Rgb565);
            break;

        case 1016:          // untested
            db = new IthmbDb(140, 140, Format.Rgb565);
            break;

        case 1017:         // untested
            db = new IthmbDb(56, 56, Format.Rgb565);
            break;

        case 1019:
            db = new IthmbDb(720, 480, Format.IYUV);
            break;

        case 1020:         // 90 ccw
            db = new IthmbDb(176, 220, Format.Rgb565BE);
            break;

        case 1024:
            db = new IthmbDb(320, 240, Format.Rgb565);
            break;

        case 1028:
            db = new IthmbDb(100, 100, Format.Rgb565);
            break;

        case 1029:
            db = new IthmbDb(200, 200, Format.Rgb565);
            break;

        case 1036:
            db = new IthmbDb(50, 41, Format.Rgb565);
            break;

        default:
            throw new ApplicationException("unknown database type");
        }

        if (size != db.Width * db.Height)
        {
            System.Console.WriteLine("Unexpected thumbnail size");
        }

        return(db.Load(path, position));
    }