Save() public method

public Save ( ) : GraphicsState
return GraphicsState
Ejemplo n.º 1
2
        public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode)
        {
            Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert);

            if (applyRect.Width == 0 || applyRect.Height == 0)
            {
                // nothing to do
                return;
            }
            GraphicsState state = graphics.Save();
            if (Invert)
            {
                graphics.SetClip(applyRect);
                graphics.ExcludeClip(rect);
            }
            ColorMatrix grayscaleMatrix = new ColorMatrix(new[] {
                new[] {.3f, .3f, .3f, 0, 0},
                new[] {.59f, .59f, .59f, 0, 0},
                new[] {.11f, .11f, .11f, 0, 0},
                new float[] {0, 0, 0, 1, 0},
                new float[] {0, 0, 0, 0, 1}
            });
            using (ImageAttributes ia = new ImageAttributes())
            {
                ia.SetColorMatrix(grayscaleMatrix);
                graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia);
            }
            graphics.Restore(state);
        }
Ejemplo n.º 2
0
        private void DrawGrid(System.Drawing.Graphics gfx)
        {
            GraphicsState gstate   = gfx.Save();
            Pen           pen      = new Pen(Color.Red);
            Rectangle     destRect = new Rectangle(0, 0, this.BackBuffer.Width, this.BackBuffer.Height);
            GraphicsPath  path     = new GraphicsPath(FillMode.Alternate);

            for (int index1 = 0; index1 < this._rows; ++index1)
            {
                for (int index2 = 0; index2 < this._cols; ++index2)
                {
                    int x = index2 * this.SnapSize.Width;
                    int y = index1 * this.SnapSize.Height;
                    path.AddRectangle(new Rectangle(x, y, this.SnapSize.Width, this.SnapSize.Height));
                }
            }
            path.Widen(pen);
            Region region = new Region(path);

            gfx.Clip = region;
            gfx.DrawImage((Image)this.BackBuffer, destRect, 0, 0, destRect.Width, destRect.Height, GraphicsUnit.Pixel, this._atts);
            gfx.Restore(gstate);
            region.Dispose();
            pen.Dispose();
        }
Ejemplo n.º 3
0
 public void RedrawDeck()
 {
     if (m_ShowDeck != null)
     {
         System.Drawing.Graphics pGraphics = this.CreateGraphics();
         m_ShowDeck.DrawToGraphics(pGraphics);
     }
     else if (m_DeckList != null)
     {
         System.Drawing.Graphics pGraphics = this.CreateGraphics();
         pGraphics.Clear(Color.Honeydew);
         int count    = m_DeckList.Count;
         int CurrentX = 0;
         for (int i = 0; i < count; i++)
         {
             kernal.PlayedDeck deck = m_DeckList[i];
             Size deckSize          = deck.GetSize();
             var  saveState         = pGraphics.Save();
             pGraphics.TranslateTransform(CurrentX, 0);
             deck.DrawToGraphics(pGraphics);
             pGraphics.Restore(saveState);
             CurrentX += deckSize.Width;
         }
     }
 }
Ejemplo n.º 4
0
        public static Image GetRotateImage(this Image img, float angle)
        {
            angle = angle % 360;//弧度转换
            double radian = angle * Math.PI / 180.0;
            double cos    = Math.Cos(radian);
            double sin    = Math.Sin(radian);
            //原图的宽和高
            int w = img.Width;
            int h = img.Height;
            int W = 80; // (int)(Math.Max(Math.Abs(w * cos - h * sin), Math.Abs(w * cos + h * sin)));
            int H = 80; //(int)(Math.Max(Math.Abs(w * sin - h * cos), Math.Abs(w * sin + h * cos)));
            //目标位图
            Image dsImage = new Bitmap(W, H, img.PixelFormat);

            using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(dsImage))
            {
                g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bilinear;
                g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                //计算偏移量
                Point Offset = new Point((W - w) / 2, (H - h) / 2);
                //构造图像显示区域:让图像的中心与窗口的中心点一致
                Rectangle rect   = new Rectangle(Offset.X, Offset.Y, w, h);
                Point     center = new Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
                g.TranslateTransform(center.X, center.Y);
                g.RotateTransform(360 - angle);
                //恢复图像在水平和垂直方向的平移
                g.TranslateTransform(-center.X, -center.Y);
                g.DrawImage(img, rect);
                //重至绘图的所有变换
                g.ResetTransform();
                g.Save();
            }
            return(dsImage);
        }
Ejemplo n.º 5
0
        public static Bitmap Rotate(Image b, int angle)
        {
            //弧度转换
            double radian = angle * System.Math.PI / 180.0;
            double cos    = System.Math.Cos(radian);
            double sin    = System.Math.Sin(radian);
            //原图的宽和高
            int w = b.Width;
            int h = b.Height;
            int W = (int)(System.Math.Max(System.Math.Abs(w * cos - h * sin), System.Math.Abs(w * cos + h * sin)));
            int H = (int)(System.Math.Max(System.Math.Abs(w * sin - h * cos), System.Math.Abs(w * sin + h * cos)));
            //目标位图
            Bitmap dsImage = new Bitmap(W, H);

            System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(dsImage);
            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bilinear;
            g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            //计算偏移量
            Point Offset = new Point((W - w) / 2, (H - h) / 2);
            //构造图像显示区域:让图像的中心与窗口的中心点一致
            Rectangle rect   = new Rectangle(Offset.X, Offset.Y, w, h);
            Point     center = new Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);

            g.TranslateTransform(center.X, center.Y);
            g.RotateTransform(360 - angle);
            //恢复图像在水平和垂直方向的平移
            g.TranslateTransform(-center.X, -center.Y);
            g.DrawImage(b, rect);
            //重至绘图的所有变换
            g.ResetTransform();
            g.Save();
            g.Dispose();
            //dsImage.Save("yuancd.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
            return(dsImage);
        }
Ejemplo n.º 6
0
		/// <summary>
		/// Implements the Apply code for the Brightness Filet
		/// </summary>
		/// <param name="graphics"></param>
		/// <param name="applyBitmap"></param>
		/// <param name="rect"></param>
		/// <param name="renderMode"></param>
		public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) {
			Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert);

			if (applyRect.Width == 0 || applyRect.Height == 0) {
				// nothing to do
				return;
			}
			GraphicsState state = graphics.Save();
			if (Invert) {
				graphics.SetClip(applyRect);
				graphics.ExcludeClip(rect);
			}
			using (IFastBitmap fastBitmap = FastBitmap.CreateCloneOf(applyBitmap, applyRect)) {
				Color highlightColor = GetFieldValueAsColor(FieldType.FILL_COLOR);
				for (int y = fastBitmap.Top; y < fastBitmap.Bottom; y++) {
					for (int x = fastBitmap.Left; x < fastBitmap.Right; x++) {
						Color color = fastBitmap.GetColorAt(x, y);
						color = Color.FromArgb(color.A, Math.Min(highlightColor.R, color.R), Math.Min(highlightColor.G, color.G), Math.Min(highlightColor.B, color.B));
						fastBitmap.SetColorAt(x, y, color);
					}
				}
				fastBitmap.DrawTo(graphics, applyRect.Location);
			}
			graphics.Restore(state);
		}
Ejemplo n.º 7
0
		public void Draw (Graphics graphics, Route route, bool atEnd)
		{
			if (graphics == null) return;
			if (route == null) return;
			GraphicsState state = graphics.Save();
			float direction = 0;
			PointF pos = default(PointF);
			if (atEnd)
			{
				pos = route.GetEndPoint();
				direction = ConvertDirection(route.GetEndDirection());
			}
			else
			{
				pos = route.GetStartPoint();
				direction = ConvertDirection(route.GetStartDirection());
			}
			
			// In matrix math, the correct way is to put rotation BEFORE
			// translation. However, the simple transformation maethods of
			// GDI+ works in "Prepend" mode, which reverses the order of
			// operations.
			graphics.TranslateTransform(pos.X, pos.Y);
			graphics.RotateTransform(direction);
			
			Paint(graphics);
			graphics.Restore(state);
		}
Ejemplo n.º 8
0
        /// <summary>
        /// Prints an image box onto the specified graphics.
        /// </summary>
        /// <param name="imageBox">Image box to print.</param>
        /// <param name="graphics">Graphics in which image box should be contained.</param>
        /// <param name="box">Rectangle within which the image box should be contained.</param>
        /// <param name="imageResolution">Image resolution.</param>
        public static void Print(this ImageBox imageBox, Graphics graphics, RectF box, int imageResolution)
        {
            var state = graphics.Save();

            FillBox(imageBox.FilmBox, box, graphics);

            var boxCopy = box;
            if (imageBox.FilmBox.Trim == "YES")
            {
                boxCopy.Inflate(-BORDER, -BORDER);
            }

            if (imageBox.ImageSequence != null && imageBox.ImageSequence.Contains(DicomTag.PixelData))
            {
                Image bitmap = null;
                try
                {
                    var image = new DicomImage(imageBox.ImageSequence);
                    var frame = image.RenderImage().As<Image>();

                    bitmap = frame;

                    DrawBitmap(graphics, boxCopy, bitmap, imageResolution, imageBox.FilmBox.EmptyImageDensity);
                }
                finally
                {
                    if (bitmap != null)
                    {
                        bitmap.Dispose();
                    }
                }
            }

            graphics.Restore(state);
        }
