-package org.simantics.trend.impl;\r
-\r
-import java.awt.Color;\r
-\r
-import org.simantics.trend.configuration.ViewProfile;\r
-\r
-/**\r
- * Internal caching class for chart rendering related data that only needs to be\r
- * recreated when the rendered TrendSpec changes, not on every rendered frame.\r
- * \r
- * @author Tuukka Lehtonen\r
- */\r
-class ViewRenderingProfile {\r
-\r
- public Color backgroundColor1 = Plot.PLOT_AREA_BG_GRADIENT_COLOR_BOTTOM;\r
- public Color backgroundColor2 = Plot.PLOT_AREA_BG_GRADIENT_COLOR_TOP;;\r
- public Color gridColor = Plot.GRID_LINE_COLOR;\r
-\r
- public ViewRenderingProfile read(ViewProfile p) {\r
- if (p.backgroundColor != null) {\r
- float[] bg = p.backgroundColor;\r
- int len = bg.length;\r
- if (len >= 6) {\r
- backgroundColor1 = toColor(bg, 0);\r
- backgroundColor2 = toColor(bg, 3);\r
- } else if (len >= 3) {\r
- backgroundColor1 = toColor(bg, 0);\r
- backgroundColor2 = null;\r
- }\r
- } else {\r
- backgroundColor1 = Plot.PLOT_AREA_BG_GRADIENT_COLOR_BOTTOM;\r
- backgroundColor2 = Plot.PLOT_AREA_BG_GRADIENT_COLOR_TOP;\r
- }\r
-\r
- if (p.gridColor != null && p.gridColor.length >= 3) {\r
- gridColor = toColor(p.gridColor, 0);\r
- } else {\r
- gridColor = Plot.GRID_LINE_COLOR;\r
- }\r
-\r
- return this;\r
- }\r
-\r
- private static Color toColor(float[] array, int offset) {\r
- return new Color(clamp(array[offset]), clamp(array[offset+1]), clamp(array[offset+2]));\r
- }\r
-\r
- private static float clamp(float v) {\r
- return Math.max(0, Math.min(v, 1));\r
- }\r
-\r
-}\r
+package org.simantics.trend.impl;
+
+import java.awt.Color;
+
+import org.simantics.trend.configuration.ViewProfile;
+
+/**
+ * Internal caching class for chart rendering related data that only needs to be
+ * recreated when the rendered TrendSpec changes, not on every rendered frame.
+ *
+ * @author Tuukka Lehtonen
+ */
+class ViewRenderingProfile {
+
+ public Color backgroundColor1 = Plot.PLOT_AREA_BG_GRADIENT_COLOR_BOTTOM;
+ public Color backgroundColor2 = Plot.PLOT_AREA_BG_GRADIENT_COLOR_TOP;;
+ public Color gridColor = Plot.GRID_LINE_COLOR;
+
+ public ViewRenderingProfile read(ViewProfile p) {
+ if (p.backgroundColor != null) {
+ float[] bg = p.backgroundColor;
+ int len = bg.length;
+ if (len >= 6) {
+ backgroundColor1 = toColor(bg, 0);
+ backgroundColor2 = toColor(bg, 3);
+ } else if (len >= 3) {
+ backgroundColor1 = toColor(bg, 0);
+ backgroundColor2 = null;
+ }
+ } else {
+ backgroundColor1 = Plot.PLOT_AREA_BG_GRADIENT_COLOR_BOTTOM;
+ backgroundColor2 = Plot.PLOT_AREA_BG_GRADIENT_COLOR_TOP;
+ }
+
+ if (p.gridColor != null && p.gridColor.length >= 3) {
+ gridColor = toColor(p.gridColor, 0);
+ } else {
+ gridColor = Plot.GRID_LINE_COLOR;
+ }
+
+ return this;
+ }
+
+ private static Color toColor(float[] array, int offset) {
+ return new Color(clamp(array[offset]), clamp(array[offset+1]), clamp(array[offset+2]));
+ }
+
+ private static float clamp(float v) {
+ return Math.max(0, Math.min(v, 1));
+ }
+
+}