Beispiel #1
0
        internal static WaterMarking GetWatermarkParameters()
        {
            WaterMarking wmarking = new WaterMarking();

            wmarking.LoadParameters();
            return(wmarking);
        }
Beispiel #2
0
        public static void AddWatermark(Image image, WaterMarking mark)
        {
            Graphics imgGraphics = Graphics.FromImage(image);
            //Font defaultFont = new Font("Verdana", 14, FontStyle.Bold);

            //calculates the fontsize of watermark
            //double width = image.Width * 0.5;
            //var size = imgGraphics.MeasureString(watermarktext, defaultFont);
            //var ratio = size.Width / defaultFont.SizeInPoints;
            //var requiredSize = width / ratio;

            //Creates transparency
            SolidBrush firstBrush  = new SolidBrush(mark.FontColor);
            SolidBrush secondBrush = new SolidBrush(Color.FromArgb(128, 255, 255, 255));

            //final font
            //SavedStates.FontName = "Verdana";
            //SavedStates.FontSize = requiredSize.ToString();
            //SavedStates.Left = 0;
            //SavedStates.Top = 0;
            //var font = new Font("Verdana", (float)requiredSize, FontStyle.Bold);

            //writes two text to create a drop shadow effect
            imgGraphics.DrawString(mark.Text, mark.Font, firstBrush, mark.Left + 2, mark.Top + 2);
            imgGraphics.DrawString(mark.Text, mark.Font, secondBrush, mark.Left, mark.Top);
        }
Beispiel #3
0
        private void LoadConfigurations()
        {
            try
            {
                this.IsGraphic = true;
                this.IsPDF     = true;
                this.IsPDFFile = false;

                this.ImageFormat     = string.Format("{0}.jpg", Guid.NewGuid());
                this.IsConstrained   = true;
                this.IsWaterMarkused = true;

                this.PhotoParameters   = InputParameters.GetParameters();
                this.PhotoWatermarking = WaterMarking.GetWatermarkParameters();
            }
            catch { }
        }