/// <summary>
        /// Clone this instance
        /// </summary>
        public override DrawObject Clone()
        {
            DrawImage drawImage = new DrawImage();

            drawImage._image         = _image;
            drawImage._originalImage = _originalImage;
            drawImage.rectangle      = rectangle;
            drawImage.IsInitialImage = IsInitialImage;

            FillDrawObjectFields(drawImage);
            return(drawImage);
        }
Ejemplo n.º 2
0
        public void InsertImage(DrawArea drawArea, Image image, bool moveToBack, bool isInitialImage, DrawImage paradigm)
        {
            //theImage.Save("D:\\im.bmp", ImageFormat.Bmp);
            if (paradigm == null)
            {
                paradigm = new DrawImage(0, 0, isInitialImage);
            }
            //else
            //{
            //	paradigm.TheImage = (Bitmap)image;
            //}
            AddNewObject(drawArea, paradigm);
            int al = drawArea.TheLayers.ActiveLayerIndex;

            drawArea.TheLayers[al].Graphics[0].MoveHandleTo(new Point(image.Width, image.Height), 5);
            ((DrawImage)drawArea.TheLayers[al].Graphics[0]).TheImage = (Bitmap)image;
            drawArea.AddCommandToHistory(new CommandAdd(drawArea.TheLayers[al].Graphics[0]));
            if (moveToBack)
            {
                drawArea.TheLayers[al].Graphics.MoveSelectionToBack();
            }
            drawArea.TheLayers[al].Graphics.UnselectAll();
        }
        public void LoadInitialImage(Image initialImage, string initialImageAsFilePath, byte[] initialImageAsPngBytes, DrawImage paradigm)
        {
            if (initialImage != null)
            {
                ((ToolImage)tools[(int)DrawToolType.Image]).InsertImage(this, initialImage, true, true, paradigm);
            }

            if (initialImageAsFilePath != null)
            {
                ((ToolImage)tools[(int)DrawToolType.Image]).InsertImage(this, initialImageAsFilePath, true, true, paradigm);
            }

            if (initialImageAsPngBytes != null)
            {
                ((ToolImage)tools[(int)DrawToolType.Image]).InsertImage(this, initialImageAsPngBytes, true, true, paradigm);
            }
            // int al = _layers.ActiveLayerIndex;
            //var temp = this.TheLayers[al].Graphics[0];
            //this.TheLayers[al].Graphics.RemoveAt(0);
            //this.TheLayers[al].Graphics.Add(temp);
            this.Invalidate();
        }
Ejemplo n.º 4
0
        public void InsertImage(DrawArea drawArea, string filePath, bool moveToBack, bool isInitialImage, DrawImage paradigm)
        {
            var theImage = (Bitmap)Bitmap.FromFile(filePath);

            byte[] bytes;
            using (MemoryStream ms = new MemoryStream())
            {
                theImage.Save(ms, ImageFormat.Png);
                bytes = StreamToBytes(ms);
            }
            InsertImage(drawArea, bytes, moveToBack, isInitialImage, paradigm);
        }
Ejemplo n.º 5
0
        public void InsertImage(DrawArea drawArea, byte[] bytes, bool moveToBack, bool isInitialImage, DrawImage paradigm)
        {
            Bitmap theImage;

            using (var ms = new MemoryStream(bytes))
            {
                theImage = (Bitmap)Bitmap.FromStream(ms);
            }
            InsertImage(drawArea, theImage, moveToBack, isInitialImage, paradigm);
        }