示例#1
0
文件: Layers.cs 项目: And-G/Magellan
 public Layer this[string name]
 {
     get { int idx = GetIndexByName( name ); return idx >= 0 ? items[idx] : null; }
     set {
         int index = GetIndexByName( value.Name );
         if ( index < 0 ) {
             Layer[] newitems = new Layer[items.Length+1];
             items.CopyTo( newitems, 0 );
             index = items.Length;
             items = newitems;
         }
         items[index] = value;
     }
 }
示例#2
0
        public static ProtoLayer FromLayer( Layer source )
        {
            ProtoLayer result = new ProtoLayer();

            result.name = source.Name;
            result.bounds = source.Bounds;
            result.opacity = source.Opacity;
            result.visible = source.Visible;
            result.protecttrans = source.ProtectTransparancy;
            result.clipping = source.Clipping;
            result.blendkey = source.Mode.Key;
            result.channels = Channels.FromImage( source.Image );

            return result;
        }
示例#3
0
文件: Layer.cs 项目: And-G/Magellan
        public static Layer FromProtoLayer( ProtoLayer proto, File file )
        {
            Layer result = new Layer( file );
            result.name = proto.Name;
            result.location = proto.Bounds.Location;
            result.clipping = proto.Clipping;
            result.visible = proto.Visible;
            result.opacity = proto.Opacity;
            result.protecttrans = proto.ProtectTransparancy;
            result.image = proto.BuildImage();
            result.mode = LayerMode.FromKey( proto.Blendkey );
            result.mask = proto.BuildMask();
            result.adjustments = new LayerAdjustment[proto.Adjustments.Length];
            proto.Adjustments.CopyTo( result.adjustments, 0 );

            return result;
        }
示例#4
0
文件: Layers.cs 项目: And-G/Magellan
        public Layer Add( Layer layer, int where )
        {
            if ( where < 0 || where > items.Length ) return Add( layer );

            layer.File = file;
            Layer[] newitems = new Layer[items.Length+1];
            if ( where == 0 ) {
                Array.Copy( items, 0, newitems, 1, items.Length  );
            }
            else {
                Array.Copy( items, 0, newitems, 0, where );
                Array.Copy( items, where, newitems, where+1, items.Length-where );
            }
            newitems[where] = layer;
            items = newitems;

            return layer;
        }
示例#5
0
文件: Layers.cs 项目: And-G/Magellan
        public Layer Add( Layer layer )
        {
            Layer[] newitems = new Layer[items.Length+1];
            items.CopyTo( newitems, 0 );
            newitems[newitems.Length-1] = layer;
            layer.File = file;
            items = newitems;

            return layer;
        }