001: /*
002:
003: Licensed to the Apache Software Foundation (ASF) under one or more
004: contributor license agreements. See the NOTICE file distributed with
005: this work for additional information regarding copyright ownership.
006: The ASF licenses this file to You under the Apache License, Version 2.0
007: (the "License"); you may not use this file except in compliance with
008: the License. You may obtain a copy of the License at
009:
010: http://www.apache.org/licenses/LICENSE-2.0
011:
012: Unless required by applicable law or agreed to in writing, software
013: distributed under the License is distributed on an "AS IS" BASIS,
014: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: See the License for the specific language governing permissions and
016: limitations under the License.
017:
018: */
019: package org.apache.batik.dom.anim;
020:
021: import org.apache.batik.anim.values.AnimatableValue;
022:
023: import org.w3c.dom.Element;
024: import org.w3c.dom.svg.SVGLength;
025:
026: /**
027: * An interface for targets of animation to provide context information.
028: *
029: * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
030: * @version $Id: AnimationTarget.java 501495 2007-01-30 18:00:36Z dvholten $
031: */
032: public interface AnimationTarget {
033:
034: // Constants for percentage interpretation.
035: short PERCENTAGE_FONT_SIZE = 0;
036: short PERCENTAGE_VIEWPORT_WIDTH = 1;
037: short PERCENTAGE_VIEWPORT_HEIGHT = 2;
038: short PERCENTAGE_VIEWPORT_SIZE = 3;
039:
040: /**
041: * Returns the element.
042: */
043: Element getElement();
044:
045: /**
046: * Updates a property value in this target.
047: */
048: void updatePropertyValue(String pn, AnimatableValue val);
049:
050: /**
051: * Updates an attribute value in this target.
052: */
053: void updateAttributeValue(String ns, String ln, AnimatableValue val);
054:
055: /**
056: * Updates a 'other' animation value in this target.
057: */
058: void updateOtherValue(String type, AnimatableValue val);
059:
060: /**
061: * Returns the underlying value of an animatable XML attribute.
062: */
063: AnimatableValue getUnderlyingValue(String ns, String ln);
064:
065: /**
066: * Gets how percentage values are interpreted by the given attribute
067: * or property.
068: */
069: short getPercentageInterpretation(String ns, String an,
070: boolean isCSS);
071:
072: /**
073: * Returns whether color interpolations should be done in linear RGB
074: * color space rather than sRGB.
075: */
076: boolean useLinearRGBColorInterpolation();
077:
078: /**
079: * Converts the given SVG length into user units.
080: * @param v the SVG length value
081: * @param type the SVG length units (one of the
082: * {@link SVGLength}.SVG_LENGTH_* constants)
083: * @param pcInterp how to interpretet percentage values (one of the
084: * {@link AnimationTarget}.PERCENTAGE_* constants)
085: * @return the SVG value in user units
086: */
087: float svgToUserSpace(float v, short type, short pcInterp);
088:
089: // Listeners
090:
091: /**
092: * Adds a listener for changes to the given attribute value.
093: */
094: void addTargetListener(String ns, String an, boolean isCSS,
095: AnimationTargetListener l);
096:
097: /**
098: * Removes a listener for changes to the given attribute value.
099: */
100: void removeTargetListener(String ns, String an, boolean isCSS,
101: AnimationTargetListener l);
102: }
|