Painter
Painter
Namespace
A global namespace containing various functionality for Blockbench's 2D and 3D paint tools and texture editor
Property | Type | Description |
---|---|---|
currentPixel | ArrayVector2 | |
brushChanges | boolean | |
current | any | |
selection | any | |
mirror_painting | boolean | |
lock_alpha | boolean | |
erase_mode | boolean | |
default_brush_presets | Array of any |
edit( texture, callback, options )
Arguments:
texture
: Texturecallback
: See typesoptions
: TextureEditOptionsmethod
:"canvas"
or"jimp"
(Optional) - Edit method. 'canvas' is defaultedit_name
: string (Optional) - Name of the undo entry that is createduse_cache
: boolean (Optional) - Whether to use the cached canvas/jimp instanceno_undo
: boolean (Optional) - If true, no undo point is created. Default is falseno_update
: boolean (Optional) - If true, the texture is not updated visuallyno_undo_init
: boolean (Optional)no_undo_finish
: boolean (Optional)
setAlphaMatrix( texture, x, y, val )
Arguments:
texture
: Texturex
: numbery
: numberval
: number
getAlphaMatrix( texture, x, y )
Arguments:
texture
: Texturex
: numbery
: number
Returns: number
combineColors( base, added, opacity )
Arguments:
Returns: RGBAColor
blendColors( base, added, opacity, blend_mode )
Arguments:
Returns: RGBAColor
getMirrorElement( element, symmetry_axes )
Arguments:
element
: OutlinerElementsymmetry_axes
: Array of number
updateNslideValues()
getBlendModeCompositeOperation()
Returns: string
getCanvas( texture )
Arguments:
texture
: Texture
Returns: HTMLCanvasElement
scanCanvas( ctx, x, y, w, h, cb )
Arguments:
ctx
: CanvasRenderingContext2Dx
: numbery
: numberw
: numberh
: numbercb
: See types
getPixelColor( ctx, x, y )
Arguments:
ctx
: CanvasRenderingContext2Dx
: numbery
: number
modifyCanvasSection( ctx, x, y, w, h, cb )
Arguments:
ctx
: CanvasRenderingContext2Dx
: numbery
: numberw
: numberh
: numbercb
: See types
editCircle( ctx, x, y, r, softness, editPx )
Arguments:
ctx
: CanvasRenderingContext2Dx
: numbery
: numberr
: numbersoftness
: numbereditPx
: See types
editSquare( ctx, x, y, r, softness, editPx )
Arguments:
ctx
: CanvasRenderingContext2Dx
: numbery
: numberr
: numbersoftness
: numbereditPx
: See types
openBrushOptions()
loadBrushPreset( preset )
Arguments:
preset
: any