Introduction
vtkTextProperty is an object that represents text properties. The primary
properties that can be set are color, opacity, font size, font family
horizontal and vertical justification, bold/italic/shadow styles.
Methods
extend
Method use to decorate a given object (publicAPI+model) with vtkProperty characteristics.
Argument | Type | Required | Description |
---|---|---|---|
publicAPI |
Yes | object on which methods will be bounds (public) | |
model |
Yes | object on which data structure will be bounds (protected) | |
initialValues |
ITextPropertyInitialValues | No | (default: {}) |
getBackgroundColor
Get the background color.
getBackgroundColorByReference
Get the background color by reference.
getFillStyle
Get the fill style.
getFontColor
Get the font color.
getFontColorByReference
Get the font color by reference.
getFontFamily
Get the font family.
getFontSizeScale
Get the font size scale.
getFontStyle
Get the font style.
getResolution
Get the resolution.
getShadowBlur
Get the shadow blur radius.
getShadowColor
Get the shadow color.
getShadowColorByReference
Get the shadow color by reference.
getShadowOffset
Get the shadow offset.
getShadowOffsetByReference
Get the shadow offset by reference.
newInstance
Method use to create a new instance of vtkTextProperty.
Argument | Type | Required | Description |
---|---|---|---|
initialValues |
ITextPropertyInitialValues | No | for pre-setting some of its content |
setBackgroundColor
Set the background color.
Argument | Type | Required | Description |
---|---|---|---|
backgroundColor |
RGBColor | Yes | The background color to set. |
setFillStyle
Set the fill style.
Argument | Type | Required | Description |
---|---|---|---|
fillStyle |
string | Yes | The fill style to set. |
setFontColor
Set the font color from RGB values.
Argument | Type | Required | Description |
---|---|---|---|
r |
number | Yes | Red component (0-255) |
g |
number | Yes | Green component (0-255) |
b |
number | Yes | Blue component (0-255) |
setFontColorFrom
Set the font color.
Argument | Type | Required | Description |
---|---|---|---|
fontColor |
RGBColor | Yes | The font color to set. |
setFontFamily
Set the font family.
Argument | Type | Required | Description |
---|---|---|---|
fontFamily |
string | Yes | The font family to set. |
setFontSizeScale
Set the font size scale.
Scales the font size based on the given resolution.
Dividing by 1.8 ensures the font size is proportionate and not too large.
The value 1.8 is a chosen scaling factor for visual balance.
Argument | Type | Required | Description |
---|---|---|---|
resolution |
number | Yes | The resolution to set. |
setFontStyle
Set the font style.
Argument | Type | Required | Description |
---|---|---|---|
fontStyle |
string | Yes | The font style to set. |
setResolution
Set the resolution.
Argument | Type | Required | Description |
---|---|---|---|
resolution |
number | Yes | The resolution to set. |
setShadowBlur
Set the shadow blur radius.
Argument | Type | Required | Description |
---|---|---|---|
shadowBlur |
number | Yes | The shadow blur radius to set. |
setShadowColor
Set the shadow color from RGB values.
Argument | Type | Required | Description |
---|---|---|---|
r |
number | Yes | Red component (0-255) |
g |
number | Yes | Green component (0-255) |
b |
number | Yes | Blue component (0-255) |
setShadowColorFrom
Set the shadow color.
Argument | Type | Required | Description |
---|---|---|---|
shadowColor |
RGBColor | Yes | The shadow color to set. |
setShadowOffset
Set the shadow offset from x and y values.
Argument | Type | Required | Description |
---|---|---|---|
x |
number | Yes | Horizontal offset |
y |
number | Yes | Vertical offset |
setShadowOffsetFrom
Set the shadow offset.
Argument | Type | Required | Description |
---|---|---|---|
shadowOffset |
Array | Yes | The shadow offset to set, as an array of [x, y]. |
Source
import { RGBColor } from '../../../types'; |
import macro from 'vtk.js/Sources/macros'; |