/hg/gfx-test: Added new class HSBPalette.java used by various te...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Fri Aug 17 03:57:11 PDT 2012
changeset 148ec0ec4ea3 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=148ec0ec4ea3
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Fri Aug 17 12:59:47 2012 +0200
Added new class HSBPalette.java used by various test suites.
diffstat:
ChangeLog | 6 ++
Makefile | 3 +
src/org/gfxtest/framework/HSBPalette.java | 87 +++++++++++++++++++++++++++++++
3 files changed, 96 insertions(+), 0 deletions(-)
diffs (117 lines):
diff -r eaaaa2701846 -r 148ec0ec4ea3 ChangeLog
--- a/ChangeLog Thu Aug 16 12:46:30 2012 +0200
+++ b/ChangeLog Fri Aug 17 12:59:47 2012 +0200
@@ -1,3 +1,9 @@
+2012-08-17 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/framework/HSBPalette.java:
+ Added new class used by various test suites.
+ * Makefile: Updated - added new classes to compile.
+
2012-08-16 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/testsuites/PrintTestCubicCurvesAsPaths.java:
diff -r eaaaa2701846 -r 148ec0ec4ea3 Makefile
--- a/Makefile Thu Aug 16 12:46:30 2012 +0200
+++ b/Makefile Fri Aug 17 12:59:47 2012 +0200
@@ -77,6 +77,9 @@
$(CLASSES)/$(FRAMEWORK_DIR)/annotations/Transformations.class \
$(CLASSES)/$(FRAMEWORK_DIR)/annotations/Transformation.class \
$(CLASSES)/$(FRAMEWORK_DIR)/annotations/Zoom.class \
+ $(CLASSES)/$(FRAMEWORK_DIR)/ColorPalette.class \
+ $(CLASSES)/$(FRAMEWORK_DIR)/GrayscalePalette.class \
+ $(CLASSES)/$(FRAMEWORK_DIR)/HSBPalette.class \
$(CLASSES)/$(FRAMEWORK_DIR)/CommonAreaOperations.class \
$(CLASSES)/$(FRAMEWORK_DIR)/CommonCAGOperations.class \
$(CLASSES)/$(FRAMEWORK_DIR)/CommonRenderingStyles.class \
diff -r eaaaa2701846 -r 148ec0ec4ea3 src/org/gfxtest/framework/HSBPalette.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/gfxtest/framework/HSBPalette.java Fri Aug 17 12:59:47 2012 +0200
@@ -0,0 +1,87 @@
+/*
+ Java gfx-test framework
+
+ Copyright (C) 2010, 2011, 2012 Red Hat
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package org.gfxtest.framework;
+
+import java.awt.Color;
+
+/**
+ * HSB palette used by various tests.
+ *
+ * @author Pavel Tisnovsky
+ */
+public class HSBPalette
+{
+ /**
+ * Return HSB color.
+ *
+ * @param hue
+ * value of hue color component
+ * @return new color
+ */
+ public static Color createHsbColor(float hue)
+ {
+ float clampedHue = clampHueValue(hue);
+ return new Color(Color.HSBtoRGB(clampedHue, 1.0f, 0.7f));
+ }
+
+ /**
+ * Clamp hue value to a given range 0.0f - 1.0f
+ *
+ * @param hue
+ * input hue value
+ * @return output hue value
+ */
+ private static float clampHueValue(float hue)
+ {
+ // negative values are clamped to zero
+ if (hue < 0.0f)
+ {
+ return 0.0f;
+ }
+ // bigger positive values are clamped to one
+ if (hue > 1.0f)
+ {
+ return 1.0f;
+ }
+ return hue;
+ }
+
+}
More information about the distro-pkg-dev
mailing list