示例#1
0
        public void Draw(Graphics e, float zoomPercent, float heightRate = 1.0f, float widthRate = 1.0f)
        {
            var pos   = Transform.Position;
            var scale = Transform.Scale;
            var rot   = Transform.Rotation;
            var size  = Transform.Size;
            //int offsetX = Transform.Size.X - (int)(scale.X * layers[i].Size.Width);
            Rectangle rect = new Rectangle((int)(pos.X), (int)(pos.Y),
                                           (int)Math.Round(size.X * scale.X * zoomPercent), (int)Math.Round(size.Y * scale.Y * zoomPercent));

            if (Img != null)
            {
                e.DrawImage(Img, rect);
            }

            if (LayerText != null)
            {
                Bitmap bitmap = new Bitmap(2400, 3200);
                using (Graphics g = Graphics.FromImage(bitmap))
                {
                    g.SmoothingMode     = SmoothingMode.AntiAlias;
                    g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
                    g.PixelOffsetMode   = PixelOffsetMode.HighQuality;

                    LayerText.HeightRate = heightRate;
                    LayerText.WidthRate  = widthRate;
                    LayerText.Draw(g, this.Transform);
                }

                rect = new Rectangle((int)(pos.X), (int)(pos.Y),
                                     (int)Math.Round(bitmap.Width * scale.X * zoomPercent), (int)Math.Round(bitmap.Height * scale.Y * zoomPercent));

                e.DrawImage(bitmap, rect);
                bitmap.Dispose();
            }
        }
示例#2
0
 public Layer(LayerText text)
 {
     this.LayerText = text;
     Transform      = new Transform();
 }