public static DrawOverlayOnAvatar ( string origAvartar, RatingOverlayImage ratingType, |
||
origAvartar | string | |
ratingType | RatingOverlayImage | |
size | Size of returned image | |
return |
/// <summary> /// Loads an Image from memory into a facade item /// </summary> /// <param name="imageFilePath">Filename of image</param> protected void SetImageToGui(string imageFilePath) { if (string.IsNullOrEmpty(imageFilePath)) { return; } // check if this user item is a shout // we may need to apply a rating overlay to the avatar if (TVTag is TraktComment) { var shout = TVTag as TraktComment; // add a rating overlay if user has rated item var ratingOverlay = GUIImageHandler.GetRatingOverlay(shout.UserRating); // get a reference to a MediaPortal Texture Identifier string suffix = Enum.GetName(typeof(RatingOverlayImage), ratingOverlay); string texture = GUIImageHandler.GetTextureIdentFromFile(imageFilePath, suffix); // build memory image, resize avatar as they come in different sizes sometimes Image memoryImage = null; if (ratingOverlay != RatingOverlayImage.None) { memoryImage = GUIImageHandler.DrawOverlayOnAvatar(imageFilePath, ratingOverlay, new Size(140, 140)); if (memoryImage == null) { return; } // load texture into facade item if (GUITextureManager.LoadFromMemory(memoryImage, texture, 0, 0, 0) > 0) { ThumbnailImage = texture; IconImage = texture; IconImageBig = texture; } } else { ThumbnailImage = imageFilePath; IconImage = imageFilePath; IconImageBig = imageFilePath; } } else { ThumbnailImage = imageFilePath; IconImage = imageFilePath; IconImageBig = imageFilePath; } // if selected and is current window force an update of thumbnail this.UpdateItemIfSelected(WindowID, ItemId); }