コード例 #1
0
        /// <summary>
        /// Equals override
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            SpriteLayout layout = (SpriteLayout)obj;

            return(base.Equals(obj) &&
                   layout.Color.Equals(this.Color));
        }
コード例 #2
0
        /// <summary>
        /// Clones the layout
        /// </summary>
        /// <returns></returns>
        public override object Clone()
        {
            SpriteLayout layout = new SpriteLayout();

            layout.SetFrom(this);

            layout.Color = this.Color;
            layout.Skew  = this.Skew;

            return(layout);
        }
コード例 #3
0
        /// <summary>
        /// Applies the provided keyframe to the control,
        /// overriding all needed properties
        /// </summary>
        /// <param name="frame"></param>
        public override void ApplyKeyFrame(KeyFrame startFrame, KeyFrame endFrame, float factor)
        {
            base.ApplyKeyFrame(startFrame, endFrame, factor);

            SpriteLayout startLayout = startFrame != null ? startFrame.Layout as SpriteLayout : null;
            SpriteLayout endLayout   = endFrame != null ? endFrame.Layout as SpriteLayout : null;

            if (startLayout == null && endLayout == null)
            {
                return;
            }

            int   r, g, b, a;
            float skew;

            if (endLayout == null)
            {
                r = startLayout.Color.R;
                g = startLayout.Color.G;
                b = startLayout.Color.B;
                a = startLayout.Color.A;

                skew = startLayout.Skew;
            }
            else
            {
                r = (int)((float)startLayout.Color.R * (1.0f - factor) + (float)endLayout.Color.R * factor);
                g = (int)((float)startLayout.Color.G * (1.0f - factor) + (float)endLayout.Color.G * factor);
                b = (int)((float)startLayout.Color.B * (1.0f - factor) + (float)endLayout.Color.B * factor);
                a = (int)((float)startLayout.Color.A * (1.0f - factor) + (float)endLayout.Color.A * factor);

                skew = startLayout.Skew * (1.0f - factor) + endLayout.Skew * factor;
            }

            this.Color = Color.FromArgb(a, r, g, b);
            this.Skew  = skew;
        }
コード例 #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 public GUISprite()
 {
     Layout = new SpriteLayout();
     Name   = "Sprite";
 }
コード例 #5
0
ファイル: GUISprite.cs プロジェクト: RasterCode/OtterUI
 /// <summary>
 /// Constructor
 /// </summary>
 public GUISprite()
 {
     Layout = new SpriteLayout();
     Name = "Sprite";
 }
コード例 #6
0
ファイル: GUISprite.cs プロジェクト: RasterCode/OtterUI
        /// <summary>
        /// Clones the layout
        /// </summary>
        /// <returns></returns>
        public override object Clone()
        {
            SpriteLayout layout = new SpriteLayout();
            layout.SetFrom(this);

            layout.Color = this.Color;
            layout.Skew = this.Skew;

            return layout;
        }