DrawOverlayOnPoster() public static méthode

public static DrawOverlayOnPoster ( string origPoster, MainOverlayImage mainType, RatingOverlayImage ratingType ) : Bitmap
origPoster string
mainType MainOverlayImage
ratingType RatingOverlayImage
Résultat System.Drawing.Bitmap
        /// <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;
            }

            // determine the overlays to add to poster
            var mainOverlay = MainOverlayImage.None;

            if (Season.IsWatchlisted(Show))
            {
                mainOverlay = MainOverlayImage.Watchlist;
            }
            else if (Season.IsWatched(Show))
            {
                mainOverlay = MainOverlayImage.Seenit;
            }

            // add additional overlay if applicable
            if (Season.IsCollected(Show))
            {
                mainOverlay |= MainOverlayImage.Library;
            }

            RatingOverlayImage ratingOverlay = GUIImageHandler.GetRatingOverlay(Season.UserRating(Show));

            // get a reference to a MediaPortal Texture Identifier
            string suffix  = Enum.GetName(typeof(MainOverlayImage), mainOverlay) + Enum.GetName(typeof(RatingOverlayImage), ratingOverlay);
            string texture = GUIImageHandler.GetTextureIdentFromFile(imageFilePath, suffix);

            // build memory image
            Image memoryImage = null;

            if (mainOverlay != MainOverlayImage.None || ratingOverlay != RatingOverlayImage.None)
            {
                memoryImage = GUIImageHandler.DrawOverlayOnPoster(imageFilePath, mainOverlay, ratingOverlay);
                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;
            }

            // if selected and is current window force an update of thumbnail
            this.UpdateItemIfSelected(WindowID, ItemId);
        }
        /// <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;
            }

            // determine the main overlay to add to poster
            TraktMovie       movie       = TVTag as TraktMovie;
            MainOverlayImage mainOverlay = MainOverlayImage.None;

            if (movie.InWatchList)
            {
                mainOverlay = MainOverlayImage.Watchlist;
            }
            if (movie.InCollection)
            {
                mainOverlay |= MainOverlayImage.Library;
            }

            // we never show rating movies in Recommendations
            RatingOverlayImage ratingOverlay = RatingOverlayImage.None;

            // get a reference to a MediaPortal Texture Identifier
            string suffix  = mainOverlay.ToString().Replace(", ", string.Empty) + Enum.GetName(typeof(RatingOverlayImage), ratingOverlay);
            string texture = GUIImageHandler.GetTextureIdentFromFile(imageFilePath, suffix);

            // build memory image
            Image memoryImage = null;

            if (mainOverlay != MainOverlayImage.None)
            {
                memoryImage = GUIImageHandler.DrawOverlayOnPoster(imageFilePath, mainOverlay, ratingOverlay);
                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;
            }

            // if selected and is current window force an update of thumbnail
            this.UpdateItemIfSelected((int)TraktGUIWindows.RecommendationsMovies, ItemId);
        }
Exemple #3
0
        /// <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;
            }

            // determine the overlays to add to poster
            TraktShow        show        = TVTag as TraktShow;
            MainOverlayImage mainOverlay = MainOverlayImage.None;

            if (show.InWatchList)
            {
                mainOverlay = MainOverlayImage.Watchlist;
            }
            //else if (show.Watched)
            //    mainOverlay = MainOverlayImage.Seenit;

            RatingOverlayImage ratingOverlay = GUIImageHandler.GetRatingOverlay(show.RatingAdvanced);

            // get a reference to a MediaPortal Texture Identifier
            string suffix  = Enum.GetName(typeof(MainOverlayImage), mainOverlay) + Enum.GetName(typeof(RatingOverlayImage), ratingOverlay);
            string texture = GUIImageHandler.GetTextureIdentFromFile(imageFilePath, suffix);

            // build memory image
            Image memoryImage = null;

            if (mainOverlay != MainOverlayImage.None || ratingOverlay != RatingOverlayImage.None)
            {
                memoryImage = GUIImageHandler.DrawOverlayOnPoster(imageFilePath, mainOverlay, ratingOverlay);
                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;
            }

            // if selected and is current window force an update of thumbnail
            this.UpdateItemIfSelected((int)TraktGUIWindows.RelatedShows, ItemId);
        }
