commit: previewpng, converttopng features.

Date: Sun Dec 21 2003 - 08:39:40 EST

  • Next message: Christian Biesinger: "Commit: support importing tabstops from .sdw files"

    CVS: ----------------------------------------------------------------------
    CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
    CVS: Committing in .
    CVS: Modified Files:
    CVS: ConvertToText.c ConvertToText.h xp/AbiCommand.cpp
    CVS: ----------------------------------------------------------------------
    AbiCommand New feature previewpng, ConvertToPNG server implementation.

    CVS: ----------------------------------------------------------------------
    CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
    CVS: Committing in .
    CVS: Modified Files:
    CVS: src/af/gr/unix/gr_UnixGraphics.cpp
    CVS: src/af/gr/unix/gr_UnixGraphics.h
    CVS: src/af/gr/unix/gr_UnixImage.cpp src/af/gr/unix/gr_UnixImage.h
    CVS: src/wp/ap/unix/ap_UnixApp.cpp src/wp/ap/unix/ap_UnixApp.h
    CVS: src/wp/ap/xp/ap_Preview_Abi.cpp
    CVS: ----------------------------------------------------------------------
    AbiWord side of previewpng. Particularly note new ap_UnixApp method,
    makePngPreview(const char * pszInFile, const char * pszPNGFile, UT_sint32
    iWid\th, UT_sint32 iHeight

    OK this implements a feature, "previewpng" in AbiCommand plus a
    C-interface to an externally running AbiWord processes in
    ConvertToText.(h,c). The
    C interface is really simple:

     * The function is fault tolerant and will report if a requested
     * file is not capable of being coverted.
     * It will also restart AbiWord if it does crash on the next invocation
     * of convertFileToText.
     * Inputs: inFile - The path to the word processor file to be converted.
     * outFile - The path to the PNG image of the first page of the doc
     * iWidth - width in pixels of the document.
     * iHeight - height in pixels of the document.
     * The function blocks until the conversion is complete or until
     * the conversion fails.
     * It returns 0 upon a successful conversion
     * and -1 if the conversion fails.
    int convertFileToPNG(const char * inFile, const char * outFile, int
    iWidth, int iHeight)

    This is useful for showing a preview of the document that you've found and
    indexed in dashbaord via ConvertToText :-)

    It relies on new features inside the Unix abiword build. Firstly there is
    now an additional constructor for GR_UnixGraphics.

            GR_UnixGraphics(GdkPixmap * win, XAP_UnixFontManager * fontManager,
    XAP_App *app, bool bUsePixmap);

    Which uses a GdkPixmap to draw on rather than a GdkWindow. This is a nice
    proof of principle that we can draw to offscreen pixmaps with almost no
    change in API (There are gdk-warnings to do with cursors though.) So if we
    wanted to we could double buffer unix pretty easily.

    A new method in AP_UnixApp which converts a WP document to a png image of
    the first page.

    AP_UnixApp:: makePngPreview(const char * pszInFile, const char *
    pszPNGFile, UT_sint32 iWidth, UT_sint32 iHeight)

    and a new GR_UnixImage method to output an image to a PNG file.

    bool GR_UnixImage::saveToPNG(const char * szFile)

    Right now the whole document is loaded and the whole layout classes are
    filled in order to make a preview of the first page. I'm pretty sure we
    don't need to do this and I'll experiment with some algorithims to load
    just the first bit of the document so we can throw up a preview
    immediately a document is selected. This will be all XP code so all
    platforms could take
    advantage of it.


    This archive was generated by hypermail 2.1.4 : Sun Dec 21 2003 - 08:39:47 EST