Exemple #1
0
        public override object SaveProperties()
        {
            if (disposed)
            {
                throw new ObjectDisposedException("BitmapLayer");
            }

            object baseProperties = base.SaveProperties();

            return(new List(properties.Clone(), new List(baseProperties, null)));
        }
Exemple #2
0
        public override void LoadProperties(object oldState, bool suppressEvents)
        {
            if (disposed)
            {
                throw new ObjectDisposedException("BitmapLayer");
            }

            List list = (List)oldState;

            // Get the base class' state, and our state
            LayerProperties       baseState = (LayerProperties)list.Tail.Head;
            BitmapLayerProperties blp       = (BitmapLayerProperties)(((List)oldState).Head);

            // Opacity is only couriered for compatibility with PDN v2.0 and v1.1
            // files. It should not be present in v2.1+ files (well, it'll be
            // part of the base class' serialization)
            if (blp.opacity != -1)
            {
                baseState.opacity = (byte)blp.opacity;
                blp.opacity       = -1;
            }

            // Have the base class load its properties
            base.LoadProperties(baseState, suppressEvents);

            // Now load our properties, and announce them to the world
            bool raiseBlendOp = false;

            if (blp.blendOp.GetType() != properties.blendOp.GetType())
            {
                if (!suppressEvents)
                {
                    raiseBlendOp = true;
                    OnPropertyChanging(BitmapLayerProperties.BlendOpName);
                }
            }

            this.properties      = (BitmapLayerProperties)blp.Clone();
            this.compiledBlendOp = null;

            Invalidate();

            if (raiseBlendOp)
            {
                OnPropertyChanged(BitmapLayerProperties.BlendOpName);
            }
        }