gcc/libjava/java/awt/Color.java
Warren Levy d05165c393 Color.java: New file.
* 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.

From-SVN: r32598
2000-03-17 00:45:06 +00:00

64 lines
2 KiB
Java

/* 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;
}
}