diff options
| author | rolfwr <rolfwr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-07-25 17:53:30 +0000 |
|---|---|---|
| committer | rolfwr <rolfwr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-07-25 17:53:30 +0000 |
| commit | 20509bc3d8e00d8ef599963a491a1d8f6ab83a3e (patch) | |
| tree | 63ee8beca6a86986c9b97b7ab1cf2dced5a16fb5 /libjava/java/awt/color | |
| parent | d3d1c81e3bc8378a9aab751cc99bea735a24400c (diff) | |
| download | ppe42-gcc-20509bc3d8e00d8ef599963a491a1d8f6ab83a3e.tar.gz ppe42-gcc-20509bc3d8e00d8ef599963a491a1d8f6ab83a3e.zip | |
2000-07-23 Rolf W. Rasmussen <rolfwr@ii.uib.no>
* libjava/java/awt/image/ColorModel.java: New file, replaces the
stub libjava/java/awt/ColorModel.java which was located in the
wrong package.
* libjava/java/awt/image/ComponentColorModel.java: New file.
* libjava/java/awt/image/ComponentSampleModel.java: New file.
* libjava/java/awt/image/DataBuffer.java: New file.
* libjava/java/awt/image/DataBufferByte.java: New file.
* libjava/java/awt/image/DataBufferInt.java: New file.
* libjava/java/awt/image/DataBufferUShort.java: New file.
* libjava/java/awt/image/DirectColorModel.java: New file.
* libjava/java/awt/image/PackedColorModel.java: New file.
* libjava/java/awt/image/Raster.java: New file.
* libjava/java/awt/image/SampleModel.java: New file.
* libjava/java/awt/image/SinglePixelPackedSampleModel.java: New
file.
* libjava/java/awt/image/IndexColorModel.java: New file.
* libjava/java/awt/image/ImageConsumer.java: Removed import of
java.awt.ColorModel stub.
* gnu/gcj/util/BitMaskExtent.java: New file, utility class.
* gnu/gcj/util/Buffers.java: New file, utility class.
* libjava/Makefile.am: Updated to include new files.
* libjava/Makefile.in: Rebuilt.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35245 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/awt/color')
| -rw-r--r-- | libjava/java/awt/color/ColorSpace.java | 111 | ||||
| -rw-r--r-- | libjava/java/awt/color/ICC_ColorSpace.java | 53 | ||||
| -rw-r--r-- | libjava/java/awt/color/ICC_Profile.java | 40 |
3 files changed, 204 insertions, 0 deletions
diff --git a/libjava/java/awt/color/ColorSpace.java b/libjava/java/awt/color/ColorSpace.java new file mode 100644 index 00000000000..e6e1251f780 --- /dev/null +++ b/libjava/java/awt/color/ColorSpace.java @@ -0,0 +1,111 @@ +/* Copyright © 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.color; + +/** + * @author Rolf W. Rasmussen <rolfwr@ii.uib.no> + */ +public abstract class ColorSpace +{ + public static final int TYPE_XYZ = 0; + public static final int TYPE_Lab = 1; + public static final int TYPE_Luv = 2; + public static final int TYPE_YCbCr = 3; + public static final int TYPE_Yxy = 4; + public static final int TYPE_RGB = 5; + public static final int TYPE_GRAY = 6; + public static final int TYPE_HSV = 7; + public static final int TYPE_HLS = 8; + public static final int TYPE_CMYK = 9; + // mysterious gap in the enumeration sequenece + public static final int TYPE_CMY = 11; + public static final int TYPE_2CLR = 12; + public static final int TYPE_3CLR = 13; + public static final int TYPE_4CLR = 14; + public static final int TYPE_5CLR = 15; + public static final int TYPE_6CLR = 16; + public static final int TYPE_7CLR = 17; + public static final int TYPE_8CLR = 18; + public static final int TYPE_9CLR = 19; + public static final int TYPE_ACLR = 20; + public static final int TYPE_BCLR = 21; + public static final int TYPE_CCLR = 22; + public static final int TYPE_DCLR = 23; + public static final int TYPE_ECLR = 24; + public static final int TYPE_FCLR = 25; + + public static final int CS_sRGB = 1000; + public static final int CS_CIEXYZ = 1001; + public static final int CS_PYCC = 1002; + public static final int CS_GRAY = 1003; + public static final int CS_LINEAR_RGB = 1004; + + private static final int CS_BASE = CS_sRGB; + private static final int CS_END = CS_LINEAR_RGB+1; + private static final int CS_COUNT = CS_END - CS_BASE; + + // Instances are lazily instantiated + private static final ColorSpace[] INSTANCES = new ColorSpace[CS_COUNT]; + + private int type; + private int numcomponents; + protected ColorSpace(int type, int numcomponents) + { + this.type = type; + this.numcomponents = numcomponents; + } + + public static ColorSpace getInstance(int colorspace) + { + if ((colorspace >= CS_BASE) && (colorspace < CS_END)) + { + int instanceIndex = colorspace - CS_BASE; + if (INSTANCES[instanceIndex] == null) + { + ICC_Profile profile = new ICC_Profile(colorspace); + INSTANCES[instanceIndex] = new ICC_ColorSpace(profile); + } + return INSTANCES[instanceIndex]; + } + throw new IllegalArgumentException("unknown/unsupported colorspace"); + } + + public boolean isCS_sRGB() + { + return false; + } + + public abstract float[] toRGB(float[] colorvalue); + + public abstract float[] fromRGB(float[] rgbvalue); + + public abstract float[] toCIEXYZ(float[] colorvalue); + + public abstract float[] fromCIEXYZ(float[] colorvalue); + + public int getType() + { + return type; + } + + public int getNumComponents() + { + return numcomponents; + } + + public String getName(int idx) + { + return "type " + type; + } + + public String toString() + { + return getClass().getName() + "[type=" + type + "]"; + } +} diff --git a/libjava/java/awt/color/ICC_ColorSpace.java b/libjava/java/awt/color/ICC_ColorSpace.java new file mode 100644 index 00000000000..90ff88c8bdc --- /dev/null +++ b/libjava/java/awt/color/ICC_ColorSpace.java @@ -0,0 +1,53 @@ +/* Copyright © 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.color; + +/** + * @author Rolf W. Rasmussen <rolfwr@ii.uib.no> + */ +public class ICC_ColorSpace extends ColorSpace +{ + private ICC_Profile profile; + + public ICC_ColorSpace(ICC_Profile profile) + { + super(CS_sRGB, profile.getNumComponents()); + + this.profile = profile; + } + + public ICC_Profile getProfile() + { + return profile; + } + + public float[] toRGB(float[] colorvalue) + { + // FIXME: Always assumes sRGB: + return colorvalue; + } + + public float[] fromRGB(float[] rgbvalue) + { + // FIXME: Always assumes sRGB: + return rgbvalue; + } + + public float[] toCIEXYZ(float[] colorvalue) + { + // FIXME: Not implemented + throw new UnsupportedOperationException(); + } + + public float[] fromCIEXYZ(float[] colorvalue) + { + // FIXME: Not implemented + throw new UnsupportedOperationException(); + } +} diff --git a/libjava/java/awt/color/ICC_Profile.java b/libjava/java/awt/color/ICC_Profile.java new file mode 100644 index 00000000000..475aa559ba4 --- /dev/null +++ b/libjava/java/awt/color/ICC_Profile.java @@ -0,0 +1,40 @@ +/* Copyright © 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.color; + +// Currently just a stub. + +/** + * @author Rolf W. Rasmussen <rolfwr@ii.uib.no> + */ +public class ICC_Profile +{ + long profileID; // why long? + + ICC_Profile(long profileID) + { + this.profileID = profileID; + } + + public int getNumComponents() + { + switch (profileID) + { + case ColorSpace.CS_sRGB: + case ColorSpace.CS_LINEAR_RGB: + case ColorSpace.CS_CIEXYZ: + return 3; + case ColorSpace.CS_GRAY: + return 1; + case ColorSpace.CS_PYCC: // have no clue about this one + default: + throw new UnsupportedOperationException("profile not implemented"); + } + } +} |

