Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Turns the selected image int a representation of the palette
            int x = 0; int y = 0;

            tex.Modified = true;
            for (int counter = 0; counter < 256; counter++)
            {
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y, counter, counter);
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y + 1, counter, counter);
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y + 2, counter, counter);
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y + 3, counter, counter);
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y + 4, counter, counter);
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y + 5, counter, counter);
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y + 6, counter, counter);
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y + 7, counter, counter);
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y + 8, counter, counter);
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y + 9, counter, counter);
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y + 10, counter, counter);
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y + 11, counter, counter);
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y + 12, counter, counter);
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y + 13, counter, counter);
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y + 14, counter, counter);
                ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y + 15, counter, counter);

                x++;
                if (x >= 64)
                {
                    x = 0;
                    y = y + 16;
                }
            }
        }
Exemplo n.º 2
0
        private void BtnImport_Click(object sender, EventArgs e)
        {
            DialogResult result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                Bitmap  jr       = (Bitmap)Bitmap.FromFile(openFileDialog1.FileName);
                Palette FinalPal = CurrentImage.GetFinalPallette();
                if ((jr.Width != CurrentImage.image.Width) || (jr.Height != CurrentImage.image.Height))
                {
                    jr = ArtLoader.Resize(jr, CurrentImage.image.Width, CurrentImage.image.Height);
                }

                for (int x = 0; x < jr.Width; x++)
                {
                    for (int y = 0; y < jr.Height; y++)
                    {
                        int nearest = PaletteLoader.GetNearestColour(jr.GetPixel(x, y), FinalPal);
                        //Get nearest palette to color
                        ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y, nearest, nearest);
                    }
                }
                ImgOut.Image = CurrentImage.image;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handles the clicking of a pixel on the image display
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ImgOut_MouseClick(object sender, MouseEventArgs e)
        {
            if (CurrentImage == null)
            {
                return;
            }
            //if (main.curgame==GAME_UW1)
            //{
            //    if (CurrentImageNo>=210)
            //    {//Editing a 32x32 floor texture
            //        factor = 8;
            //    }
            //}
            // MessageBox.Show(e.Location.X / 4 +","+ (ImgOut.Height-e.Location.Y) / 4);
            int x = (int)(e.Location.X / NumZoom.Value);
            int y = (int)((e.Location.Y) / NumZoom.Value);

            ArtUI.setPixelAtLocation(CurrentImage, ImgOut, x, y, CurrentPalettePixel, CurrentRefPixel);
        }