Beispiel #1
0
 public SelfieData(string imageUrl, Emotions.emotion emotion, float emotionValue, string sex)
 {
     this.PartitionKey = emotion.ToString();
     this.RowKey       = Guid.NewGuid().ToString();
     this.ImageUrl     = imageUrl;
     this.EmotionValue = Convert.ToString(emotionValue, CultureInfo.InvariantCulture);
     this.Sex          = sex;
 }
        public void Decorate(Image sourceImage, Rectangle rect, Emotions.emotion emotionType)
        {
            this.borderSize = (int)((sourceImage.Width + sourceImage.Height) * BORDER_WIDTH_RATIO);
            if (this.borderSize % 2 != 0)
            {
                this.borderSize++;
            }

            this.AddRect(sourceImage, rect);
            this.AddSmile(sourceImage, rect, emotionType);
        }
        private void AddSmile(Image sourceImage, Rectangle rect, Emotions.emotion emotionType)
        {
            var ratio = (int)(Math.Min(sourceImage.Width, sourceImage.Height) * SMILE_DEFAULT_SCALE_RATIO);

            using (Graphics g = Graphics.FromImage(sourceImage))
            {
                g.DrawImage(
                    this.smileStickerFactory.GetSticker(emotionType),
                    rect.Right - (ratio / 2),
                    rect.Bottom - (ratio / 2),
                    ratio,
                    ratio);
            }
        }
 public Image GetSticker(Emotions.emotion emotionType)
 {
     return(this.images[emotionType]);
 }