# Class LazyResizableRawTexture

A resizable RGBA raw texture where bits and bytes can be manipulated freely. The texture will always be square.

#### Implements

- ISceneComponent

##### Index

### Constructors

constructor

### Properties

hasAlpha
name
onUpdateObservable

### Accessors

scene
size
sizeInBytes

### Methods

attachToScene
bits
bytes
dispose
getTexture
rebuild
register
reset
setMinSize
updateIfTextureHasChanges

## Constructors

### constructor

- new LazyResizableRawTexture(
  name: string,
  hasAlpha: boolean,
  _maxTextureSize?: number,
  _onPixelChanged?: Uint32BitsOnChangedEventHandler,
  ): LazyResizableRawTexture

  Constructor

  #### Parameters

  - name: string

    Name of texture

  - hasAlpha: boolean

    Whether texture has alpha or not.

  - _maxTextureSize: number = 4096

    Maximum size of the texture. Default is 4096. May actually become less than the specified value if the GPU does not support it.

  - _onPixelChanged: Uint32BitsOnChangedEventHandler = ...

    Callback invoked when a pixel has changed its value.

  #### Returns LazyResizableRawTexture

## Properties

### hasAlpha

hasAlpha: boolean

Whether texture has alpha or not.

### name

name: string

Name of texture

Implementation of ISceneComponent.name

### `Readonly` onUpdateObservable

onUpdateObservable: Observable<LazyResizableRawTexture> = ...

## Accessors

### scene

- get scene(): Scene

  #### Returns Scene

  #### Inherit Doc

  Implementation of ISceneComponent.scene

### size

- get size(): number

  Size in pixels (RGBA) of texture.

  #### Returns number

### sizeInBytes

- get sizeInBytes(): number

  Total size in bytes of the RGBA texture

  #### Returns number

## Methods

### attachToScene

- attachToScene(scene: Scene): LazyResizableRawTexture

  Attaches the texture to a scene and ensures it is updated before rendering frames or to a render target. A texture can only be attached to one scene.

  #### Parameters

  - scene: Scene

    The scene to attach the texture to.

  #### Returns LazyResizableRawTexture

  The LazyResizableRawTexture instance.

  #### Throws

  Error if the engine is not available.

### bits

- bits(pixelOffset: number): Uint32Bits

  Gets a Uint32Bits instance that can be used to manipulate the bits of the RGBA pixel stored at the offset specified by `pixelOffset` WARNING: Never ever store a reference to the Uint32Bits instance. It is reused for all pixels in the texture. whenever bits or bytes are called again the Uint32Bits instance will point to a new pixel. This behavior is because of performace.

  #### Parameters

  - pixelOffset: number

    Pixel offset.

  #### Returns Uint32Bits

  Uint32Bits instance

### bytes

- bytes(pixelOffset: number): Uint32Bytes

  Gets a Uint32Bytes instance that can be used to manipulate the bytes of the RGBA pixel stored at the offset specified by `pixelOffset` WARNING: Never ever store a reference to the Uint32Bytes instance. It is reused for all pixels in the texture. whenever bits or bytes are called again the Uint32Bytes instance will point to a new pixel. This behavior is because of performace.

  #### Parameters

  - pixelOffset: number

    Pixel offset.

  #### Returns Uint32Bytes

  Uint32Bits instance

### dispose

- dispose(): void

  #### Returns void

  #### Inherit Doc

  Implementation of ISceneComponent.dispose

### getTexture

- getTexture(_scene: Scene): RawTexture

  Gets a BJS `RawTexture` that represents the current LazyResizableRawTexture instance.

  #### Parameters

  - _scene: Scene

    BJS scene.

  #### Returns RawTexture

  A BJS `RawTexture`.

### rebuild

- rebuild(): void

  #### Returns void

  #### Inherit Doc

  Implementation of ISceneComponent.rebuild

### register

- register(): void

  #### Returns void

  #### Inherit Doc

  Implementation of ISceneComponent.register

### reset

- reset(): void

  Resets texture. back to 0 size.

  #### Returns void

### setMinSize

- setMinSize(sz: number): number

  Sets the minimum size of the texture. If the texture is already larger then size will not be changed.

  #### Parameters

  - sz: number

    Minimum size.

  #### Returns number

  The actual size.

### updateIfTextureHasChanges

- updateIfTextureHasChanges(scene: Scene, forceRecreate?: boolean): boolean

  Updates the texture (uploads it to the GPU) if required. Will only be updated if there actually is changes in the texture since the last time that updateIfTextureHasChanges was called.

  #### Parameters

  - scene: Scene
  - forceRecreate: boolean = false

  #### Returns boolean

  `true` if texture was updated, otherwise `false`.