首页>代码>java常用工具类>/jutils-master/src/main/java/com/JUtils/QRCode/MatrixToImageConfig.java
package com.JUtils.QRCode;

import java.awt.image.BufferedImage;

/**
 *
 */
public final class MatrixToImageConfig {

  public static final int BLACK = 0xFF000000;
  public static final int WHITE = 0xFFFFFFFF;
  
  private final int onColor;
  private final int offColor;

  /**
   * Creates a default config with on color {@link #BLACK} and off color {@link #WHITE}, generating normal
   * black-on-white barcodes.
   */
  public MatrixToImageConfig() {
    this(BLACK, WHITE);
  }

  /**
   * @param onColor pixel on color, specified as an ARGB value as an int
   * @param offColor pixel off color, specified as an ARGB value as an int
   */
  public MatrixToImageConfig(int onColor, int offColor) {
    this.onColor = onColor;
    this.offColor = offColor;
  }

  public int getPixelOnColor() {
    return onColor;
  }

  public int getPixelOffColor() {
    return offColor;
  }

  int getBufferedImageColorModel() {
    // Use faster BINARY if colors match default
//    return onColor == BLACK && offColor == WHITE ? BufferedImage.TYPE_BYTE_BINARY : BufferedImage.TYPE_INT_RGB;
	  return BufferedImage.TYPE_INT_ARGB;
  }

}
最近下载更多
dapeng0011  LV15 2024年7月5日
3334004690  LV10 2024年6月6日
lee123321  LV22 2023年12月19日
初心不负丶方得始终  LV11 2023年4月21日
爱情戴罪的羔羊  LV7 2022年9月17日
guojun  LV10 2022年8月17日
iizuidaima  LV11 2022年8月11日
13940562934  LV22 2022年7月19日
姜广坤  LV14 2022年5月20日
crosa_Don  LV18 2022年4月1日
最近浏览更多
ma406805131  LV19 2024年12月8日
dapeng0011  LV15 2024年7月5日
sky1044  LV1 2024年2月19日
lee123321  LV22 2023年12月19日
shiaomon 2023年12月15日
暂无贡献等级
3334004690  LV10 2023年11月1日
lilu0226  LV7 2023年10月29日
飘逸的云  LV1 2023年7月6日
初心不负丶方得始终  LV11 2023年4月21日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友