Ejemplo n.º 9
0
        protected void PaintTransparentBackground(Graphics g, Rectangle clipRect) {
            // check if we have a parent
            if (this.Parent != null) {
                // convert the clipRects coordinates from ours to our parents
                clipRect.Offset(this.Location);

                PaintEventArgs e = new PaintEventArgs(g, clipRect);
                GraphicsState state = g.Save();

                try {
                    // move the graphics object so that we are drawing in
                    // the correct place
                    g.TranslateTransform((float)-this.Location.X, (float)-this.Location.Y);

                    // draw the parents background and foreground
                    this.InvokePaintBackground(this.Parent, e);
                    this.InvokePaint(this.Parent, e);

                    return;
                } finally {
                    // reset everything back to where they were before
                    g.Restore(state);
                    clipRect.Offset(-this.Location.X, -this.Location.Y);
                }
            }

            // we don't have a parent, so fill the rect with
            // the default control color
            g.FillRectangle(SystemBrushes.Control, clipRect);
        }
        public static void DoVKeys(this WidgetMidiList widget, FloatRect grid, Graphics g)
        {
            var gs  = g.Save();
              // Vertical
              using (var linePen = new Pen(Color.Blue, 1)) foreach (var row in widget.GetVLines(widget.LineOffset))
              {
            var r = new FloatRect(widget.Container.X + 12, row.Top, widget.WidthGutter, widget.LineHeight);

            if (row.CanDo)
            {
              // Note-Number + Piano-KeyName
              var str = string.Format("{0:00#} {1,-3}", row.RowIndex, MKeys[row.RowIndex]);

              // create rect, then move x/y and shrinks w/h by one pixel.
              var rc = new FloatRect(grid.Left, row.Top, grid.Width, widget.LineHeight).Shrink(1);

              using (var sb = new SolidBrush(Color.FromArgb(24, row.IsIvory ? Color.White : Color.Black)))
            if (row.IsIvory) g.FillRectangle(sb, rc);

              var r2 = r.Clone();
              r2.Location = r2.Location.NegX(10);
              g.DrawText(str,Color.White,widget.Font,r2,StringAlignment.Near);

            }
              }
              g.Restore(gs);
        }
Ejemplo n.º 11
0
            protected override void Paint(sd.Graphics graphics, sd.Rectangle clipBounds, sd.Rectangle cellBounds, int rowIndex, swf.DataGridViewElementStates cellState, object value, object formattedValue, string errorText, swf.DataGridViewCellStyle cellStyle, swf.DataGridViewAdvancedBorderStyle advancedBorderStyle, swf.DataGridViewPaintParts paintParts)
            {
                // save graphics state to prevent artifacts in other paint operations in the grid
                var state = graphics.Save();

                if (!ReferenceEquals(cachedGraphicsKey, graphics) || cachedGraphics == null)
                {
                    cachedGraphicsKey = graphics;
                    cachedGraphics    = new Graphics(new GraphicsHandler(graphics, dispose: false));
                }
                else
                {
                    ((GraphicsHandler)cachedGraphics.Handler).SetInitialState();
                }
                graphics.PixelOffsetMode = sd.Drawing2D.PixelOffsetMode.Half;
                graphics.SetClip(cellBounds);
                var color = new sd.SolidBrush(cellState.HasFlag(swf.DataGridViewElementStates.Selected) ? cellStyle.SelectionBackColor : cellStyle.BackColor);

                graphics.FillRectangle(color, cellBounds);
                var args = new CellPaintEventArgs(cachedGraphics, cellBounds.ToEto(), cellState.ToEto(), value);

                Handler.Callback.OnPaint(Handler.Widget, args);
                graphics.ResetClip();
                graphics.Restore(state);
            }
        public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode)
        {
            Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert);

            if (applyRect.Width == 0 || applyRect.Height == 0)
            {
                // nothing to do
                return;
            }
            int magnificationFactor = GetFieldValueAsInt(FieldType.MAGNIFICATION_FACTOR);
            GraphicsState state = graphics.Save();
            if (Invert)
            {
                graphics.SetClip(applyRect);
                graphics.ExcludeClip(rect);
            }
            graphics.SmoothingMode = SmoothingMode.None;
            graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
            graphics.CompositingQuality = CompositingQuality.HighQuality;
            graphics.PixelOffsetMode = PixelOffsetMode.None;
            int halfWidth = rect.Width / 2;
            int halfHeight = rect.Height / 2;
            int newWidth = rect.Width / magnificationFactor;
            int newHeight = rect.Height / magnificationFactor;
            Rectangle source = new Rectangle(rect.X + halfWidth - (newWidth / 2), rect.Y + halfHeight - (newHeight / 2), newWidth, newHeight);
            graphics.DrawImage(applyBitmap, rect, source, GraphicsUnit.Pixel);
            graphics.Restore(state);
        }
Ejemplo n.º 13
0
    static void CombineAllBitmap2()
    {
        string path = Application.dataPath + "/PictureCombine/combine/";
        //合成指定路径的两个图片
        Bitmap bmp1 = new Bitmap(Image.FromFile(path + "TotalCombine.png"));
        Bitmap bmp2 = new Bitmap(Image.FromFile(path + "TotalCombine2.png"));

        int maxWidth = 0;

        if (bmp1.Width >= bmp2.Width)
        {
            maxWidth = bmp1.Width;
        }
        else
        {
            maxWidth = bmp2.Width;
        }

        int    maxHeight = bmp1.Height + bmp2.Height;
        Bitmap newBmp    = new Bitmap(maxWidth, maxHeight);

        System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(newBmp);
        g.DrawImage(bmp1, 0, 0);
        g.DrawImage(bmp2, 0, bmp1.Height);
        g.Save();
        string savePath = Application.dataPath + "/PictureCombine/combine/";

        newBmp.Save(savePath + "TotalCombine3.png", ImageFormat.Png);
        Debug.Log("CombineAllBitmap2 Finish");
    }
Ejemplo n.º 14
0
        public static void DrawFocusedItemMark(System.Drawing.Graphics g, float x, float y, bool drawWhiteBounds = false)
        {
            if (focusedItemMark == null)
            {
                var b = FocusedItemMarkBounds;
                focusedItemMark = new GraphicsPath();
                focusedItemMark.AddPolygon(new []
                {
                    new PointF(0, b.Top),
                    new PointF(b.Width - 1, 0),
                    new PointF(0, b.Bottom),
                });
                focusedItemMarkBorder = new GraphicsPath();
                focusedItemMarkBorder.AddPolygon(new[]
                {
                    new PointF(0, b.Top - 1.5f),
                    new PointF(b.Width, 0),
                    new PointF(0, b.Bottom + 1.5f),
                });
            }

            GraphicsState state = g.Save();

            g.TranslateTransform(x, y);
            g.SmoothingMode = SmoothingMode.AntiAlias;
            g.FillPath(System.Drawing.Brushes.Blue, focusedItemMark);
            if (drawWhiteBounds)
            {
                g.DrawPath(System.Drawing.Pens.White, focusedItemMarkBorder);
            }
            g.Restore(state);
        }
Ejemplo n.º 15
0
 public unsafe override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode)
 {
     int blurRadius = GetFieldValueAsInt(FieldType.BLUR_RADIUS);
     double previewQuality = GetFieldValueAsDouble(FieldType.PREVIEW_QUALITY);
     Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert);
     if (applyRect.Width == 0 || applyRect.Height == 0)
     {
         return;
     }
     GraphicsState state = graphics.Save();
     if (Invert)
     {
         graphics.SetClip(applyRect);
         graphics.ExcludeClip(rect);
     }
     if (GDIplus.IsBlurPossible(blurRadius))
     {
         GDIplus.DrawWithBlur(graphics, applyBitmap, applyRect, null, null, blurRadius, false);
     }
     else
     {
         using (IFastBitmap fastBitmap = FastBitmap.CreateCloneOf(applyBitmap, applyRect))
         {
             ImageHelper.ApplyBoxBlur(fastBitmap, blurRadius);
             fastBitmap.DrawTo(graphics, applyRect);
         }
     }
     graphics.Restore(state);
     return;
 }
Ejemplo n.º 16
0
 public void DrawImage(Image source, ImagePosition position)
 {
     using (System.Drawing.Graphics drawing = System.Drawing.Graphics.FromImage(this.__img))
     {
         drawing.DrawImage(source.__img, position.X, position.Y);
         drawing.Save();
     }
 }
