Skip to main content

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

NAMETYPEDESCRIPTION
imageImageContentThe image
gridImageGridThe image grid

Methods​

text​

text(text);

Set the images text content.

Parameters

NAMETYPEDESCRIPTION
textTextContentThe content of the images text

Returns the current builder.


textItemType​

textItemType(textItemType);

Set the images text item type.

Parameters

NAMETYPEDESCRIPTION
textItemType"LABEL" | "TEXT"The type of the images text

Returns the current builder.


textWidth​

textWidth(width);

Set the image texts width.

Parameters

NAMETYPEDESCRIPTION
widthTextSizeThe text width

Returns the current builder.


textHeight​

textHeight(height);

Set the image texts height.

Parameters

NAMETYPEDESCRIPTION
heightTextSizeThe text height

Returns the current builder.


richText​

richText(richText);

Set the image texts richText.

Parameters

NAMETYPEDESCRIPTION
richTextRichTextThe rich text

Returns the current builder.


plainText​

plainText(plainText);

Set the image texts plainText.

Parameters

NAMETYPEDESCRIPTION
plainTextstringThe plain text

Returns the current builder.


textType​

textType(textType);

Set the image texts textType.

Parameters

NAMETYPEDESCRIPTION
textType"PLAIN" | "RICH"The text type

Returns the current builder.


textPadding​

textPadding(padding);

Set the image text styles padding.

Parameters

NAMETYPEDESCRIPTION
paddingnumberThe text padding

Returns the current builder.


fontFamily​

fontFamily(fontFamily);

Set the image text styles fontFamily.

Parameters

NAMETYPEDESCRIPTION
fontFamilystringThe text font family

Returns the current builder.


fontSize​

fontSize(fontSize);

Set the image text styles fontSize.

Parameters

NAMETYPEDESCRIPTION
fontSizenumberThe text font size

Returns the current builder.


fontWeight​

fontWeight(fontWeight);

Set the image text styles fontWeight.

Parameters

NAMETYPEDESCRIPTION
fontWeightnumberThe text font weight

Returns the current builder.


textAlign​

textAlign(textAlign);

Set the image text styles textAlign.

Parameters

NAMETYPEDESCRIPTION
textAlign"LEFT" | "CENTER" | "RIGHT"The text horizontal alignment

Returns the current builder.


textAlignVertical​

textAlignVertical(textAlignVertical);

Set the image text styles textAlignVertical.

Parameters

NAMETYPEDESCRIPTION
textAlignVertical"BOTTOM" | "MIDDLE" | "TOP"The text vertical alignment

Returns the current builder.


textFillColor​

textFillColor(fillColor);

Set the image text styles fillColor.

Parameters

NAMETYPEDESCRIPTION
fillColorstringThe texts fill color

Returns the current builder.


textFillOpacity​

textFillOpacity(fillOpacity);

Set the image text styles fillOpacity.

Parameters

NAMETYPEDESCRIPTION
fillOpacitynumberThe texts fill opacity

Returns the current builder.


textStrokeColor​

textStrokeColor(strokeColor);

Set the image text styles strokeColor.

Parameters

NAMETYPEDESCRIPTION
strokeColorstringThe texts stroke color

Returns the current builder.


textStrokeOpacity​

textStrokeOpacity(strokeOpacity);

Set the image text styles strokeOpacity.

Parameters

NAMETYPEDESCRIPTION
strokeOpacitynumberThe texts stroke opacity

Returns the current builder.


textStrokeWidth​

textStrokeWidth(strokeWidth);

Set the image text styles strokeWidth.

Parameters

NAMETYPEDESCRIPTION
strokeWidthnumberThe texts stroke width

Returns the current builder.


textLineHeight​

textLineHeight(lineHeight);

Set the image text styles lineHeight.

Parameters

NAMETYPEDESCRIPTION
lineHeightnumberThe texts line height

Returns the current builder.


build​

build();

Returns the final Image item.