ofimage.java

来自「现在在国外大学里最流行的java学习软件,同时还有大量的example,在名为p」· Java 代码 · 共 58 行

JAVA
58
字号
import java.awt.*;import java.awt.image.*;import javax.swing.*;/** * OFImage is a class that defines an image in OF (Objects First) format. *  * @author  Michael Kolling and David J. Barnes * @version 1.0 */public class OFImage extends BufferedImage{    /**     * Create an OFImage copied from a BufferedImage.     * @param image The image to copy.     */    public OFImage(BufferedImage image)    {         super(image.getColorModel(), image.copyData(null),                image.isAlphaPremultiplied(), null);    }    /**     * Create an OFImage with specified size and unspecified content.     * @param width The width of the image.     * @param height The height of the image.     */    public OFImage(int width, int height)    {        super(width, height, TYPE_INT_RGB);    }    /**     * Set a given pixel of this image to a specified color. The     * color is represented as an (r,g,b) value.     * @param x The x position of the pixel.     * @param y The y position of the pixel.     * @param col The color of the pixel.     */    public void setPixel(int x, int y, Color col)    {        int pixel = col.getRGB();        setRGB(x, y, pixel);    }        /**     * Get the color value at a specified pixel position.     * @param x The x position of the pixel.     * @param y The y position of the pixel.     * @return The color of the pixel at the given position.     */    public Color getPixel(int x, int y)    {        int pixel = getRGB(x, y);        return new Color(pixel);    }}

⌨️ 快捷键说明

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