Ejemplo n.º 17
0
        public static Bitmap FontToTexture(Font font, out List <Vector4> texCoords, out List <Vector2> pSizes)
        {
            var backgroundColor = Color.FromArgb(0, 0, 0, 0);
            var textColor       = Color.FromArgb(255, 0, 0, 0);
            var img             = new Bitmap(1, 1);

            System.Drawing.Graphics drawing = System.Drawing.Graphics.FromImage(img);

            SizeF textSize = SizeF.Empty;

            for (int i = 0; i < CharSheet.Length; i++)
            {
                var s = drawing.MeasureString(CharSheet[i].ToString(), font);
                textSize = new SizeF(s.Width + textSize.Width, Math.Max(textSize.Height, s.Height));
            }

            img.Dispose();
            drawing.Dispose();

            img = new Bitmap((int)textSize.Width, (int)textSize.Height);

            drawing = System.Drawing.Graphics.FromImage(img);

            drawing.Clear(backgroundColor);

            Brush textBrush = new SolidBrush(textColor);

            texCoords = new List <Vector4>();
            pSizes    = new List <Vector2>();
            var chars = CharSheet.ToCharArray();

            float total = 0;

            for (int p = 0; p < CharSheet.Length; p++)
            {
                char c = chars[p];
                drawing.DrawString(c.ToString(), font, textBrush,
                                   total, 0);

                var sizeF = drawing.MeasureString(c.ToString(), font);

                var x      = total / img.Width;
                var width  = sizeF.Width / img.Width;
                var height = sizeF.Height / img.Height;

                texCoords.Add(new Vector4(x + width * 0.1f, 0, width * 0.9f, height));
                //pSizes.Add(new Vector2(1, 1));
                pSizes.Add(new Vector2((1 - 1 / sizeF.Width) * 0.8f, 1 - 1 / sizeF.Height));
                total += sizeF.Width;
            }

            drawing.Save();

            textBrush.Dispose();
            drawing.Dispose();

            return(img);
        }
Ejemplo n.º 18
0
 protected override void Render(System.Drawing.Graphics gfx)
 {
     base.Render(gfx);
     System.Drawing.Drawing2D.GraphicsState graph = gfx.Save();
     if (TextImage != null && DrawImage)
     {
         gfx.DrawImage(TextImage, ImageOffsetX, ImageOffsetY, 17.5f, 17.5f);
         gfx.Restore(graph);
     }
 }
Ejemplo n.º 19
0
 public Image Resize(ImageSize size)
 {
     System.Drawing.Bitmap img = new System.Drawing.Bitmap(size.Width, size.Height, PixelFormat.Format32bppArgb);
     using (System.Drawing.Graphics drawing = System.Drawing.Graphics.FromImage(img))
     {
         drawing.DrawImage(this.__img, 0, 0, size.Width, size.Height);
         drawing.Save();
     }
     return(new Image(img));
 }
Ejemplo n.º 20
0
 protected override void Render(System.Drawing.Graphics gfx)
 {
     base.Render(gfx);
     System.Drawing.Drawing2D.GraphicsState graph = gfx.Save();
     if (TitleImage != null)
     {
         gfx.DrawImage(TitleImage, (this.PinPoint.X - 25) + (this.Size.Width - this.PinPoint.X), 5, 17.5f, 17.5f);
     }
     gfx.Restore(graph);
 }
Ejemplo n.º 21
0
 protected override void Render(System.Drawing.Graphics gfx)
 {
     base.Render(gfx);
     System.Drawing.Drawing2D.GraphicsState graph = gfx.Save();
     if (RowImage != null)
     {
         gfx.DrawImage(RowImage, this.Labels[0].OffsetX - 20, 2, 17.5f, 17.5f);
         gfx.Restore(graph);
     }
 }
Ejemplo n.º 22
0
		public virtual void DrawToGraphics (Graphics graphics, float x, float y, float scaleX, float scaleY)
		{
			if (graphics == null) return;

			GraphicsState state = graphics.Save();
			graphics.TranslateTransform (x, y);
			graphics.ScaleTransform(scaleX, scaleY);
			Draw(graphics);
			//graphics.DrawRectangle(Pens.Magenta, 0, 0, ShapeWidth, ShapeHeight);
			graphics.Restore(state);
		}
Ejemplo n.º 23
0
		public override void Draw(Graphics graphics)
		{
			if (graphics == null) return;
			GraphicsState state = graphics.Save();
			graphics.TranslateTransform(17.0f, 0.0f);
			graphics.ScaleTransform(-1.0f, 1.0f);
			MethodShape.DrawBrick(graphics, brickBrush1, brickBrush2, brickBrush3);
			graphics.Restore(state);
			graphics.FillRectangle(Brushes.Gray, 1.0f, 4.5f, 3.5f, 0.5f);
			graphics.FillRectangle(Brushes.Gray, 0.0f, 6.5f, 3.5f, 0.5f);
			graphics.FillRectangle(Brushes.Gray, 2.0f, 8.5f, 3.5f, 0.5f);
		}
        protected override void PaintPanel(Graphics g)
        {
            if (g == null) throw new ArgumentNullException("g");
            var scroll = Hexgrid.ScrollPosition;
            if (DesignMode) { g.FillRectangle(Brushes.Gray, ClientRectangle); return; }

            g.Clear(Color.Black);

            if (IsTransposed) { g.Transform = TransposeMatrix; }
            g.TranslateTransform(scroll.X, scroll.Y);
            g.ScaleTransform(MapScale, MapScale);

            var state = g.Save();
            g.DrawImageUnscaled(MapBuffer, Point.Empty);

            g.Restore(state); state = g.Save();
            Host.PaintUnits(g);

            g.Restore(state); state = g.Save();
            Host.PaintHighlight(g);
        }
Ejemplo n.º 25
0
    static Bitmap CombineGifBitmap(Bitmap bmp1, Bitmap bmp2, int lastWidth, int lastHeight, Boolean isNextRow, Boolean isSave, string saveName)
    {
        int maxHeight = 0;

        if (isNextRow)
        {
            maxHeight        = bmp1.Height + bmp2.Height;
            gifLastRowHeight = bmp1.Height;
        }
        else
        {
            //一旦换行过程中,后续的表情比前面的高,会出现表情存储部分的情况,需要记录上一行的高度
            if (gifCurRow == 0)
            {
                if (bmp2.Height > bmp1.Height)
                {
                    maxHeight = bmp2.Height;
                }
                else
                {
                    maxHeight = bmp1.Height;
                }
            }
            else
            {
                maxHeight = gifLastRowHeight + bmp2.Height;
            }
        }

        //记录图片的最高高度
        if (maxHeight >= gifMaxHeight)
        {
            gifMaxHeight = maxHeight;
        }

        //限定最大宽度,进行换行排列图片,节省空间
        Bitmap newBmp = new Bitmap(maxWidth, gifMaxHeight);

        System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(newBmp);
        g.DrawImage(bmp1, 0, 0);
        g.DrawImage(bmp2, lastWidth, lastHeight);
        g.Save();

        string savePath = Application.dataPath + "/PictureCombine/combine/";

        if (isSave)
        {
            newBmp.Save(savePath + saveName + ".png", ImageFormat.Png);
        }

        return(newBmp);
    }
Ejemplo n.º 26
0
        /// <summary>
        /// Mouse move function.
        /// </summary>
        /// <param name="document">Informations transferred from DrawingPanel.</param>
        /// <param name="e">MouseEventArgs.</param>
        public override void MouseMove(IDocument document, MouseEventArgs e)
        {
            MouseLoc = e.Location;

            if (document.DrawingControl is DrawingPanel)
            {
                CurrentPen.Width = (document.DrawingControl as DrawingPanel).CurrentPen.Width;
                CurrentPen.Color = (document.DrawingControl as DrawingPanel).ImageBackColor;
            }

            var zoomFactor = baseDocument.ZoomFactor;//

            if (baseDocument.BackgroundLayer != null)
            {
                zoomFactor = baseDocument.BackgroundLayer.Dimension.Width / baseDocument.BackgroundLayer.Bitmap.Width;
            }

            if (!MousePressed)
            {
                return;
            }

            this.isAnnotationActive = true;



            if (selectedShape != null && g != null)
            {
                if (selectedShape.Contains(e.Location))
                {
                    if (document.DrawingControl is DrawingPanel)
                    {
                        CurrentPen.Color = (document.DrawingControl as DrawingPanel).ImageBackColor;
                    }

                    var recEllips = new RectangleF((e.Location.X - selectedShape.Location.X - (CurrentPen.Width * zoomFactor / 2)) / (zoomFactor),
                                                   (e.Location.Y - selectedShape.Location.Y - (CurrentPen.Width * zoomFactor / 2)) / (zoomFactor),
                                                   this.CurrentPen.Width, this.CurrentPen.Width);

                    g.DrawEllipse(new Pen(CurrentPen.Color, 1), recEllips);
                    g.FillEllipse(new SolidBrush(CurrentPen.Color), recEllips);

                    g.Save();

                    // document.DrawingControl.Cursor = new Cursor(GetType(), "Eraser.cur");
                }
                else
                {
                    // document.DrawingControl.Cursor = Cursors.No;
                }
            }
        }
