boolean textwrap = (image.getAlignment() & Image.TEXTWRAP) == Image.TEXTWRAP && !((image.getAlignment() & Image.MIDDLE) == Image.MIDDLE); boolean underlying = (image.getAlignment() & Image.UNDERLYING) == Image.UNDERLYING; float diff = leading / 2; if (textwrap) { float mt[] = image.matrix(); float startPosition = indentLeft() - mt[4]; if ((image.getAlignment() & Image.RIGHT) == Image.RIGHT) startPosition = indentRight() - image.getScaledWidth() - mt[4]; if ((image.getAlignment() & Image.MIDDLE) == Image.MIDDLE) startPosition = indentLeft() + ((indentRight() - indentLeft() - image.getScaledWidth()) / 2) - mt[4]; if (image.hasAbsoluteX()) startPosition = image.getAbsoluteX(); if (textwrap) { imageEnd = currentHeight + image.getScaledHeight() + diff; if ((image.getAlignment() & Image.RIGHT) == Image.RIGHT) { if ((image.getAlignment() & Image.RIGHT) == Image.RIGHT) startPosition -= image.getIndentationRight(); else if ((image.getAlignment() & Image.MIDDLE) == Image.MIDDLE) startPosition += image.getIndentationLeft() - image.getIndentationRight(); else startPosition += image.getIndentationLeft();
boolean textwrap = (image.getAlignment() & Image.TEXTWRAP) == Image.TEXTWRAP && !((image.getAlignment() & Image.MIDDLE) == Image.MIDDLE); boolean underlying = (image.getAlignment() & Image.UNDERLYING) == Image.UNDERLYING; float diff = leading / 2; if (textwrap) { float mt[] = image.matrix(); float startPosition = indentLeft() - mt[4]; if ((image.getAlignment() & Image.RIGHT) == Image.RIGHT) startPosition = indentRight() - image.getScaledWidth() - mt[4]; if ((image.getAlignment() & Image.MIDDLE) == Image.MIDDLE) startPosition = indentLeft() + ((indentRight() - indentLeft() - image.getScaledWidth()) / 2) - mt[4]; if (image.hasAbsoluteX()) startPosition = image.getAbsoluteX(); if (textwrap) { imageEnd = currentHeight + image.getScaledHeight() + diff; if ((image.getAlignment() & Image.RIGHT) == Image.RIGHT) { if ((image.getAlignment() & Image.RIGHT) == Image.RIGHT) startPosition -= image.getIndentationRight(); else if ((image.getAlignment() & Image.MIDDLE) == Image.MIDDLE) startPosition += image.getIndentationLeft() - image.getIndentationRight(); else startPosition += image.getIndentationLeft();
left = 0f; if ((image.getAlignment() & Image.RIGHT) == Image.RIGHT) { left = right - image.getScaledWidth(); } else if ((image.getAlignment() & Image.MIDDLE) == Image.MIDDLE) { left = left + ((right - left - image.getScaledWidth()) / 2f);
/** * Constructs a RtfImage for an Image. * * @param doc The RtfDocument this RtfImage belongs to * @param image The Image that this RtfImage wraps * @throws DocumentException If an error occurred accessing the image content */ public RtfImage(RtfDocument doc, Image image) throws DocumentException { super(doc); imageType = image.getOriginalType(); if (!(imageType == Image.ORIGINAL_JPEG || imageType == Image.ORIGINAL_BMP || imageType == Image.ORIGINAL_PNG || imageType == Image.ORIGINAL_WMF || imageType == Image.ORIGINAL_GIF)) { throw new DocumentException("Only BMP, PNG, WMF, GIF and JPEG images are supported by the RTF Writer"); } alignment = image.getAlignment(); width = image.getWidth(); height = image.getHeight(); plainWidth = image.getPlainWidth(); plainHeight = image.getPlainHeight(); this.imageData = getImageData(image); }
boolean textwrap = (image.getAlignment() & Image.TEXTWRAP) == Image.TEXTWRAP && !((image.getAlignment() & Image.MIDDLE) == Image.MIDDLE); boolean underlying = (image.getAlignment() & Image.UNDERLYING) == Image.UNDERLYING; float diff = leading / 2; if (textwrap) { float[] mt = image.matrix(); float startPosition = indentLeft() - mt[4]; if ((image.getAlignment() & Image.RIGHT) == Image.RIGHT) startPosition = indentRight() - image.getScaledWidth() - mt[4]; if ((image.getAlignment() & Image.MIDDLE) == Image.MIDDLE) startPosition = indentLeft() + ((indentRight() - indentLeft() - image.getScaledWidth()) / 2) - mt[4]; if (image.hasAbsoluteX()) startPosition = image.getAbsoluteX(); if (textwrap) { imageEnd = currentHeight + image.getScaledHeight() + diff; if ((image.getAlignment() & Image.RIGHT) == Image.RIGHT) { if ((image.getAlignment() & Image.RIGHT) == Image.RIGHT) startPosition -= image.getIndentationRight(); else if ((image.getAlignment() & Image.MIDDLE) == Image.MIDDLE) startPosition += image.getIndentationLeft() - image.getIndentationRight(); else startPosition += image.getIndentationLeft();
left = 0f; if ((image.getAlignment() & Image.RIGHT) == Image.RIGHT) { left = right - image.getScaledWidth(); } else if ((image.getAlignment() & Image.MIDDLE) == Image.MIDDLE) { left = left + ((right - left - image.getScaledWidth()) / 2f);
left = 0f; if ((image.getAlignment() & Image.RIGHT) == Image.RIGHT) { left = right - image.getScaledWidth(); } else if ((image.getAlignment() & Image.MIDDLE) == Image.MIDDLE) { left = left + ((right - left - image.getScaledWidth()) / 2f);
/** * Constructs a RtfImage for an Image. * * @param doc The RtfDocument this RtfImage belongs to * @param image The Image that this RtfImage wraps * @throws DocumentException If an error occurred accessing the image content */ public RtfImage(RtfDocument doc, Image image) throws DocumentException { super(doc); imageType = image.getOriginalType(); if (!(imageType == Image.ORIGINAL_JPEG || imageType == Image.ORIGINAL_BMP || imageType == Image.ORIGINAL_PNG || imageType == Image.ORIGINAL_WMF || imageType == Image.ORIGINAL_GIF)) { throw new DocumentException(MessageLocalization.getComposedMessage("only.bmp.png.wmf.gif.and.jpeg.images.are.supported.by.the.rtf.writer")); } alignment = image.getAlignment(); width = image.getWidth(); height = image.getHeight(); plainWidth = image.getPlainWidth(); plainHeight = image.getPlainHeight(); this.imageData = getImageData(image); }
t.setSpacingAfter(img.getSpacingAfter()); t.setSpacingBefore(img.getSpacingBefore()); switch (img.getAlignment()) { case Image.LEFT: t.setHorizontalAlignment(Element.ALIGN_LEFT);
t.setSpacingAfter(img.getSpacingAfter()); t.setSpacingBefore(img.getSpacingBefore()); switch (img.getAlignment()) { case Image.LEFT: t.setHorizontalAlignment(Element.ALIGN_LEFT);
if ((image.getAlignment() & Image.RIGHT) > 0) { write(HtmlTags.ALIGN, HtmlTags.ALIGN_RIGHT); else if ((image.getAlignment() & Image.MIDDLE) > 0) { write(HtmlTags.ALIGN, HtmlTags.ALIGN_MIDDLE);
if ((image.getAlignment() & Image.RIGHT) > 0) { write(HtmlTags.ALIGN, HtmlTags.ALIGN_RIGHT); else if ((image.getAlignment() & Image.MIDDLE) > 0) { write(HtmlTags.ALIGN, HtmlTags.ALIGN_MIDDLE);
if ((image.getAlignment() & Image.RIGHT) > 0) { write(HtmlTags.ALIGN, HtmlTags.ALIGN_RIGHT); else if ((image.getAlignment() & Image.MIDDLE) > 0) { write(HtmlTags.ALIGN, HtmlTags.ALIGN_MIDDLE);
t.setSpacingAfter(img.getSpacingAfter()); t.setSpacingBefore(img.getSpacingBefore()); switch (img.getAlignment()) { case Image.LEFT: t.setHorizontalAlignment(Element.ALIGN_LEFT);