Пример #1
0
 protected override Document OnLoad(Stream input)
 {
     using (Image image = PdnResources.LoadImage(input))
     {
         Document document = Document.FromImage(image);
         return(document);
     }
 }
Пример #2
0
        protected override Document OnLoad(Stream input)
        {
            // This allows us to open images that were created in Explorer using New -> Bitmap Image
            // which actually just creates a 0-byte file
            if (input.Length == 0)
            {
                Document newDoc = new Document(800, 600);

                Layer layer = Layer.CreateBackgroundLayer(newDoc.Width, newDoc.Height);

                newDoc.Layers.Add(layer);
                return(newDoc);
            }
            else
            {
                using (Image image = PdnResources.LoadImage(input))
                {
                    Document document = Document.FromImage(image);
                    return(document);
                }
            }
        }