private static void ConvertImg(int type, bool flip, Image image) { switch (type) { case 1: image.RotateFlip(RotateFlipType.Rotate90FlipNone); break; case 2: image.RotateFlip(RotateFlipType.Rotate180FlipNone); break; case 3: image.RotateFlip(RotateFlipType.Rotate270FlipNone); break; case 4: image.RotateFlip(RotateFlipType.RotateNoneFlipX); break; case 5: image.RotateFlip(RotateFlipType.Rotate90FlipX); break; case 6: image.RotateFlip(RotateFlipType.Rotate180FlipX); break; case 7: image.RotateFlip(RotateFlipType.Rotate270FlipX); break; default: ImagePixelTool.Effect((Bitmap)image, (ImagePixelTool.ImagePixelEffects)(type / 10), type % 10); break; } if (flip) { image.RotateFlip(RotateFlipType.RotateNoneFlipX); } }
public static Image GetEffectImage(string name, int type, bool flip) { string fname = string.Format("Effect/{0}t{1}{2}", name, type, flip ? "f" : ""); if (!ImageManager.HasImage(fname)) { Image image = PicLoader.Read("Effect", string.Format("{0}.PNG", name)); switch (type) { case 1: image.RotateFlip(RotateFlipType.Rotate90FlipNone); break; case 2: image.RotateFlip(RotateFlipType.Rotate180FlipNone); break; case 3: image.RotateFlip(RotateFlipType.Rotate270FlipNone); break; case 4: image.RotateFlip(RotateFlipType.RotateNoneFlipX); break; case 5: image.RotateFlip(RotateFlipType.Rotate90FlipX); break; case 6: image.RotateFlip(RotateFlipType.Rotate180FlipX); break; case 7: image.RotateFlip(RotateFlipType.Rotate270FlipX); break; default: ImagePixelTool.Effect((Bitmap)image, (ImagePixelTool.ImagePixelEffects)(type / 10), type % 10); break; } if (flip) { image.RotateFlip(RotateFlipType.RotateNoneFlipX); } ImageManager.AddImage(fname, image); } return(ImageManager.GetImage(fname)); }