kwsch / PKHeX

Pokémon Save File Editor
https://projectpokemon.org/pkhex/
Other
3.7k stars 692 forks source link

small issue with glow sprite edges #2066

Closed NinFanBoyFTW closed 6 years ago

NinFanBoyFTW commented 6 years ago

Hey, just checked out the glow sprite edges that you put into pkhex. I think it looks pretty good. 1 issue I found though is that most if not all of the ultra sun or ultra moon exclusive pokemon (partner cap pikachu, poiple, ultra necrozma etc...) are not showing up correctly. It seems that when you hover over their sprites, a glow comes over a box around them and not their sprites individually. Thanks

kwsch commented 6 years ago

Looks like the USUM sprites dumped did not properly set their transparency data...

Will have to run something to clean up the base sprites so that they can glow correctly.

var path = @"PATH TO PROGRAM: \PKHeX\PKHeX.WinForms\Resources\img";
var files = new[] {
    @"Pokemon Sprites\25-7c.png",
    @"Pokemon Sprites\744-1.png",
    @"Pokemon Sprites\745-2.png",
    @"Pokemon Sprites\800-1.png",
    @"Pokemon Sprites\800-2.png",
    @"Pokemon Sprites\800-3.png",
    @"Pokemon Sprites\803.png",
    @"Pokemon Sprites\804.png",
    @"Pokemon Sprites\805.png",
    @"Pokemon Sprites\806.png",
    @"Pokemon Sprites\807.png",
    @"Shiny Pokemon Sprites\25-7cs.png",
    @"Shiny Pokemon Sprites\744-1s.png",
    @"Shiny Pokemon Sprites\745-2s.png",
    @"Shiny Pokemon Sprites\800-1s.png",
    @"Shiny Pokemon Sprites\800-2s.png",
    @"Shiny Pokemon Sprites\800-3s.png",
    @"Shiny Pokemon Sprites\803s.png",
    @"Shiny Pokemon Sprites\804s.png",
    @"Shiny Pokemon Sprites\805s.png",
    @"Shiny Pokemon Sprites\806s.png",
    @"Shiny Pokemon Sprites\807s.png",
};

foreach (var f in files)
{
    var p = Path.Combine(path, f);
    using (var img = (Bitmap)Bitmap.FromFile(p))
    {
        for (int x = 0; x < img.Width; x++)
        for (int y = 0; y < img.Height; y++)
        {
            var pixel = img.GetPixel(x, y);
            if (pixel.A == 0xFF)
                continue;
            img.SetPixel(x,y, Color.FromArgb(0));
        }
        img.Save(p+"edit"); // fromfile locks file
    }
    // file lock cleared, delete & move
    File.Delete(p);
    File.Move(p+"edit", p);
}