Class SaveGraphicsService


  • public class SaveGraphicsService
    extends Object
    Class is responsible for taking a component and saving it as a JPEG, PNG or TIFF. The class is very simple. Thanks to Batik and the developers who worked so hard on it.
    • Constructor Detail

      • SaveGraphicsService

        public SaveGraphicsService()
    • Method Detail

      • saveJComponent

        public void saveJComponent​(String filename,
                                   int type,
                                   JComponent component)
        Method will save the JComponent as an image. The formats are PNG, and TIFF.
        Parameters:
        filename - name of the file to store the image into
        type - of the image to be stored. Can be one of 0 for PNG or 1 for TIFF
        component - to draw the image on
      • savePNGWithBatik

        public void savePNGWithBatik​(String filename,
                                     BufferedImage image)
        Use Batik to save a PNG of the graph
        Parameters:
        filename - name of the file to store the image into
        image - to be stored
      • saveTIFFWithBatik

        public void saveTIFFWithBatik​(String filename,
                                      BufferedImage image)
        Use Batik to save a TIFF file of the graph
        Parameters:
        filename - name of the file to store the image into
        image - to be stored