[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath:
DebugGraphics implemented
Kaffe CVS
cvs-commits at kaffe.org
Sat Jan 22 11:26:32 PST 2005
PatchSet 5903
Date: 2005/01/22 19:12:20
Author: robilad
Branch: HEAD
Tag: (none)
Log:
Resynced with GNU Classpath: DebugGraphics implemented
2005-01-22 Dalibor Topic <robilad at kaffe.org>
Resynced with GNU Classpath.
2005-01-21 Michael Koch <konqueror at gmx.de>
* javax/swing/DebugGraphics.java: Mostly implemented.
Members:
ChangeLog:1.3442->1.3443
libraries/javalib/javax/swing/DebugGraphics.java:1.2->1.3
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3442 kaffe/ChangeLog:1.3443
--- kaffe/ChangeLog:1.3442 Sat Jan 22 19:10:50 2005
+++ kaffe/ChangeLog Sat Jan 22 19:12:20 2005
@@ -4,6 +4,14 @@
2005-01-21 Michael Koch <konqueror at gmx.de>
+ * javax/swing/DebugGraphics.java: Mostly implemented.
+
+2005-01-22 Dalibor Topic <robilad at kaffe.org>
+
+ Resynced with GNU Classpath.
+
+ 2005-01-21 Michael Koch <konqueror at gmx.de>
+
* javax/swing/text/DefaultEditorKit.java
(read): Added '\n' after each line.
* javax/swing/text/PlainView.java
Index: kaffe/libraries/javalib/javax/swing/DebugGraphics.java
diff -u kaffe/libraries/javalib/javax/swing/DebugGraphics.java:1.2 kaffe/libraries/javalib/javax/swing/DebugGraphics.java:1.3
--- kaffe/libraries/javalib/javax/swing/DebugGraphics.java:1.2 Mon Sep 27 17:41:09 2004
+++ kaffe/libraries/javalib/javax/swing/DebugGraphics.java Sat Jan 22 19:12:21 2005
@@ -1,5 +1,5 @@
/* DebugGraphics.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -56,6 +56,30 @@
*/
public class DebugGraphics extends Graphics
{
+ /**
+ * LOG_OPTION
+ */
+ public static final int LOG_OPTION = 1;
+
+ /**
+ * FLASH_OPTION
+ */
+ public static final int FLASH_OPTION = 2;
+
+ /**
+ * BUFFERED_OPTION
+ */
+ public static final int BUFFERED_OPTION = 4;
+
+ /**
+ * NONE_OPTION
+ */
+ public static final int NONE_OPTION = -1;
+
+ static Color debugFlashColor = Color.RED;
+ static int debugFlashCount = 10;
+ static int debugFlashTime = 1000;
+ static PrintStream debugLogStream = System.out;
/**
* graphics
@@ -63,6 +87,11 @@
Graphics graphics;
/**
+ * color
+ */
+ Color color = Color.BLACK;
+
+ /**
* buffer
*/
Image buffer;
@@ -88,26 +117,6 @@
int yOffset;
/**
- * LOG_OPTION
- */
- public static final int LOG_OPTION = 1;
-
- /**
- * FLASH_OPTION
- */
- public static final int FLASH_OPTION = 2;
-
- /**
- * BUFFERED_OPTION
- */
- public static final int BUFFERED_OPTION = 4;
-
- /**
- * NONE_OPTION
- */
- public static final int NONE_OPTION = -1;
-
- /**
* Creates a <code>DebugGraphics</code> object.
*/
public DebugGraphics()
@@ -116,55 +125,62 @@
}
/**
- * Constructor DebugGraphics
- * @param graphics TODO
+ * Creates a <code>DebugGraphics</code> object.
+ *
+ * @param graphics The <code>Graphics</code> object to wrap
* @param component TODO
*/
public DebugGraphics(Graphics graphics, JComponent component)
{
- // TODO
+ this.graphics = graphics;
+ // FIXME: What shall we do with component ?
}
/**
- * Constructor DebugGraphics
- * @param graphics TODO
+ * Creates a <code>DebugGraphics</code> object.
+ *
+ * @param graphics The <code>Graphics</code> object to wrap
*/
public DebugGraphics(Graphics graphics)
{
- // TODO
+ this.graphics = graphics;
}
/**
- * setColor
- * @param value0 TODO
+ * Sets the color to draw stuff with.
+ *
+ * @param color The color
*/
public void setColor(Color color)
{
- // TODO
+ this.color = color;
}
/**
- * create
+ * Creates a overrides <code>Graphics.create</code> to create a
+ * <code>DebugGraphics</code> object.
*
- * @return Graphics
+ * @return a new <code>DebugGraphics</code> object.
*/
public Graphics create()
{
- return null; // TODO
+ return new DebugGraphics(graphics.create());
}
/**
- * create
+ * Creates a overrides <code>Graphics.create</code> to create a
+ * <code>DebugGraphics</code> object.
+ *
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @param width the width
+ * @param height the height
*
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @returns Graphics
+ * @return a new <code>DebugGraphics</code> object.
*/
- public Graphics create(int valx, int y, int w, int h)
+ public Graphics create(int x, int y, int width, int height)
{
- return null; // TODO
+ return new DebugGraphics(graphics.create(x, y, width, height));
}
/**
@@ -174,7 +190,7 @@
*/
public static Color flashColor()
{
- return null; // TODO
+ return debugFlashColor;
}
/**
@@ -184,7 +200,7 @@
*/
public static void setFlashColor(Color color)
{
- // TODO
+ debugFlashColor = color;
}
/**
@@ -194,7 +210,7 @@
*/
public static int flashTime()
{
- return 0; // TODO
+ return debugFlashTime;
}
/**
@@ -204,16 +220,17 @@
*/
public static void setFlashTime(int time)
{
- // TODO
+ debugFlashTime = time;
}
/**
* flashCount
- * @returns int
+ *
+ * @return The number of flashes
*/
public static int flashCount()
{
- return 0; // TODO
+ return debugFlashCount;
}
/**
@@ -223,7 +240,7 @@
*/
public static void setFlashCount(int count)
{
- // TODO
+ debugFlashCount = count;
}
/**
@@ -233,7 +250,7 @@
*/
public static PrintStream logStream()
{
- return null; // TODO
+ return debugLogStream;
}
/**
@@ -243,16 +260,17 @@
*/
public static void setLogStream(PrintStream stream)
{
- // TODO
+ debugLogStream = stream;
}
/**
* getFont
- * @returns Font
+ *
+ * @return The font
*/
public Font getFont()
{
- return null; // TODO
+ return graphics.getFont();
}
/**
@@ -262,46 +280,50 @@
*/
public void setFont(Font font)
{
- // TODO
+ graphics.setFont(font);
}
/**
- * getColor
- * @returns Color
+ * Returns the color used for drawing.
+ *
+ * @return The color.
*/
public Color getColor()
{
- return null; // TODO
+ return color;
}
/**
- * getFontMetrics
- * @returns FontMetrics
+ * Returns the font metrics of the current font.
+ *
+ * @return a <code>FontMetrics</code> object
*/
public FontMetrics getFontMetrics()
{
- return null; // TODO
+ return graphics.getFontMetrics();
}
/**
- * getFontMetrics
- * @param font TODO
- * @returns FontMetrics
+ * Returns the font metrics for a given font.
+ *
+ * @param font the font to get the metrics for
+ *
+ * @return a <code>FontMetrics</code> object
*/
public FontMetrics getFontMetrics(Font font)
{
- return null; // TODO
+ return graphics.getFontMetrics(font);
}
/**
* translate
*
- * @param x TODO
- * @param y TODO
+ * @param x the x coordinate
+ * @param y the y coordinate
*/
public void translate(int x, int y)
{
- // TODO
+ graphics.translate(x, y);
}
/**
@@ -309,237 +331,291 @@
*/
public void setPaintMode()
{
- // TODO
+ graphics.setPaintMode();
}
/**
* setXORMode
*
- * @param color TODO
+ * @param color the color
*/
public void setXORMode(Color color)
{
- // TODO
+ graphics.setXORMode(color);
}
/**
* getClipBounds
- * @returns Rectangle
+ *
+ * @return Rectangle
*/
public Rectangle getClipBounds()
{
- return null; // TODO
+ return graphics.getClipBounds();
}
/**
- * clipRect
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- * @param value3 TODO
+ * Intersects the current clip region with the given region.
+ *
+ * @param x The x-position of the region
+ * @param y The y-position of the region
+ * @param width The width of the region
+ * @param height The height of the region
*/
- public void clipRect(int value0, int value1, int value2, int value3)
+ public void clipRect(int x, int y, int width, int height)
{
- // TODO
+ graphics.clipRect(x, y, width, height);
}
/**
- * setClip
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
+ * Sets the clipping region.
+ *
+ * @param x The x-position of the region
+ * @param y The y-position of the region
+ * @param width The width of the region
+ * @param height The height of the region
*/
- public void setClip(int x, int y, int w, int h)
+ public void setClip(int x, int y, int width, int height)
{
- // TODO
+ graphics.setClip(x, y, width, height);
}
/**
- * getClip
- * @returns Shape
+ * Returns the current clipping region.
+ *
+ * @return Shape
*/
public Shape getClip()
{
- return null; // TODO
+ return graphics.getClip();
}
/**
- * setClip
- * @param shape TODO
+ * Sets the current clipping region
+ *
+ * @param shape The clippin region
*/
public void setClip(Shape shape)
{
- // TODO
+ graphics.setClip(shape);
}
+ private void sleep(int milliseconds)
+ {
+ try
+ {
+ Thread.sleep(milliseconds);
+ }
+ catch (InterruptedException e)
+ {
+ // Ignore this.
+ }
+ }
+
/**
- * drawRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param valh TODO
+ * Draws a rectangle.
+ *
+ * @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
*/
- public void drawRect(int x, int y, int w, int h)
+ public void drawRect(int x, int y, int width, int height)
{
- // TODO
- } // drawRect()
+ for (int index = 0; index < (debugFlashCount - 1); ++index)
+ {
+ graphics.setColor(color);
+ graphics.drawRect(x, y, width, height);
+ sleep(debugFlashTime);
+
+ graphics.setColor(debugFlashColor);
+ graphics.drawRect(x, y, width, height);
+ sleep(debugFlashTime);
+ }
+
+ graphics.setColor(color);
+ graphics.drawRect(x, y, width, height);
+ }
/**
- * fillRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
+ * Draws a filled rectangle.
+ *
+ * @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
*/
- public void fillRect(int x, int y, int w, int h)
+ public void fillRect(int x, int y, int width, int height)
{
- // TODO
- } // fillRect()
+ for (int index = 0; index < (debugFlashCount - 1); ++index)
+ {
+ graphics.setColor(color);
+ graphics.fillRect(x, y, width, height);
+ sleep(debugFlashTime);
+
+ graphics.setColor(debugFlashColor);
+ graphics.fillRect(x, y, width, height);
+ sleep(debugFlashTime);
+ }
+
+ graphics.setColor(color);
+ graphics.fillRect(x, y, width, height);
+ }
/**
* clearRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
+ *
+ * @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
*/
- public void clearRect(int x, int y, int w, int h)
+ public void clearRect(int x, int y, int width, int height)
{
- // TODO
+ graphics.clearRect(x, y, width, height);
}
/**
* drawRoundRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
+ *
+ * @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 drawRoundRect(int x, int y, int w, int h, int arcWidth,
- int arcHeight)
+ public void drawRoundRect(int x, int y, int width, int height,
+ int arcWidth, int arcHeight)
{
- // TODO
+ graphics.drawRoundRect(x, y, width, height, arcWidth, arcHeight);
}
/**
* fillRoundRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
+ *
+ * @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 w, int h, int arcWidth,
- int arcHeight)
+ public void fillRoundRect(int x, int y, int width, int height,
+ int arcWidth, int arcHeight)
{
- // TODO
+ graphics.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
}
/**
* drawLine
- * @param x1 TODO
- * @param y1 TODO
- * @param x2 TODO
- * @param y2 TODO
+ *
+ * @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)
{
- // TODO
+ graphics.drawLine(x1, y1, x2, y2);
}
/**
* draw3DRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
+ *
+ * @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 w, int h, boolean raised)
+ public void draw3DRect(int x, int y, int width, int height, boolean raised)
{
- // TODO
+ graphics.draw3DRect(x, y, width, height, raised);
}
/**
* fill3DRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
+ *
+ * @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 w, int h, boolean raised)
+ public void fill3DRect(int x, int y, int width, int height, boolean raised)
{
- // TODO
+ graphics.fill3DRect(x, y, width, height, raised);
}
/**
* drawOval
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
+ *
+ * @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 w, int h)
+ public void drawOval(int x, int y, int width, int height)
{
- // TODO
+ graphics.drawOval(x, y, width, height);
}
/**
* fillOval
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
+ *
+ * @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 w, int h)
+ public void fillOval(int x, int y, int width, int height)
{
- // TODO
+ graphics.fillOval(x, y, width, height);
}
/**
* drawArc
*
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
+ * @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 w, int h, int startAngle, int arcAngle)
+ public void drawArc(int x, int y, int width, int height,
+ int startAngle, int arcAngle)
{
- // TODO
+ graphics.drawArc(x, y, width, height, startAngle, arcAngle);
}
/**
* fillArc
*
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
+ * @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 w, int h, int startAngle, int arcAngle)
+ public void fillArc(int x, int y, int width, int height,
+ int startAngle, int arcAngle)
{
- // TODO
+ 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)
{
- // TODO
+ graphics.drawPolyline(xpoints, ypoints, npoints);
}
/**
@@ -551,7 +627,7 @@
*/
public void drawPolygon(int[] xpoints, int[] ypoints, int npoints)
{
- // TODO
+ graphics.drawPolygon(xpoints, ypoints, npoints);
}
/**
@@ -563,31 +639,32 @@
*/
public void fillPolygon(int[] xpoints, int[] ypoints, int npoints)
{
- // TODO
+ graphics.fillPolygon(xpoints, ypoints, npoints);
}
/**
* drawString
*
- * @param string TODO
- * @param x TODO
- * @param y TODO
+ * @param string the string
+ * @param x the x coordinate
+ * @param y the y coordinate
*/
- public void drawString(String string, int s, int y)
+ public void drawString(String string, int x, int y)
{
- // TODO
+ graphics.drawString(string, x, y);
}
/**
* drawString
*
* @param iterator TODO
- * @param x TODO
- * @param y TODO
+ * @param x the x coordinate
+ * @param y the y coordinate
*/
- public void drawString(AttributedCharacterIterator iterator, int x, int y)
+ public void drawString(AttributedCharacterIterator iterator,
+ int x, int y)
{
- // TODO
+ graphics.drawString(iterator, x, y);
}
/**
@@ -596,86 +673,111 @@
* @param data TODO
* @param offset TODO
* @param length TODO
- * @param x TODO
- * @param y TODO
+ * @param x the x coordinate
+ * @param y the y coordinate
*/
- public void drawBytes(byte[] data, int offset, int length, int x, int y)
+ public void drawBytes(byte[] data, int offset, int length,
+ int x, int y)
{
- // TODO
+ graphics.drawBytes(data, offset, length, x, y);
}
/**
* drawChars
- * @param data TODO
- * @param offset TODO
- * @param length TODO
- * @param value3 TODO
- * @param value4 TODO
- */
- public void drawChars(char[] data, int offset, int value2, int x, int y)
- {
- // TODO
- } // 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)
+ {
+ 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 TODO
- * @param x TODO
- * @param y TODO
- * @param observer TODO
- * @returns boolean
+ *
+ * @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)
+ public boolean drawImage(Image image, int x, int y,
+ ImageObserver observer)
{
- return false; // TODO
+ return graphics.drawImage(image, x, y, observer);
}
/**
* drawImage
- * @param image TODO
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param observer TODO
- * @returns boolean
+ *
+ * @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 w, int h,
- ImageObserver observer)
+ public boolean drawImage(Image image, int x, int y, int width,
+ int height, ImageObserver observer)
{
- return false; // TODO
+ return graphics.drawImage(image, x, y, width, height, observer);
}
/**
* drawImage
- * @param image TODO
- * @param x TODO
- * @param y TODO
- * @param background TODO
- * @param observer TODO
- * @returns boolean
+ *
+ * @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)
+ public boolean drawImage(Image image, int x, int y,
+ Color background, ImageObserver observer)
{
- return false; // TODO
+ return graphics.drawImage(image, x, y, background, observer);
}
/**
* drawImage
- * @param image TODO
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param background TODO
- * @param observer TODO
- * @returns boolean
+ *
+ * @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 w, int h,
- Color background, ImageObserver observer)
+ public boolean drawImage(Image image, int x, int y, int width, int height,
+ Color background, ImageObserver observer)
{
- return false; // TODO
+ return graphics.drawImage(image, x, y, width, height, background, observer);
}
/**
@@ -690,14 +792,15 @@
* @param sy1 TODO
* @param sx2 TODO
* @param sy2 TODO
- * @param observer TODO
- * @returns boolean
+ * @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)
+ public boolean drawImage(Image image, int dx1, int dy1,
+ int dx2, int dy2, int sx1, int sy1, int sx2, int sy2,
+ ImageObserver observer)
{
- return false; // TODO
+ return graphics.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer);
}
/**
@@ -712,15 +815,17 @@
* @param sy1 TODO
* @param sx2 TODO
* @param sy2 TODO
- * @param background TODO
- * @param observer TODO
- * @returns 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)
+ * @param background The color for the background in the opaque regions
+ * of the image
*** Patch too long, truncated ***
More information about the kaffe
mailing list