代码和标记问答的示例图像[已关闭]
准备涉及图像的 MCVE/SSCCE 时,可以访问示例图像可能特别有帮助。为了减轻对外部图像托管或链接的需求,这里有各种可以轻松使用的图像作为示例:
图标:
雪碧图:
动画:
固体BG:
透明 BG:
图片:
图块:
代码:
除了图像,提供了一个Java类来分割棋子精灵表,以便于集成到MCVE:
import java.awt.image.*; import javax.imageio.*; import java.net.*; import java.io.*; import java.util.*; public final class ChessSprites { private ChessSprites() {} public static final int SIZE = 64; public static final BufferedImage SHEET; static { try { // see https://stackoverflow.com/a/19209651/2891664 SHEET = ImageIO.read(new URL("https://i.sstatic.net/memI0.png")); } catch (IOException x) { throw new UncheckedIOException(x); } } public static final BufferedImage GOLD_QUEEN = SHEET.getSubimage(0 * SIZE, 0, SIZE, SIZE); public static final BufferedImage SILVER_QUEEN = SHEET.getSubimage(0 * SIZE, SIZE, SIZE, SIZE); public static final BufferedImage GOLD_KING = SHEET.getSubimage(1 * SIZE, 0, SIZE, SIZE); public static final BufferedImage SILVER_KING = SHEET.getSubimage(1 * SIZE, SIZE, SIZE, SIZE); public static final BufferedImage GOLD_ROOK = SHEET.getSubimage(2 * SIZE, 0, SIZE, SIZE); public static final BufferedImage SILVER_ROOK = SHEET.getSubimage(2 * SIZE, SIZE, SIZE, SIZE); public static final BufferedImage GOLD_KNIGHT = SHEET.getSubimage(3 * SIZE, 0, SIZE, SIZE); public static final BufferedImage SILVER_KNIGHT = SHEET.getSubimage(3 * SIZE, SIZE, SIZE, SIZE); public static final BufferedImage GOLD_BISHOP = SHEET.getSubimage(4 * SIZE, 0, SIZE, SIZE); public static final BufferedImage SILVER_BISHOP = SHEET.getSubimage(4 * SIZE, SIZE, SIZE, SIZE); public static final BufferedImage GOLD_PAWN = SHEET.getSubimage(5 * SIZE, 0, SIZE, SIZE); public static final BufferedImage SILVER_PAWN = SHEET.getSubimage(5 * SIZE, SIZE, SIZE, SIZE); public static final List<BufferedImage> SPRITES = Collections.unmodifiableList(Arrays.asList(GOLD_QUEEN, SILVER_QUEEN, GOLD_KING, SILVER_KING, GOLD_ROOK, SILVER_ROOK, GOLD_KNIGHT, SILVER_KNIGHT, GOLD_BISHOP, SILVER_BISHOP, GOLD_PAWN, SILVER_PAWN)); }
以上是在哪里可以找到代码和标记问答的示例图像?的详细内容。更多信息请关注PHP中文网其他相关文章!