Ejemplo n.º 27
0
 public void Decode()
 {
     //Debug.Assert(false);
     using (Bitmap bmp = new System.Drawing.Bitmap(this.__filename))
     {
         this.__img = new System.Drawing.Bitmap(bmp.Width, bmp.Height, PixelFormat.Format32bppArgb);
         using (System.Drawing.Graphics drawing = System.Drawing.Graphics.FromImage(this.__img))
         {
             drawing.DrawImage(bmp, 0, 0);
             drawing.Save();
         }
     }
 }
Ejemplo n.º 28
0
    static Bitmap CombineStaticBitmap(Bitmap bmp1, Bitmap bmp2, int lastWidth, int lastHeight, Boolean isNextRow, Boolean isSave, string saveName)
    {
        int maxHeight = 0;

        if (isNextRow)
        {
            maxHeight        = bmp1.Height + bmp2.Height;
            pngLastRowHeight = bmp1.Height;
        }
        else
        {
            if (gifCurRow == 0)
            {
                if (bmp2.Height > bmp1.Height)
                {
                    maxHeight = bmp2.Height;
                }
                else
                {
                    maxHeight = bmp1.Height;
                }
            }
            else
            {
                maxHeight = pngLastRowHeight + bmp2.Height;
            }
        }

        //记录当前行的最高高度,作用下一行绘图开始坐标
        if (maxHeight >= pngMaxHeight)
        {
            pngMaxHeight = maxHeight;
        }

        Bitmap newBmp = new Bitmap(maxWidth, pngMaxHeight);

        System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(newBmp);
        g.DrawImage(bmp1, 0, 0);
        g.DrawImage(bmp2, lastWidth, lastHeight);
        g.Save();

        string savePath = Application.dataPath + "/PictureCombine/combine/";

        if (isSave)
        {
            newBmp.Save(savePath + saveName + ".png", ImageFormat.Png);
        }

        return(newBmp);
    }
Ejemplo n.º 29
0
        private void DrewHisgram()
        {
            double[] Properbility = new double[256];
            Color    color        = new Color();
            double   maxColorProperbility;
            string   ColorMode = (string)cmbChannal.Text;

            switch (ColorMode)
            {
            case "Red":
                /*...*/
                color                = Color.Red;
                Properbility         = this.CountProbability(bmpInfo.Red);
                maxColorProperbility = this.MaxProbability(bmpInfo.Red);
                break;

            case "Green":
                /*...*/
                color                = Color.Green;
                Properbility         = this.CountProbability(bmpInfo.Green);
                maxColorProperbility = this.MaxProbability(bmpInfo.Green);
                break;

            case "Blue":
                /*...*/
                color                = Color.Blue;
                Properbility         = this.CountProbability(bmpInfo.Blue);
                maxColorProperbility = this.MaxProbability(bmpInfo.Blue);
                break;

            default:
                return;
            }
            Pen    pen     = new Pen(color, 1);
            Bitmap hisgBmp = new Bitmap(256, 256);

            System.Drawing.Graphics g = System.Drawing.Graphics.FromImage((Image)hisgBmp);
            int y;

            for (int i = 0; i < 256; i++)
            {
                double percent = Properbility[i] / maxColorProperbility;  // 当前灰度级与最大灰度级的比率
                y = (int)(256 * (1 - percent));
                g.DrawLine(pen, i, y, i, 256);
            }
            g.Save();
            g.Dispose();
            picHisg.Image = hisgBmp;
            return;
        }
Ejemplo n.º 30
0
        public override void Render(System.Drawing.Rectangle rectangle, System.Drawing.Graphics graphics)
        {
            GraphicsState s = graphics.Save();

            Rectangle rt = new System.Drawing.Rectangle(0, 0, 57, 88);

            graphics.TranslateTransform(-rt.Width / 2, -rt.Height / 2, MatrixOrder.Append);
            graphics.RotateTransform(20, MatrixOrder.Append);
            graphics.TranslateTransform(((rectangle.X + rectangle.Width)) / 2, ((rectangle.Y + rectangle.Height)) / 2, MatrixOrder.Append);


            graphics.FillRectangle(Brushes.White, rt);
            graphics.Restore(s);
        }
Ejemplo n.º 31
0
		internal override void draw(Graphics g)
		{
			RectangleF rcNode = item.getRotatedBounds();
			Rectangle rcDev = Utilities.docToDevice(g, getIconRect(rcNode));

			if (rcDev.Width < 6 || rcDev.Height < 6) return;
GraphicsState state = g.Save();
item.flowChart.unsetTransforms(g);
			if ((item as Node).Expanded)
				g.DrawIcon(imgExpanded, rcDev.X, rcDev.Y);
			else
				g.DrawIcon(imgCollapsed, rcDev.X, rcDev.Y);
g.Restore(state);
		}
Ejemplo n.º 32
0
 public Image(ImageMode mode, ImageSize size, ImageColor color)
 {
     //Debug.Assert(mode == ImageMode.Rgba); //FIXME:???
     //PixelFormat.
     __img = new System.Drawing.Bitmap(size.Width,
                                       size.Height,
                                       PixelFormat.Format32bppArgb);
     System.Drawing.Color _backColor = System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B);
     using (System.Drawing.Graphics drawing = System.Drawing.Graphics.FromImage(__img))
     {
         drawing.Clear(_backColor);
         drawing.Save();
     }
 }
        private void DrawElement(Graphics g, Act2DMapLayoutObject.Element e)
        {
            var bitmap = file.CreateBitmapForResource(e.resourceID);
            if (bitmap == null) return;

            var saved = g.Save();
            g.TranslateTransform(e.x, e.y);
            g.TranslateTransform(bitmap.Width * 0.5f, bitmap.Height * 0.5f);
            g.RotateTransform(e.rotate);
            g.ScaleTransform(e.scale_x, e.scale_y);
            g.TranslateTransform(-bitmap.Width * 0.5f, -bitmap.Height * 0.5f);
            g.DrawImage(bitmap, new PointF(0.0f, 0.0f));
            g.Restore(saved);
        }
Ejemplo n.º 34
0
    ///// https://answers.unity.com/answers/514209/view.html
    //IEnumerator CaptureTextArea() {
    //    //Run at the end of frame so we get the most recent data
    //    //(otherwise Unity kicks up a fuss about buffers).
    //    yield return new WaitForEndOfFrame();

    //    int width = Mathf.FloorToInt(TextAreaRect.width);
    //    int height = Mathf.FloorToInt(TextAreaRect.height);
    //    Texture2D text_texture = new Texture2D(width, height, TextureFormat.RGB24, false);

    //    Rect tempRect = TextAreaRect;
    //    //There's probably a tidier way to calculate this:
    //    //Flip to match the Y axis properly.
    //    tempRect.y = Screen.height - TextAreaRect.y - TextAreaRect.height;

    //    //Grab the pixels from the system buffer.
    //    text_texture.ReadPixels(tempRect, 0, 0);
    //    text_texture.Apply(); //Apply the read.
    //    ocr_mat.mainTexture = text_texture;
    //    ivy.GetComponent<RTIvyController>().SendLeaveMaterial(ocr_mat);
    //    isIvy = false;
    //}

    /// <summary>
    /// Converting text to image (png).
    /// </summary>
    /// <param name="text">text to convert</param>
    /// <param name="font">Font to use</param>
    /// <param name="path">path to save the image</param>
    static IEnumerator DrawText(String text, int maxWidth, String path)
    {
        yield return(new WaitForEndOfFrame());

        //first, create a dummy bitmap just to get a graphics object
        Image img = new Bitmap(1, 1);

        System.Drawing.Graphics drawing = System.Drawing.Graphics.FromImage(img);
        //measure the string to see how big the image needs to be
        SizeF textSize = drawing.MeasureString(text, font, maxWidth);

        //set the stringformat flags to rtl
        StringFormat sf = new StringFormat();

        //uncomment the next line for right to left languages
        //sf.FormatFlags = StringFormatFlags.DirectionRightToLeft;
        sf.Trimming = StringTrimming.Word;
        //free up the dummy image and old graphics object
        img.Dispose();
        drawing.Dispose();

        //create a new image of the right size
        img = new Bitmap((int)textSize.Width, (int)textSize.Height);

        drawing = System.Drawing.Graphics.FromImage(img);
        //Adjust for high quality
        drawing.CompositingQuality = CompositingQuality.HighQuality;
        drawing.InterpolationMode  = InterpolationMode.HighQualityBilinear;
        drawing.PixelOffsetMode    = PixelOffsetMode.HighQuality;
        drawing.SmoothingMode      = SmoothingMode.HighQuality;
        drawing.TextRenderingHint  = TextRenderingHint.AntiAliasGridFit;

        //paint the background
        drawing.Clear(System.Drawing.Color.Transparent);

        //create a brush for the text
        Brush textBrush = new SolidBrush(black);

        Debug.Log("drawing...");

        drawing.DrawString(text, font, textBrush, new RectangleF(0, 0, textSize.Width, textSize.Height), sf);
        drawing.Save();

        textBrush.Dispose();
        drawing.Dispose();
        img.Save(path, ImageFormat.Png);
        Debug.Log("done!");
        img.Dispose();
    }
