📄 bufferedimage.java
字号:
*/ public ColorModel getColorModel() { return peer.getColorModel(); } /** * Returns the {@link WritableRaster}. * @return the <code>WriteableRaster</code> of this * <code>BufferedImage</code>. */ /* public WritableRaster getRaster() { return raster; } */ /** * Creates a <code>Graphics2D</code>, which can be used to draw into * this <code>BufferedImage</code>. * @return a <code>Graphics2D</code>, used for drawing into this * image. */ public Graphics2D createGraphics() { return (Graphics2D) peer.getGraphics(); } /** * Returns a <code>WritableRaster</code> representing the alpha * channel for <code>BufferedImage</code> objects * with <code>ColorModel</code> objects that support a separate * spatial alpha channel, such as <code>ComponentColorModel</code> and * <code>DirectColorModel</code>. Returns <code>null</code> if there * is no alpha channel associated with the <code>ColorModel</code> in * this image. This method assumes that for all * <code>ColorModel</code> objects other than * <code>IndexColorModel</code>, if the <code>ColorModel</code> * supports alpha, there is a separate alpha channel * which is stored as the last band of image data. * If the image uses an <code>IndexColorModel</code> that * has alpha in the lookup table, this method returns * <code>null</code> since there is no spatially discrete alpha * channel. This method creates a new * <code>WritableRaster</code>, but shares the data array. * @return a <code>WritableRaster</code> or <code>null</code> if this * <code>BufferedImage</code> has no alpha channel associated * with its <code>ColorModel</code>. */ /* public WritableRaster getAlphaRaster() { return null; } */ /** * Returns an integer pixel in the default RGB color model * (TYPE_INT_ARGB) and default sRGB colorspace. Color * conversion takes place if this default model does not match * the image <code>ColorModel</code>. There are only 8-bits of * precision for each color component in the returned data when using * this method. * @param x, y the coordinates of the pixel from which to get * the pixel in the default RGB color model and sRGB * color space * @return an integer pixel in the default RGB color model and * default sRGB colorspace. */ public int getRGB(int x, int y) { return peer.getRGB(x, y); } /** * Returns an array of integer pixels in the default RGB color model * (TYPE_INT_ARGB) and default sRGB color space, * from a portion of the image data. Color conversion takes * place if the default model does not match the image * <code>ColorModel</code>. There are only 8-bits of precision for * each color component in the returned data when * using this method. With a specified coordinate (x, y) in the * image, the ARGB pixel can be accessed in this way: * <pre> * pixel = rgbArray[offset + (y-startY)*scansize + (x-startX)]; * </pre> * @param startX, startY the starting coordinates * @param w width of region * @param h height of region * @param rgbArray if not <code>null</code>, the rgb pixels are * written here * @param offset offset into the <code>rgbArray</code> * @param scansize scanline stride for the <code>rgbArray</code> * @return array of RGB pixels. * @exception <code>IllegalArgumentException</code> if an unknown * datatype is specified */ public int[] getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize) { return peer.getRGB(startX, startY, w, h, rgbArray, offset, scansize); } /** * Sets a pixel in this <code>BufferedImage</code> to the specified * RGB value. The pixel is assumed to be in the default RGB color * model, TYPE_INT_ARGB, and default sRGB color space. For images * with an <code>IndexColorModel</code>, the index with the nearest * color is chosen. * @param x, y the coordinates of the pixel to set * @param rgb the RGB value */ public synchronized void setRGB(int x, int y, int rgb) { peer.setRGB(x, y, rgb); } /** * Sets an array of integer pixels in the default RGB color model * (TYPE_INT_ARGB) and default sRGB color space, * into a portion of the image data. Color conversion takes place * if the default model does not match the image * <code>ColorModel</code>. There are only 8-bits of precision for * each color component in the returned data when * using this method. With a specified coordinate (x, y) in the * this image, the ARGB pixel can be accessed in this way: * <pre> * pixel = rgbArray[offset + (y-startY)*scansize + (x-startX)]; * </pre> * WARNING: No dithering takes place. * * @param startX, startY the starting coordinates * @param w width of the region * @param h height of the region * @param rgbArray the rgb pixels * @param offset offset into the <code>rgbArray</code> * @param scansize scanline stride for the <code>rgbArray</code> */ public void setRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize) { peer.setRGB(startX, startY, w, h, rgbArray, offset, scansize); } /** * Returns the width of the <code>BufferedImage</code>. * @return the width of this <code>BufferedImage</code>. */ public int getWidth() { return peer.getWidth(); } /** * Returns the height of the <code>BufferedImage</code>. * @return the height of this <code>BufferedImage</code>. */ public int getHeight() { return peer.getHeight(); } /** * Returns the actual width of the image. If the width is not known * yet then the {@link ImageObserver} is notified later and * <code>-1</code> is returned. * @param observer the <code>ImageObserver</code> that receives * information about the image * @return the width of the image or <code>-1</code> if the width * is not yet known. * @see java.awt.Image#getHeight(ImageObserver) * @see ImageObserver */ public int getWidth(ImageObserver observer) { return peer.getWidth(observer); } /** * Returns the actual height of the image. If the height is not known * yet then the <code>ImageObserver</code> is notified later and * <code>-1</code> is returned. * @param observer the <code>ImageObserver</code> that receives * information about the image * @return the height of the image or <code>-1</code> if the height * is not yet known. * @see java.awt.Image#getWidth(ImageObserver) * @see ImageObserver */ public int getHeight(ImageObserver observer) { return peer.getHeight(observer); } /** * Returns the object that produces the pixels for the image. * @return the {@link ImageProducer} that is used to produce the * pixels for this image. * @see ImageProducer */ public ImageProducer getSource() { return peer.getSource(); } /** * Returns a property of the image by name. Individual property names * are defined by the various image formats. If a property is not * defined for a particular image, this method returns the * <code>UndefinedProperty</code> field. If the properties * for this image are not yet known, then this method returns * <code>null</code> and the <code>ImageObserver</code> object is * notified later. The property name "comment" should be used to * store an optional comment that can be presented to the user as a * description of the image, its source, or its author. * @param name the property name * @param observer the <code>ImageObserver</code> that receives * notification regarding image information * @return an {@link Object} that is the property referred to by the * specified <code>name</code> or <code>null</code> if the * properties of this image are not yet known. * @see ImageObserver * @see java.awt.Image#UndefinedProperty */ public Object getProperty(String name, ImageObserver observer) { return peer.getProperty(name, observer); } /** * Returns a property of the image by name. * @param name the property name * @return an <code>Object</code> that is the property referred to by * the specified <code>name</code>. */ public Object getProperty(String name) { return peer.getProperty(name); } /** * Flushes all resources being used to cache optimization information. * The underlying pixel data is unaffected. */ public void flush() { peer.flush(); } /** * This method returns a {@link Graphics2D}, but is here * for backwards compatibility. {@link #createGraphics() createGraphics} is more * convenient, since it is declared to return a * <code>Graphics2D</code>. * @return a <code>Graphics2D</code>, which can be used to draw into * this image. */ public java.awt.Graphics getGraphics() { return peer.getGraphics(); } /** * Creates a <code>Graphics2D</code>, which can be used to draw into * this <code>BufferedImage</code>. * @return a <code>Graphics2D</code>, used for drawing into this * image. */ /* public Graphics2D createGraphics() { } */ /** * Returns a subimage defined by a specified rectangular region. * The returned <code>BufferedImage</code> shares the same * data array as the original image. * @param x, y the coordinates of the upper-left corner of the * specified rectangular region * @param w the width of the specified rectangular region * @param h the height of the specified rectangular region * @return a <code>BufferedImage</code> that is the subimage of this * <code>BufferedImage</code>. * @exception <code>RasterFormatException</code> if the specified * area is not contained within this <code>BufferedImage</code>. */ public BufferedImage getSubimage(int x, int y, int w, int h) { return peer.getSubimage(x, y, w, h); } /** * Returns a <code>String</code> representation of this * <code>BufferedImage</code> object and its values. * @return a <code>String</code> representing this * <code>BufferedImage</code>. */ public String toString() { return peer.toString(); } /** * Returns a {@link Vector} of {@link RenderedImage} objects that are * the immediate sources, not the sources of these immediate sources, * of image data for this <code>BufferedImage</code>. This * method returns <code>null</code> if the <code>BufferedImage</code> * has no information about its immediate sources. It returns an * empty <code>Vector</code> if the <code>BufferedImage</code> has no * immediate sources. * @return a <code>Vector</code> containing immediate sources of * this <code>BufferedImage</code> object's image date, or * <code>null</code> if this <code>BufferedImage</code> has * no information about its immediate sources, or an empty * <code>Vector</code> if this <code>BufferedImage</code> * has no immediate sources. */ /* public Vector getSources() { return null; } */ /** * Returns an array of names recognized by * {@link #getProperty(String) getProperty(String)} * or <code>null</code>, if no property names are recognized. * @return a <code>String</code> array containing all of the property * names that <code>getProperty(String)</code> recognizes; * or <code>null</code> if no property names are recognized. */ public String[] getPropertyNames() { return peer.getPropertyNames(); } /** * Returns the minimum x coordinate of this * <code>BufferedImage</code>. This is always zero. * @return the minimum x coordinate of this * <code>BufferedImage</code>. */ /* public int getMinX() { return 0; } */ /** * Returns the minimum y coordinate of this * <code>BufferedImage</code>. This is always zero. * @return the minimum y coordinate of this * <code>BufferedImage</code>. */ /* public int getMinY() { return 0; } */}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -