Painter

Painter

Namespace

A global namespace containing various functionality for Blockbench's 2D and 3D paint tools and texture editor

PropertyTypeDescription
currentPixelArrayVector2
brushChangesboolean
currentany
selectionany
mirror_paintingboolean
lock_alphaboolean
erase_modeboolean
default_brush_presetsArray of any

edit( texture, callback, options )

Arguments:
  • texture: Texture
  • callback: See types
  • options: TextureEditOptions
    • method: "canvas" or "jimp" (Optional) - Edit method. 'canvas' is default
    • edit_name: string (Optional) - Name of the undo entry that is created
    • use_cache: boolean (Optional) - Whether to use the cached canvas/jimp instance
    • no_undo: boolean (Optional) - If true, no undo point is created. Default is false
    • no_update: boolean (Optional) - If true, the texture is not updated visually
    • no_undo_init: boolean (Optional)
    • no_undo_finish: boolean (Optional)

setAlphaMatrix( texture, x, y, val )

Arguments:
  • texture: Texture
  • x: number
  • y: number
  • val: number

getAlphaMatrix( texture, x, y )

Arguments:
  • texture: Texture
  • x: number
  • y: number

Returns: number

combineColors( base, added, opacity )

Arguments:

Returns: RGBAColor

blendColors( base, added, opacity, blend_mode )

Arguments:

Returns: RGBAColor

getMirrorElement( element, symmetry_axes )

Arguments:

updateNslideValues()

getBlendModeCompositeOperation()

Returns: string

getCanvas( texture )

Arguments:

Returns: HTMLCanvasElement

scanCanvas( ctx, x, y, w, h, cb )

Arguments:

getPixelColor( ctx, x, y )

Arguments:

modifyCanvasSection( ctx, x, y, w, h, cb )

Arguments:

editCircle( ctx, x, y, r, softness, editPx )

Arguments:

editSquare( ctx, x, y, r, softness, editPx )

Arguments:

openBrushOptions()

loadBrushPreset( preset )

Arguments:
  • preset: any