Ejemplo n.º 35
0
        public static void RotateImage(Stream originalStream, string thumbnailPath, int angle)
        {
            Image originalImage = Image.FromStream(originalStream);

            angle = angle % 360;
            //弧度转换
            double radian = angle * Math.PI / 180.0;
            double cos    = Math.Cos(radian);
            double sin    = Math.Sin(radian);
            //原图的宽和高
            int w = originalImage.Width;
            int h = originalImage.Height;
            int W = (int)(Math.Max(Math.Abs(w * cos - h * sin), Math.Abs(w * cos + h * sin)));
            int H = (int)(Math.Max(Math.Abs(w * sin - h * cos), Math.Abs(w * sin + h * cos)));
            //目标位图
            Bitmap dsImage = new Bitmap(W, H);

            System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(dsImage);
            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bilinear;
            g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            //计算偏移量
            Point Offset = new Point((W - w) / 2, (H - h) / 2);
            //构造图像显示区域:让图像的中心与窗口的中心点一致
            Rectangle rect   = new Rectangle(Offset.X, Offset.Y, w, h);
            Point     center = new Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);

            g.TranslateTransform(center.X, center.Y);
            g.RotateTransform(360 - angle);
            //恢复图像在水平和垂直方向的平移
            g.TranslateTransform(-center.X, -center.Y);
            g.DrawImage(originalImage, rect);
            //重至绘图的所有变换
            g.ResetTransform();
            g.Save();
            try
            {
                dsImage.Save(thumbnailPath);
            }
            catch
            {
                throw;
            }
            finally
            {
                originalImage.Dispose();
                dsImage.Dispose();
                g.Dispose();
            }
        }
Ejemplo n.º 36
0
        private void ResponseValidateCode(string p_Code)
        {
            g_BitMap = new Bitmap(60, 20, PixelFormat.Format32bppArgb);
            g_Graphics = Graphics.FromImage(g_BitMap);
            g_Graphics.FillRectangle(new LinearGradientBrush(new Point(0, 0), new Point(110, 20), Color.FromArgb(240, 255, 255, 255), Color.FromArgb(240, 255, 255, 255)), 0, 0, 200, 200);
            g_Graphics.DrawString(p_Code, new Font("arial", 11), new SolidBrush(Color.Red), new PointF(6, 0));
            g_Graphics.Save();

            MemoryStream o_MemoryStream = new MemoryStream();
            g_BitMap.Save(o_MemoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);
            Response.ClearContent();
            Response.Clear();
            Response.BinaryWrite(o_MemoryStream.ToArray());
            Response.End();
        }
Ejemplo n.º 37
0
        /// <summary>
        /// Draw grid cells
        /// </summary>
        private void DrawGrid(System.Drawing.Graphics gfx)
        {
            // Save state
            GraphicsState state = gfx.Save();

            // Created invert pen
            Pen pen = new Pen(Color.Red);

            // Get rendering rectangle
            Rectangle rect = new Rectangle(0, 0, BackBuffer.Width, BackBuffer.Height);

            // Create a new graphics path for inverted lines
            GraphicsPath path = new GraphicsPath(FillMode.Alternate);

            // Iterate through vertical tiles
            for (int row = 0; row < _rows; row++)
            {
                // Iterate through horizontal tiles
                for (int col = 0; col < _cols; col++)
                {
                    // Get position coordinates
                    int x = col * SnapSize.Width;
                    int y = row * SnapSize.Height;

                    // Add rectangle path
                    path.AddRectangle(new Rectangle(x, y, SnapSize.Width, SnapSize.Height));
                }
            }

            // Widen the path with pen
            path.Widen(pen);

            // Create new region
            Region region = new Region(path);

            // Set the region
            gfx.Clip = region;

            // Draw the backbuffer image
            gfx.DrawImage(BackBuffer, rect, 0, 0, rect.Width, rect.Height, GraphicsUnit.Pixel, _atts);

            // Restore the graphics state to non-inverted
            gfx.Restore(state);

            // Dispose of all temp objects
            region.Dispose();
            pen.Dispose();
        }
Ejemplo n.º 38
0
        } // end of Crop

        /// <summary>
        /// 以逆时针方向为正方向对图像进行旋转
        /// </summary>
        /// <param name="b">位图流</param>
        /// <param name="angle">旋转角度[0, 360]</param>
        /// <returns></returns>
        public Bitmap Rotate(Bitmap b, int angle)
        {
            angle = angle % 360;

            // 弧度转化
            double radian = angle * Math.PI / 180.0;
            double cos    = Math.Cos(radian);
            double sin    = Math.Sin(radian);

            // 原图宽高
            int w = b.Width;
            int h = b.Height;

            // 新图的宽高
            int W = (int)(Math.Max(Math.Abs(w * cos - h * sin), Math.Abs(w * cos + h * sin)));
            int H = (int)(Math.Max(Math.Abs(w * sin - h * cos), Math.Abs(w * sin + h * cos)));

            // 目标位图,即旋转后的图
            Bitmap dstImage = new Bitmap(W, H);

            System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(dstImage);
            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bilinear;
            g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

            // 偏移量
            Point offset = new Point((W - w) / 2, (H - h) / 2);

            // 构造图像显示区域:让图像的中心点与窗口的中心点一致
            Rectangle rect   = new Rectangle(offset.X, offset.Y, w, h);
            Point     center = new Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);

            // 以图像的中心点旋转
            g.TranslateTransform(center.X, center.Y);
            g.RotateTransform(360 - angle);

            // 恢复图像在水平和垂直方向的平移
            g.TranslateTransform(-center.X, -center.Y);

            // 绘制旋转后的结果图
            g.DrawImage(b, rect);

            // 重置绘图的所有变换
            g.ResetTransform();

            g.Save();

            return(dstImage);
        } // end of Rotate
Ejemplo n.º 39
0
        protected override void DrawToolTip(Graphics g, GMapMarker m, int x, int y)
        {
            GraphicsState s = g.Save();
            g.SmoothingMode = SmoothingMode.AntiAlias;

            System.Drawing.Size st = g.MeasureString(m.ToolTipText, TooltipFont).ToSize();
            System.Drawing.Rectangle rect = new System.Drawing.Rectangle(x, y, st.Width + Control.TooltipTextPadding.Width, st.Height + Control.TooltipTextPadding.Height);
            rect.Offset(m.ToolTipOffset.X, m.ToolTipOffset.Y);

            g.DrawLine(TooltipPen, x, y, rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
            g.FillRectangle(TooltipBackground, rect);
            g.DrawRectangle(TooltipPen, rect);
            g.DrawString(m.ToolTipText, TooltipFont, Brushes.Navy, rect, TooltipFormat);

            g.Restore(s);
        }
Ejemplo n.º 40
0
        public Image RotateImg(Image b, float angle)
        {
            //Bitmap bmpsource=new Bitmap(img);
            //Bitmap bmpsrc=new Bitmap(bmpsource.Width,bmpsource.Height);
            //Rectangle rect = new Rectangle(0, 0, bmpsource.Width, bmpsource.Height);
            //Graphics g = Graphics.FromImage(bmpsource);
            //g.RotateTransform(angle);
            //g.DrawImage(bmpsrc,rect);
            //g.Dispose();
            ////MessageBox.Show("1");
            //return bmpsrc;
            angle = angle % 360;
            //弧度转换
            double radian = angle * Math.PI / 180.0;
            double cos    = Math.Cos(radian);
            double sin    = Math.Sin(radian);
            //原图的宽和高
            int w = b.Width;
            int h = b.Height;
            int W = (int)(Math.Max(Math.Abs(w * cos - h * sin), Math.Abs(w * cos + h * sin)));
            int H = (int)(Math.Max(Math.Abs(w * sin - h * cos), Math.Abs(w * sin + h * cos)));
            //目标位图
            Bitmap dsImage = new Bitmap(W, H);

            System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(dsImage);
            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bilinear;
            g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            //计算偏移量
            Point Offset = new Point((W - w) / 2, (H - h) / 2);
            //构造图像显示区域:让图像的中心与窗口的中心点一致
            Rectangle rect   = new Rectangle(Offset.X, Offset.Y, w, h);
            Point     center = new Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);

            g.TranslateTransform(center.X, center.Y);
            g.RotateTransform(360 - angle);
            //恢复图像在水平和垂直方向的平移
            g.TranslateTransform(-center.X, -center.Y);
            g.DrawImage(b, rect);
            //重至绘图的所有变换
            g.ResetTransform();
            g.Save();
            g.Dispose();
            //保存旋转后的图片
            b.Dispose();
            //dsImage.Save("FocusPoint.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
            return(dsImage);
        }
        /// <summary>
        /// 图片旋转子函数
        /// </summary>
        /// <param name="b">源图片</param>
        /// <param name="angle">角度</param>
        /// <returns>(无返回值)</returns>
            public Image RotateImg(Image b, int angle)
            
        {
               angle = angle % 360;
               //弧度转换
               double radian = angle * Math.PI / 180.0;
               double cos    = Math.Cos(radian);
               double sin    = Math.Sin(radian);
               //原图的宽和高
               int w = b.Width;
               int h = b.Height;
               int W = (int)(Math.Max(Math.Abs(w * cos - h * sin), Math.Abs(w * cos + h * sin)));
               int H = (int)(Math.Max(Math.Abs(w * sin - h * cos), Math.Abs(w * sin + h * cos)));
               //目标位图
               Bitmap dsImage            = new Bitmap(W, H);
               System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(dsImage);
               g.InterpolationMode       = System.Drawing.Drawing2D.InterpolationMode.Bilinear;
               g.SmoothingMode           = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
               //计算偏移量
               Point Offset = new Point((W - w) / 2, (H - h) / 2);
               //构造图像显示区域:让图像的中心与窗口的中心点一致
               Rectangle rect   = new Rectangle(Offset.X, Offset.Y, w, h);
               Point     center = new Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
               g.TranslateTransform(center.X, center.Y);

               g.RotateTransform(360 - angle);

               //恢复图像在水平和垂直方向的平移
               g.TranslateTransform(-center.X, -center.Y);

               g.DrawImage(b, rect);

               //重至绘图的所有变换
               g.ResetTransform();

               g.Save();

               g.Dispose();

               //显示旋转后的图片
            b.Dispose();

            pictureBox4.Image = dsImage;
            return(dsImage);

              
        }
        /// <summary>
        /// 图片缩放
        /// </summary>
        /// <param name="b">源图片Bitmap</param>
        /// <param name="dstWidth">目标宽度</param>
        /// <param name="dstHeight">目标高度</param>
        /// <returns>处理完成的图片 Bitmap</returns>
        private Bitmap ResizeBitmap(Bitmap b, int dstWidth, int dstHeight)
        {
            Bitmap dstImage = new Bitmap(dstWidth, dstHeight);

            System.Drawing.Graphics g = Graphics.FromImage(dstImage);
            //   设置插值模式
            g.InterpolationMode = InterpolationMode.Bilinear;
            //   设置平滑模式
            g.SmoothingMode     = SmoothingMode.HighQuality;
            g.SmoothingMode     = SmoothingMode.HighQuality;
            g.InterpolationMode = InterpolationMode.HighQualityBicubic;
            //用Graphic的DrawImage方法通过设置大小绘制新的图片实现缩放
            g.DrawImage(b, new Rectangle(0, 0, dstImage.Width, dstImage.Height), new Rectangle(0, 0, b.Width, b.Height), GraphicsUnit.Pixel);
            g.Save();
            g.Dispose();
            return(dstImage);
        }
