1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.scenegraph.g2d;
14 import java.awt.Component;
15 import java.awt.geom.Rectangle2D;
19 * @author Tuukka Lehtonen
20 * See {@link G2DPDFRenderingHints}
22 public final class G2DRenderingHints {
24 public static final Key KEY_BEGIN_ELEMENT = new G2DRenderingHints.Key(0);
25 public static final Key KEY_END_ELEMENT = new G2DRenderingHints.Key(1);
26 public static final Key KEY_ELEMENT_ID = new G2DRenderingHints.Key(2);
28 public static class Key extends java.awt.RenderingHints.Key {
30 public Key(int privateKey) {
35 public boolean isCompatibleValue(Object val) {
38 return val == null || val instanceof String
39 || val instanceof Map;
41 return val == null || val instanceof Object;
43 return val == null || val instanceof Object;
45 throw new RuntimeException("Not possible!");
51 * A rendering hint for storing the boundaries of the control area within a
52 * Graphics2D instance.
54 public static final Key KEY_CONTROL_BOUNDS = new Key(1000) {
56 public boolean isCompatibleValue(Object val) {
57 return val instanceof Rectangle2D;
62 * A rendering hint for storing the root AWT Component on which the scene
63 * graph is rendered within a Graphics2D instance.
65 public static final Key KEY_COMPONENT = new Key(1001) {
67 public boolean isCompatibleValue(Object val) {
68 return val instanceof Component;
73 * If this hint is not specified, the default interpretation should be
78 public static enum TextRenderingMode {
84 * A rendering hint for telling text rendering Simantics G2D scene graph node
85 * implementations how to render the text: as text or paths.
89 public static final Key KEY_TEXT_RENDERING_MODE = new Key(2004) {
91 public boolean isCompatibleValue(Object val) {
92 return val instanceof TextRenderingMode;
97 * Instead of rendering SVGNode using SVG Salamander pass it to G2D as SVGPassthruShape in String format.
101 public static final Key KEY_SVG_PASSTHRU = new Key(2005) {
103 public boolean isCompatibleValue(Object val) {
104 return val instanceof Boolean;