Example #1
0
        internal void CreateDifProportions(seIm parIm, seIm childIm)
        {
            if (parIm == null)
            {
                return;
            }
            if (childIm == null)
            {
                return;
            }
            Xd = childIm.X - parIm.X;
            Yd = childIm.Y - parIm.Y;

            R  = childIm.R;
            pR = parIm.R;

            pF = parIm.F;
            F  = childIm.F;

            //dSx = ((float)childIm.Sx / (float)parIm.Sx);
            //dSy = ((float)childIm.Sy / (float)parIm.Sy);
            cSx = childIm.Sx;
            cSy = childIm.Sy;

            pSx = parIm.Sx;
            pSy = parIm.Sy;

            pT = parIm.T;
            pO = parIm.O;
            cO = childIm.O;
            dO = childIm.O - parIm.O;
        }
Example #2
0
 private void AddToGlobalAlign(DifData dd, DifData pardelta)
 {
     if (!string.IsNullOrEmpty(dd.Parent))
     {
         // get child storage items
         var storageitem = ImageStorage.Where(x => x.Name == dd.Name).FirstOrDefault();
         if (storageitem != null)
         {
             // check if default align for that parent is not already assigned
             var oldalign = storageitem.Parents.Where(x => x.Parent == dd.Parent && x.Tag == dd.Tag).FirstOrDefault();
             if (oldalign == null)
             {
                 // Get parent image align via default align and delta
                 seIm parIm          = new seIm();
                 var  pardefaultalgn = ImageStorage.Where(x => x.Name == dd.Parent).FirstOrDefault().DefaultAlign;
                 parIm.AssignFrom(pardefaultalgn); // default and delta
                 parIm.AssignFrom(pardelta);
                 // Get child image align via default align and delta
                 seIm childIm          = new seIm();
                 var  childdefaultalgn = storageitem.DefaultAlign;
                 childIm.AssignFrom(childdefaultalgn); // default and delta
                 childIm.AssignFrom(dd);
                 // add align for that parent
                 ImageRelDifVec newalign = new ImageRelDifVec();
                 newalign.Tag    = dd.Tag;
                 newalign.Parent = dd.Parent;
                 newalign.CreateDifProportions(parIm, childIm);
                 storageitem.Parents.Add(newalign);
             }
         }
     }
 }
Example #3
0
        public seIm AddImage(seIm sr)
        {
            seIm im = new seIm();

            im.AssignFrom(sr);
            VisionList.Add(im);
            return(im);
        }
Example #4
0
        public DifData(seIm item) : this()
        {
            this.Name = item.Name;

            this.X  = item.X;
            this.Y  = item.Y;
            this.Sy = item.Sy;
            this.Sx = item.Sx;
            this.R  = item.R;
            this.F  = item.F;
        }
Example #5
0
 internal void AssignFrom(seIm image)
 {
     this.O        = image.O;
     this.F        = image.F;
     this.SizeMode = image.SizeMode;
     this.Sx       = image.Sx;
     this.Sy       = image.Sy;
     this.X        = image.X;
     this.Y        = image.Y;
     this.R        = image.R;
     this.Part     = image.Part;
     this.File     = image.File;
     this.Name     = image.Name;
     this.Parent   = image.Parent;
     this.T        = image.T;
     this.ParentFlips.Clear();
     this.ParentFlips.AddRange(image.ParentFlips);
     this.Animations.Clear();
     this.Animations.AddRange(image.Animations);
 }
Example #6
0
        //! new!!!!
        internal void ApplyTo(seIm target, seIm actualParent, DifData delta)
        {
            float dSx = ((float)cSx / (float)pSx);
            float dSy = ((float)cSy / (float)pSy);

            if (delta != null)
            {
                if (delta.Sx.HasValue)
                {
                    dSx = ((float)delta.Sx / (float)pSx);
                }
                if (delta.Sy.HasValue)
                {
                    dSy = ((float)delta.Sy / (float)pSy);
                }
            }
            target.Sx = Convert.ToInt32(dSx * actualParent.Sx);
            target.Sy = Convert.ToInt32(dSy * actualParent.Sy);

            // Parent flip
            {
                target.ParentFlips.Clear();
                if (actualParent.ParentFlips != null)
                {
                    target.ParentFlips.AddRange(actualParent.ParentFlips);
                }
                if (this.pF != actualParent.F)
                {
                    target.ParentFlips.Add(actualParent.Name);
                }
            }

            { // X,Y coord
                target.X = this.Xd;
                target.Y = this.Yd;

                if (delta.Xd.HasValue)
                {
                    target.X = target.X + delta.Xd.Value;
                }
                if (delta.Yd.HasValue)
                {
                    target.Y = target.Y + delta.Yd.Value;
                }

                target.X = (int)(target.X * ((float)actualParent.Sx / pSx));
                target.Y = (int)(target.Y * ((float)actualParent.Sy / pSy));

                target.X = target.X + actualParent.X;
                target.Y = target.Y + actualParent.Y;

                //if (delta != null && delta.Xd.HasValue)
                //    target.X = target.X + delta.X.Value;
                //if (delta != null && delta.Y.HasValue)
                //    target.Y = delta.Y.Value;
            }
            target.R = this.R;
            if (delta.Rd.HasValue)
            {
                target.R = target.R + delta.Rd.Value;
            }
            if (delta.R.HasValue)
            {
                target.R = delta.R.Value;
            }

            target.F = this.F;

            // transition
            target.T = this.pT;        //default
            target.T = actualParent.T; // parent
            if (delta.T != null)       //delta
            {
                target.T = delta.T;
            }

            // opacity
            if (this.cO > -1)
            {
                target.O = this.cO;
            }
            //if (delta.Od.HasValue) target.O = target.O + delta.Od.Value;
        }