Ejemplo n.º 43
0
        private void draw_ckt(int zoom)
        {
            //drawing circutes

            nor_of_rows = 0;
            simplify_expression se = new simplify_expression(logical_exp);

            label1.Text = se.str;
            foreach (String val in se.str.Split(','))
            {
                divide_gates_for_row dgfr = new divide_gates_for_row(val);
                foreach (String v in dgfr.gates.Split('+'))
                {
                    nor_of_rows += v.Split('@').Length;
                }
            }
            richTextBox1.AppendText("Origina exp=" + logical_exp + "\n");
            Log.write_log("Origina exp=" + logical_exp + "\n");
            richTextBox1.AppendText("Simplified exp=" + se.str + "\n");
            Log.write_log("Simplified exp=" + se.str + "\n");

            String img_file = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\guru\\ckt_" + object_property.file_count + ".png";

            richTextBox1.AppendText("nor_of_rows=" + nor_of_rows + "\n");
            Log.write_log("nor_of_rows=" + nor_of_rows + "\n");
            richTextBox1.ScrollToCaret();
            label2.Text = zoom.ToString();
            System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetExecutingAssembly();
            System.Drawing.Graphics    g          = panel1.CreateGraphics();
            g.Clear(Color.White);
            draw_line(zoom, myAssembly, g);
            draw_Gates(zoom, myAssembly, g);
            g.Save();

            ckt_img = new Bitmap(panel1.Width, panel1.Height + 100);
            Graphics g2 = Graphics.FromImage(ckt_img);

            g2.Clear(Color.White);
            draw_line(zoom, myAssembly, g2);
            draw_Gates(zoom, myAssembly, g2);
            new draw_string(se.str, g2, 30, panel1.Height + 20, System.Drawing.Color.Red, 11, panel1.Width, 40);
            new draw_string("Dr AIT Mini project CSE", g2, panel1.Width - 290, panel1.Height + 25, System.Drawing.Color.Red, 14, 290, 100);
            ckt_img.Save(img_file, ImageFormat.Png);
            panel1.Refresh();
            //  g.Dispose();
        }
Ejemplo n.º 44
0
        private static Bitmap CaptureScreen(double x, double y, double width, double height)
        {
            int ix = Convert.ToInt32(x);
            int iy = Convert.ToInt32(y);
            int iw = Convert.ToInt32(width);
            int ih = Convert.ToInt32(height);

            System.Drawing.Bitmap bitmap = new Bitmap(iw, ih);
            using (System.Drawing.Graphics graphics = Graphics.FromImage(bitmap))
            {
                graphics.CopyFromScreen(ix, iy, 0, 0, new System.Drawing.Size(iw, ih));
                graphics.Save();
                bitmap.Save(@"C:\p" + DateTime.Now.ToShortDateString().Replace("/", "") + ".jpg", System.Drawing.Imaging.ImageFormat.Png);
            }

            return(bitmap);
        }
		public override void Draw(Graphics graphics)
		{
			if (graphics == null) return;
			GraphicsState state = graphics.Save();
			CollapseExpandShape.DrawButton(graphics);
			
			if (collapsed)
			{
				graphics.TranslateTransform(0, 21);
				graphics.ScaleTransform(1, -1);
			}

			CollapseExpandShape.DrawArrow(graphics);
			graphics.TranslateTransform(0, 6);
			CollapseExpandShape.DrawArrow(graphics);
			graphics.Restore(state);
		}
Ejemplo n.º 46
0
        public override void Render(GDI.Graphics g, Map map)
        {
            if (map.Center == null)
            {
                throw (new ApplicationException("Cannot render map. View center not specified"));
            }

            g.SmoothingMode = SmoothingMode;
            var envelope = ToSource(map.Envelope); //View to render

            if (DataSource == null)
            {
                throw (new ApplicationException("DataSource property not set on layer '" + LayerName + "'"));
            }

            // Get the transform
            var transform = new Matrix3x2(g.Transform.Elements);

            // Save state of the graphics object
            var gs = g.Save();

            // Create and prepare the render target
            var rt = RenderTargetFactory.Create(_d2d1Factory, g, map);

            // Set anti-alias mode and transform
            rt.AntialiasMode = AntialiasMode;
            rt.Transform     = transform;

            if (Theme != null)
            {
                RenderInternal(_d2d1Factory, rt, map, envelope, Theme);
            }
            else
            {
                RenderInternal(_d2d1Factory, rt, map, envelope);
            }

            // Clean up the render target
            RenderTargetFactory.CleanUp(rt, g, map);

            // Restore the graphics object
            g.Restore(gs);

            // Invoke LayerRendered event
            OnLayerRendered(g);
        }
        public static void DoGrid(this WidgetMidiList widget, FloatRect grid, Graphics g)
        {
            var gs = g.Save();
              using (g.Clip = new Region(grid))
              {
            using (var p0 = new Pen(Color.Black)) foreach (var i in widget.GetHLines(4))
              g.DrawLines(p0, new Point[] { new FloatPoint(i.XO, grid.Top), new FloatPoint(i.XO, grid.Bottom) });

            using (var p1 = new Pen(Gray130)) foreach (var i in widget.GetHLines(Convert.ToInt32(Math.Pow(4, 2))))
              g.DrawLines(p1, new Point[] { new FloatPoint(i.XO, grid.Top), new FloatPoint(i.XO, grid.Bottom) });

            using (var p2 = new Pen(White)) foreach (var i in widget.GetHLines(Convert.ToInt32(Math.Pow(4, 3))))
              g.DrawLines(p2, new Point[] { new FloatPoint(i.XO, grid.Top), new FloatPoint(i.XO, grid.Bottom) });

            g.ResetClip();
              }
              g.Restore(gs);
        }
