Class ImgStreamingUtils


  • public class ImgStreamingUtils
    extends Object
    Provides utility functions used by the imgstreaming package(s).
    Author:
    Sebastien Vincent
    • Constructor Detail

      • ImgStreamingUtils

        public ImgStreamingUtils()
    • Method Detail

      • getScaledImage

        public static BufferedImage getScaledImage​(BufferedImage src,
                                                   int width,
                                                   int height,
                                                   int type)
        Get a scaled BufferedImage. Mainly inspired by: http://java.developpez.com/faq/gui/?page=graphique_general_images #GRAPHIQUE_IMAGE_redimensionner
        Parameters:
        src - source image
        width - width of scaled image
        height - height of scaled image
        type - BufferedImage type
        Returns:
        scaled BufferedImage
      • getImageBytes

        public static byte[] getImageBytes​(BufferedImage src,
                                           byte[] output)
        Get raw bytes from ARGB BufferedImage.
        Parameters:
        src - ARGB BufferImage
        output - output buffer, if not null and if its length is at least image's (width * height) * 4, method will put bytes in it.
        Returns:
        raw bytes or null if src is not an ARGB BufferedImage