makeColor() 공개 정적인 메소드

public static makeColor ( int r, int g, int b ) : int
r int
g int
b int
리턴 int
예제 #1
0
        public void cut()
        {
            if (!bSelection)
            {
                return;
            }

            copy();

            Operations.OperationManager om = Global.opManager;
            om.beginGroup("VSP Manager: Cut Tiledata");
            Ops.SetTiledataGroup stdg = new Ops.SetTiledataGroup(Global.ActiveVsp);

            Selection s = originalSelection;

            if (s.width > 0 && s.height > 0)
            {
                int y0      = s.y;
                int x0      = s.x;
                int magenta = Render.makeColor(255, 0, 255);
                for (int y = 0; y < s.height; y++)
                {
                    for (int x = 0; x < s.width; x++)
                    {
                        int   t       = (s.y + y) * TilesWide + s.x + x;
                        int[] newData = new int[16 * 16];
                        for (int i = 0; i < 256; i++)
                        {
                            newData[i] = magenta;
                        }
                        stdg.addRecord(t, newData);
                    }
                }
                om.add(stdg);
            }
            om.endGroupExec();

            Invalidate();
        }
예제 #2
0
        protected unsafe override void OnMouseMove(MouseEventArgs e)
        {
            //base.OnMouseMove(e);
            if (bLMousePressed)
            {
                if (sourceLeft != null)
                {
                    //sourceLeft.colorInfo.
                    Point destCoord = TranslateToTileCoords(e.Location);
                    Console.WriteLine("Draggin left.. ({0},{1})", destCoord.X, destCoord.Y);
                    active_tile.Image.SetPixel(destCoord.X, destCoord.Y, Render.makeColor(SourceLeft.colorInfo.R, SourceLeft.colorInfo.G, SourceLeft.colorInfo.B));
                    Invalidate(true);

                    if (TileDataChanged != null)
                    {
                        TileDataChanged(ActiveTileIndex);
                    }
                }
            }
            else if (bRMousePressed)
            {
            }
        }
예제 #3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            if (parent == null)
            {
                e.Graphics.FillRectangle(System.Drawing.Brushes.Black, e.ClipRectangle.Left, e.ClipRectangle.Right, e.ClipRectangle.Width, e.ClipRectangle.Height);
                return;
            }

            e.Graphics.PixelOffsetMode   = PixelOffsetMode.Half;
            e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;

            Bitmap bmp = new Bitmap(TilesWide * 16, (TilesHigh + 1) * 16, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            pr2.IRenderImage qimg = pr2.RenderImage.LockBitmap(bmp);

            int row = 0, col = 0;

            for (int i = scrollOffset; i < parent.vsp.Tiles.Count; i++)
            {
                Render.render(qimg, col * 16, row * 16, parent.vsp.GetTile(i).Image, true);

                if (bSelection)
                {
                    int xx = col;
                    int yy = row + logicalRow;
                    if (selection.getPoint(xx, yy))
                    {
                        int tile = originalSelection.getPointIntegerValue(xx - selection.x + originalSelection.x, yy - selection.y + originalSelection.y, this);
                        if (tile != -1)
                        {
                            Render.render(qimg, col * 16, row * 16, parent.vsp.GetTile(tile).Image, true);
                        }
                    }
                }

                col++;
                if (col == TilesWide)
                {
                    col = 0;
                    row++;
                    if (row == TilesHigh)
                    {
                        break;
                    }
                }
            }

            //render the empty area
            while (row != TilesHigh + 1)
            {
                while (col != TilesWide)
                {
                    Render.renderColoredStippleTile(qimg, col * 16, row * 16, Render.makeColor(0, 0, 0), Render.makeColor(192, 192, 192));
                    col++;
                }
                col = 0;
                row++;
            }

            qimg.Dispose();
            e.Graphics.DrawImage(bmp, 0, 0, TilesWide * 16, (TilesHigh + 1) * 16);
            bmp.Dispose();


            e.Graphics.PixelOffsetMode = PixelOffsetMode.Default;

            if (bSelectingRect)
            {
                Point p0  = (new Point(Math.Min(mtx, mtx1), Math.Min(mty, mty1)));
                Point p1  = (new Point(Math.Max(mtx, mtx1), Math.Max(mty, mty1)));
                Pen   pen = new Pen(Color.White);
                pen.DashStyle = DashStyle.Dash;
                pen.Width     = 1;
                e.Graphics.DrawRectangle(pen, p0.X * 16, (p0.Y - logicalRow) * 16, (p1.X - p0.X) * 16, (p1.Y - p0.Y) * 16);
                pen.Dispose();
            }
            if (bSelection)
            {
                GraphicsPath gp = new GraphicsPath();

                selection.updateGraphicsPath(gp, 16, 0, -logicalRow * 16);
                Pen pen = new Pen(Color.FromArgb(128, 0, 0, 0));
                pen.Width     = 5;
                pen.DashStyle = DashStyle.Solid;
                e.Graphics.TranslateTransform(1.0f, 1.0f);
                e.Graphics.DrawPath(pen, gp);
                e.Graphics.TranslateTransform(-1.0f, -1.0f);

                pen.Color     = Color.White;
                pen.Width     = 1;
                pen.DashStyle = DashStyle.Dash;
                e.Graphics.DrawPath(pen, gp);
                pen.Dispose();
                gp.Dispose();
            }
        }