Makefile.in: Rebuilt.
* Makefile.in: Rebuilt. * Makefile.am (awt_java_source_files): Updated for new files. * java/awt/Adjustable.java (HORIZONTAL, VERTICAL): Set values. * java/awt/Label.java: New file. * java/awt/Rectangle.java (Rectangle): Extend Rectangle2D. (createIntersection, createUnion, getBounds2D): New methods. * java/awt/Scrollbar.java: New file. * java/awt/Shape.java: Updated to 1.2. * java/awt/geom/AffineTransform.java: New file. * java/awt/geom/Ellipse2D.java: New file. * java/awt/geom/NoninvertibleTransformException.java: New file. * java/awt/geom/PathIterator.java: New file. * java/awt/geom/Rectangle2D.java: New file. * java/awt/geom/RectangularShape.java: New file. * java/awt/geom/Point2D.java (Double, Float): New inner classes. * java/awt/geom/IllegalPathStateException.java: New file. From-SVN: r35195
This commit is contained in:
parent
4eb00163ad
commit
8039a4ea73
@ -1,5 +1,22 @@
|
||||
2000-07-20 Tom Tromey <tromey@cygnus.com>
|
||||
|
||||
* Makefile.in: Rebuilt.
|
||||
* Makefile.am (awt_java_source_files): Updated for new files.
|
||||
* java/awt/Adjustable.java (HORIZONTAL, VERTICAL): Set values.
|
||||
* java/awt/Label.java: New file.
|
||||
* java/awt/Rectangle.java (Rectangle): Extend Rectangle2D.
|
||||
(createIntersection, createUnion, getBounds2D): New methods.
|
||||
* java/awt/Scrollbar.java: New file.
|
||||
* java/awt/Shape.java: Updated to 1.2.
|
||||
* java/awt/geom/AffineTransform.java: New file.
|
||||
* java/awt/geom/Ellipse2D.java: New file.
|
||||
* java/awt/geom/NoninvertibleTransformException.java: New file.
|
||||
* java/awt/geom/PathIterator.java: New file.
|
||||
* java/awt/geom/Rectangle2D.java: New file.
|
||||
* java/awt/geom/RectangularShape.java: New file.
|
||||
* java/awt/geom/Point2D.java (Double, Float): New inner classes.
|
||||
* java/awt/geom/IllegalPathStateException.java: New file.
|
||||
|
||||
* scripts/showval.java: New file.
|
||||
|
||||
* scripts/classes.pl (scan): Print inner classes properly.
|
||||
|
@ -486,49 +486,15 @@ gnu/gcj/convert/UnicodeToBytes.java
|
||||
special_java_source_files = java/lang/Class.java java/lang/Object.java
|
||||
|
||||
awt_java_source_files = \
|
||||
java/awt/event/ActionEvent.java \
|
||||
java/awt/event/ActionListener.java \
|
||||
java/awt/event/ComponentEvent.java \
|
||||
java/awt/event/HierarchyBoundsAdapter.java \
|
||||
java/awt/event/HierarchyBoundsListener.java \
|
||||
java/awt/event/HierarchyEvent.java \
|
||||
java/awt/event/HierarchyListener.java \
|
||||
java/awt/event/InputEvent.java \
|
||||
java/awt/event/KeyAdapter.java \
|
||||
java/awt/event/KeyEvent.java \
|
||||
java/awt/event/KeyListener.java \
|
||||
java/awt/event/TextEvent.java \
|
||||
java/awt/event/TextListener.java \
|
||||
java/awt/event/WindowAdapter.java \
|
||||
java/awt/event/WindowEvent.java \
|
||||
java/awt/event/WindowListener.java \
|
||||
java/awt/event/InputMethodListener.java \
|
||||
java/awt/event/ComponentListener.java \
|
||||
java/awt/event/AdjustmentListener.java \
|
||||
java/awt/event/AWTEventListener.java \
|
||||
java/awt/event/FocusListener.java \
|
||||
java/awt/event/AdjustmentEvent.java \
|
||||
java/awt/event/ItemListener.java \
|
||||
java/awt/event/ContainerListener.java \
|
||||
java/awt/event/MouseListener.java \
|
||||
java/awt/event/MouseMotionListener.java \
|
||||
java/awt/event/ComponentAdapter.java \
|
||||
java/awt/event/ContainerAdapter.java \
|
||||
java/awt/event/FocusAdapter.java \
|
||||
java/awt/event/MouseAdapter.java \
|
||||
java/awt/event/MouseMotionAdapter.java \
|
||||
java/awt/event/FocusEvent.java \
|
||||
java/awt/event/InputMethodEvent.java \
|
||||
java/awt/event/MouseEvent.java \
|
||||
java/awt/event/ItemEvent.java \
|
||||
java/awt/event/InvocationEvent.java \
|
||||
java/awt/event/PaintEvent.java \
|
||||
java/awt/event/ContainerEvent.java \
|
||||
java/awt/AWTError.java \
|
||||
java/awt/AWTEvent.java \
|
||||
java/awt/AWTEventMulticaster.java \
|
||||
java/awt/AWTException.java \
|
||||
java/awt/ActiveEvent.java \
|
||||
java/awt/Adjustable.java \
|
||||
java/awt/BorderLayout.java \
|
||||
java/awt/CheckboxGroup.java \
|
||||
java/awt/Color.java \
|
||||
java/awt/ColorModel.java \
|
||||
java/awt/Component.java \
|
||||
java/awt/ComponentOrientation.java \
|
||||
@ -541,8 +507,13 @@ java/awt/EventQueue.java \
|
||||
java/awt/Font.java \
|
||||
java/awt/FontMetrics.java \
|
||||
java/awt/Frame.java \
|
||||
java/awt/Graphics.java \
|
||||
java/awt/GraphicsConfiguration.java \
|
||||
java/awt/IllegalComponentStateException.java \
|
||||
java/awt/Image.java \
|
||||
java/awt/Insets.java \
|
||||
java/awt/ItemSelectable.java \
|
||||
java/awt/Label.java \
|
||||
java/awt/LayoutManager.java \
|
||||
java/awt/LayoutManager2.java \
|
||||
java/awt/Menu.java \
|
||||
@ -551,23 +522,73 @@ java/awt/MenuComponent.java \
|
||||
java/awt/MenuContainer.java \
|
||||
java/awt/MenuItem.java \
|
||||
java/awt/MenuShortcut.java \
|
||||
java/awt/Paint.java \
|
||||
java/awt/PaintContext.java \
|
||||
java/awt/Panel.java \
|
||||
java/awt/Point.java \
|
||||
java/awt/PopupMenu.java \
|
||||
java/awt/PopupMenu.java \
|
||||
java/awt/Rectangle.java \
|
||||
java/awt/Scrollbar.java \
|
||||
java/awt/Shape.java \
|
||||
java/awt/TextArea.java \
|
||||
java/awt/TextComponent.java \
|
||||
java/awt/Toolkit.java \
|
||||
java/awt/Transparency.java \
|
||||
java/awt/Window.java \
|
||||
java/awt/event/AWTEventListener.java \
|
||||
java/awt/event/ActionEvent.java \
|
||||
java/awt/event/ActionListener.java \
|
||||
java/awt/event/AdjustmentEvent.java \
|
||||
java/awt/event/AdjustmentListener.java \
|
||||
java/awt/event/ComponentAdapter.java \
|
||||
java/awt/event/ComponentEvent.java \
|
||||
java/awt/event/ComponentListener.java \
|
||||
java/awt/event/ContainerAdapter.java \
|
||||
java/awt/event/ContainerEvent.java \
|
||||
java/awt/event/ContainerListener.java \
|
||||
java/awt/event/FocusAdapter.java \
|
||||
java/awt/event/FocusEvent.java \
|
||||
java/awt/event/FocusListener.java \
|
||||
java/awt/event/HierarchyBoundsAdapter.java \
|
||||
java/awt/event/HierarchyBoundsListener.java \
|
||||
java/awt/event/HierarchyEvent.java \
|
||||
java/awt/event/HierarchyListener.java \
|
||||
java/awt/event/InputEvent.java \
|
||||
java/awt/event/InputMethodEvent.java \
|
||||
java/awt/event/InputMethodListener.java \
|
||||
java/awt/event/InvocationEvent.java \
|
||||
java/awt/event/ItemEvent.java \
|
||||
java/awt/event/ItemListener.java \
|
||||
java/awt/event/KeyAdapter.java \
|
||||
java/awt/event/KeyEvent.java \
|
||||
java/awt/event/KeyListener.java \
|
||||
java/awt/event/MouseAdapter.java \
|
||||
java/awt/event/MouseEvent.java \
|
||||
java/awt/event/MouseListener.java \
|
||||
java/awt/event/MouseMotionAdapter.java \
|
||||
java/awt/event/MouseMotionListener.java \
|
||||
java/awt/event/PaintEvent.java \
|
||||
java/awt/event/TextEvent.java \
|
||||
java/awt/event/TextListener.java \
|
||||
java/awt/event/WindowAdapter.java \
|
||||
java/awt/event/WindowEvent.java \
|
||||
java/awt/event/WindowListener.java \
|
||||
java/awt/geom/AffineTransform.java \
|
||||
java/awt/geom/Dimension2D.java \
|
||||
java/awt/geom/Ellipse2D.java \
|
||||
java/awt/geom/IllegalPathStateException.java \
|
||||
java/awt/geom/NoninvertibleTransformException.java \
|
||||
java/awt/geom/PathIterator.java \
|
||||
java/awt/geom/Point2D.java \
|
||||
java/awt/geom/Rectangle2D.java \
|
||||
java/awt/geom/RectangularShape.java \
|
||||
java/awt/image/ImageConsumer.java \
|
||||
java/awt/image/ImageObserver.java \
|
||||
java/awt/image/ImageProducer.java \
|
||||
java/awt/geom/Dimension2D.java \
|
||||
java/awt/geom/Point2D.java \
|
||||
java/awt/peer/ButtonPeer.java \
|
||||
java/awt/peer/CanvasPeer.java \
|
||||
java/awt/peer/CheckboxMenuItemPeer.java \
|
||||
java/awt/peer/CheckboxPeer.java \
|
||||
java/awt/peer/CheckboxMenuItemPeer.java \
|
||||
java/awt/peer/CheckboxPeer.java \
|
||||
java/awt/peer/ChoicePeer.java \
|
||||
java/awt/peer/ComponentPeer.java \
|
||||
java/awt/peer/ContainerPeer.java \
|
||||
@ -580,28 +601,16 @@ java/awt/peer/LightweightPeer.java \
|
||||
java/awt/peer/ListPeer.java \
|
||||
java/awt/peer/MenuBarPeer.java \
|
||||
java/awt/peer/MenuComponentPeer.java \
|
||||
java/awt/peer/MenuItemPeer.java \
|
||||
java/awt/peer/MenuItemPeer.java \
|
||||
java/awt/peer/MenuPeer.java \
|
||||
java/awt/peer/PanelPeer.java \
|
||||
java/awt/peer/PopupMenuPeer.java \
|
||||
java/awt/peer/ScrollPanePeer.java \
|
||||
java/awt/peer/ScrollbarPeer.java \
|
||||
java/awt/peer/TextAreaPeer.java \
|
||||
java/awt/peer/TextAreaPeer.java \
|
||||
java/awt/peer/TextComponentPeer.java \
|
||||
java/awt/peer/TextFieldPeer.java \
|
||||
java/awt/peer/WindowPeer.java \
|
||||
java/awt/Adjustable.java \
|
||||
java/awt/Color.java \
|
||||
java/awt/Graphics.java \
|
||||
java/awt/Image.java \
|
||||
java/awt/Paint.java \
|
||||
java/awt/PaintContext.java \
|
||||
java/awt/Transparency.java \
|
||||
java/awt/ItemSelectable.java \
|
||||
java/awt/AWTException.java \
|
||||
java/awt/ActiveEvent.java \
|
||||
java/awt/Rectangle.java \
|
||||
java/awt/IllegalComponentStateException.java
|
||||
java/awt/peer/WindowPeer.java
|
||||
|
||||
## Java files which are created by configure and thus are in the build
|
||||
## directory.
|
||||
|
@ -115,31 +115,48 @@ here = @here@
|
||||
libgcj_basedir = @libgcj_basedir@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign no-installinfo
|
||||
@TESTSUBDIR_TRUE@SUBDIRS = @TESTSUBDIR_TRUE@$(DIRLTDL) testsuite gcj include
|
||||
@TESTSUBDIR_FALSE@SUBDIRS = @TESTSUBDIR_FALSE@$(DIRLTDL) gcj include
|
||||
@USE_LIBDIR_TRUE@toolexeclibdir = @USE_LIBDIR_TRUE@$(libdir)$(MULTISUBDIR)
|
||||
@USE_LIBDIR_FALSE@toolexeclibdir = @USE_LIBDIR_FALSE@$(toolexecdir)/lib$(MULTISUBDIR)
|
||||
@USE_LIBDIR_FALSE@toolexecdir = @USE_LIBDIR_FALSE@$(exec_prefix)/$(target_alias)
|
||||
@TESTSUBDIR_TRUE@SUBDIRS = \
|
||||
@TESTSUBDIR_TRUE@$(DIRLTDL) testsuite gcj include
|
||||
@TESTSUBDIR_FALSE@SUBDIRS = \
|
||||
@TESTSUBDIR_FALSE@$(DIRLTDL) gcj include
|
||||
@USE_LIBDIR_TRUE@toolexeclibdir = \
|
||||
@USE_LIBDIR_TRUE@$(libdir)$(MULTISUBDIR)
|
||||
@USE_LIBDIR_FALSE@toolexeclibdir = \
|
||||
@USE_LIBDIR_FALSE@$(toolexecdir)/lib$(MULTISUBDIR)
|
||||
@USE_LIBDIR_FALSE@toolexecdir = \
|
||||
@USE_LIBDIR_FALSE@$(exec_prefix)/$(target_alias)
|
||||
|
||||
toolexeclib_LTLIBRARIES = libgcj.la
|
||||
toolexeclib_DATA = libgcj.spec
|
||||
data_DATA = libgcj.zip
|
||||
|
||||
@NEEDS_DATA_START_TRUE@toolexeclib_LIBRARIES = @NEEDS_DATA_START_TRUE@libgcjdata.a
|
||||
@NEEDS_DATA_START_TRUE@libgcjdata_a_SOURCES = @NEEDS_DATA_START_TRUE@libgcjdata.c
|
||||
@NEEDS_DATA_START_TRUE@toolexeclib_LIBRARIES = \
|
||||
@NEEDS_DATA_START_TRUE@libgcjdata.a
|
||||
@NEEDS_DATA_START_TRUE@libgcjdata_a_SOURCES = \
|
||||
@NEEDS_DATA_START_TRUE@libgcjdata.c
|
||||
|
||||
@NATIVE_TRUE@bin_PROGRAMS = @NATIVE_TRUE@jv-convert gij
|
||||
@NATIVE_TRUE@bin_PROGRAMS = \
|
||||
@NATIVE_TRUE@jv-convert gij
|
||||
|
||||
bin_SCRIPTS = addr2name.awk
|
||||
@CANADIAN_TRUE@@NULL_TARGET_TRUE@GCJ = @CANADIAN_TRUE@@NULL_TARGET_TRUE@gcj
|
||||
@CANADIAN_TRUE@@NULL_TARGET_FALSE@GCJ = @CANADIAN_TRUE@@NULL_TARGET_FALSE@$(target_alias)-gcj
|
||||
@CANADIAN_FALSE@GCJ = @CANADIAN_FALSE@$(expanded)/gcj$(EXEEXT) -B$(expanded)/
|
||||
@CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_TRUE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
|
||||
@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_FALSE@zip
|
||||
@CANADIAN_FALSE@ZIP = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
|
||||
@CANADIAN_TRUE@GCJH = @CANADIAN_TRUE@gcjh
|
||||
@CANADIAN_FALSE@GCJH = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh$(EXEEXT)
|
||||
@CANADIAN_FALSE@expanded = @CANADIAN_FALSE@`cd $(MULTIBUILDTOP)../$(COMPPATH)/gcc && pwd`
|
||||
@CANADIAN_TRUE@@NULL_TARGET_TRUE@GCJ = \
|
||||
@CANADIAN_TRUE@@NULL_TARGET_TRUE@gcj
|
||||
@CANADIAN_TRUE@@NULL_TARGET_FALSE@GCJ = \
|
||||
@CANADIAN_TRUE@@NULL_TARGET_FALSE@$(target_alias)-gcj
|
||||
@CANADIAN_FALSE@GCJ = \
|
||||
@CANADIAN_FALSE@$(expanded)/gcj$(EXEEXT) -B$(expanded)/
|
||||
@CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = \
|
||||
@CANADIAN_TRUE@@NULL_TARGET_TRUE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
|
||||
@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = \
|
||||
@CANADIAN_TRUE@@NULL_TARGET_FALSE@zip
|
||||
@CANADIAN_FALSE@ZIP = \
|
||||
@CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
|
||||
@CANADIAN_TRUE@GCJH = \
|
||||
@CANADIAN_TRUE@gcjh
|
||||
@CANADIAN_FALSE@GCJH = \
|
||||
@CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh$(EXEEXT)
|
||||
@CANADIAN_FALSE@expanded = \
|
||||
@CANADIAN_FALSE@`cd $(MULTIBUILDTOP)../$(COMPPATH)/gcc && pwd`
|
||||
|
||||
GCJCOMPILE = CLASSPATH=$(here) $(LIBTOOL) --mode=compile $(GCJ) -fassume-compiled -L$(here) $(JC1FLAGS) -c
|
||||
GCJLINK = $(LIBTOOL) --mode=link $(GCJ) -L$(here) $(JC1FLAGS) $(LDFLAGS) -o $@
|
||||
@ -153,8 +170,10 @@ WARNINGS = -W -Wall
|
||||
AM_CXXFLAGS = -fno-rtti -fvtable-thunks -fasynchronous-exceptions \
|
||||
@LIBGCJ_CXXFLAGS@ @EXCEPTIONSPEC@ $(WARNINGS) -D_GNU_SOURCE
|
||||
|
||||
@USING_GCC_TRUE@AM_CFLAGS = @USING_GCC_TRUE@@LIBGCJ_CFLAGS@ $(WARNINGS)
|
||||
@USING_GCC_FALSE@AM_CFLAGS = @USING_GCC_FALSE@@LIBGCJ_CFLAGS@
|
||||
@USING_GCC_TRUE@AM_CFLAGS = \
|
||||
@USING_GCC_TRUE@@LIBGCJ_CFLAGS@ $(WARNINGS)
|
||||
@USING_GCC_FALSE@AM_CFLAGS = \
|
||||
@USING_GCC_FALSE@@LIBGCJ_CFLAGS@
|
||||
|
||||
JCFLAGS = -g
|
||||
JC1FLAGS = -g @LIBGCJ_JAVAFLAGS@
|
||||
@ -206,7 +225,8 @@ extra_headers = java/lang/Object.h java/lang/Class.h
|
||||
|
||||
NM = nm
|
||||
|
||||
@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@noinst_PROGRAMS = @NATIVE_TRUE@@MAINTAINER_MODE_TRUE@gen-from-JIS
|
||||
@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@noinst_PROGRAMS = \
|
||||
@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@gen-from-JIS
|
||||
|
||||
CONVERT_DIR = gnu/gcj/convert
|
||||
|
||||
@ -262,49 +282,15 @@ gnu/gcj/convert/UnicodeToBytes.java
|
||||
special_java_source_files = java/lang/Class.java java/lang/Object.java
|
||||
|
||||
awt_java_source_files = \
|
||||
java/awt/event/ActionEvent.java \
|
||||
java/awt/event/ActionListener.java \
|
||||
java/awt/event/ComponentEvent.java \
|
||||
java/awt/event/HierarchyBoundsAdapter.java \
|
||||
java/awt/event/HierarchyBoundsListener.java \
|
||||
java/awt/event/HierarchyEvent.java \
|
||||
java/awt/event/HierarchyListener.java \
|
||||
java/awt/event/InputEvent.java \
|
||||
java/awt/event/KeyAdapter.java \
|
||||
java/awt/event/KeyEvent.java \
|
||||
java/awt/event/KeyListener.java \
|
||||
java/awt/event/TextEvent.java \
|
||||
java/awt/event/TextListener.java \
|
||||
java/awt/event/WindowAdapter.java \
|
||||
java/awt/event/WindowEvent.java \
|
||||
java/awt/event/WindowListener.java \
|
||||
java/awt/event/InputMethodListener.java \
|
||||
java/awt/event/ComponentListener.java \
|
||||
java/awt/event/AdjustmentListener.java \
|
||||
java/awt/event/AWTEventListener.java \
|
||||
java/awt/event/FocusListener.java \
|
||||
java/awt/event/AdjustmentEvent.java \
|
||||
java/awt/event/ItemListener.java \
|
||||
java/awt/event/ContainerListener.java \
|
||||
java/awt/event/MouseListener.java \
|
||||
java/awt/event/MouseMotionListener.java \
|
||||
java/awt/event/ComponentAdapter.java \
|
||||
java/awt/event/ContainerAdapter.java \
|
||||
java/awt/event/FocusAdapter.java \
|
||||
java/awt/event/MouseAdapter.java \
|
||||
java/awt/event/MouseMotionAdapter.java \
|
||||
java/awt/event/FocusEvent.java \
|
||||
java/awt/event/InputMethodEvent.java \
|
||||
java/awt/event/MouseEvent.java \
|
||||
java/awt/event/ItemEvent.java \
|
||||
java/awt/event/InvocationEvent.java \
|
||||
java/awt/event/PaintEvent.java \
|
||||
java/awt/event/ContainerEvent.java \
|
||||
java/awt/AWTError.java \
|
||||
java/awt/AWTEvent.java \
|
||||
java/awt/AWTEventMulticaster.java \
|
||||
java/awt/AWTException.java \
|
||||
java/awt/ActiveEvent.java \
|
||||
java/awt/Adjustable.java \
|
||||
java/awt/BorderLayout.java \
|
||||
java/awt/CheckboxGroup.java \
|
||||
java/awt/Color.java \
|
||||
java/awt/ColorModel.java \
|
||||
java/awt/Component.java \
|
||||
java/awt/ComponentOrientation.java \
|
||||
@ -317,8 +303,13 @@ java/awt/EventQueue.java \
|
||||
java/awt/Font.java \
|
||||
java/awt/FontMetrics.java \
|
||||
java/awt/Frame.java \
|
||||
java/awt/Graphics.java \
|
||||
java/awt/GraphicsConfiguration.java \
|
||||
java/awt/IllegalComponentStateException.java \
|
||||
java/awt/Image.java \
|
||||
java/awt/Insets.java \
|
||||
java/awt/ItemSelectable.java \
|
||||
java/awt/Label.java \
|
||||
java/awt/LayoutManager.java \
|
||||
java/awt/LayoutManager2.java \
|
||||
java/awt/Menu.java \
|
||||
@ -327,23 +318,73 @@ java/awt/MenuComponent.java \
|
||||
java/awt/MenuContainer.java \
|
||||
java/awt/MenuItem.java \
|
||||
java/awt/MenuShortcut.java \
|
||||
java/awt/Paint.java \
|
||||
java/awt/PaintContext.java \
|
||||
java/awt/Panel.java \
|
||||
java/awt/Point.java \
|
||||
java/awt/PopupMenu.java \
|
||||
java/awt/PopupMenu.java \
|
||||
java/awt/Rectangle.java \
|
||||
java/awt/Scrollbar.java \
|
||||
java/awt/Shape.java \
|
||||
java/awt/TextArea.java \
|
||||
java/awt/TextComponent.java \
|
||||
java/awt/Toolkit.java \
|
||||
java/awt/Transparency.java \
|
||||
java/awt/Window.java \
|
||||
java/awt/event/AWTEventListener.java \
|
||||
java/awt/event/ActionEvent.java \
|
||||
java/awt/event/ActionListener.java \
|
||||
java/awt/event/AdjustmentEvent.java \
|
||||
java/awt/event/AdjustmentListener.java \
|
||||
java/awt/event/ComponentAdapter.java \
|
||||
java/awt/event/ComponentEvent.java \
|
||||
java/awt/event/ComponentListener.java \
|
||||
java/awt/event/ContainerAdapter.java \
|
||||
java/awt/event/ContainerEvent.java \
|
||||
java/awt/event/ContainerListener.java \
|
||||
java/awt/event/FocusAdapter.java \
|
||||
java/awt/event/FocusEvent.java \
|
||||
java/awt/event/FocusListener.java \
|
||||
java/awt/event/HierarchyBoundsAdapter.java \
|
||||
java/awt/event/HierarchyBoundsListener.java \
|
||||
java/awt/event/HierarchyEvent.java \
|
||||
java/awt/event/HierarchyListener.java \
|
||||
java/awt/event/InputEvent.java \
|
||||
java/awt/event/InputMethodEvent.java \
|
||||
java/awt/event/InputMethodListener.java \
|
||||
java/awt/event/InvocationEvent.java \
|
||||
java/awt/event/ItemEvent.java \
|
||||
java/awt/event/ItemListener.java \
|
||||
java/awt/event/KeyAdapter.java \
|
||||
java/awt/event/KeyEvent.java \
|
||||
java/awt/event/KeyListener.java \
|
||||
java/awt/event/MouseAdapter.java \
|
||||
java/awt/event/MouseEvent.java \
|
||||
java/awt/event/MouseListener.java \
|
||||
java/awt/event/MouseMotionAdapter.java \
|
||||
java/awt/event/MouseMotionListener.java \
|
||||
java/awt/event/PaintEvent.java \
|
||||
java/awt/event/TextEvent.java \
|
||||
java/awt/event/TextListener.java \
|
||||
java/awt/event/WindowAdapter.java \
|
||||
java/awt/event/WindowEvent.java \
|
||||
java/awt/event/WindowListener.java \
|
||||
java/awt/geom/AffineTransform.java \
|
||||
java/awt/geom/Dimension2D.java \
|
||||
java/awt/geom/Ellipse2D.java \
|
||||
java/awt/geom/IllegalPathStateException.java \
|
||||
java/awt/geom/NoninvertibleTransformException.java \
|
||||
java/awt/geom/PathIterator.java \
|
||||
java/awt/geom/Point2D.java \
|
||||
java/awt/geom/Rectangle2D.java \
|
||||
java/awt/geom/RectangularShape.java \
|
||||
java/awt/image/ImageConsumer.java \
|
||||
java/awt/image/ImageObserver.java \
|
||||
java/awt/image/ImageProducer.java \
|
||||
java/awt/geom/Dimension2D.java \
|
||||
java/awt/geom/Point2D.java \
|
||||
java/awt/peer/ButtonPeer.java \
|
||||
java/awt/peer/CanvasPeer.java \
|
||||
java/awt/peer/CheckboxMenuItemPeer.java \
|
||||
java/awt/peer/CheckboxPeer.java \
|
||||
java/awt/peer/CheckboxMenuItemPeer.java \
|
||||
java/awt/peer/CheckboxPeer.java \
|
||||
java/awt/peer/ChoicePeer.java \
|
||||
java/awt/peer/ComponentPeer.java \
|
||||
java/awt/peer/ContainerPeer.java \
|
||||
@ -356,28 +397,16 @@ java/awt/peer/LightweightPeer.java \
|
||||
java/awt/peer/ListPeer.java \
|
||||
java/awt/peer/MenuBarPeer.java \
|
||||
java/awt/peer/MenuComponentPeer.java \
|
||||
java/awt/peer/MenuItemPeer.java \
|
||||
java/awt/peer/MenuItemPeer.java \
|
||||
java/awt/peer/MenuPeer.java \
|
||||
java/awt/peer/PanelPeer.java \
|
||||
java/awt/peer/PopupMenuPeer.java \
|
||||
java/awt/peer/ScrollPanePeer.java \
|
||||
java/awt/peer/ScrollbarPeer.java \
|
||||
java/awt/peer/TextAreaPeer.java \
|
||||
java/awt/peer/TextAreaPeer.java \
|
||||
java/awt/peer/TextComponentPeer.java \
|
||||
java/awt/peer/TextFieldPeer.java \
|
||||
java/awt/peer/WindowPeer.java \
|
||||
java/awt/Adjustable.java \
|
||||
java/awt/Color.java \
|
||||
java/awt/Graphics.java \
|
||||
java/awt/Image.java \
|
||||
java/awt/Paint.java \
|
||||
java/awt/PaintContext.java \
|
||||
java/awt/Transparency.java \
|
||||
java/awt/ItemSelectable.java \
|
||||
java/awt/AWTException.java \
|
||||
java/awt/ActiveEvent.java \
|
||||
java/awt/Rectangle.java \
|
||||
java/awt/IllegalComponentStateException.java
|
||||
java/awt/peer/WindowPeer.java
|
||||
|
||||
|
||||
built_java_source_files = java/lang/ConcreteProcess.java
|
||||
@ -1031,13 +1060,14 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
|
||||
.deps/java/awt/GraphicsConfiguration.P \
|
||||
.deps/java/awt/IllegalComponentStateException.P .deps/java/awt/Image.P \
|
||||
.deps/java/awt/Insets.P .deps/java/awt/ItemSelectable.P \
|
||||
.deps/java/awt/LayoutManager.P .deps/java/awt/LayoutManager2.P \
|
||||
.deps/java/awt/Menu.P .deps/java/awt/MenuBar.P \
|
||||
.deps/java/awt/MenuComponent.P .deps/java/awt/MenuContainer.P \
|
||||
.deps/java/awt/MenuItem.P .deps/java/awt/MenuShortcut.P \
|
||||
.deps/java/awt/Paint.P .deps/java/awt/PaintContext.P \
|
||||
.deps/java/awt/Panel.P .deps/java/awt/Point.P \
|
||||
.deps/java/awt/PopupMenu.P .deps/java/awt/Rectangle.P \
|
||||
.deps/java/awt/Label.P .deps/java/awt/LayoutManager.P \
|
||||
.deps/java/awt/LayoutManager2.P .deps/java/awt/Menu.P \
|
||||
.deps/java/awt/MenuBar.P .deps/java/awt/MenuComponent.P \
|
||||
.deps/java/awt/MenuContainer.P .deps/java/awt/MenuItem.P \
|
||||
.deps/java/awt/MenuShortcut.P .deps/java/awt/Paint.P \
|
||||
.deps/java/awt/PaintContext.P .deps/java/awt/Panel.P \
|
||||
.deps/java/awt/Point.P .deps/java/awt/PopupMenu.P \
|
||||
.deps/java/awt/Rectangle.P .deps/java/awt/Scrollbar.P \
|
||||
.deps/java/awt/Shape.P .deps/java/awt/TextArea.P \
|
||||
.deps/java/awt/TextComponent.P .deps/java/awt/Toolkit.P \
|
||||
.deps/java/awt/Transparency.P .deps/java/awt/Window.P \
|
||||
@ -1071,8 +1101,15 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
|
||||
.deps/java/awt/event/PaintEvent.P .deps/java/awt/event/TextEvent.P \
|
||||
.deps/java/awt/event/TextListener.P \
|
||||
.deps/java/awt/event/WindowAdapter.P .deps/java/awt/event/WindowEvent.P \
|
||||
.deps/java/awt/event/WindowListener.P .deps/java/awt/geom/Dimension2D.P \
|
||||
.deps/java/awt/geom/Point2D.P .deps/java/awt/image/ImageConsumer.P \
|
||||
.deps/java/awt/event/WindowListener.P \
|
||||
.deps/java/awt/geom/AffineTransform.P .deps/java/awt/geom/Dimension2D.P \
|
||||
.deps/java/awt/geom/Ellipse2D.P \
|
||||
.deps/java/awt/geom/IllegalPathStateException.P \
|
||||
.deps/java/awt/geom/NoninvertibleTransformException.P \
|
||||
.deps/java/awt/geom/PathIterator.P .deps/java/awt/geom/Point2D.P \
|
||||
.deps/java/awt/geom/Rectangle2D.P \
|
||||
.deps/java/awt/geom/RectangularShape.P \
|
||||
.deps/java/awt/image/ImageConsumer.P \
|
||||
.deps/java/awt/image/ImageObserver.P \
|
||||
.deps/java/awt/image/ImageProducer.P .deps/java/awt/peer/ButtonPeer.P \
|
||||
.deps/java/awt/peer/CanvasPeer.P \
|
||||
@ -1714,7 +1751,7 @@ distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
cp -pr $$/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|
@ -18,8 +18,8 @@ import java.awt.event.*;
|
||||
|
||||
public interface Adjustable
|
||||
{
|
||||
static final int HORIZONTAL;
|
||||
static final int VERTICAL;
|
||||
public static final int HORIZONTAL = 0;
|
||||
public static final int VERTICAL = 1;
|
||||
|
||||
public void addAdjustmentListener (AdjustmentListener l);
|
||||
public int getBlockIncrement ();
|
||||
|
76
libjava/java/awt/Label.java
Normal file
76
libjava/java/awt/Label.java
Normal file
@ -0,0 +1,76 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation
|
||||
|
||||
This file is part of libjava.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt;
|
||||
|
||||
/**
|
||||
* @author Tom Tromey <tromey@cygnus.com>
|
||||
* @date April 12, 2000
|
||||
*/
|
||||
|
||||
/* Status: addNotify() not written. */
|
||||
|
||||
public class Label extends Component
|
||||
{
|
||||
public static final int CENTER = 1;
|
||||
public static final int LEFT = 0;
|
||||
public static final int RIGHT = 2;
|
||||
|
||||
public Label ()
|
||||
{
|
||||
this ("", LEFT);
|
||||
}
|
||||
|
||||
public Label (String text)
|
||||
{
|
||||
this (text, LEFT);
|
||||
}
|
||||
|
||||
public Label (String text, int alignment)
|
||||
{
|
||||
if (alignment != CENTER && alignment != LEFT && alignment != RIGHT)
|
||||
throw new IllegalArgumentException ();
|
||||
this.text = text;
|
||||
this.alignment = alignment;
|
||||
}
|
||||
|
||||
public void addNotify ()
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
|
||||
public int getAlignment ()
|
||||
{
|
||||
return alignment;
|
||||
}
|
||||
|
||||
public String getText ()
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
protected String paramString ()
|
||||
{
|
||||
return "Label[" + alignment + "," + text + "]";
|
||||
}
|
||||
|
||||
public void setAlignment (int alignment)
|
||||
{
|
||||
if (alignment != CENTER && alignment != LEFT && alignment != RIGHT)
|
||||
throw new IllegalArgumentException ();
|
||||
this.alignment = alignment;
|
||||
}
|
||||
|
||||
public void setText (String text)
|
||||
{
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
private String text;
|
||||
private int alignment;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1999 Free Software Foundation
|
||||
/* Copyright (C) 1999, 2000 Free Software Foundation
|
||||
|
||||
This file is part of libjava.
|
||||
|
||||
@ -7,11 +7,11 @@ Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt;
|
||||
import java.awt.geom.*;
|
||||
|
||||
/* Status: Mostly complete. Some of the Java2D stuff is commented out. */
|
||||
|
||||
// FIXME: Should extend Rectangle2D for 1.2 implementation
|
||||
public class Rectangle implements Cloneable, Shape
|
||||
public class Rectangle extends Rectangle2D implements Cloneable, Shape
|
||||
{
|
||||
public int x;
|
||||
public int y;
|
||||
@ -151,6 +151,12 @@ public class Rectangle implements Cloneable, Shape
|
||||
return new Point(x,y);
|
||||
}
|
||||
|
||||
public PathIterator getPathIterator (AffineTransform t)
|
||||
{
|
||||
// FIXME
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dimension getSize()
|
||||
{
|
||||
return new Dimension(width, height);
|
||||
@ -307,25 +313,32 @@ public class Rectangle implements Cloneable, Shape
|
||||
}
|
||||
|
||||
// Commented out until we have Rectangle2D
|
||||
/*
|
||||
public Rectangle2D createIntersection(Rectangle2D r)
|
||||
{
|
||||
// FIXME: maybe we should consider returning a Rectangle or
|
||||
// Rectangle2D.Float depending on type of R.
|
||||
Rectangle2D.Double res = new Rectangle2D.Double ();
|
||||
intersect (this, r, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public Rectangle2D createUnion(Rectangle2D r)
|
||||
{
|
||||
// FIXME: maybe we should consider returning a Rectangle or
|
||||
// Rectangle2D.Float depending on type of R.
|
||||
Rectangle2D.Double res = new Rectangle2D.Double ();
|
||||
union (this, r, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public Rectangle2D getBounds2D()
|
||||
{
|
||||
return new Rectangle (x, y, width, height);
|
||||
}
|
||||
*/
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getClass().getName() + "[x=" + x + ",y=" + y + ",width=" + width +
|
||||
",height=" + height + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
215
libjava/java/awt/Scrollbar.java
Normal file
215
libjava/java/awt/Scrollbar.java
Normal file
@ -0,0 +1,215 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation
|
||||
|
||||
This file is part of libjava.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt;
|
||||
import java.awt.event.*;
|
||||
import java.util.Vector;
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
* @author Tom Tromey <tromey@cygnus.com>
|
||||
* @date April 12, 2000
|
||||
*/
|
||||
|
||||
public class Scrollbar extends Component implements Adjustable
|
||||
{
|
||||
public Scrollbar ()
|
||||
{
|
||||
this (VERTICAL, 0, 10, 0, 100);
|
||||
}
|
||||
|
||||
public Scrollbar (int orientation)
|
||||
{
|
||||
this (orientation, 0, 10, 0, 100);
|
||||
}
|
||||
|
||||
public Scrollbar (int orientation, int value, int visible,
|
||||
int minimum, int maximum)
|
||||
{
|
||||
if (orientation != HORIZONTAL && orientation != VERTICAL)
|
||||
throw new IllegalArgumentException ();
|
||||
|
||||
if (maximum < minimum)
|
||||
maximum = minimum;
|
||||
if (value < minimum)
|
||||
value = minimum;
|
||||
if (value > maximum)
|
||||
value = maximum;
|
||||
|
||||
this.orientation = orientation;
|
||||
this.value = value;
|
||||
this.visible = visible;
|
||||
this.minimum = minimum;
|
||||
this.maximum = maximum;
|
||||
this.unit = 1;
|
||||
this.listeners = new Vector ();
|
||||
|
||||
this.block = 0; // FIXME
|
||||
}
|
||||
|
||||
public void addNotify ()
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
|
||||
public int getOrientation ()
|
||||
{
|
||||
return orientation;
|
||||
}
|
||||
|
||||
public void setOrientation (int orientation)
|
||||
{
|
||||
if (orientation != HORIZONTAL && orientation != VERTICAL)
|
||||
throw new IllegalArgumentException ();
|
||||
this.orientation = orientation;
|
||||
}
|
||||
|
||||
public int getValue ()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue (int value)
|
||||
{
|
||||
if (value < minimum)
|
||||
value = minimum;
|
||||
else if (value > maximum)
|
||||
value = maximum;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getMinimum ()
|
||||
{
|
||||
return minimum;
|
||||
}
|
||||
|
||||
public void setMinimum (int minimum)
|
||||
{
|
||||
// FIXME: what if it is > max?
|
||||
this.minimum = minimum;
|
||||
}
|
||||
|
||||
public int getMaximum ()
|
||||
{
|
||||
return maximum;
|
||||
}
|
||||
|
||||
public void setMaximum (int maximum)
|
||||
{
|
||||
// FIXME: what if it is < min?
|
||||
this.maximum = maximum;
|
||||
}
|
||||
|
||||
public int getVisibleAmount ()
|
||||
{
|
||||
return visible;
|
||||
}
|
||||
|
||||
public int getVisible ()
|
||||
{
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisibleAmount (int visible)
|
||||
{
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public void setUnitIncrement (int v)
|
||||
{
|
||||
unit = v;
|
||||
}
|
||||
|
||||
public void setLineIncrement (int v)
|
||||
{
|
||||
unit = v;
|
||||
}
|
||||
|
||||
public int getUnitIncrement ()
|
||||
{
|
||||
return unit;
|
||||
}
|
||||
|
||||
public int getLineIncrement ()
|
||||
{
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void setBlockIncrement (int v)
|
||||
{
|
||||
block = v;
|
||||
}
|
||||
|
||||
public void setPageIncrement (int v)
|
||||
{
|
||||
block = v;
|
||||
}
|
||||
|
||||
public int getBlockIncrement ()
|
||||
{
|
||||
return block;
|
||||
}
|
||||
|
||||
public int getPageIncrement ()
|
||||
{
|
||||
return block;
|
||||
}
|
||||
|
||||
public synchronized void setValues (int value, int visible,
|
||||
int minimum, int maximum)
|
||||
{
|
||||
// fixme;
|
||||
}
|
||||
|
||||
public void addAdjustmentListener (AdjustmentListener l)
|
||||
{
|
||||
if (l != null)
|
||||
{
|
||||
listeners.addElement (l);
|
||||
enableEvents (0); // FIXME
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAdjustmentListener (AdjustmentListener l)
|
||||
{
|
||||
if (l != null)
|
||||
listeners.remove (l);
|
||||
}
|
||||
|
||||
protected void processEvent (AWTEvent e)
|
||||
{
|
||||
if (e instanceof AdjustmentEvent)
|
||||
processAdjustmentEvent ((AdjustmentEvent) e);
|
||||
else
|
||||
super.processEvent (e);
|
||||
}
|
||||
|
||||
protected void processAdjustmentEvent (AdjustmentEvent e)
|
||||
{
|
||||
Enumeration en = listeners.elements ();
|
||||
while (en.hasMoreElements ())
|
||||
{
|
||||
AdjustmentListener l = (AdjustmentListener) en.nextElement ();
|
||||
l.adjustmentValueChanged (e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String paramString ()
|
||||
{
|
||||
return null; // FIXME
|
||||
}
|
||||
|
||||
private Vector listeners;
|
||||
private int orientation;
|
||||
private int value;
|
||||
private int visible;
|
||||
private int minimum;
|
||||
private int maximum;
|
||||
private int unit;
|
||||
private int block;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1999 Free Software Foundation
|
||||
/* Copyright (C) 1999, 2000 Free Software Foundation
|
||||
|
||||
This file is part of libjava.
|
||||
|
||||
@ -7,17 +7,27 @@ Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt;
|
||||
import java.awt.geom.*;
|
||||
|
||||
/**
|
||||
* @author Per Bothner <bothner@cygnus.com>
|
||||
* @date Fenruary 8, 1999.
|
||||
* @date February 8, 1999.
|
||||
*/
|
||||
|
||||
/* Written using "Java Class Libraries", 2nd edition.
|
||||
* Status: Believed complete and correct.
|
||||
* Status: Believed complete and correct to JDK 1.2.
|
||||
*/
|
||||
|
||||
public interface Shape
|
||||
{
|
||||
public boolean contains (double x, double y);
|
||||
public boolean contains (double x, double y, double w, double h);
|
||||
public boolean contains (Point2D p);
|
||||
public boolean contains (Rectangle2D r);
|
||||
public Rectangle getBounds ();
|
||||
public Rectangle2D getBounds2D ();
|
||||
public PathIterator getPathIterator (AffineTransform at);
|
||||
public PathIterator getPathIterator (AffineTransform at, double flatness);
|
||||
public boolean intersects (double x, double y, double w, double h);
|
||||
public boolean intersects (Rectangle2D r);
|
||||
}
|
||||
|
652
libjava/java/awt/geom/AffineTransform.java
Normal file
652
libjava/java/awt/geom/AffineTransform.java
Normal file
@ -0,0 +1,652 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation
|
||||
|
||||
This file is part of libjava.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt.geom;
|
||||
import java.awt.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Tom Tromey <tromey@cygnus.com>
|
||||
* @date April 16, 2000
|
||||
*/
|
||||
|
||||
/* Status: mostly complete. Search for fixme to see problems.
|
||||
Also, TYPE_ returns are not handled correctly. */
|
||||
|
||||
public class AffineTransform implements Cloneable, Serializable
|
||||
{
|
||||
static final int TYPE_IDENTITY = 0;
|
||||
static final int TYPE_FLIP = 64;
|
||||
static final int TYPE_GENERAL_ROTATION = 16;
|
||||
static final int TYPE_GENERAL_SCALE = 4;
|
||||
static final int TYPE_GENERAL_TRANSFORM = 32;
|
||||
static final int TYPE_MASK_ROTATION = 24;
|
||||
static final int TYPE_MASK_SCALE = 6;
|
||||
static final int TYPE_QUADRANT_ROTATION = 8;
|
||||
static final int TYPE_TRANSLATION = 1;
|
||||
static final int TYPE_UNIFORM_SCALE = 2;
|
||||
|
||||
public AffineTransform ()
|
||||
{
|
||||
setToIdentity ();
|
||||
}
|
||||
|
||||
public AffineTransform (AffineTransform tx)
|
||||
{
|
||||
setTransform (tx);
|
||||
}
|
||||
|
||||
public AffineTransform (float m00, float m10,
|
||||
float m01, float m11,
|
||||
float m02, float m12)
|
||||
{
|
||||
this.m00 = m00;
|
||||
this.m10 = m10;
|
||||
this.m01 = m01;
|
||||
this.m11 = m11;
|
||||
this.m02 = m02;
|
||||
this.m12 = m12;
|
||||
this.type = 0; // fixme;
|
||||
}
|
||||
|
||||
public AffineTransform (float[] flatmatrix)
|
||||
{
|
||||
m00 = flatmatrix[0];
|
||||
m10 = flatmatrix[1];
|
||||
m01 = flatmatrix[2];
|
||||
m11 = flatmatrix[3];
|
||||
if (flatmatrix.length >= 6)
|
||||
{
|
||||
m02 = flatmatrix[4];
|
||||
m12 = flatmatrix[5];
|
||||
}
|
||||
}
|
||||
|
||||
public AffineTransform (double m00, double m10, double m01,
|
||||
double m11, double m02, double m12)
|
||||
{
|
||||
this.m00 = m00;
|
||||
this.m10 = m10;
|
||||
this.m01 = m01;
|
||||
this.m11 = m11;
|
||||
this.m02 = m02;
|
||||
this.m12 = m12;
|
||||
this.type = TYPE_GENERAL_TRANSFORM;
|
||||
}
|
||||
|
||||
public AffineTransform (double[] flatmatrix)
|
||||
{
|
||||
m00 = flatmatrix[0];
|
||||
m10 = flatmatrix[1];
|
||||
m01 = flatmatrix[2];
|
||||
m11 = flatmatrix[3];
|
||||
if (flatmatrix.length >= 6)
|
||||
{
|
||||
m02 = flatmatrix[4];
|
||||
m12 = flatmatrix[5];
|
||||
}
|
||||
}
|
||||
|
||||
public static AffineTransform getTranslateInstance (double tx, double ty)
|
||||
{
|
||||
AffineTransform t = new AffineTransform ();
|
||||
t.setToTranslation (tx, ty);
|
||||
return t;
|
||||
}
|
||||
|
||||
public static AffineTransform getRotateInstance (double theta)
|
||||
{
|
||||
AffineTransform t = new AffineTransform ();
|
||||
t.setToRotation (theta);
|
||||
return t;
|
||||
}
|
||||
|
||||
public static AffineTransform getRotateInstance (double theta,
|
||||
double x, double y)
|
||||
{
|
||||
AffineTransform t = new AffineTransform ();
|
||||
t.rotate (theta, x, y);
|
||||
return t;
|
||||
}
|
||||
|
||||
public static AffineTransform getScaleInstance (double sx, double sy)
|
||||
{
|
||||
AffineTransform t = new AffineTransform ();
|
||||
t.setToScale (sx, sy);
|
||||
return t;
|
||||
}
|
||||
|
||||
public static AffineTransform getShearInstance (double shx, double shy)
|
||||
{
|
||||
AffineTransform t = new AffineTransform ();
|
||||
t.setToShear (shx, shy);
|
||||
return t;
|
||||
}
|
||||
|
||||
public int getType ()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public double getDeterminant ()
|
||||
{
|
||||
return m00 * m11 - m01 * m10;
|
||||
}
|
||||
|
||||
public void getMatrix (double[] flatmatrix)
|
||||
{
|
||||
flatmatrix[0] = m00;
|
||||
flatmatrix[1] = m10;
|
||||
flatmatrix[2] = m01;
|
||||
flatmatrix[3] = m11;
|
||||
if (flatmatrix.length >= 6)
|
||||
{
|
||||
flatmatrix[4] = m02;
|
||||
flatmatrix[5] = m12;
|
||||
}
|
||||
}
|
||||
|
||||
public double getScaleX ()
|
||||
{
|
||||
return m00;
|
||||
}
|
||||
|
||||
public double getScaleY ()
|
||||
{
|
||||
return m11;
|
||||
}
|
||||
|
||||
public double getShearX ()
|
||||
{
|
||||
return m01;
|
||||
}
|
||||
|
||||
public double getShearY ()
|
||||
{
|
||||
return m10;
|
||||
}
|
||||
|
||||
public double getTranslateX ()
|
||||
{
|
||||
return m02;
|
||||
}
|
||||
|
||||
public double getTranslateY ()
|
||||
{
|
||||
return m12;
|
||||
}
|
||||
|
||||
public void translate (double tx, double ty)
|
||||
{
|
||||
m02 += tx * m00 + ty * m01;
|
||||
m12 += tx * m10 + ty * m11;
|
||||
}
|
||||
|
||||
public void rotate (double theta)
|
||||
{
|
||||
double c = Math.cos (theta);
|
||||
double s = Math.sin (theta);
|
||||
double n00 = m00 * c + m01 * s;
|
||||
double n01 = m00 * -s + m01 * c;
|
||||
double n10 = m10 * c + m11 * s;
|
||||
double n11 = m10 * -s + m11 * c;
|
||||
|
||||
m00 = n00;
|
||||
m01 = n01;
|
||||
m10 = n10;
|
||||
m11 = n11;
|
||||
}
|
||||
|
||||
public void rotate (double theta, double x, double y)
|
||||
{
|
||||
translate (x, y);
|
||||
rotate (theta);
|
||||
translate (-x, -y);
|
||||
}
|
||||
|
||||
public void scale (double sx, double sy)
|
||||
{
|
||||
m00 *= sx;
|
||||
m01 *= sy;
|
||||
m10 *= sx;
|
||||
m11 *= sy;
|
||||
}
|
||||
|
||||
public void shear (double shx, double shy)
|
||||
{
|
||||
double n00 = m00 + shx * m01;
|
||||
double n01 = shx * m00 + m01;
|
||||
double n10 = m10 * shy + m11;
|
||||
double n11 = shx * m10 + m11;
|
||||
|
||||
m00 = n00;
|
||||
m01 = n01;
|
||||
m10 = n10;
|
||||
m11 = n11;
|
||||
}
|
||||
|
||||
public void setToIdentity ()
|
||||
{
|
||||
m00 = m11 = 1;
|
||||
m01 = m02 = m10 = m12 = 0;
|
||||
type = TYPE_IDENTITY;
|
||||
}
|
||||
|
||||
public void setToTranslation (double tx, double ty)
|
||||
{
|
||||
m00 = m11 = 1;
|
||||
m01 = m10 = 0;
|
||||
m02 = tx;
|
||||
m12 = ty;
|
||||
type = TYPE_TRANSLATION;
|
||||
}
|
||||
|
||||
public void setToRotation (double theta)
|
||||
{
|
||||
double c = Math.cos (theta);
|
||||
double s = Math.sin (theta);
|
||||
|
||||
m00 = c;
|
||||
m01 = -s;
|
||||
m02 = 0;
|
||||
m10 = s;
|
||||
m11 = c;
|
||||
m12 = 0;
|
||||
type = TYPE_GENERAL_ROTATION;
|
||||
}
|
||||
|
||||
public void setToScale (double sx, double sy)
|
||||
{
|
||||
m00 = sx;
|
||||
m01 = m02 = m10 = m12 = 0;
|
||||
m11 = sy;
|
||||
type = (sx == sy) ? TYPE_UNIFORM_SCALE : TYPE_GENERAL_SCALE;
|
||||
}
|
||||
|
||||
public void setToShear (double shx, double shy)
|
||||
{
|
||||
m00 = m11 = 1;
|
||||
m01 = shx;
|
||||
m10 = shy;
|
||||
m02 = m12 = 0;
|
||||
type = 0; // FIXME
|
||||
}
|
||||
|
||||
public void setTransform (AffineTransform tx)
|
||||
{
|
||||
m00 = tx.m00;
|
||||
m01 = tx.m01;
|
||||
m02 = tx.m02;
|
||||
m10 = tx.m10;
|
||||
m11 = tx.m11;
|
||||
m12 = tx.m12;
|
||||
type = tx.type;
|
||||
}
|
||||
|
||||
public void setTransform (double m00, double m10, double m01,
|
||||
double m11, double m02, double m12)
|
||||
{
|
||||
this.m00 = m00;
|
||||
this.m10 = m10;
|
||||
this.m01 = m01;
|
||||
this.m11 = m11;
|
||||
this.m02 = m02;
|
||||
this.m12 = m12;
|
||||
this.type = 0; // FIXME
|
||||
}
|
||||
|
||||
public void concatentate (AffineTransform tx)
|
||||
{
|
||||
double n00 = m00 * tx.m00 + m01 * tx.m10;
|
||||
double n01 = m00 * tx.m01 + m01 * tx.m11;
|
||||
double n02 = m00 * tx.m02 + m01 * tx.m12 + m02;
|
||||
double n10 = m10 * tx.m00 + m11 * tx.m10;
|
||||
double n11 = m10 * tx.m01 + m11 * tx.m11;
|
||||
double n12 = m10 * tx.m02 + m11 * tx.m12 + m12;
|
||||
|
||||
m00 = n00;
|
||||
m01 = n01;
|
||||
m02 = n02;
|
||||
m10 = n10;
|
||||
m11 = n11;
|
||||
m12 = n12;
|
||||
}
|
||||
|
||||
public void preConcatenate (AffineTransform tx)
|
||||
{
|
||||
double n00 = tx.m00 * m00 + tx.m01 * m10;
|
||||
double n01 = tx.m00 * m01 + tx.m01 * m11;
|
||||
double n02 = tx.m00 * m02 + tx.m01 * m12 + tx.m02;
|
||||
double n10 = tx.m10 * m00 + tx.m11 * m10;
|
||||
double n11 = tx.m10 * m01 + tx.m11 * m11;
|
||||
double n12 = tx.m10 * m02 + tx.m11 * m12 + tx.m12;
|
||||
|
||||
m00 = n00;
|
||||
m01 = n01;
|
||||
m02 = n02;
|
||||
m10 = n10;
|
||||
m11 = n11;
|
||||
m12 = n12;
|
||||
}
|
||||
|
||||
public AffineTransform createInverse ()
|
||||
throws NoninvertibleTransformException
|
||||
{
|
||||
double det = getDeterminant ();
|
||||
if (det == 0)
|
||||
throw new NoninvertibleTransformException ("can't invert transform");
|
||||
|
||||
double i00 = m11 / det;
|
||||
double i01 = -m10 / det;
|
||||
double i02 = 0;
|
||||
double i10 = m01 / det;
|
||||
double i11 = -m00 / det;
|
||||
double i12 = 0;
|
||||
|
||||
return new AffineTransform (i00, i01, i02,
|
||||
i10, i11, i12);
|
||||
}
|
||||
|
||||
public Point2D transform (Point2D src, Point2D dst)
|
||||
{
|
||||
if (dst == null)
|
||||
dst = new Point2D.Double ();
|
||||
|
||||
// We compute and set separately to correctly overwrite if
|
||||
// src==dst.
|
||||
double x = src.getX ();
|
||||
double y = src.getY ();
|
||||
double nx = m00 * x + m01 * y + m02;
|
||||
double ny = m10 * x + m11 * y + m12;
|
||||
|
||||
dst.setLocation (nx, ny);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
public void transform (Point2D[] src, int srcOff,
|
||||
Point2D[] dst, int dstOff,
|
||||
int num)
|
||||
{
|
||||
while (num-- > 0)
|
||||
{
|
||||
dst[dstOff] = transform (src[srcOff], dst[dstOff]);
|
||||
++srcOff;
|
||||
++dstOff;
|
||||
}
|
||||
}
|
||||
|
||||
public void transform (float[] srcPts, int srcOff,
|
||||
float[] dstPts, int dstOff,
|
||||
int num)
|
||||
{
|
||||
while (num-- > 0)
|
||||
{
|
||||
float x = srcPts[srcOff];
|
||||
float y = srcPts[srcOff + 1];
|
||||
srcOff += 2;
|
||||
float nx = (float) (m00 * x + m01 * y + m02);
|
||||
float ny = (float) (m10 * x + m10 * y + m12);
|
||||
dstPts[dstOff] = nx;
|
||||
dstPts[dstOff + 1] = ny;
|
||||
dstOff += 2;
|
||||
}
|
||||
}
|
||||
|
||||
public void transform (double[] srcPts, int srcOff,
|
||||
double[] dstPts, int dstOff,
|
||||
int num)
|
||||
{
|
||||
while (num-- > 0)
|
||||
{
|
||||
double x = srcPts[srcOff];
|
||||
double y = srcPts[srcOff + 1];
|
||||
srcOff += 2;
|
||||
double nx = m00 * x + m01 * y + m02;
|
||||
double ny = m10 * x + m10 * y + m12;
|
||||
dstPts[dstOff] = nx;
|
||||
dstPts[dstOff + 1] = ny;
|
||||
dstOff += 2;
|
||||
}
|
||||
}
|
||||
|
||||
public void transform (float[] srcPts, int srcOff,
|
||||
double[] dstPts, int dstOff,
|
||||
int num)
|
||||
{
|
||||
while (num-- > 0)
|
||||
{
|
||||
float x = srcPts[srcOff];
|
||||
float y = srcPts[srcOff + 1];
|
||||
srcOff += 2;
|
||||
double nx = m00 * x + m01 * y + m02;
|
||||
double ny = m10 * x + m10 * y + m12;
|
||||
dstPts[dstOff] = nx;
|
||||
dstPts[dstOff + 1] = ny;
|
||||
dstOff += 2;
|
||||
}
|
||||
}
|
||||
|
||||
public void transform (double[] srcPts, int srcOff,
|
||||
float[] dstPts, int dstOff,
|
||||
int num)
|
||||
{
|
||||
while (num-- > 0)
|
||||
{
|
||||
double x = srcPts[srcOff];
|
||||
double y = srcPts[srcOff + 1];
|
||||
srcOff += 2;
|
||||
float nx = (float) (m00 * x + m01 * y + m02);
|
||||
float ny = (float) (m10 * x + m10 * y + m12);
|
||||
dstPts[dstOff] = nx;
|
||||
dstPts[dstOff + 1] = ny;
|
||||
dstOff += 2;
|
||||
}
|
||||
}
|
||||
|
||||
public Point2D inverseTransform (Point2D src, Point2D dst)
|
||||
throws NoninvertibleTransformException
|
||||
{
|
||||
double det = getDeterminant ();
|
||||
if (det == 0)
|
||||
throw new NoninvertibleTransformException ("couldn't invert transform");
|
||||
|
||||
if (dst == null)
|
||||
dst = new Point2D.Double ();
|
||||
double x = src.getX ();
|
||||
double y = src.getY ();
|
||||
double nx = (m11 * x + - m10 * y) / det;
|
||||
double ny = (m01 * x + - m00 * y) / det;
|
||||
dst.setLocation (nx, ny);
|
||||
return dst;
|
||||
}
|
||||
|
||||
public void inverseTransform (double[] srcPts, int srcOff,
|
||||
double[] dstPts, int dstOff,
|
||||
int num)
|
||||
throws NoninvertibleTransformException
|
||||
{
|
||||
double det = getDeterminant ();
|
||||
if (det == 0)
|
||||
throw new NoninvertibleTransformException ("couldn't invert transform");
|
||||
|
||||
while (num-- > 0)
|
||||
{
|
||||
double x = srcPts[srcOff];
|
||||
double y = srcPts[srcOff + 1];
|
||||
double nx = (m11 * x + - m10 * y) / det;
|
||||
double ny = (m01 * x + - m00 * y) / det;
|
||||
dstPts[dstOff] = nx;
|
||||
dstPts[dstOff + 1] = ny;
|
||||
dstOff += 2;
|
||||
srcOff += 2;
|
||||
}
|
||||
}
|
||||
|
||||
public Point2D deltaTransform (Point2D src, Point2D dst)
|
||||
{
|
||||
if (dst == null)
|
||||
dst = new Point2D.Double ();
|
||||
double x = src.getX ();
|
||||
double y = src.getY ();
|
||||
double nx = m00 * x + m01 * y;
|
||||
double ny = m10 * x + m11 * y;
|
||||
dst.setLocation (nx, ny);
|
||||
return dst;
|
||||
}
|
||||
|
||||
public void deltaTransform (double[] srcPts, int srcOff,
|
||||
double[] dstPts, int dstOff,
|
||||
int num)
|
||||
{
|
||||
while (num-- > 0)
|
||||
{
|
||||
double x = srcPts[srcOff];
|
||||
double y = srcPts[srcOff + 1];
|
||||
double nx = m00 * x + m01 * y;
|
||||
double ny = m10 * x + m11 * y;
|
||||
dstPts[dstOff] = nx;
|
||||
dstPts[dstOff + 1] = ny;
|
||||
dstOff += 2;
|
||||
srcOff += 2;
|
||||
}
|
||||
}
|
||||
|
||||
public Shape createTransformedShape (Shape pSrc)
|
||||
{
|
||||
// FIXME
|
||||
return null;
|
||||
}
|
||||
|
||||
public String toString ()
|
||||
{
|
||||
// FIXME
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isIdentity ()
|
||||
{
|
||||
return (m00 == 1 && m01 == 0 && m02 == 0
|
||||
&& m10 == 0 && m11 == 1 && m12 == 0);
|
||||
}
|
||||
|
||||
public Object clone ()
|
||||
{
|
||||
return new AffineTransform (this);
|
||||
}
|
||||
|
||||
public int hashCode ()
|
||||
{
|
||||
// FIXME
|
||||
return 23;
|
||||
}
|
||||
|
||||
public boolean equals (Object obj)
|
||||
{
|
||||
if (! (obj instanceof AffineTransform))
|
||||
return false;
|
||||
AffineTransform t = (AffineTransform) obj;
|
||||
return (m00 == t.m00 && m01 == t.m01 && m02 == t.m02
|
||||
&& m10 == t.m10 && m11 == t.m11 && m12 == t.m12);
|
||||
}
|
||||
|
||||
// This iterator is used to apply an AffineTransform to some other
|
||||
// iterator. It is not private because we want to be able to access
|
||||
// it from the rest of this package.
|
||||
class Iterator implements PathIterator
|
||||
{
|
||||
// The iterator we are applied to.
|
||||
private PathIterator subIterator;
|
||||
|
||||
public Iterator (PathIterator subIterator)
|
||||
{
|
||||
this.subIterator = subIterator;
|
||||
}
|
||||
|
||||
public int currentSegment (double[] coords)
|
||||
{
|
||||
int r = subIterator.currentSegment (coords);
|
||||
int count = 0;
|
||||
|
||||
switch (r)
|
||||
{
|
||||
case SEG_CUBICTO:
|
||||
count = 3;
|
||||
break;
|
||||
|
||||
case SEG_QUADTO:
|
||||
count = 2;
|
||||
break;
|
||||
|
||||
case SEG_LINETO:
|
||||
case SEG_MOVETO:
|
||||
count = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Error. But how to report?
|
||||
case SEG_CLOSE:
|
||||
break;
|
||||
}
|
||||
|
||||
transform (coords, 0, coords, 0, count);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
public int currentSegment (float[] coords)
|
||||
{
|
||||
int r = subIterator.currentSegment (coords);
|
||||
int count = 0;
|
||||
|
||||
switch (r)
|
||||
{
|
||||
case SEG_CUBICTO:
|
||||
count = 3;
|
||||
break;
|
||||
|
||||
case SEG_QUADTO:
|
||||
count = 2;
|
||||
break;
|
||||
|
||||
case SEG_LINETO:
|
||||
case SEG_MOVETO:
|
||||
count = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Error. But how to report?
|
||||
case SEG_CLOSE:
|
||||
break;
|
||||
}
|
||||
|
||||
transform (coords, 0, coords, 0, count);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
public int getWindingRule ()
|
||||
{
|
||||
return subIterator.getWindingRule ();
|
||||
}
|
||||
|
||||
public boolean isDone ()
|
||||
{
|
||||
return subIterator.isDone ();
|
||||
}
|
||||
|
||||
public void next ()
|
||||
{
|
||||
subIterator.next ();
|
||||
}
|
||||
}
|
||||
|
||||
private double m00, m01, m02;
|
||||
private double m10, m11, m12;
|
||||
private int type;
|
||||
}
|
176
libjava/java/awt/geom/Ellipse2D.java
Normal file
176
libjava/java/awt/geom/Ellipse2D.java
Normal file
@ -0,0 +1,176 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation
|
||||
|
||||
This file is part of libjava.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt.geom;
|
||||
|
||||
/**
|
||||
* @author Tom Tromey <tromey@cygnus.com>
|
||||
* @date April 16, 2000
|
||||
*/
|
||||
|
||||
public abstract class Ellipse2D extends RectangularShape
|
||||
{
|
||||
protected Ellipse2D ()
|
||||
{
|
||||
}
|
||||
|
||||
public boolean contains (double x, double y)
|
||||
{
|
||||
double rx = getWidth () / 2;
|
||||
double ry = getHeight () / 2;
|
||||
double tx = (x - getCenterX ()) / rx;
|
||||
double ty = (y - getCenterY ()) / ry;
|
||||
return tx * tx + ty * ty <= 1.0;
|
||||
}
|
||||
|
||||
public boolean contains (double x, double y, double w, double h)
|
||||
{
|
||||
double x2 = x + w;
|
||||
double y2 = y + h;
|
||||
return (contains (x, y) && contains (x, y2)
|
||||
&& contains (x2, y) && contains (x2, y2));
|
||||
}
|
||||
|
||||
public PathIterator getPathIterator (AffineTransform at)
|
||||
{
|
||||
// fixme;
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean intersects (double x, double y, double w, double h)
|
||||
{
|
||||
// fixme
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Double extends Ellipse2D
|
||||
{
|
||||
public double height;
|
||||
public double width;
|
||||
public double x;
|
||||
public double y;
|
||||
|
||||
public Double ()
|
||||
{
|
||||
height = width = x = y = 0;
|
||||
}
|
||||
|
||||
public Double (double x, double y, double w, double h)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.height = h;
|
||||
this.width = w;
|
||||
}
|
||||
|
||||
public Rectangle2D getBounds2D ()
|
||||
{
|
||||
return new Rectangle2D.Double (x, y, width, height);
|
||||
}
|
||||
|
||||
public double getHeight ()
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
public double getWidth ()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
public double getX ()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
public double getY ()
|
||||
{
|
||||
return y;
|
||||
}
|
||||
|
||||
public boolean isEmpty ()
|
||||
{
|
||||
return height <= 0 || width <= 0;
|
||||
}
|
||||
|
||||
public void setFrame (double x, double y, double w, double h)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.height = h;
|
||||
this.width = w;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Float extends Ellipse2D
|
||||
{
|
||||
public float height;
|
||||
public float width;
|
||||
public float x;
|
||||
public float y;
|
||||
|
||||
public Float ()
|
||||
{
|
||||
height = width = x = y = 0;
|
||||
}
|
||||
|
||||
public Float (float x, float y, float w, float h)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.height = h;
|
||||
this.width = w;
|
||||
}
|
||||
|
||||
public Rectangle2D getBounds2D ()
|
||||
{
|
||||
return new Rectangle2D.Float (x, y, width, height);
|
||||
}
|
||||
|
||||
public double getHeight ()
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
public double getWidth ()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
public double getX ()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
public double getY ()
|
||||
{
|
||||
return y;
|
||||
}
|
||||
|
||||
public boolean isEmpty ()
|
||||
{
|
||||
return height <= 0 || width <= 0;
|
||||
}
|
||||
|
||||
public void setFrame (float x, float y, float w, float h)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.height = h;
|
||||
this.width = w;
|
||||
}
|
||||
|
||||
public void setFrame (double x, double y, double w, double h)
|
||||
{
|
||||
this.x = (float) x;
|
||||
this.y = (float) y;
|
||||
this.height = (float) h;
|
||||
this.width = (float) w;
|
||||
}
|
||||
}
|
||||
}
|
27
libjava/java/awt/geom/IllegalPathStateException.java
Normal file
27
libjava/java/awt/geom/IllegalPathStateException.java
Normal file
@ -0,0 +1,27 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation
|
||||
|
||||
This file is part of libjava.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt.geom;
|
||||
|
||||
/**
|
||||
* @author Tom Tromey <tromey@cygnus.com>
|
||||
* @date July 17, 2000
|
||||
*/
|
||||
|
||||
public class IllegalPathStateException extends RuntimeException
|
||||
{
|
||||
public IllegalPathStateException ()
|
||||
{
|
||||
super ();
|
||||
}
|
||||
|
||||
public IllegalPathStateException (String msg)
|
||||
{
|
||||
super (msg);
|
||||
}
|
||||
}
|
22
libjava/java/awt/geom/NoninvertibleTransformException.java
Normal file
22
libjava/java/awt/geom/NoninvertibleTransformException.java
Normal file
@ -0,0 +1,22 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation
|
||||
|
||||
This file is part of libjava.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt.geom;
|
||||
|
||||
/**
|
||||
* @author Tom Tromey <tromey@cygnus.com>
|
||||
* @date July 15, 2000
|
||||
*/
|
||||
|
||||
public class NoninvertibleTransformException extends Exception
|
||||
{
|
||||
public NoninvertibleTransformException (String s)
|
||||
{
|
||||
super (s);
|
||||
}
|
||||
}
|
31
libjava/java/awt/geom/PathIterator.java
Normal file
31
libjava/java/awt/geom/PathIterator.java
Normal file
@ -0,0 +1,31 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation
|
||||
|
||||
This file is part of libjava.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt.geom;
|
||||
|
||||
/**
|
||||
* @author Tom Tromey <tromey@cygnus.com>
|
||||
* @date April 16, 2000
|
||||
*/
|
||||
|
||||
public interface PathIterator
|
||||
{
|
||||
public static final int SEG_CLOSE = 4;
|
||||
public static final int SEG_CUBICTO = 3;
|
||||
public static final int SEG_LINETO = 1;
|
||||
public static final int SEG_MOVETO = 0;
|
||||
public static final int SEG_QUADTO = 2;
|
||||
public static final int WIND_EVEN_ODD = 0;
|
||||
public static final int WIND_NON_ZERO = 1;
|
||||
|
||||
public int currentSegment (double[] coords);
|
||||
public int currentSegment (float[] coords);
|
||||
public int getWindingRule ();
|
||||
public boolean isDone ();
|
||||
public void next ();
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1999 Free Software Foundation
|
||||
/* Copyright (C) 1999, 2000 Free Software Foundation
|
||||
|
||||
This file is part of libjava.
|
||||
|
||||
@ -10,7 +10,7 @@ package java.awt.geom;
|
||||
|
||||
/**
|
||||
* @author Per Bothner <bothner@cygnus.com>
|
||||
* @date Fenruary 8, 1999.
|
||||
* @date February 8, 1999.
|
||||
*/
|
||||
|
||||
/* Written using "Java Class Libraries", 2nd edition, plus online
|
||||
@ -66,4 +66,82 @@ public abstract class Point2D implements Cloneable
|
||||
{
|
||||
return super.clone();
|
||||
}
|
||||
|
||||
public static class Double extends Point2D
|
||||
{
|
||||
public double x;
|
||||
public double y;
|
||||
|
||||
public Double ()
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
public Double (double x, double y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public double getX ()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
public double getY ()
|
||||
{
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setLocation (double x, double y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public String toString ()
|
||||
{
|
||||
return "(" + x + ", " + y + ")";
|
||||
}
|
||||
}
|
||||
|
||||
public static class Float extends Point2D
|
||||
{
|
||||
public float x;
|
||||
public float y;
|
||||
|
||||
public Float ()
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
public Float (float x, float y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public double getX ()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
public double getY ()
|
||||
{
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setLocation (double x, double y)
|
||||
{
|
||||
this.x = (float) x;
|
||||
this.y = (float) y;
|
||||
}
|
||||
|
||||
public String toString ()
|
||||
{
|
||||
return "(" + x + ", " + y + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
428
libjava/java/awt/geom/Rectangle2D.java
Normal file
428
libjava/java/awt/geom/Rectangle2D.java
Normal file
@ -0,0 +1,428 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation
|
||||
|
||||
This file is part of libjava.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt.geom;
|
||||
|
||||
/**
|
||||
* @author Tom Tromey <tromey@cygnus.com>
|
||||
* @date April 16, 2000
|
||||
*/
|
||||
|
||||
public abstract class Rectangle2D extends RectangularShape
|
||||
{
|
||||
public static final int OUT_LEFT = 1;
|
||||
public static final int OUT_TOP = 2;
|
||||
public static final int OUT_RIGHT = 4;
|
||||
public static final int OUT_BOTTOM = 8;
|
||||
|
||||
protected Rectangle2D ()
|
||||
{
|
||||
}
|
||||
|
||||
/** Set the bounding box of this rectangle.
|
||||
* @param x X coordinate
|
||||
* @param y Y coordinate
|
||||
* @param w Width
|
||||
* @param h Height
|
||||
*/
|
||||
public abstract void setRect (double x, double y, double w, double h);
|
||||
|
||||
/** Set the bounding box of this rectangle.
|
||||
* @param r Bounding rectangle.
|
||||
*/
|
||||
public void setRect (Rectangle2D r)
|
||||
{
|
||||
setRect (r.getX (), r.getY (), r.getWidth (), r.getHeight ());
|
||||
}
|
||||
|
||||
/** Returns true if line segment intersects interior of this
|
||||
* rectangle.
|
||||
* @param x1 X coordinate of first end of line segment
|
||||
* @param y1 Y coordinate of first end of line segment
|
||||
* @param x2 X coordinate of second end of line segment
|
||||
* @param y1 Y coordinate of segment end of line segment
|
||||
*/
|
||||
public boolean intersectsLine (double x1, double y1, double x2, double y2)
|
||||
{
|
||||
int o1 = outcode (x1, y1);
|
||||
int o2 = outcode (x2, y2);
|
||||
|
||||
double mx = getX ();
|
||||
double my = getY ();
|
||||
double mx2 = getWidth ();
|
||||
double my2 = getHeight ();
|
||||
x1 -= mx;
|
||||
x2 -= mx;
|
||||
y1 -= my;
|
||||
y2 -= my;
|
||||
|
||||
// Here we handle all lines that stay entirely on one side of the
|
||||
// rectangle. We also handle some lines that intersect the
|
||||
// rectangle. All vertical and horizontal lines are handled here.
|
||||
int xor = o1 ^ o2;
|
||||
int or = o1 | o2;
|
||||
if ((xor & (OUT_BOTTOM | OUT_TOP)) == 0)
|
||||
{
|
||||
if ((or & (OUT_BOTTOM | OUT_TOP)) != 0)
|
||||
return false;
|
||||
return ((o1 & (OUT_LEFT | OUT_RIGHT)) != 0
|
||||
|| (o2 & (OUT_LEFT | OUT_RIGHT)) != 0);
|
||||
}
|
||||
else if ((xor & (OUT_LEFT | OUT_RIGHT)) == 0)
|
||||
{
|
||||
if ((or & (OUT_LEFT | OUT_RIGHT)) != 0)
|
||||
return false;
|
||||
return ((o1 & (OUT_BOTTOM | OUT_TOP)) != 0
|
||||
|| (o2 & (OUT_BOTTOM | OUT_TOP)) != 0);
|
||||
}
|
||||
|
||||
double dx = x2 - x1;
|
||||
double dy = y2 - y1;
|
||||
|
||||
double t1l = - x1 / dx;
|
||||
double t1h = (mx2 - x1) / dx;
|
||||
|
||||
if (t1l >= t1h)
|
||||
return false;
|
||||
double t2l = - y1 / dy;
|
||||
double t2h = (my2 - y1) / dy;
|
||||
|
||||
if (t2l >= t2h || t2l >= t1h || t2h < t1l)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Return true if line segment intersects interior of this
|
||||
* rectangle.
|
||||
* @param l The line segment
|
||||
*/
|
||||
// public boolean intersectsLine (Line2D l)
|
||||
// {
|
||||
// }
|
||||
|
||||
public abstract int outcode (double x, double y);
|
||||
|
||||
public int outcode (Point2D p)
|
||||
{
|
||||
return outcode (p.getX (), p.getY ());
|
||||
}
|
||||
|
||||
/** Set bounding frame for this rectangle.
|
||||
* @param x X coordinate
|
||||
* @param y Y coordinate
|
||||
* @param w Width
|
||||
* @param h Height
|
||||
*/
|
||||
public void setFrame (double x, double y, double w, double h)
|
||||
{
|
||||
setRect (x, y, w, h);
|
||||
}
|
||||
|
||||
public Rectangle2D getBounds2D ()
|
||||
{
|
||||
// FIXME.
|
||||
return (Rectangle2D) clone ();
|
||||
}
|
||||
|
||||
public boolean contains (double x, double y)
|
||||
{
|
||||
double mx = getX ();
|
||||
double mw = getWidth ();
|
||||
if (x < mx || x >= mx + mw)
|
||||
return false;
|
||||
double my = getY ();
|
||||
double mh = getHeight ();
|
||||
return y >= my && y < my + mh;
|
||||
}
|
||||
|
||||
public boolean intersects (double x, double y, double w, double h)
|
||||
{
|
||||
double mx = getX ();
|
||||
double mw = getWidth ();
|
||||
if (x < mx || x >= mx + mw || x + w < mx || x + w >= mx + mw)
|
||||
return false;
|
||||
double my = getY ();
|
||||
double mh = getHeight ();
|
||||
return y >= my && y < my + mh && y + h >= my && y + h < my + mh;
|
||||
}
|
||||
|
||||
public boolean contains (double x, double y, double w, double h)
|
||||
{
|
||||
return contains (x, y) && contains (x + w, y + h);
|
||||
}
|
||||
|
||||
public abstract Rectangle2D createIntersection (Rectangle2D r);
|
||||
|
||||
public static void intersect (Rectangle2D src1, Rectangle2D src2,
|
||||
Rectangle2D dest)
|
||||
{
|
||||
double x1l = src1.getMinX ();
|
||||
double x2l = src2.getMinX ();
|
||||
double nxl = Math.max (x1l, x2l);
|
||||
double x1h = src1.getMaxX ();
|
||||
double x2h = src2.getMaxX ();
|
||||
double nxh = Math.min (x1h, x2h);
|
||||
if (nxh < nxl)
|
||||
nxh = nxl;
|
||||
double y1l = src1.getMinY ();
|
||||
double y2l = src2.getMinY ();
|
||||
double nyl = Math.max (y1l, y2l);
|
||||
double y1h = src1.getMaxY ();
|
||||
double y2h = src2.getMaxY ();
|
||||
double nyh = Math.min (y1h, y2h);
|
||||
if (nyh < nyl)
|
||||
nyh = nyl;
|
||||
dest.setFrameFromDiagonal (nxl, nyl, nxh, nyh);
|
||||
}
|
||||
|
||||
public abstract Rectangle2D createUnion (Rectangle2D r);
|
||||
|
||||
public static void union (Rectangle2D src1, Rectangle2D src2,
|
||||
Rectangle2D dest)
|
||||
{
|
||||
double x1l = src1.getMinX ();
|
||||
double x2l = src2.getMinX ();
|
||||
double nxl = Math.max (x1l, x2l);
|
||||
double x1h = src1.getMaxX ();
|
||||
double x2h = src2.getMaxX ();
|
||||
double nxh = Math.min (x1h, x2h);
|
||||
double y1l = src1.getMinY ();
|
||||
double y2l = src2.getMinY ();
|
||||
double nyl = Math.max (y1l, y2l);
|
||||
double y1h = src1.getMaxY ();
|
||||
double y2h = src2.getMaxY ();
|
||||
double nyh = Math.min (y1h, y2h);
|
||||
dest.setFrameFromDiagonal (nxl, nyl, nxh, nyh);
|
||||
}
|
||||
|
||||
public void add (double newx, double newy)
|
||||
{
|
||||
double minx = Math.min (getMinX (), newx);
|
||||
double maxx = Math.max (getMaxX (), newx);
|
||||
double miny = Math.min (getMinY (), newy);
|
||||
double maxy = Math.max (getMaxY (), newy);
|
||||
setFrameFromDiagonal (minx, miny, maxx, maxy);
|
||||
}
|
||||
|
||||
public void add (Point2D p)
|
||||
{
|
||||
add (p.getX (), p.getY ());
|
||||
}
|
||||
|
||||
public void add (Rectangle2D r)
|
||||
{
|
||||
add (r.getMinX (), r.getMinY ());
|
||||
add (r.getMaxX (), r.getMaxY ());
|
||||
}
|
||||
|
||||
public PathIterator getPathIterator (AffineTransform at)
|
||||
{
|
||||
// We know the superclass just ignores the flatness parameter.
|
||||
return getPathIterator (at, 0);
|
||||
}
|
||||
|
||||
public static class Double extends Rectangle2D
|
||||
{
|
||||
public double height;
|
||||
public double width;
|
||||
public double x;
|
||||
public double y;
|
||||
|
||||
public Double ()
|
||||
{
|
||||
height = width = x = y = 0;
|
||||
}
|
||||
|
||||
public Double (double x, double y, double w, double h)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = w;
|
||||
this.height = h;
|
||||
}
|
||||
|
||||
public double getX ()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
public double getY ()
|
||||
{
|
||||
return y;
|
||||
}
|
||||
|
||||
public double getWidth ()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
public double getHeight ()
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
public boolean isEmpty ()
|
||||
{
|
||||
return width <= 0 || height <= 0;
|
||||
}
|
||||
|
||||
public void setRect (double x, double y, double w, double h)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = w;
|
||||
this.height = h;
|
||||
}
|
||||
|
||||
public void setRect (Rectangle2D r)
|
||||
{
|
||||
this.x = r.getX ();
|
||||
this.y = r.getY ();
|
||||
this.width = r.getWidth ();
|
||||
this.height = r.getHeight ();
|
||||
}
|
||||
|
||||
public int outcode (double x, double y)
|
||||
{
|
||||
int code = 0;
|
||||
if (x < this.x)
|
||||
code |= OUT_LEFT;
|
||||
else if (x >= this.x + this.width)
|
||||
code |= OUT_RIGHT;
|
||||
if (y < this.y)
|
||||
code |= OUT_TOP;
|
||||
else if (y >= this.y + this.height)
|
||||
code |= OUT_BOTTOM;
|
||||
return code;
|
||||
}
|
||||
|
||||
public Rectangle2D getBounds2D ()
|
||||
{
|
||||
return new Rectangle2D.Double (x, y, width, height);
|
||||
}
|
||||
|
||||
public Rectangle2D createIntersection (Rectangle2D r)
|
||||
{
|
||||
Double res = new Double ();
|
||||
intersect (this, r, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public Rectangle2D createUnion (Rectangle2D r)
|
||||
{
|
||||
Double res = new Double ();
|
||||
union (this, r, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public String toString ()
|
||||
{
|
||||
return "fixme";
|
||||
}
|
||||
}
|
||||
|
||||
public static class Float extends Rectangle2D
|
||||
{
|
||||
public float height;
|
||||
public float width;
|
||||
public float x;
|
||||
public float y;
|
||||
|
||||
public Float ()
|
||||
{
|
||||
height = width = x = y = 0;
|
||||
}
|
||||
|
||||
public Float (float x, float y, float w, float h)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = w;
|
||||
this.height = h;
|
||||
}
|
||||
|
||||
public double getX ()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
public double getY ()
|
||||
{
|
||||
return y;
|
||||
}
|
||||
|
||||
public double getWidth ()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
public double getHeight ()
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
public boolean isEmpty ()
|
||||
{
|
||||
return width <= 0 || height <= 0;
|
||||
}
|
||||
|
||||
public void setRect (double x, double y, double w, double h)
|
||||
{
|
||||
this.x = (float) x;
|
||||
this.y = (float) y;
|
||||
this.width = (float) w;
|
||||
this.height = (float) h;
|
||||
}
|
||||
|
||||
public void setRect (Rectangle2D r)
|
||||
{
|
||||
this.x = (float) r.getX ();
|
||||
this.y = (float) r.getY ();
|
||||
this.width = (float) r.getWidth ();
|
||||
this.height = (float) r.getHeight ();
|
||||
}
|
||||
|
||||
public int outcode (double x, double y)
|
||||
{
|
||||
int code = 0;
|
||||
if (x < this.x)
|
||||
code |= OUT_LEFT;
|
||||
else if (x >= this.x + this.width)
|
||||
code |= OUT_RIGHT;
|
||||
if (y < this.y)
|
||||
code |= OUT_TOP;
|
||||
else if (y >= this.y + this.height)
|
||||
code |= OUT_BOTTOM;
|
||||
return code;
|
||||
}
|
||||
|
||||
public Rectangle2D getBounds2D ()
|
||||
{
|
||||
return new Rectangle2D.Float (x, y, width, height);
|
||||
}
|
||||
|
||||
public Rectangle2D createIntersection (Rectangle2D r)
|
||||
{
|
||||
Float res = new Float ();
|
||||
intersect (this, r, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public Rectangle2D createUnion (Rectangle2D r)
|
||||
{
|
||||
Float res = new Float ();
|
||||
union (this, r, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public String toString ()
|
||||
{
|
||||
return "fixme";
|
||||
}
|
||||
}
|
||||
}
|
293
libjava/java/awt/geom/RectangularShape.java
Normal file
293
libjava/java/awt/geom/RectangularShape.java
Normal file
@ -0,0 +1,293 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation
|
||||
|
||||
This file is part of libjava.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt.geom;
|
||||
import java.awt.*;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
/**
|
||||
* @author Tom Tromey <tromey@cygnus.com>
|
||||
* @date April 16, 2000
|
||||
*/
|
||||
|
||||
public abstract class RectangularShape implements Shape, Cloneable
|
||||
{
|
||||
protected RectangularShape ()
|
||||
{
|
||||
}
|
||||
|
||||
public abstract double getX ();
|
||||
public abstract double getY ();
|
||||
public abstract double getWidth ();
|
||||
public abstract double getHeight ();
|
||||
|
||||
public double getMinX ()
|
||||
{
|
||||
return Math.min (getX (), getX () + getWidth ());
|
||||
}
|
||||
|
||||
public double getMinY ()
|
||||
{
|
||||
return Math.min (getY (), getY () + getHeight ());
|
||||
}
|
||||
|
||||
public double getMaxX ()
|
||||
{
|
||||
return Math.max (getX (), getX () + getWidth ());
|
||||
}
|
||||
|
||||
public double getMaxY ()
|
||||
{
|
||||
return Math.max (getY (), getY () + getHeight ());
|
||||
}
|
||||
|
||||
public double getCenterX ()
|
||||
{
|
||||
return getX () + getWidth () / 2;
|
||||
}
|
||||
|
||||
public double getCenterY ()
|
||||
{
|
||||
return getY () + getHeight () / 2;
|
||||
}
|
||||
|
||||
public Rectangle2D getFrame ()
|
||||
{
|
||||
return new Rectangle2D.Double (getX (), getY (),
|
||||
getWidth (), getHeight ());
|
||||
}
|
||||
|
||||
public abstract boolean isEmpty ();
|
||||
public abstract void setFrame (double x, double y, double w, double h);
|
||||
|
||||
public void setFrame (Point2D loc, Dimension2D size)
|
||||
{
|
||||
setFrame (loc.getX (), loc.getY (), size.getWidth (), size.getHeight ());
|
||||
}
|
||||
|
||||
public void setFrame (Rectangle2D r)
|
||||
{
|
||||
setFrame (r.getX (), r.getY (), r.getWidth (), r.getHeight ());
|
||||
}
|
||||
|
||||
public void setFrameFromDiagonal (double x1, double y1,
|
||||
double x2, double y2)
|
||||
{
|
||||
if (x1 > x2)
|
||||
{
|
||||
double t = x2;
|
||||
x2 = x1;
|
||||
x1 = t;
|
||||
}
|
||||
if (y1 > y2)
|
||||
{
|
||||
double t = y2;
|
||||
y2 = y1;
|
||||
y1 = t;
|
||||
}
|
||||
setFrame (x1, y1, x2 - x1, y2 - y1);
|
||||
}
|
||||
|
||||
public void setFrameFromDiagonal (Point2D p1, Point2D p2)
|
||||
{
|
||||
setFrameFromDiagonal (p1.getX (), p1.getY (),
|
||||
p2.getX (), p2.getY ());
|
||||
}
|
||||
|
||||
public void setFrameFromCenter (double centerX, double centerY,
|
||||
double cornerX, double cornerY)
|
||||
{
|
||||
double halfw = Math.abs (cornerX - centerX);
|
||||
double halfh = Math.abs (cornerY - centerY);
|
||||
setFrame (centerX - halfw, centerY - halfh,
|
||||
2 * halfw, 2 * halfh);
|
||||
}
|
||||
|
||||
public void setFrameFromCenter (Point2D center, Point2D corner)
|
||||
{
|
||||
setFrameFromCenter (center.getX (), center.getY (),
|
||||
corner.getX (), corner.getY ());
|
||||
}
|
||||
|
||||
public boolean contains (Point2D p)
|
||||
{
|
||||
double x = p.getX ();
|
||||
double y = p.getY ();
|
||||
double rx = getX ();
|
||||
double ry = getY ();
|
||||
double w = getWidth ();
|
||||
double h = getHeight ();
|
||||
return x >= rx && x < rx + w && y >= ry && y < ry + h;
|
||||
}
|
||||
|
||||
public boolean intersects (Rectangle2D r)
|
||||
{
|
||||
double x = getX ();
|
||||
double w = getWidth ();
|
||||
double mx = r.getX ();
|
||||
double mw = r.getWidth ();
|
||||
if (x < mx || x >= mx + mw || x + w < mx || x + w >= mx + mw)
|
||||
return false;
|
||||
double y = getY ();
|
||||
double h = getHeight ();
|
||||
double my = r.getY ();
|
||||
double mh = r.getHeight ();
|
||||
return y >= my && y < my + mh && y + h >= my && y + h < my + mh;
|
||||
}
|
||||
|
||||
private boolean containsPoint (double x, double y)
|
||||
{
|
||||
double mx = getX ();
|
||||
double mw = getWidth ();
|
||||
if (x < mx || x >= mx + mw)
|
||||
return false;
|
||||
double my = getY ();
|
||||
double mh = getHeight ();
|
||||
return y >= my && y < my + mh;
|
||||
}
|
||||
|
||||
public boolean contains (Rectangle2D r)
|
||||
{
|
||||
return (containsPoint (r.getMinX (), r.getMinY ())
|
||||
&& containsPoint (r.getMaxX (), r.getMaxY ()));
|
||||
}
|
||||
|
||||
public Rectangle getBounds ()
|
||||
{
|
||||
return new Rectangle ((int) getX (), (int) getY (),
|
||||
(int) getWidth (), (int) getHeight ());
|
||||
}
|
||||
|
||||
public PathIterator getPathIterator (AffineTransform at, double flatness)
|
||||
{
|
||||
// FIXME
|
||||
// return new AffineTransform.Iterator (new Iterator ());
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object clone ()
|
||||
{
|
||||
return super.clone ();
|
||||
}
|
||||
|
||||
// This implements the PathIterator for all RectangularShape objects
|
||||
// that don't override getPathIterator.
|
||||
private class Iterator implements PathIterator
|
||||
{
|
||||
// Our current coordinate.
|
||||
private int coord;
|
||||
|
||||
private static final int START = 0;
|
||||
private static final int END_PLUS_ONE = 5;
|
||||
|
||||
public Iterator ()
|
||||
{
|
||||
coord = START;
|
||||
}
|
||||
|
||||
public int currentSegment (double[] coords)
|
||||
{
|
||||
int r;
|
||||
switch (coord)
|
||||
{
|
||||
case 0:
|
||||
coords[0] = getX ();
|
||||
coords[1] = getY ();
|
||||
r = SEG_MOVETO;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
coords[0] = getX () + getWidth ();
|
||||
coords[1] = getY ();
|
||||
r = SEG_LINETO;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
coords[0] = getX () + getWidth ();
|
||||
coords[1] = getY () + getHeight ();
|
||||
r = SEG_LINETO;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
coords[0] = getX ();
|
||||
coords[1] = getY () + getHeight ();
|
||||
r = SEG_LINETO;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
r = SEG_CLOSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
// It isn't clear what to do if the caller calls us after
|
||||
// isDone returns true.
|
||||
r = SEG_CLOSE;
|
||||
break;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
public int currentSegment (float[] coords)
|
||||
{
|
||||
int r;
|
||||
switch (coord)
|
||||
{
|
||||
case 0:
|
||||
coords[0] = (float) getX ();
|
||||
coords[1] = (float) getY ();
|
||||
r = SEG_MOVETO;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
coords[0] = (float) (getX () + getWidth ());
|
||||
coords[1] = (float) getY ();
|
||||
r = SEG_LINETO;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
coords[0] = (float) (getX () + getWidth ());
|
||||
coords[1] = (float) (getY () + getHeight ());
|
||||
r = SEG_LINETO;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
coords[0] = (float) getX ();
|
||||
coords[1] = (float) (getY () + getHeight ());
|
||||
r = SEG_LINETO;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
default:
|
||||
// It isn't clear what to do if the caller calls us after
|
||||
// isDone returns true. We elect to keep returning
|
||||
// SEG_CLOSE.
|
||||
r = SEG_CLOSE;
|
||||
break;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
public int getWindingRule ()
|
||||
{
|
||||
return WIND_NON_ZERO;
|
||||
}
|
||||
|
||||
public boolean isDone ()
|
||||
{
|
||||
return coord == END_PLUS_ONE;
|
||||
}
|
||||
|
||||
public void next ()
|
||||
{
|
||||
if (coord < END_PLUS_ONE)
|
||||
++coord;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user