/// <summary>
        /// Highlights the given rectangle on a clone of the given data context's
        /// inner bitmap and returns it
        ///
        /// If the given rectangle is null (might happen if bounding rectangle doesn't exist),
        ///     then the original bitmap is returned
        /// </summary>
        /// <param name="ecId">Element context id</param>
        /// <param name="rect"></param>
        /// <returns></returns>
        private static Bitmap GetScreenShotForIssueDescription(Guid ecId, Rectangle?rect)
        {
            var dc = GetDataAction.GetElementDataContext(ecId);

            if (dc.Screenshot != null)
            {
                Bitmap newImg = new Bitmap(dc.Screenshot);

                if (rect.HasValue)
                {
                    Rectangle valueRect = rect.Value;
                    using (var graphics = Graphics.FromImage(newImg))
                        using (Pen pen = new Pen(Color.Red, 5))
                        {
                            // Use element
                            var el        = GetDataAction.GetA11yElementInDataContext(ecId, dc.ScreenshotElementId);
                            var outerRect = el.BoundingRectangle;

                            valueRect.X -= outerRect.X;
                            valueRect.Y -= outerRect.Y;
                            graphics.DrawRectangle(pen, valueRect);
                        }
                }
                return(newImg);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
 /// <summary>
 /// Hilight an element with selected hilighter
 /// </summary>
 /// <param name="ecId">ElementContext Id</param>
 /// <param name="eId"></param>
 public void SetElement(Guid ecId, int eId)
 {
     SetElementInternal(GetDataAction.GetA11yElementInDataContext(ecId, eId));
 }
Example #3
0
        /// <summary>
        /// Set single element
        /// </summary>
        /// <param name="ecId"></param>
        /// <param name="e"></param>
        /// <param name="txt">text to show in top right corner</param>
        public void SetSingleElement(Guid ecId, int eId, string txt = null)
        {
            var e = GetDataAction.GetA11yElementInDataContext(ecId, eId);

            Highlighter.SetSingleElement(e, txt);
        }