public void TestIsVisible_OneAlwaysVisibleOthersVisible() { var layout = CreateLayout(true, true, false, true); layout.AnnotationBoxes[1].AlwaysVisible = true; Assert.IsTrue(TextOverlayVisibilityHelper.IsVisible(layout, true)); }
private static Bitmap DrawToIcon(IPresentationImage image, int width, int height) { //We just hide the text overlay and application graphics because it creates ugly icons. var textOverlayHider = new TextOverlayVisibilityHelper(image); var applicationGraphicsHider = GraphicsVisibilityHelper.CreateForApplicationGraphics(image); textOverlayHider.Hide(); applicationGraphicsHider.HideAll(); try { return(image.DrawToBitmap(width, height)); } catch (Exception ex) { // rendering the error text to a 100x100 icon is useless, so we'll just paint a placeholder error icon and log the icon error Platform.Log(LogLevel.Warn, ex, "Failed to render icon with dimensions {0}x{1}", width, height); var bitmap = new Bitmap(width, height); using (var graphics = System.Drawing.Graphics.FromImage(bitmap)) { graphics.FillRectangle(Brushes.Black, 0, 0, width, height); graphics.DrawLine(Pens.WhiteSmoke, 0, 0, width, height); graphics.DrawLine(Pens.WhiteSmoke, 0, height, width, 0); } return(bitmap); } finally { textOverlayHider.Restore(); applicationGraphicsHider.RestoreAll(); } }
public void TestRestoreHidden() { var layout = CreateLayout(false); var helper = new TextOverlayVisibilityHelper(layout); Assert.IsFalse(layout.Visible); helper.Show(); Assert.IsTrue(layout.Visible); helper.Restore(); Assert.IsFalse(layout.Visible); }
public static Bitmap CreateThumbnail(IPresentationImage image, int width, int height) { var visibilityHelper = new TextOverlayVisibilityHelper(image); visibilityHelper.Hide(); var bitmap = CreateThumbnailImage(image, width, height); using (System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap)) DrawBorder(graphics, width, height); visibilityHelper.Restore(); return(bitmap); }
private static string BuildClipboardItemDescription(IPresentationImage image) { if (!(image is IImageSopProvider)) { return(string.Empty); } var imageSopProvider = (IImageSopProvider)image; var sop = imageSopProvider.ImageSop; return(string.Format(SR.MessageClipboardDescription , sop.PatientId , sop.PatientsName == null ? null : sop.PatientsName.FormattedName , Format.Date(DateParser.Parse(sop.StudyDate)) , sop.StudyDescription , sop.AccessionNumber , sop.Modality , TextOverlayVisibilityHelper.IsVisible(image, true) ? SR.LabelOn : SR.LabelOff)); }
public void TestIsVisible_Hidden_NoAnnotationBoxes() { var layout = CreateLayout(false); Assert.IsFalse(TextOverlayVisibilityHelper.IsVisible(layout, true)); }
public void TestIsVisible_EntireLayoutHidden() { var layout = CreateLayout(false, true); Assert.IsFalse(TextOverlayVisibilityHelper.IsVisible(layout, true)); }
public void TestIsVisible_OneVisible() { var layout = CreateLayout(true, false, false, true); Assert.IsTrue(TextOverlayVisibilityHelper.IsVisible(layout, true)); }