예제 #1
0
파일: SharedImage.cs 프로젝트: stuart2w/SAW
 public SharedImage(MemoryImage image, int CRC = 0)
 {
     // CRC can be provided if already calculated - to avoid recalculating it
     m_Image = image;
     if (CRC == 0)
     {
         CRC = image.CalcCRC();
     }
     this.CRC = CRC;
 }
예제 #2
0
파일: SharedImage.cs 프로젝트: stuart2w/SAW
        public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID)
        {
            base.CopyFrom(other, depth, mapID);
            SharedImage sharedImage = (SharedImage)other;

            if (depth >= CopyDepth.Duplicate)
            {
                m_Image = sharedImage.m_Image?.Clone();
                CRC     = sharedImage.CRC;
            }
            m_ResourceName = sharedImage.m_ResourceName;
        }
예제 #3
0
파일: BinaryData.cs 프로젝트: stuart2w/SAW
 public void WriteOptionalMemoryImage(MemoryImage image)
 {
     if (image == null)
     {
         Write(false);
     }
     else
     {
         Write(true);
         image.Save(this);
     }
 }
예제 #4
0
파일: SVG.cs 프로젝트: stuart2w/SAW
        public override void DrawImage(MemoryImage image, RectangleF destination, RectangleF sourceRect, System.Drawing.Imaging.ImageAttributes attributes = null)
        {
            if (image.IsSVG && sourceRect.Location.IsEmpty && sourceRect.Size.Equals(image.Size.ToSizeF()))
            {             // sourceRect param was actually redundant as it specifies the entire thing
                          // this check done for efficiency, since if rendering the entire thing we can use SVG, whereas code below generates an entire new image each time
                DrawImage(image, destination, attributes);
                return;
            }
            string ID = PrepareMemoryImage(image, image.GetHashCode(), sourceRect);

            SimpleImage(ID, sourceRect.Size, destination);
        }
예제 #5
0
파일: SharedImage.cs 프로젝트: stuart2w/SAW
 public override void Load(DataReader reader)
 {
     base.Load(reader);
     CRC = reader.ReadInt32();
     if (reader.Version < 76 || reader.ReadBoolean())             // Version 76 onwards start with a boolean indicating what is stored in the object
     {
         m_Image = new MemoryImage(reader);
     }
     else
     {
         m_ResourceName = reader.ReadString();
     }
 }
예제 #6
0
        /// <summary>Adds the given file to the displayed list</summary>
        private void ShowPicture(DisplayedImage image)
        {
            PictureBox  ctr    = new PictureBox();
            MemoryImage memory = new MemoryImage(image.Filename);             // this is used for its SVG handling.  We don't really need the memory buffer overhead!

            ctr.Image        = memory.GetNetImage();
            ctr.Tag          = image;
            ctr.Size         = new Size(100, 100);
            ctr.SizeMode     = PictureBoxSizeMode.Zoom;
            ctr.Margin       = new Padding(10, 10, 10, 10);
            ctr.Padding      = new Padding(10, 10, 10, 10);
            ctr.Click       += Image_Click;
            ctr.DoubleClick += Image_DoubleClick;
            pnlImages.Controls.Add(ctr);
        }
예제 #7
0
        public void btnChangeActivityIcon_Click(object sender, EventArgs e)
        {
            string filename = FileDialog.ShowOpen(FileDialog.Context.Image);

            if (string.IsNullOrEmpty(filename))
            {
                return;
            }
            m_Image = new MemoryImage(filename);
            m_Image.ChangeToBitmap(new Size(144, 144));
            pnlPreviewActivityIcon.Image = m_Image.GetNetImage();
            EnableOK();
            Globals.OnAvailableActivitiesChanged();
            // We should also raise this if the text changes; but that's more complicated if we don't want to raise numerous events, and I'm not sure it's worth the effort
        }
예제 #8
0
파일: SVG.cs 프로젝트: stuart2w/SAW
        private string PrepareMemoryImage(MemoryImage img, int imageKey, RectangleF source)
        {
            if (!img.IsSVG)
            {
                return(PrepareImage((Bitmap)img.GetNetImage(true), imageKey, source));
            }

            // rest for SVG only, which partially repeats PrepareImage (above)
            string     ID     = "img" + imageKey.ToString("x");
            RectangleF bounds = new RectangleF(PointF.Empty, img.Size);

            if (!source.IsEmpty && !source.Equals(bounds))
            {
                ID += "_" + source.GetHashCode();
            }
            if (!m_Images.Contains(ID))
            {             // for SVG images can just retrieve the data directly from the memory image (no need to worry about formats)
                Debug.Assert(img.Buffer != null);
                AddImageToDefinitions(img.Buffer, ID, img.Size, "svg+xml");
            }
            return(ID);
        }
예제 #9
0
파일: Canvas.cs 프로젝트: stuart2w/SAW
 public abstract void DrawImage(MemoryImage image, PointF[] destinationPoints, RectangleF sourceRect, ImageAttributes attributes = null);
예제 #10
0
파일: Canvas.cs 프로젝트: stuart2w/SAW
 // The image can be specified in 3 ways.  cannot just use .net images because PDF/SVG can't really use these.  We need access to the underlying data
 // likewise there are 3 different ways of specifying the coordinates
 public abstract void DrawImage(MemoryImage image, RectangleF destination, ImageAttributes attributes = null);
예제 #11
0
파일: NetCanvas.cs 프로젝트: stuart2w/SAW
 public override void DrawImage(MemoryImage image, PointF[] destinationPoints, RectangleF sourceRect, ImageAttributes attributes = null)
 {
     image.Draw(gr, destinationPoints, sourceRect, attributes);
 }
예제 #12
0
파일: NetCanvas.cs 프로젝트: stuart2w/SAW
 public override void DrawImage(MemoryImage image, RectangleF destination, ImageAttributes attributes = null)
 {
     image.Draw(gr, destination, attributes);
 }
예제 #13
0
파일: SVG.cs 프로젝트: stuart2w/SAW
        public override void DrawImage(MemoryImage image, RectangleF destination, System.Drawing.Imaging.ImageAttributes attributes = null)
        {
            string ID = PrepareMemoryImage(image, image.GetHashCode(), RectangleF.Empty);

            SimpleImage(ID, image.Size, destination);
        }
예제 #14
0
파일: SVG.cs 프로젝트: stuart2w/SAW
        public override void DrawImage(MemoryImage image, PointF[] destinationPoints, RectangleF sourceRect, System.Drawing.Imaging.ImageAttributes attributes = null)
        {
            var ID = PrepareMemoryImage(image, image.GetHashCode(), sourceRect);

            ComplexImage(ID, sourceRect, destinationPoints);
        }