示例#1
0
        void DoDrawImageCore(Player p, Vec3S32[] marks, DrawArgs dArgs)
        {
            Bitmap bmp = HeightmapGen.ReadBitmap(dArgs.Name, "extra/images/", p);

            if (bmp == null)
            {
                return;
            }

            ImagePrintDrawOp op = new ImagePrintDrawOp();

            op.LayerMode = dArgs.Layer; op.DualLayer = dArgs.Dual;
            op.CalcState(marks);

            int width  = dArgs.Width == 0 ? bmp.Width  : dArgs.Width;
            int height = dArgs.Height == 0 ? bmp.Height : dArgs.Height;

            Clamp(p, marks, op, ref width, ref height);

            if (width < bmp.Width || height < bmp.Height)
            {
                bmp = Resize(bmp, width, height);
            }

            op.SetLevel(p.level);
            op.Player  = p; op.Source = bmp;
            op.Palette = dArgs.Pal; op.Filename = dArgs.Name;
            DrawOpPerformer.Do(op, null, p, marks, false);
        }
示例#2
0
        void DoDrawImageCore(Player p, Vec3S32[] m, DrawArgs dArgs)
        {
            Bitmap bmp = HeightmapGen.ReadBitmap(dArgs.name, "extra/images/", p);

            if (bmp == null)
            {
                return;
            }
            try {
                bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
            } catch (Exception ex) {
                Server.ErrorLog(ex);
                bmp.Dispose();
                return;
            }

            ImagePrintDrawOp op = new ImagePrintDrawOp();

            if (Math.Abs(m[1].X - m[0].X) > Math.Abs(m[1].Z - m[0].Z))
            {
                op.Direction = m[1].X <= m[0].X ? 1 : 0;
            }
            else
            {
                op.Direction = m[1].Z <= m[0].Z ? 3 : 2;
            }

            op.Level    = p.level;
            op.Player   = p;
            op.Source   = bmp;
            op.Layer    = dArgs.layer;
            op.Mode     = dArgs.popType;
            op.Filename = dArgs.name;

            if (op.Layer)
            {
                if (op.Mode == 1)
                {
                    op.Mode = 2;
                }
                if (op.Mode == 3)
                {
                    op.Mode = 4;
                }
            }
            DrawOp.DoDrawOp(op, null, p, m, false);
        }
示例#3
0
        void DoDrawImageCore(Player p, Vec3S32[] m, DrawArgs dArgs)
        {
            Bitmap bmp = HeightmapGen.ReadBitmap(dArgs.name, "extra/images/", p);

            if (bmp == null)
            {
                return;
            }
            try {
                bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
            } catch (Exception ex) {
                Logger.LogError(ex);
                bmp.Dispose();
                return;
            }

            ImagePrintDrawOp op = new ImagePrintDrawOp();
            int dir;

            if (Math.Abs(m[1].X - m[0].X) > Math.Abs(m[1].Z - m[0].Z))
            {
                dir = m[1].X <= m[0].X ? 1 : 0;
            }
            else
            {
                dir = m[1].Z <= m[0].Z ? 3 : 2;
            }
            op.LayerMode = dArgs.layer; op.DualLayer = dArgs.dualLayered;
            op.CalcState(dir);

            ResizeImage(p, m, op, ref bmp);
            op.SetLevel(p.level);
            op.Player = p; op.Source = bmp;

            op.Palette = dArgs.palette; op.Filename = dArgs.name;
            DrawOpPerformer.Do(op, null, p, m, false);
        }