Ejemplo n.º 1
0
 /// <summary>
 /// Конструктор
 /// </summary>
 public ImageInfo(SchemeView.Image image, Func<string, bool> nameIsUniqueMethod)
 {
     Image = image;
     Source = null;
     Name = image.Name;
     DataSize = 0;
     ImageSize = new SchemeView.Size(0, 0);
     Format = "";
     NameIsUniqueMethod = nameIsUniqueMethod;
 }
Ejemplo n.º 2
0
            /// <summary>
            /// Загрузить изображение из его данных
            /// </summary>
            public void LoadImage()
            {
                if (Source == null && Image != null && Image.Data != null)
                {
                    // using не используется, т.к. поток memStream должен существовать одновременно с изображением
                    MemoryStream memStream = new MemoryStream(Image.Data);
                    Source = Bitmap.FromStream(memStream);
                    DataSize = (int)memStream.Length;
                    ImageSize = new SchemeView.Size(Source.Width, Source.Height);

                    ImageFormat imageFormat = Source.RawFormat;
                    if (imageFormat.Equals(ImageFormat.Bmp))
                        Format = "Bmp";
                    else if (imageFormat.Equals(ImageFormat.Gif))
                        Format = "Gif";
                    else if (imageFormat.Equals(ImageFormat.Jpeg))
                        Format = "Jpeg";
                    else if (imageFormat.Equals(ImageFormat.Png))
                        Format = "Png";
                    else if (imageFormat.Equals(ImageFormat.Tiff))
                        Format = "Tiff";
                }
            }