📄 debuggraphics.java
字号:
} graphics.drawRoundRect(x, y, width, height, arcWidth, arcHeight); } /** * fillRoundRect * * @param x The x-position of the rectangle * @param y The y-position of the rectangle * @param width The width of the rectangle * @param height The height of the rectangle * @param arcWidth TODO * @param arcHeight TODO */ public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Filling round rect: " + new Rectangle(x, y, width, height) + " arcWidth: " + arcWidth + " arcHeight: " + arcHeight); } graphics.fillRoundRect(x, y, width, height, arcWidth, arcHeight); } /** * drawLine * * @param x1 The x-position of the start * @param y1 The y-position of the start * @param x2 The x-position of the end * @param y2 The y-position of the end */ public void drawLine(int x1, int y1, int x2, int y2) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing line: from (" + x1 + ", " + y1 + ") to (" + x2 + ", " + y2 + ")"); } graphics.drawLine(x1, y1, x2, y2); } /** * draw3DRect * * @param x The x-position of the rectangle * @param y The y-position of the rectangle * @param width The width of the rectangle * @param height The height of the rectangle * @param raised TODO */ public void draw3DRect(int x, int y, int width, int height, boolean raised) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing 3D rect: " + new Rectangle(x, y, width, height) + "Raised bezel: " + raised); } graphics.draw3DRect(x, y, width, height, raised); } /** * fill3DRect * * @param x The x-position of the rectangle * @param y The y-position of the rectangle * @param width The width of the rectangle * @param height The height of the rectangle * @param raised TODO */ public void fill3DRect(int x, int y, int width, int height, boolean raised) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Filling 3D rect: " + new Rectangle(x, y, width, height) + "Raised bezel: " + raised); } graphics.fill3DRect(x, y, width, height, raised); } /** * drawOval * * @param x the x coordinate * @param y the y coordiante * @param width the width * @param height the height */ public void drawOval(int x, int y, int width, int height) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing oval: " + new Rectangle(x, y, width, height)); } graphics.drawOval(x, y, width, height); } /** * fillOval * * @param x the x coordinate * @param y the y coordinate * @param width the width * @param height the height */ public void fillOval(int x, int y, int width, int height) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Filling oval: " + new Rectangle(x, y, width, height)); } graphics.fillOval(x, y, width, height); } /** * drawArc * * @param x the x coordinate * @param y the y coordinate * @param width the width * @param height the height * @param startAngle TODO * @param arcAngle TODO */ public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing arc: " + new Rectangle(x, y, width, height) + " startAngle: " + startAngle + " arcAngle: " + arcAngle); } graphics.drawArc(x, y, width, height, startAngle, arcAngle); } /** * fillArc * * @param x the coordinate * @param y the y coordinate * @param width the width * @param height the height * @param startAngle TODO * @param arcAngle TODO */ public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Filling arc: " + new Rectangle(x, y, width, height) + " startAngle: " + startAngle + " arcAngle: " + arcAngle); } graphics.fillArc(x, y, width, height, startAngle, arcAngle); } /** * drawPolyline * * @param xpoints TODO * @param ypoints TODO * @param npoints TODO */ public void drawPolyline(int[] xpoints, int[] ypoints, int npoints) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing polyline: nPoints: " + npoints + " X's: " + xpoints + " Y's: " + ypoints); } graphics.drawPolyline(xpoints, ypoints, npoints); } /** * drawPolygon * * @param xpoints TODO * @param ypoints TODO * @param npoints TODO */ public void drawPolygon(int[] xpoints, int[] ypoints, int npoints) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing polygon: nPoints: " + npoints + " X's: " + xpoints + " Y's: " + ypoints); } graphics.drawPolygon(xpoints, ypoints, npoints); } /** * fillPolygon * * @param xpoints TODO * @param ypoints TODO * @param npoints TODO */ public void fillPolygon(int[] xpoints, int[] ypoints, int npoints) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing polygon: nPoints: " + npoints + " X's: " + xpoints + " Y's: " + ypoints); } graphics.fillPolygon(xpoints, ypoints, npoints); } /** * drawString * * @param string the string * @param x the x coordinate * @param y the y coordinate */ public void drawString(String string, int x, int y) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing string: \"" + string + "\" at: " + new Point(x, y)); } graphics.drawString(string, x, y); } /** * drawString * * @param iterator TODO * @param x the x coordinate * @param y the y coordinate */ public void drawString(AttributedCharacterIterator iterator, int x, int y) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing string: \"" + iterator + "\" at: " + new Point(x, y)); } graphics.drawString(iterator, x, y); } /** * drawBytes * * @param data TODO * @param offset TODO * @param length TODO * @param x the x coordinate * @param y the y coordinate */ public void drawBytes(byte[] data, int offset, int length, int x, int y) { if ((debugOptions & LOG_OPTION) != 0) logStream().println(prefix() + " Drawing bytes at: " + new Point(x, y)); graphics.drawBytes(data, offset, length, x, y); } /** * drawChars * * @param data array of characters to draw * @param offset offset in array * @param length number of characters in array to draw * @param x x-position * @param y y-position */ public void drawChars(char[] data, int offset, int length, int x, int y) { if ((debugOptions & LOG_OPTION) != 0) logStream().println(prefix() + " Drawing chars at: " + new Point(x, y)); if ((debugOptions & FLASH_OPTION) != 0) { Color color = graphics.getColor(); for (int index = 0; index < (debugFlashCount - 1); ++index) { graphics.setColor(color); graphics.drawChars(data, offset, length, x, y); sleep(debugFlashTime); graphics.setColor(debugFlashColor); graphics.drawChars(data, offset, length, x, y); sleep(debugFlashTime); } graphics.setColor(color); } graphics.drawChars(data, offset, length, x, y); } /** * drawImage * * @param image The image to draw * @param x The x position * @param y The y position * @param observer The image observer * @return boolean */ public boolean drawImage(Image image, int x, int y, ImageObserver observer) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing image: " + image + " at: " + new Point(x, y)); } return graphics.drawImage(image, x, y, observer); } /** * drawImage * * @param image The image to draw * @param x The x position * @param y The y position * @param width The width of the area to draw the image * @param height The height of the area to draw the image * @param observer The image observer * * @return boolean */ public boolean drawImage(Image image, int x, int y, int width, int height, ImageObserver observer) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing image: " + image + " at: " + new Rectangle(x, y, width, height)); } return graphics.drawImage(image, x, y, width, height, observer); } /** * drawImage * * @param image The image to draw * @param x The x position * @param y The y position * @param background The color for the background in the opaque regions * of the image * @param observer The image observer * * @return boolean */ public boolean drawImage(Image image, int x, int y, Color background, ImageObserver observer) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing image: " + image + " at: " + new Point(x, y) + ", bgcolor: " + background); } return graphics.drawImage(image, x, y, background, observer); } /** * drawImage * * @param image The image to draw * @param x The x position * @param y The y position * @param width The width of the area to draw the image * @param height The height of the area to draw the image * @param background The color for the background in the opaque regions * of the image * @param observer The image observer * * @return boolean */ public boolean drawImage(Image image, int x, int y, int width, int height, Color background, ImageObserver observer) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing image: " + image + " at: " + new Rectangle(x, y, width, height) + ", bgcolor: " + background); } return graphics.drawImage(image, x, y, width, height, background, observer); } /** * drawImage * * @param image The image to draw * @param dx1 TODO * @param dy1 TODO * @param dx2 TODO * @param dy2 TODO * @param sx1 TODO * @param sy1 TODO * @param sx2 TODO * @param sy2 TODO * @param observer The image observer * * @return boolean */ public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing image: " + image + " destination: " + new Rectangle(dx1, dy1, dx2, dy2) + " source: " + new Rectangle(sx1, sy1, sx2, sy2)); } return graphics.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer); } /** * drawImage * * @param image The image to draw * @param dx1 TODO * @param dy1 TODO * @param dx2 TODO * @param dy2 TODO * @param sx1 TODO * @param sy1 TODO * @param sx2 TODO * @param sy2 TODO * @param background The color for the background in the opaque regions * of the image * @param observer The image observer * * @return boolean */ public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color background, ImageObserver observer) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Drawing image: " + image + " destination: " + new Rectangle(dx1, dy1, dx2, dy2) + " source: " + new Rectangle(sx1, sy1, sx2, sy2) + ", bgcolor: " + background); } return graphics.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, background, observer); } /** * copyArea * * @param x The x position of the source area * @param y The y position of the source area * @param width The width of the area * @param height The height of the area * @param destx The x position of the destination area * @param desty The y posiiton of the destination area */ public void copyArea(int x, int y, int width, int height, int destx, int desty) { if ((debugOptions & LOG_OPTION) != 0) { logStream().println(prefix() + " Copying area from: " + new Rectangle(x, y, width, height) + " to: " + new Point(destx, desty)); } graphics.copyArea(x, y, width, height, destx, desty); } /** * Releases all system resources that this <code>Graphics</code> is using. */ public void dispose() { graphics.dispose(); graphics = null; } /** * isDrawingBuffer * * @return boolean */ public boolean isDrawingBuffer() { return false; // TODO } /** * setDebugOptions * * @param options the debug options */ public void setDebugOptions(int options) { debugOptions = options; if ((debugOptions & LOG_OPTION) != 0) if (options == NONE_OPTION) logStream().println(prefix() + "Disabling debug"); else logStream().println(prefix() + "Enabling debug"); } /** * getDebugOptions * * @return the debug options */ public int getDebugOptions() { return debugOptions; } /** * Creates and returns the prefix that should be prepended to all logging * messages. The prefix is made up like this: * * <code>Graphics(<counter>-1)</code> where counter is an integer number * saying how many DebugGraphics objects have been created so far. The second * number always seem to be 1 on Sun's JDK, this has to be investigated a * little more. * * @return the prefix that should be prepended to all logging * messages */ private String prefix() { return "Graphics(" + counter + "-1)"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -