PKHeX/Util.cs
Kurt 3bf2516851 Moved import code, image layering.
Image layering will now display shinies and contents of eggs.
Import code moved to Code Generator.
2014-07-28 15:28:06 -07:00

30 lines
1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace PKHeX
{
public partial class Util
{
public static Image layerImage(Image baseLayer, Image overLayer, int x, int y, double trans)
{
Bitmap overlayImage = (Bitmap)overLayer;
Bitmap newImage = (Bitmap)baseLayer;
for (int i = 0; i < (overlayImage.Width * overlayImage.Height); i++)
{
Color newColor = overlayImage.GetPixel(i % (overlayImage.Width), i / (overlayImage.Width));
newColor = Color.FromArgb((int)((double)(newColor.A) * trans), newColor.R, newColor.G, newColor.B); // Apply transparency change
if (newColor != Color.FromArgb(0, 0, 0, 0))
{
newImage.SetPixel(
i % (overlayImage.Width) + x,
i / (overlayImage.Width) + y,
newColor);
}
}
return newImage;
}
}
}