ImageBuilder
A builder for the Image item.
Extends GenericItemBuilder
Example
import OBR, { buildImage } from "@owlbear-rodeo/sdk";
const item = buildImage(
{
height: 300,
width: 300,
url: "https://www.example.com/test.png",
mime: "image/png",
},
{ dpi: 300, offset: { x: 150, y: 150 } }
)
.plainText("Player 1")
.build();
OBR.scene.items.addItems([item]);
Reference
constructor
buildImage(image, grid);
Create an image builder with the given image and grid.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| image | ImageContent | The image |
| grid | ImageGrid | The image grid |
Methods
text
text(text);
Set the images text content.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| text | TextContent | The content of the images text |
Returns the current builder.
textItemType
textItemType(textItemType);
Set the images text item type.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| textItemType | "LABEL" | "TEXT" | The type of the images text |
Returns the current builder.
textWidth
textWidth(width);
Set the image texts width.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| width | TextSize | The text width |
Returns the current builder.
textHeight
textHeight(height);
Set the image texts height.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| height | TextSize | The text height |
Returns the current builder.
richText
richText(richText);
Set the image texts richText.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| richText | RichText | The rich text |
Returns the current builder.
plainText
plainText(plainText);
Set the image texts plainText.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| plainText | string | The plain text |
Returns the current builder.
textType
textType(textType);
Set the image texts textType.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| textType | "PLAIN" | "RICH" | The text type |
Returns the current builder.
textPadding
textPadding(padding);
Set the image text styles padding.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| padding | number | The text padding |
Returns the current builder.
fontFamily
fontFamily(fontFamily);
Set the image text styles fontFamily.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fontFamily | string | The text font family |
Returns the current builder.
fontSize
fontSize(fontSize);
Set the image text styles fontSize.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fontSize | number | The text font size |
Returns the current builder.
fontWeight
fontWeight(fontWeight);
Set the image text styles fontWeight.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fontWeight | number | The text font weight |
Returns the current builder.
textAlign
textAlign(textAlign);
Set the image text styles textAlign.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| textAlign | "LEFT" | "CENTER" | "RIGHT" | The text horizontal alignment |
Returns the current builder.
textAlignVertical
textAlignVertical(textAlignVertical);
Set the image text styles textAlignVertical.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| textAlignVertical | "BOTTOM" | "MIDDLE" | "TOP" | The text vertical alignment |
Returns the current builder.
textFillColor
textFillColor(fillColor);
Set the image text styles fillColor.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fillColor | string | The texts fill color |
Returns the current builder.
textFillOpacity
textFillOpacity(fillOpacity);
Set the image text styles fillOpacity.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fillOpacity | number | The texts fill opacity |
Returns the current builder.
textStrokeColor
textStrokeColor(strokeColor);
Set the image text styles strokeColor.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| strokeColor | string | The texts stroke color |
Returns the current builder.
textStrokeOpacity
textStrokeOpacity(strokeOpacity);
Set the image text styles strokeOpacity.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| strokeOpacity | number | The texts stroke opacity |
Returns the current builder.
textStrokeWidth
textStrokeWidth(strokeWidth);
Set the image text styles strokeWidth.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| strokeWidth | number | The texts stroke width |
Returns the current builder.
textLineHeight
textLineHeight(lineHeight);
Set the image text styles lineHeight.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| lineHeight | number | The texts line height |
Returns the current builder.
build
build();
Returns the final Image item.