Thread: iLiad My djvu viewer
View Single Post
Old 11-10-2009, 10:44 PM   #1
ericshliao
Guru
ericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enough
 
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
My djvu viewer

This is a simple djvu viewer with GTK+ gui, not QT gui.

I was enlightened by Evince when I found Evince (capable of displaying djvu files) is written on GTK+, not on QT. After reading the source code, I know that Evince use Cairo to draw djvu page image on GdkWindow. I think it too compilcated for me, so I choose another way. I use ddjvu (an utility provided by djvulibre) to generate a page image and draw it on GtkWidget. It's much more simple to implement.

The basic idea is using popen() to execute ddjvu and send output to GdkPixbufLoader.

The benefit will be:
1. reduced lib size. No more huge QT libs.
2. reduced loading time and ram usage. Loading QT lib is burdensome for iLiad.

To install:
Just unpack the attachment to anywhere and a dir "mydjvuview" will emerge. Execute it from contentlister.

Note:
0. I compiled the program agains GTK+2.14.7. I don't know if it works on common iLiad with GTK+2.6. Since I don't use any fancy GtkWidget, I think it should be working on your iLiad. If not, please tell me.
1. There is no file chooser currently. This app only open a specified sample djvu file bundled in the attachment.
2. To open your own djvu file, you have to modify "run.sh". If you want, you can modify registry.xml to enabl opening a djvu file from contentlister.
3. I found some djvu files do not conform to djvu standards. These files will cause the app crash without warning. It can be solved by using "djvm -c outfile infile" to convert a non-standard conforming file to standard-conforming.
4. This is only a demo. I am lazy to deal with the UI details in C. If I can call gdk_pixbuf_loader_write() in Lua script, I will make a lua version with more UI features.
Attached Files
File Type: zip mydjvuview.zip (1.45 MB, 780 views)

Last edited by ericshliao; 11-10-2009 at 11:38 PM.
ericshliao is offline   Reply With Quote