示例#1
0
文件: PixelPainter.cs 项目: sgww/cozy
 public void Save(string filename)
 {
     if (IsReady)
     {
         SourceImage.Save(filename);
     }
 }
示例#2
0
        public Stream Process()
        {
            if (SourceStream != null)
            {
                if (SourceImage == null)
                {
                    SourceImage = Image.Load(SourceStream, out var format);
                    Format      = format;
                }
            }

            if (SourceImage != null)
            {
                if (SourcePackage == null)
                {
                    SourcePackage = new ImagePackage {
                        Format = Format, Image = SourceImage
                    }
                }
            }
            ;

            // Now, backfills.

            SourceImage = SourceImage ?? SourcePackage.Image;
            Format      = Format ?? SourcePackage.Format;

            foreach (var item in Items)
            {
                SourceImage = item.Process(SourceImage);
            }

            var memoryStream = new MemoryStream();

            SourceImage.Save(memoryStream, Format);

            memoryStream.Position = 0;

            return(memoryStream);
        }