Beispiel #1
0
        //клонировать этот экземпляр
        public override DrawObject Clone()
        {
            DrawImage drawImage = new DrawImage();

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

            //FillDrawObjectFields(drawImage);
            return(drawImage);
        }
Beispiel #2
0
        public void InsertImage(DrawArea drawArea, Image image, bool moveToBack, bool isInitialImage, DrawImage paradigm)
        {
            if (paradigm == null)
            {
                paradigm = new DrawImage(0, 0, isInitialImage);
            }

            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();
        }
Beispiel #3
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);
        }
Beispiel #4
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);
        }
Beispiel #5
0
        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);
            }

            this.Invalidate();
        }