View Single Post
Old 06-06-2007, 10:46 AM   #7
igorsk
Wizard
igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.
 
Posts: 3,442
Karma: 300001
Join Date: Sep 2006
Location: Belgium
Device: PRS-500/505/700, Kindle, Cybook Gen3, Words Gear
Viewer plugins interface is very abstract, so you can use the same code on Win32 and Linux. Fsk takes care of all input and display, you only need to implement the features you need. The text viewer interface is described by the DocViewer structure. For the bare minimum you need to implement:
  1. CanHandle, which is used by Fsk to check whether the plugin can render a given mime type
  2. New, which is called by Fsk on opening of the file and should return a new viewer instance. One of the parameters has a pointer to the fileRead function, which can be used to read the actual file data.
  3. Dispose, called when closing the file.
  4. Render, called by Fsk when it needs to render a page. It should return an FskBitmap with rendered text/graphics. Various Fsk APIs can be used for rendering text and graphics on the bitmap.
  5. A few propery handlers in PropTable. You probably need at least handlers for Dimensions and Crop. If you want resizable text, you need to implement TextScale. To handle multi-page documents, Page and Pages.
When using resizable fonts, marks interface needs to be implemented too (MarkNewFromLocation etc).
To register in the viewer plugins chain, the plugin should call FskExtensionInstall in the fskLoad function.
igorsk is offline   Reply With Quote