public static string buildLogoImage(List <string> logosForBuilding, int imgWidth, int imgHeight) { try { if (logosForBuilding.Count == 1) { return(logosForBuilding[0]); } else if (logosForBuilding.Count > 1) { tmpFile = string.Empty; foreach (string logo in logosForBuilding) { tmpFile += System.IO.Path.GetFileNameWithoutExtension(logo); } tmpFile = Path.Combine(pathfortmpfile, @"\anime3_" + tmpFile + ".png"); Bitmap b = new Bitmap(imgWidth, imgHeight); Image img = b; Graphics g = Graphics.FromImage(img); appendLogos(logosForBuilding, ref g, imgHeight, imgWidth); return(ImageAllocator.GetOtherImage(b, tmpFile, new Size(), true)); // don't resize in allocator } else { return(string.Empty); } } catch (Exception ex) { BaseConfig.MyAnimeLog.Write("The Logo Building Engine generated an error: " + ex.ToString()); return(string.Empty); } }
/* * static string LogoSourceBluRay = mediaFolder + @"BLURAY.png"; * static string LogoSourceDVD = mediaFolder + @"DVD.png"; * * static string LogoCodecX264 = mediaFolder + @"AVC.png"; * static string LogoCodecXVid = mediaFolder + @"XVID.png"; * static string LogoCodecDivx = mediaFolder + @"DIVX.png"; * static string LogoCodecMpeg2 = mediaFolder + @"MP2V.png"; * static string LogoCodecAVC = mediaFolder + @"AVC.png"; * * static string LogoRes720 = mediaFolder + @"720p.png"; * static string LogoRes1080 = mediaFolder + @"1080p.png"; * * static string LogoDim16x9 = mediaFolder + @"WIDESCREEN.png"; * static string LogoDim4x3 = mediaFolder + @"FULLSCREEN.png"; */ public static string buildRating(double value, string offstar, string onstar, int width, int height) { try { Bitmap b = new Bitmap(width * 10, height); Image img = b; Graphics g = Graphics.FromImage(img); BaseConfig.MyAnimeLog.Write("Source: " + offstar + " Dest: " + onstar); Image off = ImageAllocator.LoadImageFastFromFile(GUIGraphicsContext.Skin + @"\Media\" + offstar); Image on = ImageAllocator.LoadImageFastFromFile(GUIGraphicsContext.Skin + @"\Media\" + onstar); int val = (int)Math.Floor(value); string tmpfile = onstar + "_" + ((int)val).ToString(CultureInfo.InvariantCulture) + "_"; for (int x = 0; x < 10; x++) { if (x < val) { g.DrawImage(on, new Rectangle(x * width, 0, width, height), new Rectangle(0, 0, on.Width, on.Height), GraphicsUnit.Pixel); } if (x >= val) { g.DrawImage(off, new Rectangle(x * width, 0, width, height), new Rectangle(0, 0, off.Width, off.Height), GraphicsUnit.Pixel); } if (x == val) { int sub = (int)((value - val) * width); tmpfile += sub; if (sub > 0) { var subSrc = (int)((value - val) * on.Width); g.DrawImage(on, new Rectangle(x * width, 0, sub, height), new Rectangle(0, 0, subSrc, on.Height), GraphicsUnit.Pixel); } } } tmpfile += ".png"; tmpfile = Path.Combine(pathfortmpfile, @"\anime3_" + tmpfile + ".png"); return(ImageAllocator.GetOtherImage(b, tmpfile, new Size(), true)); } catch (Exception ex) { BaseConfig.MyAnimeLog.Write("The Rating Building Engine generated an error: " + ex.ToString()); return(string.Empty); } }