예제 #1
0
        /// <summary>
        /// Gets the watermark to use when the application is in reduced functionality mode.
        /// </summary>
        /// <param name="galleryId">The gallery ID.</param>
        /// <returns>Returns a <see cref="Watermark" /> instance.</returns>
        public static Watermark GetReducedFunctionalityModeWatermark(int galleryId)
        {
            IGallerySettings gallerySetting = Factory.LoadGallerySetting(galleryId);

            Watermark tempWatermark = null;

            try
            {
                tempWatermark = new Watermark();
                tempWatermark.WatermarkText       = Resources.Reduced_Functionality_Mode_Watermark_Text;
                tempWatermark.TextFontName        = gallerySetting.WatermarkTextFontName;
                tempWatermark.TextColor           = HelperFunctions.GetColor(gallerySetting.WatermarkTextColor);
                tempWatermark.TextHeightPixels    = 0;
                tempWatermark.TextWidthPercent    = 100;
                tempWatermark.TextOpacityPercent  = 100;
                tempWatermark.TextLocation        = ContentAlignment.MiddleCenter;
                tempWatermark._watermarkImage     = Resources.GsLogo;
                tempWatermark.ImageWidthPercent   = 85;
                tempWatermark.ImageOpacityPercent = 50;
                tempWatermark.ImageLocation       = ContentAlignment.BottomCenter;
            }
            catch
            {
                tempWatermark?.Dispose();

                throw;
            }

            return(tempWatermark);
        }
예제 #2
0
        /// <summary>
        /// Gets the watermark that is configured for the specified <paramref name="galleryId" />.
        /// </summary>
        /// <param name="galleryId">The gallery ID.</param>
        /// <returns>Returns a <see cref="Watermark" /> instance.</returns>
        public static Watermark GetUserSpecifiedWatermark(int galleryId)
        {
            IGallerySettings gallerySetting = Factory.LoadGallerySetting(galleryId);

            Watermark tempWatermark = null;

            try
            {
                tempWatermark = new Watermark();
                tempWatermark.WatermarkText      = gallerySetting.WatermarkText;
                tempWatermark.TextFontName       = gallerySetting.WatermarkTextFontName;
                tempWatermark.TextColor          = HelperFunctions.GetColor(gallerySetting.WatermarkTextColor);
                tempWatermark.TextHeightPixels   = gallerySetting.WatermarkTextFontSize;
                tempWatermark.TextWidthPercent   = gallerySetting.WatermarkTextWidthPercent;
                tempWatermark.TextOpacityPercent = gallerySetting.WatermarkTextOpacityPercent;
                tempWatermark.TextLocation       = gallerySetting.WatermarkTextLocation;
                tempWatermark.SetImagePath(gallerySetting.WatermarkImagePath, galleryId);
                tempWatermark.ImageWidthPercent   = gallerySetting.WatermarkImageWidthPercent;
                tempWatermark.ImageOpacityPercent = gallerySetting.WatermarkImageOpacityPercent;
                tempWatermark.ImageLocation       = gallerySetting.WatermarkImageLocation;
            }
            catch
            {
                tempWatermark?.Dispose();

                throw;
            }

            return(tempWatermark);
        }