Class Paint

    • Method Detail

      • create

        public static Paint create​(Document targetDocument,
                                   ColorSpace colorSpace,
                                   double[] color,
                                   Transparency transparency)
                            throws ConformanceException

        Create an new paint.

        Transparency is supported by PDF 1.4 or higher and by PDF/A-2 or higher. The returned paint object is not yet used on any page, but it is associated with the given target document.
        Parameters:
        targetDocument - the output document with which the returned object is associated
        colorSpace - the color space of the paint
        color - the color components
        transparency - the transparency parameters. Use null to create an opaque paint.
        Returns:
        newly created paint object
        Throws:
        ConformanceException - if the transparency argument is not null and Transparency.getAlpha() of transparency is not 1.0 and the explicitly specified conformance does not support transparency (PDF/A-1, PDF 1.0 - 1.3).
        ConformanceException - if the transparency argument is not null and Transparency.getBlendMode() is not BlendMode.NORMAL and the explicitly specified conformance does not support transparency (PDF/A-1, PDF 1.0 - 1.3).
        java.lang.IllegalArgumentException - if the targetDocument argument has already been closed
        java.lang.IllegalArgumentException - if the targetDocument argument is read-only
        java.lang.IllegalArgumentException - if the colorSpace object has already been closed
        java.lang.IllegalArgumentException - if the colorSpace is associated with a different document
        java.lang.IllegalArgumentException - if the color argument contains too few elements
        java.lang.IllegalArgumentException - if an element of the color argument is out of range
        java.lang.IllegalArgumentException - if targetDocument is null
        java.lang.IllegalArgumentException - if colorSpace is null
        java.lang.IllegalArgumentException - if color is null
      • getColorSpace

        public ColorSpace getColorSpace()
        The color space of this paint.
        Throws:
        java.lang.IllegalStateException - the object has already been closed
        java.lang.IllegalStateException - the object has been created with any creation method of the document.
      • getColor

        public double[] getColor()
        The color values of this paint.
        Throws:
        java.lang.IllegalStateException - the object has already been closed
        java.lang.IllegalStateException - the object has been created with any creation method of the document.
      • getTransparency

        public Transparency getTransparency()
        The transparency parameters of this paint or null if this paint is opaque.
        Throws:
        java.lang.IllegalStateException - the object has already been closed
        java.lang.IllegalStateException - the object has been created with any creation method of the document.