?? image.java
字號:
* Returns the absolute Y position. * * @return a position */ public float absoluteY() { return absoluteY; } /** * Returns the type. * * @return a type */ public int type() { return type; } /** * Returns <CODE>true</CODE> if the image is a <CODE>Gif</CODE>-object. * * @return a <CODE>boolean</CODE> */ public boolean isGif() { return type == GIF; } /** * Returns <CODE>true</CODE> if the image is a <CODE>Jpeg</CODE>-object. * * @return a <CODE>boolean</CODE> */ public boolean isJpeg() { return type == JPEG; } /** * Returns <CODE>true</CODE> if the image is a <CODE>Png</CODE>-object. * * @return a <CODE>boolean</CODE> */ public boolean isPng() { return type == PNG; } /** * Returns <CODE>true</CODE> if the image is a <CODE>ImgRaw</CODE>-object. * * @return a <CODE>boolean</CODE> */ public boolean isImgRaw() { return type == IMGRAW; } /** * Returns <CODE>true</CODE> if the image is an <CODE>ImgTemplate</CODE>-object. * * @return a <CODE>boolean</CODE> */ public boolean isImgTemplate() { return type == IMGTEMPLATE; } /** * Gets the <CODE>String</CODE>-representation of the reference to the image. * * @return a <CODE>String</CODE> */ public URL url() { return url; } /** * Gets the alignment for the image. * * @return a value */ public int alignment() { return alignment; } /** * Gets the alternative text for the image. * * @return a <CODE>String</CODE> */ public String alt() { return alt; } /** * Gets the scaled width of the image. * * @return a value */ public float scaledWidth() { return scaledWidth; } /** * Gets the scaled height of the image. * * @return a value */ public float scaledHeight() { return scaledHeight; } /** * 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 colorspace() { return colorspace; } /** * Returns the transformation matrix of the image. * * @return an array [AX, AY, BX, BY, CX, CY, DX, DY] */ public float[] matrix() { float[] matrix = new float[8]; float cosX = (float)Math.cos(rotation); float sinX = (float)Math.sin(rotation); matrix[AX] = plainWidth * cosX; matrix[AY] = plainWidth * sinX; matrix[BX] = (- plainHeight) * sinX; matrix[BY] = plainHeight * cosX; if (rotation < Math.PI / 2f) { matrix[CX] = matrix[BX]; matrix[CY] = 0; matrix[DX] = matrix[AX]; matrix[DY] = matrix[AY] + matrix[BY]; } else if (rotation < Math.PI) { matrix[CX] = matrix[AX] + matrix[BX]; matrix[CY] = matrix[BY]; matrix[DX] = 0; matrix[DY] = matrix[AY]; } else if (rotation < Math.PI * 1.5f) { matrix[CX] = matrix[AX]; matrix[CY] = matrix[AY] + matrix[BY]; matrix[DX] = matrix[BX]; matrix[DY] = 0; } else { matrix[CX] = 0; matrix[CY] = matrix[AY]; matrix[DX] = matrix[AX] + matrix[BX]; matrix[DY] = matrix[BY]; } return matrix; } /** * This method is an alternative for the <CODE>InputStream.skip()</CODE>-method * that doesn't seem to work properly for big values of <CODE>size</CODE>. * * @param is the <CODE>InputStream</CODE> * @param size the number of bytes to skip */ static public void skip(InputStream is, int size) throws IOException { while (size > 0) { size -= is.skip(size); } } /** * This method makes a valid URL from a given filename. * <P> * This method makes the conversion of this library from the JAVA 2 platform * to a JDK1.1.x-version easier. * * @param filename a given filename * @return a valid URL */ public static URL toURL(String filename) throws MalformedURLException { if (filename.startsWith("file:/") || filename.startsWith("http://")) { return new URL(filename); } File f = new File(filename); String path = f.getAbsolutePath(); if (File.separatorChar != '/') { path = path.replace(File.separatorChar, '/'); } if (!path.startsWith("/")) { path = "/" + path; } if (!path.endsWith("/") && f.isDirectory()) { path = path + "/"; } return new URL("file", "", path); } /** * Returns the transparency. */ public int[] getTransparency() { return transparency; } /** * Checks if a given tag corresponds with this object. * * @param tag the given tag * @return true if the tag corresponds */ public static boolean isTag(String tag) { return ElementTags.IMAGE.equals(tag); } /** * Gets the plain width of the image. * * @return a value */ public float plainWidth() { return plainWidth; } /** * Gets the plain height of the image. * * @return a value */ public float plainHeight() { return plainHeight; } static protected synchronized Long getSerialId() { ++serialId; return new Long(serialId); } public Long getMySerialId() { return mySerialId; } /** 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; } /** 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 bpc == 1 && colorspace == 1; } return type == PNG && bpc == 1 && colorspace == 1; } /** 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; } /** 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 can not contain another image mask."); if (!mask.mask) throw new DocumentException("The image mask is not a mask. Did you do makeMask()?"); imageMask = mask; } /** Gets the explicit masking. * @return the explicit masking */ public Image getImageMask() { return imageMask; } /** 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; } /** Inverts the meaning of the bits of a mask. * @param invertMask <CODE>true</CODE> to invert the meaning of the bits of a mask */ public void setInvertMask(boolean invertMask) { this.invertMask = invertMask; } /** Returns <CODE>true</CODE> if the bits are to be inverted * in the mask. * @return <CODE>true</CODE> if the bits are to be inverted in the mask */ public boolean isInvertMask() { return invertMask; } public boolean isInvertedJPEG() { return invert; } /** 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; } /** * @see com.lowagie.text.MarkupAttributes#setMarkupAttribute(java.lang.String, java.lang.String) */ public void setMarkupAttribute(String name, String value) { markupAttributes = (markupAttributes == null) ? new Properties() : markupAttributes; markupAttributes.put(name, value); } /** * @see com.lowagie.text.MarkupAttributes#setMarkupAttributes(java.util.Properties) */ public void setMarkupAttributes(Properties markupAttributes) { this.markupAttributes = markupAttributes; } /** * @see com.lowagie.text.MarkupAttributes#getMarkupAttribute(java.lang.String) */ public String getMarkupAttribute(String name) { return (markupAttributes == null) ? null : String.valueOf(markupAttributes.get(name)); } /** * @see com.lowagie.text.MarkupAttributes#getMarkupAttributeNames() */ public Set getMarkupAttributeNames() { return Chunk.getKeySet(markupAttributes); } /** * @see com.lowagie.text.MarkupAttributes#getMarkupAttributes() */ public Properties getMarkupAttributes() { return markupAttributes; } /** 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; }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -