Class Picture
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal StringWhere a floating picture sits across the column:LEFT,CENTERorRIGHT.static final StringFloats behind the text, which ignores it.static final StringHorizontal placement of a floating picture: centered in the column.final StringAlternative text for readers that cannot show the picture.final floatThe gap kept between a floating picture and the text wrapped around it, in points.final floatThe displayed height in points.final StringThe block id.static final StringFloats over the text, which ignores it.static final StringLaid out in the line like a large character; the default.static final StringHorizontal placement of a floating picture: at the left edge of the column.final StringThe MIME type ofdata(), such asimage/png; empty for a linked picture.final floatHow far below the top of its anchor paragraph a floating picture starts, in points.static final StringHorizontal placement of a floating picture: at the right edge of the column.final StringThe URL a linked picture names, as Markdown'sor HTML's<img src>gives it; null for a picture that holds its own bytes.static final StringFloats at a side of the column; text wraps around its box.static final StringFloats on lines of its own; no text beside it.final floatThe displayed width in points.final StringHow text flows around the picture:INLINE,SQUARE,TOP_BOTTOM,BEHINDorIN_FRONT. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]data()The encoded image.intThe size of the encoded image.A picture in a line reads as nothing in plain text.booleanTwo pictures are equal when their id, bytes, source, type, size, description and placement are.inthashCode()A hash consistent withequals.id()The block id.booleanWhether the picture floats instead of sitting in a line.booleanisLinked()Whether the picture names its image by URL and holds no bytes.static PictureA picture that names its image by URL instead of holding it.withSize(float w, float h) A copy shown at another size.A copy placed differently.
-
Field Details
-
id
The block id. -
mimeType
The MIME type ofdata(), such asimage/png; empty for a linked picture. -
source
The URL a linked picture names, as Markdown'sor HTML's<img src>gives it; null for a picture that holds its own bytes. A linked picture has no bytes: HTML, Markdown and.cn1docwrite the URL back, while DOCX, ODT, RTF, a page view and PDF export, which can only show an image they hold, leave its box empty or skip it. -
width
public final float widthThe displayed width in points. -
height
public final float heightThe displayed height in points. -
description
Alternative text for readers that cannot show the picture. -
INLINE
Laid out in the line like a large character; the default.- See Also:
-
SQUARE
Floats at a side of the column; text wraps around its box.- See Also:
-
TOP_BOTTOM
-
BEHIND
-
IN_FRONT
-
LEFT
Horizontal placement of a floating picture: at the left edge of the column.- See Also:
-
CENTER
Horizontal placement of a floating picture: centered in the column.- See Also:
-
RIGHT
Horizontal placement of a floating picture: at the right edge of the column.- See Also:
-
wrap
How text flows around the picture:INLINE,SQUARE,TOP_BOTTOM,BEHINDorIN_FRONT. -
align
Where a floating picture sits across the column:LEFT,CENTERorRIGHT. -
offsetY
public final float offsetYHow far below the top of its anchor paragraph a floating picture starts, in points. -
distance
public final float distanceThe gap kept between a floating picture and the text wrapped around it, in points.
-
-
Constructor Details
-
Picture
public Picture(String id, byte[] data, String mimeType, float width, float height, String description) Creates a picture.
Parameters
-
id: the block id -
data: the encoded image; the array is copied -
mimeType: its MIME type -
width: the displayed width in points, greater than zero -
height: the displayed height in points, greater than zero -
description: alternative text, or null
-
-
-
Method Details
-
linked
public static Picture linked(String id, String source, float width, float height, String description) A picture that names its image by URL instead of holding it.
Parameters
-
id: the block id -
source: the image URL, not empty -
width: the displayed width in points, greater than zero -
height: the displayed height in points, greater than zero -
description: alternative text, or null
Returns
the picture
-
-
isLinked
public boolean isLinked()Whether the picture names its image by URL and holds no bytes.
Returns
true when
sourceis set -
isFloating
public boolean isFloating()Whether the picture floats instead of sitting in a line.
Returns
true unless the wrap is
INLINE -
withWrap
A copy placed differently.
Parameters
-
wrapMode:INLINE,SQUARE,TOP_BOTTOM,BEHINDorIN_FRONT -
alignment:LEFT,CENTERorRIGHT -
offset: points below the top of the anchor paragraph -
gap: points kept between the picture and wrapped text, 0 to 72
Returns
the copy
-
-
id
-
data
public byte[] data()The encoded image.
Returns
a copy of the bytes; empty for a linked picture
-
dataLength
public int dataLength()The size of the encoded image.
Returns
the byte count
-
withSize
A copy shown at another size.
Parameters
-
w: the width in points -
h: the height in points
Returns
the copy
-
-
equals
-
hashCode
-
displayText
A picture in a line reads as nothing in plain text.
Returns
the empty string
- Specified by:
displayTextin interfaceInline
-