Package magick

Class PixelPacket


  • public class PixelPacket
    extends Magick
    • Constructor Summary

      Constructors 
      Constructor Description
      PixelPacket​(int red, int green, int blue, int opacity)
      Constructor
    • Constructor Detail

      • PixelPacket

        public PixelPacket​(int red,
                           int green,
                           int blue,
                           int opacity)
        Constructor
        Parameters:
        red - the red channel value
        green - the green channel value
        blue - the blue channel value
        opacity - the opacity/alpha channel value
    • Method Detail

      • setRed

        public void setRed​(int red)
        Set the red channel value.
        Parameters:
        red - the new red channel value
      • setGreen

        public void setGreen​(int green)
        Set the green channel value.
        Parameters:
        green - the new green channel value
      • setBlue

        public void setBlue​(int blue)
        Set the blue channel value.
        Parameters:
        blue - the new blue channel value
      • setOpacity

        public void setOpacity​(int opacity)
        Set the opacity/alpha channel value.
        Parameters:
        opacity - the new opacity/alpha channel value
      • getRed

        public int getRed()
        Get the red channel value.
        Returns:
        the red channel value
      • getGreen

        public int getGreen()
        Get the green channel value.
        Returns:
        the green channel value
      • getBlue

        public int getBlue()
        Get the blue channel value.
        Returns:
        the blue channel value
      • getOpacity

        public int getOpacity()
        Get the opacity/alpha channel value.
        Returns:
        the opacity/alpha channel value
      • queryColorDatabase

        public static PixelPacket queryColorDatabase​(java.lang.String target)
                                              throws MagickException
        looks up a RGB values for a color given in the target string.
        Parameters:
        target - Specifies the color to lookup in the X color database
        Returns:
        a PixelPacket that represents the target
        Throws:
        MagickException - on error
      • getColor

        public static PixelPacket getColor​(java.lang.String target)
                                    throws MagickException
        Converts a web (i.e. css-compliant) color string to a pixel packet.
        Parameters:
        target - Specifies the color string to convert
        Returns:
        a PixelPacket that represents the target
        Throws:
        MagickException - on error
      • toString

        public java.lang.String toString()
        Display the object as a String
        Overrides:
        toString in class java.lang.Object