本文整理了Java中java.awt.image.BufferedImage.toString()
方法的一些代码示例,展示了BufferedImage.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BufferedImage.toString()
方法的具体详情如下:
包路径:java.awt.image.BufferedImage
类名称:BufferedImage
方法名:toString
[英]Returns a String
representation of this BufferedImage
object and its values.
[中]返回此BufferedImage
对象及其值的String
表示形式。
代码示例来源:origin: haraldk/TwelveMonkeys
private static void addImage(Container pParent, ImageReader pReader, int pImageNo, String pName) throws IOException {
final JLabel label = new JLabel();
final BufferedImage image = pReader.read(pImageNo);
label.setIcon(new Icon() {
private static final int SIZE = 110;
public void paintIcon(Component c, Graphics g, int x, int y) {
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setColor(Color.DARK_GRAY);
g.fillRoundRect(x, y, SIZE, SIZE, 10, 10);
g.drawImage(image, (SIZE - image.getWidth()) / 2 + x, (SIZE - image.getHeight()) / 2 + y, null);
}
public int getIconWidth() {
return SIZE;
}
public int getIconHeight() {
return SIZE;
}
});
label.setText("" + image.getWidth() + "x" + image.getHeight() + ": " + pName);
label.setToolTipText(image.toString());
pParent.add(label);
}
代码示例来源:origin: haraldk/TwelveMonkeys
private void assertResampleBufferedImageTypes(final int pFilterType) {
List<String> exceptions = new ArrayList<>();
// Test all image types in BufferedImage
for (int type = BufferedImage.TYPE_INT_ARGB; type <= BufferedImage.TYPE_BYTE_INDEXED; type++) {
// TODO: Does not currently work with TYPE_BYTE_GRAY or TYPE_USHORT_GRAY
// TODO: FixMe!
if ((pFilterType == ResampleOp.FILTER_POINT || pFilterType == ResampleOp.FILTER_TRIANGLE) &&
(type == BufferedImage.TYPE_BYTE_GRAY || type == BufferedImage.TYPE_USHORT_GRAY)) {
continue;
}
BufferedImage image = createImage(10, 10, type);
try {
assertResample(image, 15, 5, pFilterType);
}
catch (ImagingOpException e) {
// NOTE: It is currently allowed for filters to throw this exception and it is PLATFORM DEPENDENT..
System.err.println("WARNING: " + e.getMessage() + ", image: " + image);
//e.printStackTrace();
}
catch (Throwable t) {
exceptions.add(t.toString() + ": " + image.toString());
}
}
assertEquals("Filter threw exceptions: ", Collections.EMPTY_LIST, exceptions);
}
代码示例来源:origin: stackoverflow.com
BufferedImage img = ImageIO.read(new File("C:\\Users\\Public\\Pictures\\Sample Pictures\\Chrysanthemum.jpg"));
System.out.println(img.toString());
label.setIcon(new ImageIcon(img));
代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub
@Override
public StringBuilder toString(StringBuilder sb) {
sb = super.toString(sb);
sb.append(", allowRowStride ").append(allowRowStride).append(", image [").append(image.getWidth()).append("x").append(image.getHeight()).append(", ").append(image.toString()).append("]");
return sb;
}
@Override
代码示例来源:origin: com.twelvemonkeys.imageio/imageio-thumbsdb
private static void addImage(Container pParent, ImageReader pReader, int pImageNo, String pName) throws IOException {
final JLabel label = new JLabel();
final BufferedImage image = pReader.read(pImageNo);
label.setIcon(new Icon() {
private static final int SIZE = 110;
public void paintIcon(Component c, Graphics g, int x, int y) {
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setColor(Color.DARK_GRAY);
g.fillRoundRect(x, y, SIZE, SIZE, 10, 10);
g.drawImage(image, (SIZE - image.getWidth()) / 2 + x, (SIZE - image.getHeight()) / 2 + y, null);
}
public int getIconWidth() {
return SIZE;
}
public int getIconHeight() {
return SIZE;
}
});
label.setText("" + image.getWidth() + "x" + image.getHeight() + ": " + pName);
label.setToolTipText(image.toString());
pParent.add(label);
}
代码示例来源:origin: de.alpharogroup/swing-components
if (!imageDrawn)
throw new RuntimeException("BufferedImage could not be drawn:" + bi.toString());
代码示例来源:origin: com.twelvemonkeys/twelvemonkeys-core
private void assertResampleBufferedImageTypes(final int pFilterType) {
List<String> exceptions = new ArrayList<String>();
// Test all image types in BufferedImage
for (int type = BufferedImage.TYPE_INT_ARGB; type <= BufferedImage.TYPE_BYTE_INDEXED; type++) {
// TODO: Does not currently work with TYPE_BYTE_GRAY or TYPE_USHORT_GRAY
// TODO: FixMe!
if ((pFilterType == ResampleOp.FILTER_POINT || pFilterType == ResampleOp.FILTER_TRIANGLE) &&
(type == BufferedImage.TYPE_BYTE_GRAY || type == BufferedImage.TYPE_USHORT_GRAY)) {
continue;
}
BufferedImage image = createImage(10, 10, type);
try {
assertResample(image, 15, 5, pFilterType);
}
catch (ImagingOpException e) {
// NOTE: It is currently allowed for filters to throw this exception and it is PLATFORM DEPENDENT..
System.err.println("WARNING: " + e.getMessage() + ", image: " + image);
//e.printStackTrace();
}
catch (Throwable t) {
exceptions.add(t.toString() + ": " + image.toString());
}
}
assertEquals("Filter threw exceptions: ", Collections.EMPTY_LIST, exceptions);
}
代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.common/common-image
private void assertResampleBufferedImageTypes(final int pFilterType) {
List<String> exceptions = new ArrayList<>();
// Test all image types in BufferedImage
for (int type = BufferedImage.TYPE_INT_ARGB; type <= BufferedImage.TYPE_BYTE_INDEXED; type++) {
// TODO: Does not currently work with TYPE_BYTE_GRAY or TYPE_USHORT_GRAY
// TODO: FixMe!
if ((pFilterType == ResampleOp.FILTER_POINT || pFilterType == ResampleOp.FILTER_TRIANGLE) &&
(type == BufferedImage.TYPE_BYTE_GRAY || type == BufferedImage.TYPE_USHORT_GRAY)) {
continue;
}
BufferedImage image = createImage(10, 10, type);
try {
assertResample(image, 15, 5, pFilterType);
}
catch (ImagingOpException e) {
// NOTE: It is currently allowed for filters to throw this exception and it is PLATFORM DEPENDENT..
System.err.println("WARNING: " + e.getMessage() + ", image: " + image);
//e.printStackTrace();
}
catch (Throwable t) {
exceptions.add(t.toString() + ": " + image.toString());
}
}
assertEquals("Filter threw exceptions: ", Collections.EMPTY_LIST, exceptions);
}
代码示例来源:origin: com.twelvemonkeys.common/common-image
private void assertResampleBufferedImageTypes(final int pFilterType) {
List<String> exceptions = new ArrayList<>();
// Test all image types in BufferedImage
for (int type = BufferedImage.TYPE_INT_ARGB; type <= BufferedImage.TYPE_BYTE_INDEXED; type++) {
// TODO: Does not currently work with TYPE_BYTE_GRAY or TYPE_USHORT_GRAY
// TODO: FixMe!
if ((pFilterType == ResampleOp.FILTER_POINT || pFilterType == ResampleOp.FILTER_TRIANGLE) &&
(type == BufferedImage.TYPE_BYTE_GRAY || type == BufferedImage.TYPE_USHORT_GRAY)) {
continue;
}
BufferedImage image = createImage(10, 10, type);
try {
assertResample(image, 15, 5, pFilterType);
}
catch (ImagingOpException e) {
// NOTE: It is currently allowed for filters to throw this exception and it is PLATFORM DEPENDENT..
System.err.println("WARNING: " + e.getMessage() + ", image: " + image);
//e.printStackTrace();
}
catch (Throwable t) {
exceptions.add(t.toString() + ": " + image.toString());
}
}
assertEquals("Filter threw exceptions: ", Collections.EMPTY_LIST, exceptions);
}
代码示例来源:origin: qupath/qupath
logger.info("Test reading thumbnail with openslide: passed (" + getBufferedThumbnail(200, 200, 0).toString() + ")");
代码示例来源:origin: RPTools/maptool
log.debug("ZoneImageGenerator() stats: " + image.toString());
内容来源于网络,如有侵权,请联系作者删除!