本文整理了Java中java.awt.Canvas.createImage()
方法的一些代码示例,展示了Canvas.createImage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Canvas.createImage()
方法的具体详情如下:
包路径:java.awt.Canvas
类名称:Canvas
方法名:createImage
暂无
代码示例来源:origin: com.itextpdf/itextpdf
java.awt.Image img = canvas.createImage(new java.awt.image.MemoryImageSource(w, h, pix, 0, w));
return img;
代码示例来源:origin: itext/itext7
/**
* Creates a <CODE>java.awt.Image</CODE>. A successful call to the method <CODE>generate()</CODE>
* before calling this method is required.
*
* @param foreground the color of the bars
* @param background the color of the background
* @return the image
*/
public java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color background) {
if (image == null)
return null;
int f = foreground.getRGB();
int g = background.getRGB();
java.awt.Canvas canvas = new java.awt.Canvas();
int w = width + 2 * ws;
int h = height + 2 * ws;
int[] pix = new int[w * h];
int stride = (w + 7) / 8;
int ptr = 0;
for (int k = 0; k < h; ++k) {
int p = k * stride;
for (int j = 0; j < w; ++j) {
int b = image[p + j / 8] & 0xff;
b <<= j % 8;
pix[ptr++] = (b & 0x80) == 0 ? g : f;
}
}
java.awt.Image img = canvas.createImage(new java.awt.image.MemoryImageSource(w, h, pix, 0, w));
return img;
}
代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext
/**
* Creates a <CODE>java.awt.Image</CODE>. A successful call to the method <CODE>generate()</CODE>
* before calling this method is required.
* @param foreground the color of the bars
* @param background the color of the background
* @return the image
*/
public java.awt.Image createAwtImage(Color foreground, Color background) {
if (image == null)
return null;
int f = foreground.getRGB();
int g = background.getRGB();
Canvas canvas = new Canvas();
int w = width + 2 * ws;
int h = height + 2 * ws;
int pix[] = new int[w * h];
int stride = (w + 7) / 8;
int ptr = 0;
for (int k = 0; k < h; ++k) {
int p = k * stride;
for (int j = 0; j < w; ++j) {
int b = image[p + (j / 8)] & 0xff;
b <<= j % 8;
pix[ptr++] = (b & 0x80) == 0 ? g : f;
}
}
java.awt.Image img = canvas.createImage(new MemoryImageSource(w, h, pix, 0, w));
return img;
}
代码示例来源:origin: com.github.librepdf/openpdf
/**
* Creates a <CODE>java.awt.Image</CODE>. A successful call to the method <CODE>generate()</CODE>
* before calling this method is required.
* @param foreground the color of the bars
* @param background the color of the background
* @return the image
*/
public java.awt.Image createAwtImage(Color foreground, Color background) {
if (image == null)
return null;
int f = foreground.getRGB();
int g = background.getRGB();
Canvas canvas = new Canvas();
int w = width + 2 * ws;
int h = height + 2 * ws;
int[] pix = new int[w * h];
int stride = (w + 7) / 8;
int ptr = 0;
for (int k = 0; k < h; ++k) {
int p = k * stride;
for (int j = 0; j < w; ++j) {
int b = image[p + (j / 8)] & 0xff;
b <<= j % 8;
pix[ptr++] = (b & 0x80) == 0 ? g : f;
}
}
java.awt.Image img = canvas.createImage(new MemoryImageSource(w, h, pix, 0, w));
return img;
}
代码示例来源:origin: com.itextpdf/itextpdf
java.awt.Image img = canvas.createImage(new java.awt.image.MemoryImageSource(bitColumns, codeRows * h, pix, 0, bitColumns));
return img;
代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext
java.awt.Image img = canvas.createImage(new MemoryImageSource(bitColumns, codeRows * h, pix, 0, bitColumns));
return img;
代码示例来源:origin: itext/itext7
java.awt.Image img = canvas.createImage(new java.awt.image.MemoryImageSource(bitColumns, codeRows * h, pix, 0, bitColumns));
return img;
代码示例来源:origin: com.github.librepdf/openpdf
java.awt.Image img = canvas.createImage(new MemoryImageSource(bitColumns, codeRows * h, pix, 0, bitColumns));
return img;
代码示例来源:origin: itext/itext7
/**
* Creates a <CODE>java.awt.Image</CODE>. This image only
* contains the bars without any text.
*
* @param foreground the color of the bars
* @param background the color of the background
* @return the image
*/
@Override
public Image createAwtImage(java.awt.Color foreground, java.awt.Color background) {
int foregroundColor = (foreground == null) ? DEFAULT_BAR_FOREGROUND_COLOR.getRGB() : foreground.getRGB();
int backgroundColor = (background == null) ? DEFAULT_BAR_BACKGROUND_COLOR.getRGB() : background.getRGB();
java.awt.Canvas canvas = new java.awt.Canvas();
String bCode = this.code;
if (this.generateChecksum) {
bCode = bCode + Integer.toString(getChecksum(this.code));
}
byte[] bars = getBarsMSI(bCode);
int fullWidth = bars.length;
int fullHeight = (int) this.barHeight;
int[] pix = new int[fullWidth * fullHeight];
for (int x = 0; x < bars.length; x++) {
int color = (bars[x] == 1 ? foregroundColor : backgroundColor);
for (int y = 0; y < fullHeight; y++) {
int currentPixel = x + (y * fullWidth);
pix[currentPixel] = color;
}
}
return canvas.createImage(new java.awt.image.MemoryImageSource(fullWidth, fullHeight, pix, 0, fullWidth));
}
代码示例来源:origin: itext/itext7
System.arraycopy(pix, 0, pix, k, fullWidth);
return canvas.createImage(new java.awt.image.MemoryImageSource(fullWidth, height, pix, 0, fullWidth));
代码示例来源:origin: itext/itext7
System.arraycopy(pix, 0, pix, k, fullWidth);
return canvas.createImage(new java.awt.image.MemoryImageSource(fullWidth, height, pix, 0, fullWidth));
代码示例来源:origin: com.itextpdf/itextpdf
System.arraycopy(pix, 0, pix, k, fullWidth);
java.awt.Image img = canvas.createImage(new java.awt.image.MemoryImageSource(fullWidth, height, pix, 0, fullWidth));
代码示例来源:origin: com.itextpdf/itextpdf
/** Creates a <CODE>java.awt.Image</CODE>.
* @param foreground the color of the bars
* @param background the color of the background
* @return the image
*/
public java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color background) {
int f = foreground.getRGB();
int g = background.getRGB();
java.awt.Canvas canvas = new java.awt.Canvas();
int width = bm.getWidth();
int height = bm.getHeight();
int pix[] = new int[width * height];
byte[][] mt = bm.getArray();
for (int y = 0; y < height; ++y) {
byte[] line = mt[y];
for (int x = 0; x < width; ++x) {
pix[y * width + x] = line[x] == 0 ? f : g;
}
}
java.awt.Image img = canvas.createImage(new java.awt.image.MemoryImageSource(width, height, pix, 0, width));
return img;
}
代码示例来源:origin: com.github.librepdf/openpdf
System.arraycopy(pix, 0, pix, k, fullWidth);
Image img = canvas.createImage(new MemoryImageSource(fullWidth, height, pix, 0, fullWidth));
代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext
System.arraycopy(pix, 0, pix, k, fullWidth);
Image img = canvas.createImage(new MemoryImageSource(fullWidth, height, pix, 0, fullWidth));
代码示例来源:origin: com.github.librepdf/openpdf
System.arraycopy(pix, 0, pix, k, fullWidth);
Image img = canvas.createImage(new MemoryImageSource(fullWidth, height, pix, 0, fullWidth));
代码示例来源:origin: com.itextpdf/itextpdf
System.arraycopy(pix, 0, pix, k, fullWidth);
java.awt.Image img = canvas.createImage(new java.awt.image.MemoryImageSource(fullWidth, height, pix, 0, fullWidth));
代码示例来源:origin: itext/itext7
/**
* Creates a <CODE>java.awt.Image</CODE>.
*
* @param foreground the color of the bars
* @param background the color of the background
* @return the image
*/
public java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color background) {
int f = foreground.getRGB();
int g = background.getRGB();
java.awt.Canvas canvas = new java.awt.Canvas();
int width = bm.getWidth();
int height = bm.getHeight();
int[] pix = new int[width * height];
byte[][] mt = bm.getArray();
for (int y = 0; y < height; ++y) {
byte[] line = mt[y];
for (int x = 0; x < width; ++x) {
pix[y * width + x] = line[x] == 0 ? f : g;
}
}
java.awt.Image img = canvas.createImage(new java.awt.image.MemoryImageSource(width, height, pix, 0, width));
return img;
}
代码示例来源:origin: com.itextpdf/itextpdf
System.arraycopy(pix, 0, pix, k, fullWidth);
java.awt.Image img = canvas.createImage(new java.awt.image.MemoryImageSource(fullWidth, height, pix, 0, fullWidth));
代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext
System.arraycopy(pix, 0, pix, k, fullWidth);
Image img = canvas.createImage(new MemoryImageSource(fullWidth, height, pix, 0, fullWidth));
内容来源于网络,如有侵权,请联系作者删除!