Beispiel #1
0
 public void ResetRealTime()
 {
     X.RealTimeToSource();
     Y.RealTimeToSource();
     Rad.RealTimeToSource();
     Vx.RealTimeToSource();
     Vy.RealTimeToSource();
     F.RealTimeToSource();
     R.RealTimeToSource();
     G.RealTimeToSource();
     B.RealTimeToSource();
 }
Beispiel #2
0
        protected void SetMinMax()
        {
            // 与bitmapObject不同,由于sb是纯静态的,所以可先判断出范围,为提高效率,这里先进行计算
            if (_element.FadeList.Count > 0)
            {
                FadeTime = new TimeRange
                {
                    Min = (int)_element.FadeList.Min(k => k.StartTime),
                    Max = (int)_element.FadeList.Max(k => k.EndTime),
                };
                F.Source = _element.FadeList.First().F1;
                F.Target = _element.FadeList.Last().F2;
            }
            if (_element.RotateList.Count > 0)
            {
                RotateTime = new TimeRange
                {
                    Min = (int)_element.RotateList.Min(k => k.StartTime),
                    Max = (int)_element.RotateList.Max(k => k.EndTime),
                };
                Rad.Source = _element.RotateList.First().R1;
                Rad.Target = _element.RotateList.Last().R2;
            }

            if (_element.ScaleList.Count > 0)
            {
                VTime = new TimeRange
                {
                    Min = (int)_element.ScaleList.Min(k => k.StartTime),
                    Max = (int)_element.ScaleList.Max(k => k.EndTime)
                };
                Vx.Source = _element.ScaleList.First().S1 *_vSize.Width;
                Vy.Source = _element.ScaleList.First().S1 *_vSize.Width;
                Vx.Target = _element.ScaleList.Last().S2 *_vSize.Height;
                Vy.Target = _element.ScaleList.Last().S2 *_vSize.Height;
            }
            if (_element.VectorList.Count > 0)
            {
                if (!VTime.Equals(TimeRange.Default))
                {
                    var tmpMin = (int)_element.VectorList.Min(k => k.StartTime);
                    var tmpMax = (int)_element.VectorList.Max(k => k.EndTime);

                    if (tmpMin < VTime.Min)
                    {
                        VTime.Min = tmpMin;
                        Vx.Source = _element.VectorList.First().Vx1 *_vSize.Width;
                        Vy.Source = _element.VectorList.First().Vy1 *_vSize.Height;
                    }

                    if (tmpMax > VTime.Max)
                    {
                        VTime.Max = tmpMax;
                        Vx.Target = _element.VectorList.Last().Vx2 *_vSize.Width;
                        Vy.Target = _element.VectorList.Last().Vy2 *_vSize.Height;
                    }
                }
                else
                {
                    VTime = new TimeRange
                    {
                        Min = (int)_element.VectorList.Min(k => k.StartTime),
                        Max = (int)_element.VectorList.Max(k => k.EndTime)
                    };
                    Vx.Source = _element.VectorList.First().Vx1 *_vSize.Width;
                    Vy.Source = _element.VectorList.First().Vy1 *_vSize.Height;
                    Vx.Target = _element.VectorList.Last().Vx2 *_vSize.Width;
                    Vy.Target = _element.VectorList.Last().Vy2 *_vSize.Height;
                }
            }

            if (_element.MoveList.Count > 0)
            {
                MovTime = new TimeRange
                {
                    Min = (int)_element.MoveList.Min(k => k.StartTime),
                    Max = (int)_element.MoveList.Max(k => k.EndTime)
                };
                X.Source = (_element.MoveList.First().X1 + 107) * _vSize.Width;
                Y.Source = _element.MoveList.First().Y1 *_vSize.Height;
                X.Target = (_element.MoveList.Last().X2 + 107) * _vSize.Width;
                Y.Target = _element.MoveList.Last().Y2 *_vSize.Height;
            }
            if (_element.MoveXList.Count > 0)
            {
                if (!MovTime.Equals(TimeRange.Default))
                {
                    var tmpMin = (int)_element.MoveXList.Min(k => k.StartTime);
                    var tmpMax = (int)_element.MoveXList.Max(k => k.EndTime);

                    if (tmpMin < MovTime.Min)
                    {
                        MovTime.Min = tmpMin;
                        X.Source    = (_element.MoveXList.First().X1 + 107) * _vSize.Width;
                    }

                    if (tmpMax > MovTime.Max)
                    {
                        MovTime.Max = tmpMax;
                        X.Target    = (_element.MoveXList.Last().X2 + 107) * _vSize.Width;
                    }
                }
                else
                {
                    MovTime = new TimeRange
                    {
                        Min = (int)_element.MoveXList.Min(k => k.StartTime),
                        Max = (int)_element.MoveXList.Max(k => k.EndTime)
                    };
                    X.Source = (_element.MoveXList.First().X1 + 107) * _vSize.Width;
                    X.Target = (_element.MoveXList.Last().X2 + 107) * _vSize.Width;
                }
            }
            if (_element.MoveYList.Count > 0)
            {
                if (!MovTime.Equals(TimeRange.Default))
                {
                    var tmpMin = (int)_element.MoveYList.Min(k => k.StartTime);
                    var tmpMax = (int)_element.MoveYList.Max(k => k.EndTime);

                    if (tmpMin <= MovTime.Min)
                    {
                        MovTime.Min = tmpMin;
                        Y.Source    = _element.MoveYList.First().Y1 *_vSize.Height;
                    }

                    if (tmpMax >= MovTime.Max)
                    {
                        MovTime.Max = tmpMax;
                        Y.Target    = _element.MoveYList.Last().Y2 *_vSize.Height;
                    }
                }
                else
                {
                    MovTime = new TimeRange
                    {
                        Min = (int)_element.MoveYList.Min(k => k.StartTime),
                        Max = (int)_element.MoveYList.Max(k => k.EndTime)
                    };
                    Y.Source = _element.MoveYList.First().Y1 *_vSize.Height;
                    Y.Target = _element.MoveYList.Last().Y2 *_vSize.Height;
                }
            }

            if (_element.ColorList.Count > 0)
            {
                CTime = new TimeRange
                {
                    Min = (int)_element.ColorList.Min(k => k.StartTime),
                    Max = (int)_element.ColorList.Max(k => k.EndTime)
                };
                R.Source = _element.ColorList.First().R1;
                G.Source = _element.ColorList.First().G1;
                B.Source = _element.ColorList.First().B1;
                R.Target = _element.ColorList.Last().R2;
                G.Target = _element.ColorList.Last().G2;
                B.Target = _element.ColorList.Last().B2;
            }

            if (_element.ParameterList.Count > 0)
            {
                PTime = new TimeRange
                {
                    Min = (int)_element.ParameterList.Min(k => k.StartTime),
                    Max = (int)_element.ParameterList.Max(k => k.EndTime)
                };
            }

            X.RealTimeToSource();
            Y.RealTimeToSource();
            Rad.RealTimeToSource();
            Vx.RealTimeToSource();
            Vy.RealTimeToSource();
            F.RealTimeToSource();
            R.RealTimeToSource();
            G.RealTimeToSource();
            B.RealTimeToSource();
        }