diff options
author | warrenl <warrenl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-03-17 00:45:06 +0000 |
---|---|---|
committer | warrenl <warrenl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-03-17 00:45:06 +0000 |
commit | 6159a0513584db9578418a64b456efbae6750db7 (patch) | |
tree | e13c2ee8b0bb648f9f9ab698a7a4d17c7b938323 /libjava/java/awt/Color.java | |
parent | 64a83102c5936e841f52a8c42a6d9a90034eacd5 (diff) | |
download | ppe42-gcc-6159a0513584db9578418a64b456efbae6750db7.tar.gz ppe42-gcc-6159a0513584db9578418a64b456efbae6750db7.zip |
* java/awt/Color.java: New file.
* java/awt/Graphics.java: New file.
* java/awt/Image.java: New file.
* java/awt/Paint.java: New file.
* java/awt/PaintContext.java: New file.
* java/awt/Transparency.java: New file.
* java/util/Collection.java: New file.
* java/util/Comparator.java: New file.
* java/util/Iterator.java: New file.
* java/util/List.java: New file.
* java/util/ListIterator.java: New file.
* Makefile.am: Added above new files.
* Makefile.in: Rebuilt.
* java/awt/Font.java (PLAIN): New field.
(BOLD): New field.
(ITALIC): New field.
(ROMAN_BASELINE): New field.
(CENTER_BASELINE): New field.
(HANGING_BASELINE): New field.
(name): New field.
(style): New field.
(size): New field.
(pointSize): New field.
(Font): Implemented constructor.
(isPlain): Implemented method.
(isBold): Implemented method.
(isItalic): Implemented method.
(getName): Implemented method.
(getStyle): Implemented method.
(getSize): Implemented method.
(getSize2D): Implemented method.
(decode): Stubbed.
* java/awt/Frame.java (getFont): Stubbed.
(postEvent): Stubbed.
(remove): Stubbed.
* java/awt/Menu.java (postEvent): Stubbed.
* java/awt/MenuBar.java (getFont): Stubbed.
(postEvent): Stubbed.
* java/awt/Toolkit.java (getImage): Added abstract method.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32598 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/awt/Color.java')
-rw-r--r-- | libjava/java/awt/Color.java | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/libjava/java/awt/Color.java b/libjava/java/awt/Color.java new file mode 100644 index 00000000000..0f0742c9868 --- /dev/null +++ b/libjava/java/awt/Color.java @@ -0,0 +1,64 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt; + +/** + * @author Warren Levy <warrenl@cygnus.com> + * @date March 15, 2000. + */ + +/** + * Written using on-line Java Platform 1.2 API Specification, as well + * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998). + * Status: Stubbed; A very incomplete implementation. + */ + +public class Color extends Object implements Paint, Serializable +{ + public static final Color white = new Color(0xff, 0xff, 0xff); + public static final Color lightGray = new Color(0xc0, 0xc0, 0xc0); + public static final Color gray = new Color(0x80, 0x80, 0x80); + public static final Color darkGray = new Color(0x40, 0x40, 0x40); + public static final Color black = new Color(0x00, 0x00, 0x00); + public static final Color red = new Color(0xff, 0x00, 0x00); + public static final Color pink = new Color(0xff, 0xaf, 0xaf); + public static final Color orange = new Color(0xff, 0xc8, 0x00); + public static final Color yellow = new Color(0xff, 0xff, 0x00); + public static final Color green = new Color(0x00, 0xff, 0x00); + public static final Color magenta = new Color(0xff, 0x00, 0xff); + public static final Color cyan = new Color(0x00, 0xff, 0xff); + public static final Color blue = new Color(0x00, 0x00, 0xff); + + // The internal sRGB representation. + private float r; + private float g; + private float b; + private int alpha = 255; + + public Color(int rgb) + { + this(rgb, false); + } + + public Color(int rgba, boolean hasalpha) + { + // Alpha is bits 24-31, if hasalpha is true. + // Red is bits 16-23; Green is bits 8-15; Blue is bits 0-7. + b = rgb & 0xFF; + g = (rgb >>= 8) & 0xFF; + r = (rgb >>= 8) & 0xFF; + if (hasalpha) + alpha = (rgb >>= 8) & 0xFF; + } + + public int getRGB() + { + return alpha << 24 | r << 16 | g << 8 | b; + } +} |