⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 image.java

📁 处理PDF
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
	}	/**	 * Setter for property widthPercentage.	 * 	 * @param widthPercentage	 *            New value of property widthPercentage.	 */	public void setWidthPercentage(float widthPercentage) {		this.widthPercentage = widthPercentage;	}    // annotation	/** if the annotation is not null the image will be clickable. */	protected Annotation annotation = null;		/**	 * Sets the annotation of this Image.	 * 	 * @param annotation	 *            the annotation	 */	public void setAnnotation(Annotation annotation) {		this.annotation = annotation;	}	/**	 * Gets the annotation.	 * 	 * @return the annotation that is linked to this image	 */	public Annotation getAnnotation() {		return annotation;	}    // Optional Content    /** Optional Content layer to which we want this Image to belong. */	protected PdfOCG layer;		/**	 * Gets the layer this image belongs to.	 * 	 * @return the layer this image belongs to or <code>null</code> for no	 *         layer defined	 */	public PdfOCG getLayer() {		return layer;	}	/**	 * Sets the layer this image belongs to.	 * 	 * @param layer	 *            the layer this image belongs to	 */	public void setLayer(PdfOCG layer) {		this.layer = layer;	}	// interpolation	/** Holds value of property interpolation. */	protected boolean interpolation;	/**	 * Getter for property interpolation.	 * 	 * @return Value of property interpolation.	 */	public boolean isInterpolation() {		return interpolation;	}	/**	 * Sets the image interpolation. Image interpolation attempts to produce a	 * smooth transition between adjacent sample values.	 * 	 * @param interpolation	 *            New value of property interpolation.	 */	public void setInterpolation(boolean interpolation) {		this.interpolation = interpolation;	}		// original type and data	/** Holds value of property originalType. */	protected int originalType = ORIGINAL_NONE;	/** Holds value of property originalData. */	protected byte[] originalData;		/**	 * Getter for property originalType.	 * 	 * @return Value of property originalType.	 *  	 */	public int getOriginalType() {		return this.originalType;	}	/**	 * Setter for property originalType.	 * 	 * @param originalType	 *            New value of property originalType.	 *  	 */	public void setOriginalType(int originalType) {		this.originalType = originalType;	}	/**	 * Getter for property originalData.	 * 	 * @return Value of property originalData.	 *  	 */	public byte[] getOriginalData() {		return this.originalData;	}	/**	 * Setter for property originalData.	 * 	 * @param originalData	 *            New value of property originalData.	 *  	 */	public void setOriginalData(byte[] originalData) {		this.originalData = originalData;	}	// the following values are only set for specific types of images.		/** Holds value of property deflated. */	protected boolean deflated = false;	/**	 * Getter for property deflated.	 * 	 * @return Value of property deflated.	 *  	 */	public boolean isDeflated() {		return this.deflated;	}	/**	 * Setter for property deflated.	 * 	 * @param deflated	 *            New value of property deflated.	 */	public void setDeflated(boolean deflated) {		this.deflated = deflated;	}		// DPI info		/** Holds value of property dpiX. */	protected int dpiX = 0;	/** Holds value of property dpiY. */	protected int dpiY = 0;	/**	 * Gets the dots-per-inch in the X direction. Returns 0 if not available.	 * 	 * @return the dots-per-inch in the X direction	 */	public int getDpiX() {		return dpiX;	}	/**	 * Gets the dots-per-inch in the Y direction. Returns 0 if not available.	 * 	 * @return the dots-per-inch in the Y direction	 */	public int getDpiY() {		return dpiY;	}	/**	 * Sets the dots per inch value	 * 	 * @param dpiX	 *            dpi for x coordinates	 * @param dpiY	 *            dpi for y coordinates	 */	public void setDpi(int dpiX, int dpiY) {		this.dpiX = dpiX;		this.dpiY = dpiY;	}		// XY Ratio		/** Holds value of property XYRatio. */	private float XYRatio = 0;	/**	 * Gets the X/Y pixel dimensionless aspect ratio.	 * 	 * @return the X/Y pixel dimensionless aspect ratio	 */	public float getXYRatio() {		return this.XYRatio;	}	/**	 * Sets the X/Y pixel dimensionless aspect ratio.	 * 	 * @param XYRatio	 *            the X/Y pixel dimensionless aspect ratio	 */	public void setXYRatio(float XYRatio) {		this.XYRatio = XYRatio;	}		// color, colorspaces and transparency	/** this is the colorspace of a jpeg-image. */	protected int colorspace = -1;	/**	 * Gets the colorspace for the image.	 * <P>	 * Remark: this only makes sense for Images of the type <CODE>Jpeg</CODE>.	 * 	 * @return a colorspace value	 */	public int getColorspace() {		return colorspace;	}    	/** Image color inversion */	protected boolean invert = false;	/**	 * Getter for the inverted value	 * 	 * @return true if the image is inverted	 */	public boolean isInverted() {		return invert;	}	/**	 * Sets inverted true or false	 * 	 * @param invert	 *            true or false	 */	public void setInverted(boolean invert) {		this.invert = invert;	}	/** ICC Profile attached */	protected ICC_Profile profile = null;	/**	 * Tags this image with an ICC profile.	 * 	 * @param profile	 *            the profile	 */	public void tagICC(ICC_Profile profile) {		this.profile = profile;	}	/**	 * Checks is the image has an ICC profile.	 * 	 * @return the ICC profile or <CODE>null</CODE>	 */	public boolean hasICCProfile() {		return (this.profile != null);	}	/**	 * Gets the images ICC profile.	 * 	 * @return the ICC profile	 */	public ICC_Profile getICCProfile() {		return profile;	}	/** a dictionary with additional information */	private PdfDictionary additional = null;		/**	 * Getter for the dictionary with additional information.	 * 	 * @return a PdfDictionary with additional information.	 */	public PdfDictionary getAdditional() {		return this.additional;	}	/**	 * Sets the /Colorspace key.	 * 	 * @param additional	 *            a PdfDictionary with additional information.	 */	public void setAdditional(PdfDictionary additional) {		this.additional = additional;	}    /**     * Replaces CalRGB and CalGray colorspaces with DeviceRGB and DeviceGray.     */        public void simplifyColorspace() {        if (additional == null)            return;        PdfObject value = additional.get(PdfName.COLORSPACE);        if (value == null || !value.isArray())            return;        PdfObject cs = simplifyColorspace(value);        if (cs.isName())            value = cs;        else {            PdfObject first = (PdfObject)(((PdfArray)value).getArrayList().get(0));            if (PdfName.INDEXED.equals(first)) {                ArrayList array = ((PdfArray)value).getArrayList();                if (array.size() >= 2 && ((PdfObject)array.get(1)).isArray()) {                     array.set(1, simplifyColorspace((PdfObject)array.get(1)));                }            }        }        additional.put(PdfName.COLORSPACE, value);    }		/**	 * Gets a PDF Name from an array or returns the object that was passed.	 */    private PdfObject simplifyColorspace(PdfObject obj) {        if (obj == null || !obj.isArray())            return obj;        PdfObject first = (PdfObject)(((PdfArray)obj).getArrayList().get(0));        if (PdfName.CALGRAY.equals(first))            return PdfName.DEVICEGRAY;        else if (PdfName.CALRGB.equals(first))            return PdfName.DEVICERGB;        else            return obj;    }	/** Is this image a mask? */	protected boolean mask = false;		/** The image that serves as a mask for this image. */	protected Image imageMask;	/** Holds value of property smask. */	private boolean smask;	/**	 * Returns <CODE>true</CODE> if this <CODE>Image</CODE> is a mask.	 * 	 * @return <CODE>true</CODE> if this <CODE>Image</CODE> is a mask	 */	public boolean isMask() {		return mask;	}	/**	 * Make this <CODE>Image</CODE> a mask.	 * 	 * @throws DocumentException	 *             if this <CODE>Image</CODE> can not be a mask	 */	public void makeMask() throws DocumentException {		if (!isMaskCandidate())			throw new DocumentException("This image can not be an image mask.");		mask = true;	}	/**	 * Returns <CODE>true</CODE> if this <CODE>Image</CODE> has the	 * requisites to be a mask.	 * 	 * @return <CODE>true</CODE> if this <CODE>Image</CODE> can be a mask	 */	public boolean isMaskCandidate() {		if (type == IMGRAW) {			if (bpc > 0xff)				return true;		}		return colorspace == 1;	}	/**	 * Gets the explicit masking.	 * 	 * @return the explicit masking	 */	public Image getImageMask() {		return imageMask;	}	/**	 * Sets the explicit masking.	 * 	 * @param mask	 *            the mask to be applied	 * @throws DocumentException	 *             on error	 */	public void setImageMask(Image mask) throws DocumentException {		if (this.mask)			throw new DocumentException(					"An image mask cannot contain another image mask.");		if (!mask.mask)			throw new DocumentException(					"The image mask is not a mask. Did you do makeMask()?");		imageMask = mask;		smask = (mask.bpc > 1 && mask.bpc <= 8);	}	/**	 * Getter for property smask.	 * 	 * @return Value of property smask.	 *  	 */	public boolean isSmask() {		return this.smask;	}	/**	 * Setter for property smask.	 * 	 * @param smask	 *            New value of property smask.	 */	public void setSmask(boolean smask) {		this.smask = smask;	}	/** this is the transparency information of the raw image */	protected int transparency[];	/**	 * Returns the transparency.	 * 	 * @return the transparency values	 */	public int[] getTransparency() {		return transparency;	}	/**	 * Sets the transparency values	 * 	 * @param transparency	 *            the transparency values	 */	public void setTransparency(int transparency[]) {		this.transparency = transparency;	}	/**	 * Returns the compression level used for images written as a compressed stream.	 * @return the compression level (0 = best speed, 9 = best compression, -1 is default)     * @since	2.1.3	 */	public int getCompressionLevel() {		return compressionLevel;	}	/**	 * Sets the compression level to be used if the image is written as a compressed stream.	 * @param compressionLevel a value between 0 (best speed) and 9 (best compression)     * @since	2.1.3	 */	public void setCompressionLevel(int compressionLevel) {		if (compressionLevel < PdfStream.NO_COMPRESSION || compressionLevel > PdfStream.BEST_COMPRESSION)			this.compressionLevel = PdfStream.DEFAULT_COMPRESSION;		else			this.compressionLevel = compressionLevel;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -