/// <summary> /// Draws a trakt overlay, library/seen/watchlist icon on a episode thumb /// This is done in memory and wont touch the existing file /// </summary> /// <param name="origThumb">Filename of the untouched episode thumb</param> /// <param name="type">Overlay type enum</param> /// <param name="size">Size of returned image</param> /// <returns>An image with overlay added to episode thumb</returns> public static Bitmap DrawOverlayOnEpisodeThumb(string origThumb, MainOverlayImage mainType, RatingOverlayImage ratingType, Size size) { Image image = GUIImageHandler.LoadImage(origThumb); if (image == null) { return(null); } Bitmap thumb = new Bitmap(image, size); Graphics gph = Graphics.FromImage(thumb); string mainOverlayImage = TraktHelper.GetThemedSkinFile(SkinThemeType.Image, string.Format("trakt{0}.png", mainType.ToString().Replace(", ", string.Empty))); if (mainType != MainOverlayImage.None && File.Exists(mainOverlayImage)) { Bitmap newThumb = new Bitmap(GUIImageHandler.LoadImage(mainOverlayImage)); gph.DrawImage(newThumb, TraktSkinSettings.EpisodeThumbMainOverlayPosX, TraktSkinSettings.EpisodeThumbMainOverlayPosY); } string ratingOverlayImage = TraktHelper.GetThemedSkinFile(SkinThemeType.Image, string.Format("trakt{0}.png", Enum.GetName(typeof(RatingOverlayImage), ratingType))); if (ratingType != RatingOverlayImage.None && File.Exists(ratingOverlayImage)) { Bitmap newThumb = new Bitmap(GUIImageHandler.LoadImage(ratingOverlayImage)); gph.DrawImage(newThumb, TraktSkinSettings.EpisodeThumbRatingOverlayPosX, TraktSkinSettings.EpisodeThumbRatingOverlayPosY); } gph.Dispose(); return(thumb); }
public static void Init() { // Import Skin Settings string xmlSkinSettings = TraktHelper.GetThemedSkinFile(SkinThemeType.File, "Trakt.SkinSettings.xml"); Load(xmlSkinSettings); // Remember last skin used incase we need to reload PreviousSkin = CurrentSkin; }
/// <summary> /// Draws a trakt overlay, rating icon on a poster /// This is done in memory and wont touch the existing file /// </summary> /// <param name="origPoster">Filename of the untouched avatar</param> /// <param name="type">Overlay type enum</param> /// <param name="size">Size of returned image</param> /// <returns>An image with overlay added to avatar</returns> public static Bitmap DrawOverlayOnAvatar(string origAvartar, RatingOverlayImage ratingType, Size size) { Image image = GUIImageHandler.LoadImage(origAvartar); if (image == null) { return(null); } Bitmap avatar = size.IsEmpty ? new Bitmap(image) : new Bitmap(image, size); Graphics gph = Graphics.FromImage(avatar); string ratingOverlayImage = TraktHelper.GetThemedSkinFile(SkinThemeType.Image, string.Format("trakt{0}.png", Enum.GetName(typeof(RatingOverlayImage), ratingType))); if (ratingType != RatingOverlayImage.None && File.Exists(ratingOverlayImage)) { Bitmap newAvatar = new Bitmap(GUIImageHandler.LoadImage(ratingOverlayImage)); gph.DrawImage(newAvatar, TraktSkinSettings.AvatarRatingOverlayPosX, TraktSkinSettings.AvatarRatingOverlayPosY); } gph.Dispose(); return(avatar); }