Ejemplo n.º 1
0
        public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID)
        {
            base.CopyFrom(other, depth, mapID);
            MaskedImage mask = (MaskedImage)other;

            // largely copied fom scriptable
            Debug.Assert((Image == null) == (MaskShape == null));
            if (depth == CopyDepth.Transform && MaskShape != null)             // m_Mask and m_Image will either both be null or neither
            {
                // first time must copy reference, below
                if (MaskShape != mask.MaskShape)
                {
                    MaskShape?.CopyFrom(mask.MaskShape, depth, mapID);
                }
                if (Image != mask.Image)
                {
                    Image?.CopyFrom(mask.Image, depth, mapID);
                }
            }
            else            // if (depth == CopyDepth.Duplicate)
            {
                if (mapID?.ContainsKey(mask.MaskShape.ID) ?? false)
                {
                    MaskShape = (Lined)mapID[mask.MaskShape.ID];
                }
                else
                {
                    MaskShape = (Lined)mask.MaskShape.Clone(mapID ?? new Mapping());                     // use actual mapID if there is one, otherwise need a real one as Container aspects of Item don't like Ignore
                }
                MaskShape.Parent = this;

                if (mapID?.ContainsKey(mask.Image.ID) ?? false)
                {
                    Image = (ImportedImage)mapID[mask.Image.ID];
                }
                else
                {
                    Image = (ImportedImage)mask.Image.Clone(mapID ?? new Mapping());                     // use actual mapID if there is one, otherwise need a real one as Container aspects of Item don't like Ignore
                }
                Image.Parent = this;
            }


            m_Bounds = RectangleF.Empty;
        }
Ejemplo n.º 2
0
        protected override bool IdenticalToShape(Shape other)
        {
            if (!base.IdenticalToShape(other))
            {
                return(false);
            }
            MaskedImage otherMask = (MaskedImage)other;

            if (!MaskShape.IdenticalTo(otherMask.MaskShape))
            {
                return(false);
            }
            if (!Image.IdenticalTo(otherMask.Image))
            {
                return(false);
            }
            return(true);
        }