Exemple #4
0
        /// <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;
            }

            // determine the overlay to add to poster
            var movie       = TVTag as TraktMovie;
            var mainOverlay = MainOverlayImage.None;

            // don't show watchlist overlay in personal watchlist window
            if (WindowID == (int)TraktGUIWindows.WatchedListMovies)
            {
                if ((GUIWatchListMovies.CurrentUser != TraktSettings.Username) && movie.InWatchList)
                {
                    mainOverlay = MainOverlayImage.Watchlist;
                }
                else if (movie.Watched)
                {
                    mainOverlay = MainOverlayImage.Seenit;
                }
            }
            else
            {
                if (movie.InWatchList)
                {
                    mainOverlay = MainOverlayImage.Watchlist;
                }
                else if (movie.Watched)
                {
                    mainOverlay = MainOverlayImage.Seenit;
                }
            }

            // add additional overlay if applicable
            if (movie.InCollection)
            {
                mainOverlay |= MainOverlayImage.Library;
            }

            RatingOverlayImage ratingOverlay = GUIImageHandler.GetRatingOverlay(movie.RatingAdvanced);

            // get a reference to a MediaPortal Texture Identifier
            string suffix  = mainOverlay.ToString().Replace(", ", string.Empty) + Enum.GetName(typeof(RatingOverlayImage), ratingOverlay);
            string texture = GUIImageHandler.GetTextureIdentFromFile(imageFilePath, suffix);

            // build memory image
            Image memoryImage = null;

            if (mainOverlay != MainOverlayImage.None || ratingOverlay != RatingOverlayImage.None)
            {
                memoryImage = GUIImageHandler.DrawOverlayOnPoster(imageFilePath, mainOverlay, ratingOverlay);
                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;
            }

            // if selected and is current window force an update of thumbnail
            this.UpdateItemIfSelected(WindowID, ItemId);
        }
Exemple #5
0
        protected void SetImageToGui(string imageFilePath, Size size)
        {
            if (string.IsNullOrEmpty(imageFilePath))
            {
                return;
            }

            // determine the overlay to add to poster
            var mainOverlay   = MainOverlayImage.None;
            var ratingOverlay = RatingOverlayImage.None;

            if (TVTag is TraktUserListItem)
            {
                var listItem = TVTag as TraktUserListItem;
                if (listItem == null)
                {
                    return;
                }

                if (listItem.InWatchList)
                {
                    mainOverlay = MainOverlayImage.Watchlist;
                }
                else if (listItem.Watched)
                {
                    mainOverlay = MainOverlayImage.Seenit;
                }

                // add additional overlay if applicable
                if (listItem.InCollection)
                {
                    mainOverlay |= MainOverlayImage.Library;
                }

                ratingOverlay = GUIImageHandler.GetRatingOverlay(listItem.RatingAdvanced);
            }
            else if (TVTag is TraktActivity.Activity)
            {
                var activity = TVTag as TraktActivity.Activity;
                if (activity == null)
                {
                    return;
                }

                var movie = activity.Movie;
                var show  = activity.Show;

                if (movie != null && movie.InWatchList)
                {
                    mainOverlay = MainOverlayImage.Watchlist;
                }
                else if (show != null && show.InWatchList)
                {
                    mainOverlay = MainOverlayImage.Watchlist;
                }
                else if (movie != null && movie.Watched)
                {
                    mainOverlay = MainOverlayImage.Seenit;
                }

                // add additional overlay if applicable
                if (movie != null && movie.InCollection)
                {
                    mainOverlay |= MainOverlayImage.Library;
                }

                if (movie != null)
                {
                    ratingOverlay = GUIImageHandler.GetRatingOverlay(movie.RatingAdvanced);
                }
                else
                {
                    ratingOverlay = GUIImageHandler.GetRatingOverlay(show.RatingAdvanced);
                }
            }

            // get a reference to a MediaPortal Texture Identifier
            string suffix  = mainOverlay.ToString().Replace(", ", string.Empty) + Enum.GetName(typeof(RatingOverlayImage), ratingOverlay);
            string texture = GUIImageHandler.GetTextureIdentFromFile(imageFilePath, suffix);

            // build memory image
            Image memoryImage = null;

            if (mainOverlay != MainOverlayImage.None || ratingOverlay != RatingOverlayImage.None)
            {
                memoryImage = GUIImageHandler.DrawOverlayOnPoster(imageFilePath, mainOverlay, ratingOverlay, size);
                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;
            }

            // if selected and is current window force an update of thumbnail
            this.UpdateItemIfSelected(WindowID, ItemId);
        }