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

📄 gifcolor.java

📁 Ftp服务1.0
💻 JAVA
字号:
package ranab.img.gif;

import java.io.*;
import java.awt.*;
import java.awt.image.*;

/**
 * Color data structure.
 *
 * @author <a href="mailto:rana_b@yahoo.com">Rana Bhattacharyya</a>
 */
public
final class GifColor {

    private byte mbyRed;
    private byte mbyGreen;
    private byte mbyBlue;

    /**
     * Constructor
     */
    GifColor(IndexColorModel cm, int idx) {
        mbyRed   = (byte)cm.getRed(idx);
        mbyGreen = (byte)cm.getGreen(idx);
        mbyBlue  = (byte)cm.getBlue(idx);
    }

    /**
     * Write gif color
     */
    public void write(DataOutputStream ds) throws IOException {
        ds.writeByte(mbyRed);
        ds.writeByte(mbyGreen);
        ds.writeByte(mbyBlue);
    }

    /**
     * Update color entry
     */
    public void updateColor(Color col) {
        mbyRed = (byte)col.getRed();
        mbyGreen = (byte)col.getGreen();
        mbyBlue = (byte)col.getBlue();
    }


    /**
     * Get color
     */
    public Color getColor() {
        return new Color(mbyRed & 0x00ff, mbyGreen & 0xff, mbyBlue & 0xff);
    }
}

⌨️ 快捷键说明

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