Package loci.poi.hpsf

Class Thumbnail


  • public class Thumbnail
    extends Object

    Class to manipulate data in the Clipboard Variant (VT_CF) format.

    Since:
    2002-04-29
    Version:
    $Id: Thumbnail.java 489730 2006-12-22 19:18:16Z bayard $
    Author:
    Drew Varner (Drew.Varner inOrAround sc.edu)
    See Also:
    SummaryInformation.getThumbnail()
    • Field Detail

      • OFFSET_WMFDATA

        public static int OFFSET_WMFDATA

        Offset in bytes where the Windows Metafile (WMF) image data starts in the byte[] returned by SummaryInformation.getThumbnail()

        There is only WMF data at this point in the byte[] if the Clipboard Format Tag is CFTAG_WINDOWS and the Clipboard Format is CF_METAFILEPICT.

        Note: The byte[] that starts at OFFSET_WMFDATA and ends at getThumbnail().length - 1 forms a complete WMF image. It can be saved to disk with a .wmf file type and read using a WMF-capable image viewer.

      • CFTAG_WINDOWS

        public static int CFTAG_WINDOWS

        Clipboard Format Tag - Windows clipboard format

        A DWORD indicating a built-in Windows clipboard format value

      • CFTAG_MACINTOSH

        public static int CFTAG_MACINTOSH

        Clipboard Format Tag - Macintosh clipboard format

        A DWORD indicating a Macintosh clipboard format value

      • CFTAG_FMTID

        public static int CFTAG_FMTID

        Clipboard Format Tag - Format ID

        A GUID containing a format identifier (FMTID). This is rarely used.

      • CFTAG_NODATA

        public static int CFTAG_NODATA

        Clipboard Format Tag - No Data

        A DWORD indicating No data. This is rarely used.

      • CF_METAFILEPICT

        public static int CF_METAFILEPICT

        Clipboard Format - Windows metafile format. This is the recommended way to store thumbnails in Property Streams.

        Note: This is not the same format used in regular WMF images. The clipboard version of this format has an extra clipboard-specific header.

      • CF_DIB

        public static int CF_DIB

        Clipboard Format - Device Independent Bitmap

      • CF_ENHMETAFILE

        public static int CF_ENHMETAFILE

        Clipboard Format - Enhanced Windows metafile format

    • Constructor Detail

      • Thumbnail

        public Thumbnail()

        Default Constructor. If you use it then one you'll have to add the thumbnail byte[] from SummaryInformation.getThumbnail() to do any useful manipulations, otherwise you'll get a NullPointerException.

      • Thumbnail

        public Thumbnail​(byte[] thumbnailData)

        Creates a Thumbnail instance and initializes with the specified image bytes.

        Parameters:
        thumbnailData - The thumbnail data
    • Method Detail

      • setThumbnail

        public void setThumbnail​(byte[] thumbnail)

        Sets the Thumbnail's underlying byte[] in VT_CF format.

        Parameters:
        thumbnail - The new thumbnail value
        See Also:
        SummaryInformation.getThumbnail()
      • getThumbnailAsWMF

        public byte[] getThumbnailAsWMF()
                                 throws HPSFException

        Returns the Thumbnail as a byte[] of WMF data if the Thumbnail's Clipboard Format Tag is CFTAG_WINDOWS and its Clipboard Format is CF_METAFILEPICT

        This byte[] is in the traditional WMF file, not the clipboard-specific version with special headers.

        See http://www.wvware.com/caolan/ora-wmf.html for more information on the WMF image format.

        Returns:
        A WMF image of the Thumbnail
        Throws:
        HPSFException - if the Thumbnail isn't CFTAG_WINDOWS and CF_METAFILEPICT