Esempio n. 1
0
        public override void VisitShapeDraw(ShapeDraw shapeDraw)
        {
            using (Image png = new Bitmap(shapeDraw.SignSize.Width * shapeDraw.Zoom, shapeDraw.SignSize.Height * shapeDraw.Zoom, PixelFormat.Format32bppArgb))
            {
                using (Graphics g = Graphics.FromImage(png))
                {
                    g.Clear(Color.Transparent);

                    foreach (ShapePaint shape in shapeDraw.Childs)
                    {
                        shape.DrawOutputImage(g);
                    }
                }

                using (Bitmap outbmp = ImageHelper.ReSizeImage(png, shapeDraw.SignSize.Width, shapeDraw.SignSize.Height) as Bitmap)
                {
                    //产生背景为透明的Gif图片
                    //GifImageHelper gifTransparent = new GifImageHelper();
                    //Bitmap gifOut = gifTransparent.Quantize(outbmp);
                    try
                    {
                        outbmp.Save(ImageFile, ImageFormat.Png);
                    }
                    catch (Exception e)
                    {
                        ImageFile = string.Empty;
                        Log.Error("Shape GenerateUploadImage Error: " + e.Message);
                    }
                }
            }
        }
Esempio n. 2
0
 public void VisitShapeDraw(ShapeDraw shapeDraw)
 {
     if (shapeDraw.BackColor != Color.Empty)
     {
         ShapePaintHelper.FillRectangle(Graphics, ResourceCache.DefaultCache.GetSolidBrush(shapeDraw.BackColor), shapeDraw.VirtualBounds);
     }
 }
Esempio n. 3
0
        public override void VisitShapeDraw(ShapeDraw shapeDraw)
        {
            shapeDraw.ComputerBounds();
            using (Graphics innerGraphics = GetGraphics())
            {
                innerGraphics.Clear(Color.Transparent);
                foreach (ShapePaint shape in shapeDraw.Childs)
                {
                    shape.PaintFigure(innerGraphics, shapeDraw.VirtualBounds);
                }
            };

            int w = shapeDraw.InnerImage.Width / Zoom;
            int h = shapeDraw.InnerImage.Height / Zoom;

            w = w < 1 ? 1 : w;
            h = h < 1 ? 1 : h;

            Image smallImg = ImageHelper.ReSizeImage(shapeDraw.InnerImage, w, h);

            shapeDraw.InnerImage.Dispose();
            shapeDraw.InnerImage = null;
            shapeDraw.InnerImage = ImageHelper.ReSizeImage(smallImg, shapeDraw.Width, shapeDraw.Height);

            smallImg.Dispose();
            smallImg = null;
            shapeDraw.InnerImagePath = shapeDraw.SaveImage(shapeDraw.InnerImage);

            shapeDraw.InnerImage.Dispose();
            shapeDraw.InnerImage = null;
        }