Class ColorScalePane

    • Constructor Detail

      • ColorScalePane

        public ColorScalePane​(ColorScale cs)
        Create a ColorScalePane using the provided ColorScale. This class will assume, that the ColorScale is continuous and will thus generate a Linear gradient from the ColorScale.
        Parameters:
        cs - The ColorScale to use for this component.
    • Method Detail

      • paintScale

        protected void paintScale​(Graphics g,
                                  int w,
                                  int h)
        This helper function paints a LinearGradientPaint on a graphics object. Unfortunately directly printing it to a panel will mess up the size, so we print it to a image instead in paintComponent
        Parameters:
        g - The graphics object to paint to
        w - The width of the gradient
        h - the height of the gradient
      • getImage

        public BufferedImage getImage​(int width,
                                      int height)
        Get an image that represents this ColorScalePane, with the given width and height
        Parameters:
        width - the Width of the image
        height - The height of the image.
        Returns:
        an Image of this colorscalepane