Ejemplo n.º 48
0
		/// <summary>
		/// Implements the Apply code for the Brightness Filet
		/// </summary>
		/// <param name="graphics"></param>
		/// <param name="applyBitmap"></param>
		/// <param name="rect"></param>
		/// <param name="renderMode"></param>
		public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) {
			Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert);

			if (applyRect.Width == 0 || applyRect.Height == 0) {
				// nothing to do
				return;
			}

			GraphicsState state =  graphics.Save();
			if (Invert) {
				graphics.SetClip(applyRect);
				graphics.ExcludeClip(rect);
			}
			float brightness = GetFieldValueAsFloat(FieldType.BRIGHTNESS);
			using (ImageAttributes ia = ImageHelper.CreateAdjustAttributes(brightness, 1f, 1f)) {
				graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia);
			}
			graphics.Restore(state);
		}
        protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates dataGridViewElementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            this.checkBox.Size = CheckBoxRenderer.GetGlyphSize(graphics, CheckBoxState.UncheckedNormal);
            this.checkBox.Location = new Point(2, cellBounds.Height / 2 - this.checkBox.Height / 2);
            this.checkRectangle.Size = new Size(this.checkBox.Right + 1, clipBounds.Height);

            Point realLocation = this.checkBox.Location + (Size)cellBounds.Location;
            ButtonState state = GetCheckBoxState();

            Padding newPadding = cellStyle.Padding;
            newPadding.Left = checkRectangle.Width;
            cellStyle.Padding = newPadding;

            GraphicsState gstate = graphics.Save();
            graphics.ExcludeClip(new Rectangle(realLocation, this.checkBox.Size));
            base.Paint(graphics, clipBounds, cellBounds, rowIndex, dataGridViewElementState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
            graphics.Restore(gstate);

            CheckBoxRenderer.DrawCheckBox(graphics, realLocation, ConvertFromButtonState(state, false, this.mouseInCheckBox));
        }
 public static void DoNoteIds(this WidgetMidiList widget, FloatRect grid, Graphics g)
 {
     var gs = g.Save();
       using (g.Clip = new Region(grid))
       {
     foreach (var i in widget.GetHLines(Convert.ToInt32(Math.Pow(4, 2))))
     {
       var r2=new FloatRect(i.XO-16,grid.Top,32,24);
       g.FillEllipse(Brushes.Black,r2);
       g.DrawText((i.Index / 4).ToString(),Color.White,widget.Font,r2);
     }
     foreach (var i in widget.GetHLines(Convert.ToInt32(Math.Pow(4, 3))))
     {
       var r2=new FloatRect(i.XO-16,grid.Top+32,32,24);
       g.FillEllipse(Brushes.Black,r2);
       g.DrawText((i.Index / 64).ToString(),Color.White,widget.Font,r2);
     }
     g.ResetClip();
       }
       g.Restore(gs);
 }
Ejemplo n.º 51
0
 public static void DrawWatermarkText(Graphics graphics, string text, string fontName) {
     int imageHeight = (int)graphics.VisibleClipBounds.Height;
     int imageWidth = (int)graphics.VisibleClipBounds.Width;
     int maxTextWidth = (int)(imageHeight * 0.4);
     int[] fontSizes = new int[] { 72, 48, 36, 24, 18, 18, 14, 12, 10 };
     Font font = null;
     foreach(int fontSize in fontSizes) {
         font = new Font(fontName, fontSize, GraphicsUnit.Pixel);
         if(graphics.MeasureString(text, font).Width <= maxTextWidth)
             break;
     }
     GraphicsState state = graphics.Save();
     SmoothGraphics(graphics);
     graphics.RotateTransform(-90);
     float padding = font.Size / 2;
     graphics.TranslateTransform(-imageHeight + padding, imageWidth - font.GetHeight() - padding);
     graphics.TextContrast = 12;
     graphics.PageUnit = font.Unit;
     graphics.DrawString(text, font, new SolidBrush(Color.FromArgb(120, Color.Black)), 1, 1);
     graphics.DrawString(text, font, new SolidBrush(Color.FromArgb(120, Color.White)), 0, 0);
     graphics.Restore(state);
 }
        private static void DrawInk(GraphicsPath p, InkPressureFeedbackMode m, Size s, Graphics g)
        {
            RectangleF PathBounds = p.GetBounds();  //get the bounds of the path and compute the square scale transform
            float ds = 0.8f * Math.Min(s.Width / PathBounds.Width, s.Height / PathBounds.Height);

            GraphicsState OriginalGraphicsState = g.Save();

            g.TranslateTransform(s.Width >> 1, s.Height >> 1);
            g.ScaleTransform(ds, -ds);

            switch (m)
            {
                case InkPressureFeedbackMode.Size:
                    g.FillEllipse(Brushes.Black, new Rectangle(-800, -800, 1600, 1600));
                    break;

                case InkPressureFeedbackMode.Width:
                    g.DrawLine(new Pen(Color.Black, 500f), new Point(-500, 0), new Point(500, 0));
                    break;

                case InkPressureFeedbackMode.None:
                case InkPressureFeedbackMode.Color:
                default:
                    GraphicsPath InkRegion = new GraphicsPath();    //upper-left triangular clip region to fake "ink"
                    InkRegion.AddPolygon(new Point[] { Point.Empty, new Point(s.Width, 0), new Point(0, s.Height) });
                    Matrix InverseTransform = g.Transform;
                    InverseTransform.Invert();
                    InkRegion.Transform(InverseTransform);

                    g.IntersectClip(new Region(InkRegion));
                    g.DrawPath(new Pen(Color.Blue, 4 / ds), p);
                    break;
            }

            g.Restore(OriginalGraphicsState);
        }
Ejemplo n.º 53
0
        private void DrawWindowHistogram(Graphics g)
        {
            float maxVal = m_DisplayWindowData.Max();
            int XGAP = 0;
            int YGAP = 0;

            if (maxVal != 0)
            {
                float xScale = (picStretched.Image.Width - 2 * XGAP) * 1.0f / 256;
                float yScale = (picStretched.Image.Height - 2 * YGAP) * 1.0f / maxVal;

                g.FillRectangle(m_DisplaySettings.BackgroundColorBrush, new Rectangle(0, 0, picStretched.Image.Width, picStretched.Image.Height));

                g.DrawRectangle(Pens.Black, XGAP, YGAP, picStretched.Image.Width - 2 * XGAP + 1,
                                picStretched.Image.Height - 2 * YGAP);

                for (int i = 0; i < 256; i++)
                {
                    float xFrom = XGAP + i * xScale + 1;
                    float xSize = xScale;
                    float yFrom = picStretched.Image.Height - YGAP - m_DisplayWindowData[i] * yScale;
                    float ySize = m_DisplayWindowData[i] * yScale;

                    g.FillRectangle(Brushes.LimeGreen, xFrom, yFrom, xSize, ySize);
                }
            }

            g.Save();
        }
Ejemplo n.º 54
0
        private void DrawFullHistogram(Graphics g)
        {
            EnsureHistogramData();

            float maxVal = m_DisplayData.Max();
            int XGAP = 0;
            int YGAP = 0;

            if (maxVal > 0)
            {
                float xScale = (picHistogram.Image.Width - 2 * XGAP) * 1.0f / 256;
                float yScale = (picHistogram.Image.Height - 2 * YGAP) * 1.0f / maxVal;

                g.FillRectangle(m_DisplaySettings.BackgroundColorBrush, new Rectangle(0, 0, picHistogram.Image.Width, picHistogram.Image.Height));

                g.DrawRectangle(Pens.Black, XGAP, YGAP, picHistogram.Image.Width - 2 * XGAP + 1, picHistogram.Image.Height - 2 * YGAP);

                // Highlight the current window
                g.FillRectangle(m_DisplaySettings.SmallGraphFocusBackgroundBrush, m_FromByte * xScale, 0, (m_ToByte - m_FromByte) * xScale, picStretched.Image.Height);

                for (int i = 0; i < 256; i++)
                {
                    float xFrom = XGAP + i * xScale + 1;
                    float xSize = xScale;
                    float yFrom = picHistogram.Image.Height - YGAP - m_DisplayData[i] * yScale;
                    float ySize = m_DisplayData[i] * yScale;

                    g.FillRectangle(Brushes.LimeGreen, xFrom, yFrom, xSize, ySize);
                }

                g.Save();
            }
        }
        private void AddLabels(Graphics g)
        {
            float xOffset = ChartArea.Width / 30.0f;
            float yOffset = ChartArea.Height / 30.0f;
            SizeF labelFontSize = g.MeasureString("A", LabelFont);
            SizeF titleFontSize = g.MeasureString("A", TitleFont);

            // Add horizontal axis label:
            SolidBrush aBrush = new SolidBrush(LabelFontColor);
            SizeF stringSize = g.MeasureString(XLabel, LabelFont);
            g.DrawString(XLabel, LabelFont, aBrush,
                new Point(form1.PlotPanel.Left + form1.PlotPanel.Width / 2 -
                (int)stringSize.Width / 2, ChartArea.Bottom -
                (int)yOffset - (int)labelFontSize.Height));

            // Add y-axis label:
            StringFormat sFormat = new StringFormat();
            sFormat.Alignment = StringAlignment.Center;
            stringSize = g.MeasureString(YLabel, LabelFont);
            // Save the state of the current Graphics object
            GraphicsState gState = g.Save();
            g.TranslateTransform(ChartArea.X + xOffset, ChartArea.Y
                + yOffset + titleFontSize.Height
                + yOffset / 3 + form1.PlotPanel.Height / 2);
            g.RotateTransform(-90);
            g.DrawString(YLabel, LabelFont, aBrush, 0, 0, sFormat);
            // Restore it:
            g.Restore(gState);

            // Add title:
            aBrush = new SolidBrush(TitleFontColor);
            stringSize = g.MeasureString(Title, TitleFont);
            if (Title.ToUpper() != "NO TITLE")
            {
                g.DrawString(Title, TitleFont, aBrush,
                    new Point(form1.PlotPanel.Left + form1.PlotPanel.Width / 2 -
                    (int)stringSize.Width / 2, ChartArea.Top + (int)yOffset));
            }
            aBrush.Dispose();
        }
