Class DtImageDataRenderer


  • public class DtImageDataRenderer
    extends Object
    Utility for safety render data in ImageData

    Note that renderer can convert SVG data to PNG image for showing in SWT widgets

    • Method Detail

      • render

        public static Optional<org.eclipse.swt.graphics.ImageData> render​(ByteArrayInputStream imageBuffer)
        Render specific source in ImageData
        Parameters:
        imageBuffer - the source bytes stream, cannot be null
        Returns:
        Optional with ImageData, or empty if specified source inconsistent or cannot be converted to image
      • render

        public static Optional<org.eclipse.swt.graphics.ImageData> render​(InputStream imageStream)
        Render specific source in ImageData
        Parameters:
        imageStream - the source stream, cannot be null
        Returns:
        Optional with ImageData, or empty if specified source inconsistent or cannot be converted to image
        See Also:
        render(ByteArrayInputStream)
      • render

        public static Optional<org.eclipse.swt.graphics.ImageData> render​(byte[] imageBuffer)
        Render specific source in ImageData
        Parameters:
        imageBuffer - the source byte array, cannot be null
        Returns:
        Optional with ImageData, or empty if specified source inconsistent or cannot be converted to image
        See Also:
        render(ByteArrayInputStream)
      • render

        public static Optional<org.eclipse.swt.graphics.ImageData> render​(File file)
        Render specific source in ImageData
        Parameters:
        file - the source image file, cannot be null
        Returns:
        Optional with ImageData, or empty if specified source inconsistent or cannot be converted to image
        See Also:
        render(ByteArrayInputStream)
      • getFormatName

        public static String getFormatName​(InputStream imageStream)
                                    throws IOException
        Tries to retrieve image format name from InputStream
        Parameters:
        imageStream - image input stream, cannot be null
        Returns:
        image format name or empty string if not found
        Throws:
        IOException