Пример #1
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;
            }
        }
 public Bitmap LowResAt(int index)
 {
     if (imageCacheLowRes[index] == null)
     {
         BitmapUW tmp = LoadImageAt(index);
         tmp.image.RotateFlip(RotateFlipType.RotateNoneFlipY);
         imageCacheLowRes[index] = ArtLoader.Resize(tmp.image, LOWRESSIZE, LOWRESSIZE);
     }
     return(imageCacheLowRes[index]);
 }