Ejemplo n.º 56
0
    public override void Paint(Graphics g, object obj)
    {

      System.Drawing.Drawing2D.GraphicsState gs = g.Save();
      g.TranslateTransform(X,Y);
      g.RotateTransform(-_rotation);
      
      // Modification of StringFormat is necessary to avoid 
      // too big spaces between successive words
      StringFormat strfmt = (StringFormat)StringFormat.GenericTypographic.Clone();
      strfmt.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;

      strfmt.LineAlignment = StringAlignment.Near;
      strfmt.Alignment = StringAlignment.Near;

      // next statement is necessary to have a consistent string length both
      // on 0 degree rotated text and rotated text
      // without this statement, the text is fitted to the pixel grid, which
      // leads to "steps" during scaling
      g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

      if(this.AutoSize)
      {
        SizeF mySize = g.MeasureString(_text, _font);
        this.Width = mySize.Width;
        this.Height = mySize.Height;
        g.DrawString(_text, _font, new SolidBrush(_color), 0, 0, strfmt);
      }
      else
      {
        System.Drawing.RectangleF rect = new RectangleF(0, 0, this.Width, this.Height);
        g.DrawString(_text, _font, new SolidBrush(_color), rect, strfmt);
      }
      
      g.Restore(gs);
    }
Ejemplo n.º 57
0
		/// <summary>
		/// Paint the shape group in the graphic context.
		/// </summary>
		/// <param name="g">Graphic context.</param>
		/// <param name="paintContext">The paint context.</param>
		public override void Paint(Graphics g, IPaintContext paintContext)
		{
			GraphicsState gs = g.Save();
			this.TransformGraphics(g);

			foreach (GraphicBase graphics in _groupedObjects)
				graphics.Paint(g, paintContext);

			g.Restore(gs);
		}
Ejemplo n.º 58
0
        private void AddLabels(Graphics g, ChartStyle cs3d, ChartLabels cl, Axes ax)
        {
            float xOffset = ChartArea.Width / 30.0f;
            float yOffset = ChartArea.Height / 30.0f;
            SizeF labelFontSize = g.MeasureString("A", cl.LabelFont);
            SizeF titleFontSize = g.MeasureString("A", cl.TitleFont);
            SizeF tickFontSize = g.MeasureString("A", cl.TickFont);

            SolidBrush aBrush = new SolidBrush(cl.TickFontColor);
            StringFormat sFormat = new StringFormat();

            // Create the x-axis tick marks:
            aBrush = new SolidBrush(cl.TickFontColor);
            for (float fX = ax.XMin; fX <= ax.XMax; fX += ax.XTick)
            {
                PointF yAxisPoint = Point2D(new PointF(fX, ax.YMin), ax);
                sFormat.Alignment = StringAlignment.Far;
                SizeF sizeXTick = g.MeasureString(fX.ToString(), cl.TickFont);
                g.DrawString(fX.ToString(), cl.TickFont, aBrush,
                    new PointF(yAxisPoint.X + sizeXTick.Width / 2,
                    yAxisPoint.Y + 4f), sFormat);
            }

            // Create the y-axis tick marks:
            for (float fY = ax.YMin; fY <= ax.YMax; fY += ax.YTick)
            {
                PointF xAxisPoint = Point2D(new PointF(ax.XMin, fY), ax);
                sFormat.Alignment = StringAlignment.Far;
                g.DrawString(fY.ToString(), cl.TickFont, aBrush,
                    new PointF(xAxisPoint.X - 3f,
                    xAxisPoint.Y - tickFontSize.Height / 2), sFormat);
            }

            // Add horizontal axis label:
            aBrush = new SolidBrush(cl.LabelFontColor);
            SizeF stringSize = g.MeasureString(cl.XLabel, cl.LabelFont);
            g.DrawString(cl.XLabel, cl.LabelFont, aBrush,
                new Point(PlotArea.X + PlotArea.Width / 2 -
                (int)stringSize.Width / 2, ChartArea.Bottom -
                (int)yOffset - (int)labelFontSize.Height));

            // Add y-axis label:
            sFormat.Alignment = StringAlignment.Center;
            stringSize = g.MeasureString(cl.YLabel, cl.LabelFont);
            // Save the state of the current Graphics object
            GraphicsState gState = g.Save();
            g.TranslateTransform(xOffset, yOffset + titleFontSize.Height
                + yOffset / 3 + PlotArea.Height / 2);
            g.RotateTransform(-90);
            g.DrawString(cl.YLabel, cl.LabelFont, aBrush, 0, 0, sFormat);
            // Restore it:
            g.Restore(gState);

            // Add title:
            aBrush = new SolidBrush(cl.TitleColor);
            stringSize = g.MeasureString(cl.Title, cl.TitleFont);
            if (cl.Title.ToUpper() != "NO TITLE")
            {
                g.DrawString(cl.Title, cl.TitleFont, aBrush,
                    new Point(PlotArea.X + PlotArea.Width / 2 -
                    (int)stringSize.Width / 2, ChartArea.Top + (int)yOffset));
            }
            aBrush.Dispose();
        }
Ejemplo n.º 59
0
 protected void PaintTransparentBackground(Graphics graphics, Rectangle clipRect)
 {
     graphics.Clear(Color.Transparent);
     if ((Parent != null)) {
         clipRect.Offset(Location);
         PaintEventArgs e = new PaintEventArgs(graphics, clipRect);
         GraphicsState state = graphics.Save();
         graphics.SmoothingMode = SmoothingMode.HighSpeed;
         try {
             graphics.TranslateTransform(-Location.X, -Location.Y);
             InvokePaintBackground(Parent, e);
             InvokePaint(Parent, e);
         } finally {
             graphics.Restore(state);
             clipRect.Offset(-Location.X, -Location.Y);
         }
     }
 }
Ejemplo n.º 60
0
        private void drawPlaybackIndicators(Graphics g)
        {
            // Playback start/end arrows
            if (PlaybackStartTime.HasValue || PlaybackEndTime.HasValue) {
                GraphicsState gstate = g.Save();
                g.TranslateTransform(0, -_arrowBase/2);

                if (PlaybackStartTime.HasValue) {
                    // start arrow (faces left)  |<|
                    int x = (int) timeToPixels(PlaybackStartTime.Value);
                    g.FillPolygon(Brushes.DarkGray, new Point[]
                                                        {
                                                            new Point(x, Height - _arrowBase/2), // left mid point
                                                            new Point(x + _arrowLength, Height - _arrowBase), // right top point
                                                            new Point(x + _arrowLength, Height) // right bottom point
                                                        });
                    g.DrawLine(Pens.DarkGray, x, Height - _arrowBase, x, Height);
                }

                if (PlaybackEndTime.HasValue) {
                    // end arrow (faces right)   |>|
                    int x = (int) timeToPixels(PlaybackEndTime.Value);
                    g.FillPolygon(Brushes.DarkGray, new Point[]
                                                        {
                                                            new Point(x, Height - _arrowBase/2), // right mid point
                                                            new Point(x - _arrowLength, Height - _arrowBase), // left top point
                                                            new Point(x - _arrowLength, Height) // left bottom point
                                                        });
                    g.DrawLine(Pens.DarkGray, x, Height - _arrowBase, x, Height);
                }

                if (PlaybackStartTime.HasValue && PlaybackEndTime.HasValue) {
                    // line between the two
                    using (Pen p = new Pen(Color.DarkGray)) {
                        p.Width = 4;
                        int x1 = (int) timeToPixels(PlaybackStartTime.Value) + _arrowLength;
                        int x2 = (int) timeToPixels(PlaybackEndTime.Value) - _arrowLength;
                        int y = Height - _arrowBase/2;
                        g.DrawLine(p, x1, y, x2, y);
                    }
                }

                g.Restore(gstate);
            }

            // Current position arrow
            if (PlaybackCurrentTime.HasValue) {
                int x = (int) timeToPixels(PlaybackCurrentTime.Value);
                g.FillPolygon(Brushes.Green, new Point[]
                                             	{
                                             		new Point(x, _arrowLength), // bottom mid point
                                             		new Point(x - _arrowBase/2, 0), // top left point
                                             		new Point(x + _arrowBase/2, 0), // top right point
                                             	});
            }
        }