Ejemplo n.º 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();
    }
Ejemplo n.º 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();
    }
Ejemplo n.º 3
0
        public void Dump()
        {
            System.Console.WriteLine(dbrec.Datasets.Count);

            foreach (ImageDataSetRecord dataset in dbrec.Datasets)
            {
                ListRecord list = dataset.Record;

                System.Console.WriteLine("{0}.Count = {1}", list.Name, list.Items.Count);

                if (list is ImageListRecord)
                {
                    ImageItemRecord image = ((ImageListRecord)list).Images [0] as ImageItemRecord;
                    IthmbDb.DisplayItem(image, System.IO.Path.GetDirectoryName(this.Path));

                    foreach (ImageItemRecord iirec in ((ImageListRecord)list).Images)
                    {
                        System.Console.WriteLine("Id = {0}", iirec.Id);
                        foreach (ImageDataObjectRecord file in iirec.Versions)
                        {
                            System.Console.WriteLine("   path={0} size {1} position {2} ID {3}",
                                                     file.Child.Path,
                                                     file.Child.ThumbPosition,
                                                     file.Child.ThumbSize,
                                                     file.Child.CorrelationID);
                        }
                    }
                }
                else if (list is AlbumListRecord)
                {
                    foreach (AlbumBookRecord book in list.Items)
                    {
                        System.Console.WriteLine("Book Title = {0}", book.Title);
                        foreach (AlbumItemRecord entry in book.Items)
                        {
                            System.Console.WriteLine("entry {0}", entry.Id);
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
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));
    }