From 6159a0513584db9578418a64b456efbae6750db7 Mon Sep 17 00:00:00 2001 From: warrenl Date: Fri, 17 Mar 2000 00:45:06 +0000 Subject: * 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 --- libjava/java/awt/Color.java | 64 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 libjava/java/awt/Color.java (limited to 'libjava/java/awt/Color.java') 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 + * @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; + } +} -- cgit v1.2.3