summaryrefslogtreecommitdiff
path: root/libjava/gnu/gcj/xlib/Colormap.java
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libjava/gnu/gcj/xlib/Colormap.java
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libjava/gnu/gcj/xlib/Colormap.java')
-rw-r--r--libjava/gnu/gcj/xlib/Colormap.java84
1 files changed, 84 insertions, 0 deletions
diff --git a/libjava/gnu/gcj/xlib/Colormap.java b/libjava/gnu/gcj/xlib/Colormap.java
new file mode 100644
index 000000000..538782e7e
--- /dev/null
+++ b/libjava/gnu/gcj/xlib/Colormap.java
@@ -0,0 +1,84 @@
+/* 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 gnu.gcj.xlib;
+
+import gnu.gcj.RawData;
+
+/**
+ * An X11 color map resource.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public final class Colormap extends XID
+{
+ Screen screen;
+
+ public static final byte FLAG_SHARED = 1;
+ public static final byte FLAG_NOT_SHARED = 2;
+
+ public Colormap(Screen screen, int xid)
+ {
+ super(screen.getDisplay(), xid);
+ this.screen = screen;
+ }
+
+ /**
+ * Allocate color pixel.
+ *
+ * @param color The color to be allocated. If allocation is
+ * successful, this object will be modified to reflect the actual
+ * color that was allocated.
+ *
+ * @return the pixel value of the allocated color.
+ */
+ public native long allocateColorPixel(XColor color);
+
+ /**
+ * Allocate a color consisting of the given RGB-triplet.
+ *
+ * @return a color object describing the allocated color.
+ */
+ public XColor allocateColor(int r, int g, int b)
+ {
+ XColor color = new XColor(r, g, b);
+ allocateColorPixel(color);
+
+ return color;
+ }
+
+ /**
+ * Get an array of all colors that currently resides in shared (read
+ * only) color-cells in this color map.
+ */
+ public native XColor[] getSharedColors();
+
+
+ /**
+ * Get all colors currently residing in this color map. Colors that
+ * are shared (read only) are marked as such by the color flags.
+ * The indexes of the returned array will correspond to the
+ * colorcells of the color map. Given a color <code>XColor
+ * color</code> from a given color-cell, the expression
+ * <code>color.getFlags() == Colormap.FLAG_SHARED</code> will check
+ * whether the color-cell is shared.
+ */
+ public native XColor[] getXColors();
+
+ /**
+ * Convenience method used by native code to create fully
+ * initialized arrays of XColor objects.
+ */
+ private XColor[] newXColorArray(int n)
+ {
+ XColor[] array = new XColor[n];
+ for (int i=0; i<n; i++)
+ array[i] = new XColor();
+ return array;
+ }
+}