Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Barnes2008-01-18 19:38:09 +0000
committerKevin Barnes2008-01-18 19:38:09 +0000
commit67bb2b105506b2e5d8c1c72f8ebd139f8644ce26 (patch)
tree190a9c2bcd86c8ffb46e4d1fabce7fa42ef8628c
parent834c9467f51c7351eb60e711e0f3f8c2f98a937d (diff)
downloadeclipse.platform.swt-67bb2b105506b2e5d8c1c72f8ebd139f8644ce26.tar.gz
eclipse.platform.swt-67bb2b105506b2e5d8c1c72f8ebd139f8644ce26.tar.xz
eclipse.platform.swt-67bb2b105506b2e5d8c1c72f8ebd139f8644ce26.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/DiscretePropertyAnimation.java110
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/LinearPropertyAnimation.java66
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/PropertyAnimation.java91
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/SplinePropertyAnimation.java116
4 files changed, 289 insertions, 94 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/DiscretePropertyAnimation.java b/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/DiscretePropertyAnimation.java
index e36cbb1f78..e50299e33a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/DiscretePropertyAnimation.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/DiscretePropertyAnimation.java
@@ -5,6 +5,7 @@ import org.eclipse.swt.internal.wpf.*;
public class DiscretePropertyAnimation extends PropertyAnimation {
int beginFrame, endFrame;
+ int bX, bY, bW, bH, eX, eY, eW, eH;
void createDoubleAnimation() {
int animation = OS.gcnew_DoubleAnimationUsingKeyFrames();
@@ -18,6 +19,7 @@ public class DiscretePropertyAnimation extends PropertyAnimation {
OS.IList_Add(children, animation);
OS.GCHandle_Free(children);
OS.GCHandle_Free(animation);
+ setTargetProperty(animation, property);
}
void createIntegerAnimation() {
@@ -32,6 +34,56 @@ public class DiscretePropertyAnimation extends PropertyAnimation {
OS.IList_Add(children, animation);
OS.GCHandle_Free(children);
OS.GCHandle_Free(animation);
+ setTargetProperty(animation, property);
+ }
+
+ void createRectangleAnimation() {
+ int children = OS.TimelineGroup_Children(handle);
+ int animation = OS.gcnew_DoubleAnimationUsingKeyFrames();
+ bX = OS.gcnew_DiscreteDoubleKeyFrame();
+ eX = OS.gcnew_DiscreteDoubleKeyFrame();
+ int frames = OS.DoubleAnimationUsingKeyFrames_KeyFrames(animation);
+ OS.IList_Add(frames, bX);
+ OS.IList_Add(frames, eX);
+ OS.GCHandle_Free(frames);
+ OS.IList_Add(children, animation);
+ setTargetProperty(animation, "x");
+ OS.GCHandle_Free(animation);
+
+ animation = OS.gcnew_DoubleAnimationUsingKeyFrames();
+ bY = OS.gcnew_DiscreteDoubleKeyFrame();
+ eY = OS.gcnew_DiscreteDoubleKeyFrame();
+ frames = OS.DoubleAnimationUsingKeyFrames_KeyFrames(animation);
+ OS.IList_Add(frames, bY);
+ OS.IList_Add(frames, eY);
+ OS.GCHandle_Free(frames);
+ OS.IList_Add(children, animation);
+ setTargetProperty(animation, "y");
+ OS.GCHandle_Free(animation);
+
+ animation = OS.gcnew_DoubleAnimationUsingKeyFrames();
+ bW = OS.gcnew_DiscreteDoubleKeyFrame();
+ eW = OS.gcnew_DiscreteDoubleKeyFrame();
+ frames = OS.DoubleAnimationUsingKeyFrames_KeyFrames(animation);
+ OS.IList_Add(frames, bW);
+ OS.IList_Add(frames, eW);
+ OS.GCHandle_Free(frames);
+ OS.IList_Add(children, animation);
+ setTargetProperty(animation, "Width");
+ OS.GCHandle_Free(animation);
+
+ animation = OS.gcnew_DoubleAnimationUsingKeyFrames();
+ bH = OS.gcnew_DiscreteDoubleKeyFrame();
+ eH = OS.gcnew_DiscreteDoubleKeyFrame();
+ frames = OS.DoubleAnimationUsingKeyFrames_KeyFrames(animation);
+ OS.IList_Add(frames, bH);
+ OS.IList_Add(frames, eH);
+ OS.GCHandle_Free(frames);
+ OS.IList_Add(children, animation);
+ setTargetProperty(animation, "Height");
+ OS.GCHandle_Free(animation);
+
+ OS.GCHandle_Free(children);
}
void release() {
@@ -40,6 +92,22 @@ public class DiscretePropertyAnimation extends PropertyAnimation {
beginFrame = 0;
if (endFrame != 0) OS.GCHandle_Free(endFrame);
endFrame = 0;
+ if (bX != 0) OS.GCHandle_Free(bX);
+ bX = 0;
+ if (bY != 0) OS.GCHandle_Free(bY);
+ bY = 0;
+ if (bW != 0) OS.GCHandle_Free(bW);
+ bW = 0;
+ if (bH != 0) OS.GCHandle_Free(bH);
+ bH = 0;
+ if (eX != 0) OS.GCHandle_Free(eX);
+ eX = 0;
+ if (eY != 0) OS.GCHandle_Free(eY);
+ eY = 0;
+ if (eW != 0) OS.GCHandle_Free(eW);
+ eW = 0;
+ if (eH != 0) OS.GCHandle_Free(eH);
+ eH = 0;
}
long updateDuration(long delay) {
@@ -54,11 +122,20 @@ public class DiscretePropertyAnimation extends PropertyAnimation {
|| paramType == Transform.class) {
OS.DoubleKeyFrame_KeyTime(beginFrame, begin);
OS.DoubleKeyFrame_KeyTime(endFrame, end);
- } else if (paramType == Integer.TYPE) {
+ }
+ if (paramType == Integer.TYPE) {
OS.Int32KeyFrame_KeyTime(beginFrame, begin);
OS.Int32KeyFrame_KeyTime(endFrame, end);
- } else {
- throw new RuntimeException(paramType.getName() + " is not supported yet.");
+ }
+ if (paramType == Rectangle.class) {
+ OS.DoubleKeyFrame_KeyTime(bX, begin);
+ OS.DoubleKeyFrame_KeyTime(bY, begin);
+ OS.DoubleKeyFrame_KeyTime(bW, begin);
+ OS.DoubleKeyFrame_KeyTime(bH, begin);
+ OS.DoubleKeyFrame_KeyTime(eX, end);
+ OS.DoubleKeyFrame_KeyTime(eY, end);
+ OS.DoubleKeyFrame_KeyTime(eW, end);
+ OS.DoubleKeyFrame_KeyTime(eH, end);
}
OS.GCHandle_Free(begin);
OS.GCHandle_Free(end);
@@ -69,13 +146,24 @@ public class DiscretePropertyAnimation extends PropertyAnimation {
if (paramType == Double.TYPE
|| paramType == Color.class
|| paramType == Transform.class) {
- OS.DoubleKeyFrame_Value(beginFrame, from);
- OS.DoubleKeyFrame_Value(endFrame, to);
- } else if (paramType == Integer.TYPE) {
- OS.Int32KeyFrame_Value(beginFrame, (int)from);
- OS.Int32KeyFrame_Value(endFrame, (int)to);
- } else {
- throw new RuntimeException(paramType.getName() + " is not supported yet.");
- }
+ OS.DoubleKeyFrame_Value(beginFrame, ((Double)from).doubleValue());
+ OS.DoubleKeyFrame_Value(endFrame, ((Double)to).doubleValue());
+ }
+ if (paramType == Integer.TYPE) {
+ OS.Int32KeyFrame_Value(beginFrame, ((Integer)from).intValue());
+ OS.Int32KeyFrame_Value(endFrame, ((Integer)to).intValue());
+ }
+ if (paramType == Rectangle.class) {
+ Rectangle fromRect = (Rectangle) from;
+ Rectangle toRect = (Rectangle) to;
+ OS.DoubleKeyFrame_Value(bX, fromRect.x);
+ OS.DoubleKeyFrame_Value(bY, fromRect.y);
+ OS.DoubleKeyFrame_Value(bW, fromRect.width);
+ OS.DoubleKeyFrame_Value(bH, fromRect.height);
+ OS.DoubleKeyFrame_Value(eX, toRect.x);
+ OS.DoubleKeyFrame_Value(eY, toRect.y);
+ OS.DoubleKeyFrame_Value(eW, toRect.width);
+ OS.DoubleKeyFrame_Value(eH, toRect.height);
+ }
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/LinearPropertyAnimation.java b/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/LinearPropertyAnimation.java
index 2372bb81af..6f9f5dcfc0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/LinearPropertyAnimation.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/LinearPropertyAnimation.java
@@ -5,6 +5,7 @@ import org.eclipse.swt.internal.wpf.*;
public class LinearPropertyAnimation extends PropertyAnimation {
int animation;
+ int xAnim, yAnim, wAnim, hAnim;
double accelerationRatio, decelerationRatio;
void create() {
@@ -16,6 +17,7 @@ public class LinearPropertyAnimation extends PropertyAnimation {
int children = OS.TimelineGroup_Children(handle);
OS.IList_Add(children, animation);
OS.GCHandle_Free(children);
+ setTargetProperty(animation, property);
}
void createIntegerAnimation() {
@@ -23,6 +25,24 @@ public class LinearPropertyAnimation extends PropertyAnimation {
int children = OS.TimelineGroup_Children(handle);
OS.IList_Add(children, animation);
OS.GCHandle_Free(children);
+ setTargetProperty(animation, property);
+ }
+
+ void createRectangleAnimation() {
+ int children = OS.TimelineGroup_Children(handle);
+ xAnim = OS.gcnew_DoubleAnimation();
+ OS.IList_Add(children, xAnim);
+ setTargetProperty(xAnim, "x");
+ yAnim = OS.gcnew_DoubleAnimation();
+ OS.IList_Add(children, yAnim);
+ setTargetProperty(yAnim, "y");
+ wAnim = OS.gcnew_DoubleAnimation();
+ OS.IList_Add(children, wAnim);
+ setTargetProperty(wAnim, "Width");
+ hAnim = OS.gcnew_DoubleAnimation();
+ OS.IList_Add(children, hAnim);
+ setTargetProperty(hAnim, "Height");
+ OS.GCHandle_Free(children);
}
public double getAccelerationRatio() {
@@ -39,6 +59,14 @@ public class LinearPropertyAnimation extends PropertyAnimation {
super.release();
if (animation != 0) OS.GCHandle_Free(animation);
animation = 0;
+ if (xAnim != 0) OS.GCHandle_Free(xAnim);
+ xAnim = 0;
+ if (yAnim != 0) OS.GCHandle_Free(yAnim);
+ yAnim = 0;
+ if (wAnim != 0) OS.GCHandle_Free(wAnim);
+ wAnim = 0;
+ if (hAnim != 0) OS.GCHandle_Free(hAnim);
+ hAnim = 0;
}
public void setAccelerationRatio(double ratio) {
@@ -60,28 +88,42 @@ public class LinearPropertyAnimation extends PropertyAnimation {
//set duration
int timeSpan = OS.TimeSpan_FromMilliseconds(duration);
int dur = OS.gcnew_Duration(timeSpan);
- OS.Timeline_Duration(animation, dur);
+ OS.Timeline_Duration(handle, dur);
OS.GCHandle_Free(dur);
OS.GCHandle_Free(timeSpan);
//set begin time
timeSpan = OS.TimeSpan_FromMilliseconds(delay + beginTime);
- OS.Timeline_BeginTime(animation, timeSpan);
+ OS.Timeline_BeginTime(handle, timeSpan);
OS.GCHandle_Free(timeSpan);
return delay+beginTime+duration;
}
void updateFromToValues() {
- if (paramType == Double.TYPE
- || paramType == Color.class
- || paramType == Transform.class) {
- OS.DoubleAnimation_From(animation, from);
- OS.DoubleAnimation_To(animation, to);
- } else if (paramType == Integer.TYPE) {
- OS.Int32Animation_From(animation, (int)from);
- OS.Int32Animation_To(animation, (int)to);
- } else {
- throw new RuntimeException(paramType.getName() + " is not supported yet.");
+ if (paramType == Double.TYPE) {
+ OS.DoubleAnimation_From(animation, ((Double)from).doubleValue());
+ OS.DoubleAnimation_To(animation, ((Double)to).doubleValue());
+ }
+ if (paramType == Color.class || paramType == Transform.class) {
+ OS.DoubleAnimation_From(animation, 0);
+ OS.DoubleAnimation_To(animation, 1);
+ }
+ if (paramType == Integer.TYPE) {
+ OS.Int32Animation_From(animation, ((Integer)from).intValue());
+ OS.Int32Animation_To(animation, ((Integer)to).intValue());
+ }
+ if (paramType == Rectangle.class) {
+ OS.DoubleAnimation_From(xAnim, ((Rectangle)from).x);
+ OS.DoubleAnimation_To(xAnim, ((Rectangle)to).x);
+ OS.DoubleAnimation_From(yAnim, ((Rectangle)from).y);
+ OS.DoubleAnimation_To(yAnim, ((Rectangle)to).y);
+ OS.DoubleAnimation_From(wAnim, ((Rectangle)from).width);
+ OS.DoubleAnimation_To(wAnim, ((Rectangle)to).width);
+ OS.DoubleAnimation_From(hAnim, ((Rectangle)from).height);
+ OS.DoubleAnimation_To(hAnim, ((Rectangle)to).height);
}
+// else {
+// throw new RuntimeException(paramType.getName() + " is not supported yet.");
+// }
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/PropertyAnimation.java b/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/PropertyAnimation.java
index f4d9e58bc1..f76799f0af 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/PropertyAnimation.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/PropertyAnimation.java
@@ -9,10 +9,8 @@ import org.eclipse.swt.internal.wpf.*;
import org.eclipse.swt.widgets.*;
public class PropertyAnimation extends Animation {
- double from, to;
+ Object from, to;
long duration;
- float[] transformTo, transformFrom;
- Color colorTo, colorFrom;
String name, property;
Object target;
Method method;
@@ -28,7 +26,6 @@ public class PropertyAnimation extends Animation {
super.create();
setParamType();
createAnimation();
- setTargetProperty();
register(widget);
}
updateFromToValues();
@@ -39,6 +36,7 @@ public class PropertyAnimation extends Animation {
int children = OS.TimelineGroup_Children(handle);
OS.IList_Add(children, customAnimation);
OS.GCHandle_Free(children);
+ setTargetProperty (customAnimation, property);
}
void createDoubleAnimation() {
@@ -47,6 +45,9 @@ public class PropertyAnimation extends Animation {
void createIntegerAnimation() {
}
+ void createRectangleAnimation() {
+ }
+
void OnPropertyChanged(int object, int args) {
try {
if (nextValue != null) {
@@ -89,6 +90,9 @@ public class PropertyAnimation extends Animation {
}
Color getColor(double newValue) {
+ if (!(from instanceof Color && to instanceof Color)) return null;
+ Color colorFrom = (Color)from;
+ Color colorTo = (Color)to;
RGB start = colorFrom.getRGB();
RGB end = colorTo.getRGB();
int red = (int) (((end.red-start.red)*newValue) + start.red);
@@ -101,7 +105,7 @@ public class PropertyAnimation extends Animation {
void GetCurrentValueCore(double currentTime) {
if (interpolator != null) {
try {
- nextValue = interpolator.getCurrentValue(new Double(from), new Double(to), (long)currentTime, duration);
+ nextValue = interpolator.getCurrentValue(from, to, (long)currentTime, duration);
return;
} catch (RuntimeException e) {
e.printStackTrace();
@@ -115,6 +119,11 @@ public class PropertyAnimation extends Animation {
}
Transform getTransform(double newValue) {
+ if (!(from instanceof Transform && to instanceof Transform)) return null;
+ float[] transformFrom = new float[6];
+ float[] transformTo = new float[6];
+ ((Transform)from).getElements(transformFrom);
+ ((Transform)to).getElements(transformTo);
Control control = (Control)target;
Transform transform = control.getTransform();
float[] f = new float[6];
@@ -153,37 +162,17 @@ public class PropertyAnimation extends Animation {
this.duration = duration;
}
- public void setFrom(Color from) {
- checkAnimation();
- colorFrom = from;
- this.to = 1;
- this.from = 0;
- }
-
- public void setFrom(double from) {
+ public void setFrom(Object from) {
checkAnimation();
this.from = from;
}
- public void setFrom(Transform from) {
- checkAnimation();
- transformFrom = new float[6];
- from.getElements(transformFrom);
- this.to = 1;
- this.from = 0;
- }
-
// public void setInterpolator(IInterpolator interpolator) {
// checkAnimation();
// this.interpolator = interpolator;
// }
void setParamType() {
- if (interpolator == null) {
- // if using custom interpolation we cannot use OS to set property.
- paramType = Properties.getParamType(property);
- }
- if (paramType != null) return;
String mName = "set" + property.substring(0, 1).toUpperCase() + property.substring(1);
Class clazz = target.getClass();
Method[] methods = clazz.getMethods();
@@ -199,7 +188,6 @@ public class PropertyAnimation extends Animation {
}
// if (method == null) error?
paramType = method.getParameterTypes()[0];
- animatorHandle = OS.gcnew_SWTAnimator(jniRef);
}
public void setProperty(String property) {
@@ -212,22 +200,15 @@ public class PropertyAnimation extends Animation {
this.target = target;
}
- void setTargetProperty() {
- int dp = getDependencyProperty();
- int propertyPath = OS.gcnew_PropertyPath(dp);
- OS.Storyboard_SetTargetProperty(handle, propertyPath);
- OS.GCHandle_Free(propertyPath);
- OS.GCHandle_Free(dp);
- }
-
-
-
- int getDependencyProperty() {
+ void setTargetProperty(int dependencyObject, String prop) {
+ int dp;
if (interpolator != null) {
- return OS.SWTAnimator_DoubleValueProperty();
+ dp = OS.SWTAnimator_DoubleValueProperty();
+ } else {
+ dp = Properties.getDependencyProperty(target, prop);
}
- int dp = Properties.getDependencyProperty(target, property);
if (dp == 0) {
+ animatorHandle = OS.gcnew_SWTAnimator(jniRef);
if (paramType == null
|| paramType == Double.TYPE
|| paramType == Color.class
@@ -239,7 +220,10 @@ public class PropertyAnimation extends Animation {
throw new RuntimeException(paramType + " is not supported yet.");
}
}
- return dp;
+ int propertyPath = OS.gcnew_PropertyPath(dp);
+ OS.Storyboard_SetTargetProperty(dependencyObject, propertyPath);
+ OS.GCHandle_Free(propertyPath);
+ OS.GCHandle_Free(dp);
}
void createAnimation() {
@@ -256,30 +240,19 @@ public class PropertyAnimation extends Animation {
if (paramType == Integer.TYPE) {
createIntegerAnimation();
return;
- }
+ }
+ if (paramType == Rectangle.class) {
+ createRectangleAnimation();
+ return;
+ }
throw new RuntimeException(paramType + " is not supported yet.");
}
- public void setTo(Color to) {
- checkAnimation();
- colorTo = to;
- this.to = 1;
- this.from = 0;
- }
-
- public void setTo(double to) {
+ public void setTo(Object to) {
checkAnimation();
this.to = to;
}
-
- public void setTo(Transform to) {
- checkAnimation();
- transformTo = new float[6];
- to.getElements(transformTo);
- this.to = 1;
- this.from = 0;
- }
-
+
int targetHandle() {
if (animatorHandle != 0) return animatorHandle;
if (target instanceof Widget) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/SplinePropertyAnimation.java b/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/SplinePropertyAnimation.java
index 8ba31407e9..06e18dcade 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/SplinePropertyAnimation.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Animation2/wpf/org/eclipse/swt/animation/SplinePropertyAnimation.java
@@ -4,7 +4,8 @@ import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.wpf.*;
public class SplinePropertyAnimation extends PropertyAnimation {
- int beginFrame, endFrame;
+ int beginFrame, endFrame;
+ int bX, bY, bW, bH, eX, eY, eW, eH;
double x1, y1, x2, y2;
void createDoubleAnimation() {
@@ -17,6 +18,7 @@ public class SplinePropertyAnimation extends PropertyAnimation {
OS.GCHandle_Free(frames);
int children = OS.TimelineGroup_Children(handle);
OS.IList_Add(children, animation);
+ setTargetProperty(animation, property);
OS.GCHandle_Free(children);
OS.GCHandle_Free(animation);
}
@@ -31,16 +33,82 @@ public class SplinePropertyAnimation extends PropertyAnimation {
OS.GCHandle_Free(frames);
int children = OS.TimelineGroup_Children(handle);
OS.IList_Add(children, animation);
+ setTargetProperty(animation, property);
OS.GCHandle_Free(children);
OS.GCHandle_Free(animation);
}
+ void createRectangleAnimation() {
+ int children = OS.TimelineGroup_Children(handle);
+ int animation = OS.gcnew_DoubleAnimationUsingKeyFrames();
+ bX = OS.gcnew_SplineDoubleKeyFrame();
+ eX = OS.gcnew_SplineDoubleKeyFrame();
+ int frames = OS.DoubleAnimationUsingKeyFrames_KeyFrames(animation);
+ OS.IList_Add(frames, bX);
+ OS.IList_Add(frames, eX);
+ OS.GCHandle_Free(frames);
+ OS.IList_Add(children, animation);
+ setTargetProperty(animation, "x");
+ OS.GCHandle_Free(animation);
+
+ animation = OS.gcnew_DoubleAnimationUsingKeyFrames();
+ bY = OS.gcnew_SplineDoubleKeyFrame();
+ eY = OS.gcnew_SplineDoubleKeyFrame();
+ frames = OS.DoubleAnimationUsingKeyFrames_KeyFrames(animation);
+ OS.IList_Add(frames, bY);
+ OS.IList_Add(frames, eY);
+ OS.GCHandle_Free(frames);
+ OS.IList_Add(children, animation);
+ setTargetProperty(animation, "y");
+ OS.GCHandle_Free(animation);
+
+ animation = OS.gcnew_DoubleAnimationUsingKeyFrames();
+ bW = OS.gcnew_SplineDoubleKeyFrame();
+ eW = OS.gcnew_SplineDoubleKeyFrame();
+ frames = OS.DoubleAnimationUsingKeyFrames_KeyFrames(animation);
+ OS.IList_Add(frames, bW);
+ OS.IList_Add(frames, eW);
+ OS.GCHandle_Free(frames);
+ OS.IList_Add(children, animation);
+ setTargetProperty(animation, "Width");
+ OS.GCHandle_Free(animation);
+
+ animation = OS.gcnew_DoubleAnimationUsingKeyFrames();
+ bH = OS.gcnew_SplineDoubleKeyFrame();
+ eH = OS.gcnew_SplineDoubleKeyFrame();
+ frames = OS.DoubleAnimationUsingKeyFrames_KeyFrames(animation);
+ OS.IList_Add(frames, bH);
+ OS.IList_Add(frames, eH);
+ OS.GCHandle_Free(frames);
+ OS.IList_Add(children, animation);
+ setTargetProperty(animation, "Height");
+ OS.GCHandle_Free(animation);
+
+ OS.GCHandle_Free(children);
+ }
+
void release() {
super.release();
if (beginFrame != 0) OS.GCHandle_Free(beginFrame);
beginFrame = 0;
if (endFrame != 0) OS.GCHandle_Free(endFrame);
endFrame = 0;
+ if (bX != 0) OS.GCHandle_Free(bX);
+ bX = 0;
+ if (bY != 0) OS.GCHandle_Free(bY);
+ bY = 0;
+ if (bW != 0) OS.GCHandle_Free(bW);
+ bW = 0;
+ if (bH != 0) OS.GCHandle_Free(bH);
+ bH = 0;
+ if (eX != 0) OS.GCHandle_Free(eX);
+ eX = 0;
+ if (eY != 0) OS.GCHandle_Free(eY);
+ eY = 0;
+ if (eW != 0) OS.GCHandle_Free(eW);
+ eW = 0;
+ if (eH != 0) OS.GCHandle_Free(eH);
+ eH = 0;
}
public void setSpline(double x1, double y1, double x2, double y2) {
@@ -63,11 +131,20 @@ public class SplinePropertyAnimation extends PropertyAnimation {
|| paramType == Transform.class) {
OS.DoubleKeyFrame_KeyTime(beginFrame, begin);
OS.DoubleKeyFrame_KeyTime(endFrame, end);
- } else if (paramType == Integer.TYPE) {
+ }
+ if (paramType == Integer.TYPE) {
OS.Int32KeyFrame_KeyTime(beginFrame, begin);
OS.Int32KeyFrame_KeyTime(endFrame, end);
- } else {
- throw new RuntimeException(paramType.getName() + " is not supported yet.");
+ }
+ if (paramType == Rectangle.class) {
+ OS.DoubleKeyFrame_KeyTime(bX, begin);
+ OS.DoubleKeyFrame_KeyTime(bY, begin);
+ OS.DoubleKeyFrame_KeyTime(bW, begin);
+ OS.DoubleKeyFrame_KeyTime(bH, begin);
+ OS.DoubleKeyFrame_KeyTime(eX, end);
+ OS.DoubleKeyFrame_KeyTime(eY, end);
+ OS.DoubleKeyFrame_KeyTime(eW, end);
+ OS.DoubleKeyFrame_KeyTime(eH, end);
}
OS.GCHandle_Free(begin);
OS.GCHandle_Free(end);
@@ -79,16 +156,31 @@ public class SplinePropertyAnimation extends PropertyAnimation {
if (paramType == Double.TYPE
|| paramType == Color.class
|| paramType == Transform.class) {
- OS.DoubleKeyFrame_Value(beginFrame, from);
- OS.DoubleKeyFrame_Value(endFrame, to);
+ OS.DoubleKeyFrame_Value(beginFrame, ((Double)from).doubleValue());
+ OS.DoubleKeyFrame_Value(endFrame, ((Double)to).doubleValue());
OS.SplineDoubleKeyFrame_KeySpline(endFrame, keySpline);
- } else if (paramType == Integer.TYPE) {
- OS.Int32KeyFrame_Value(beginFrame, (int)from);
- OS.Int32KeyFrame_Value(endFrame, (int)to);
+ }
+ if (paramType == Integer.TYPE) {
+ OS.Int32KeyFrame_Value(beginFrame, ((Integer)from).intValue());
+ OS.Int32KeyFrame_Value(endFrame, ((Integer)to).intValue());
OS.SplineInt32KeyFrame_KeySpline(endFrame, keySpline);
- } else {
- throw new RuntimeException(paramType.getName() + " is not supported yet.");
- }
+ }
+ if (paramType == Rectangle.class) {
+ Rectangle fromRect = (Rectangle) from;
+ Rectangle toRect = (Rectangle) to;
+ OS.DoubleKeyFrame_Value(bX, fromRect.x);
+ OS.DoubleKeyFrame_Value(bY, fromRect.y);
+ OS.DoubleKeyFrame_Value(bW, fromRect.width);
+ OS.DoubleKeyFrame_Value(bH, fromRect.height);
+ OS.DoubleKeyFrame_Value(eX, toRect.x);
+ OS.DoubleKeyFrame_Value(eY, toRect.y);
+ OS.DoubleKeyFrame_Value(eW, toRect.width);
+ OS.DoubleKeyFrame_Value(eH, toRect.height);
+ OS.SplineInt32KeyFrame_KeySpline(eX, keySpline);
+ OS.SplineInt32KeyFrame_KeySpline(eY, keySpline);
+ OS.SplineInt32KeyFrame_KeySpline(eW, keySpline);
+ OS.SplineInt32KeyFrame_KeySpline(eH, keySpline);
+ }
OS.GCHandle_Free(keySpline);
}
}

Back to the top