Source:
<code>private void watermarkText(final IMOperation op, final File source, final Map<Class<AbstractImageToolOption>, AbstractImageToolOption> options) throws Exception { WatermarkTextOption watermarkText = getOption(options, WatermarkTextOption.class); if (watermarkText != null) { final String[] imageInfo; DimensionOption dimension = getOption(options, DimensionOption.class); if (dimension != null) { imageInfo = new String[2]; imageInfo[0] = dimension.getWidth() != null ? String.valueOf(dimension.getWidth()) : getImageInfo(source, WIDTH_IN_PIXEL)[0]; imageInfo[1] = dimension.getHeight() != null ? String.valueOf(dimension.getHeight()) : getImageInfo(source, HEIGHT_IN_PIXEL)[0]; } else { imageInfo = getImageInfo(source, WIDTH_IN_PIXEL, HEIGHT_IN_PIXEL); } int width = Integer.valueOf(imageInfo[0]); int height = Integer.valueOf(imageInfo[1]); <START> int pointSize = (int) Math.rint((width * 0.02) + Math.log(width)); <END> pointSize = Math.min((int) (height * 0.2), pointSize); int minX = (int) Math.max(1, (height * 0.015)); int minY = (int) Math.max(1, (height * 0.025)); int x = (int) (minX + Math.max(1, (pointSize / 2.5))); int y = (int) (minY + Math.max(1, (pointSize / 1.75))); final String text = watermarkText.getText(); final AnchoringPosition anchoringPosition = watermarkText.getAnchoringPosition(); op.font(watermarkText.getFont()); op.pointsize(pointSize); String black = "rgba(0, 0, 0, 0.5)"; String white = "rgba(255, 255, 255, 0.5)"; drawText(op, black, text, anchoringPosition, x, y); drawText(op, white, text, anchoringPosition, minX, minY); } }</code><technical_language>![MINOR](<LINK_1> Assign this magic number 0.02 a well-named constant, constant instead. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private void watermarkText(final IMOperation op, final File source, final Map<Class<AbstractImageToolOption>, AbstractImageToolOption> options) throws SilverpeasException { WatermarkTextOption watermarkText = getOption(options, WatermarkTextOption.class); if (watermarkText != null) { final String[] imageInfo; DimensionOption dimension = getOption(options, DimensionOption.class); if (dimension != null) { imageInfo = new String[2]; imageInfo[0] = dimension.getWidth() != null ? String.valueOf(dimension.getWidth()) : getImageInfo(source, WIDTH_IN_PIXEL)[0]; imageInfo[1] = dimension.getHeight() != null ? String.valueOf(dimension.getHeight()) : getImageInfo(source, HEIGHT_IN_PIXEL)[0]; } else { imageInfo = getImageInfo(source, WIDTH_IN_PIXEL, HEIGHT_IN_PIXEL); } int width = Integer.valueOf(imageInfo[0]); int height = Integer.valueOf(imageInfo[1]); int pointSize = (int) Math.rint((width * 0.02) + Math.log(width)); pointSize = Math.min((int) (height * 0.2), pointSize); int minX = (int) Math.max(1, (height * 0.015)); int minY = (int) Math.max(1, (height * 0.025)); int x = (int) (minX + Math.max(1, (pointSize / 2.5))); int y = (int) (minY + Math.max(1, (pointSize / 1.75))); final String text = watermarkText.getText(); final AnchoringPosition anchoringPosition = watermarkText.getAnchoringPosition(); op.font(watermarkText.getFont()); op.pointsize(pointSize); String black = "rgba(0, 0, 0, 0.5)"; String white = "rgba(255, 255, 255, 0.5)"; drawText(op, black, text, anchoringPosition, x, y); drawText(op, white, text, anchoringPosition, minX, minY); } }