Image

class lluvia.core.Image
allocationInfo
changeLayout(self, ImageLayout newLayout)

Changes image layout.

Parameters

newLayoutstr.

The new layout. Its value must be one of the values defined in lluvia.ImageLayout:

  • Undefined

  • General

  • ColorAttachmentOptimal

  • DepthStencilAttachmentOptimal

  • DepthStencilReadOnlyOptimal

  • ShaderReadOnlyOptimal

  • TransferSrcOptimal

  • TransferDstOptimal

  • Preinitialized

  • PresentSrcKHR

  • SharedPresentKHR

  • DepthReadOnlyStencilAttachmentOptimalKHR

  • DepthAttachmentStencilReadOnlyOptimalKHR

channelType
channels
clear(self)

Immediately clears the image pixels to zero.

This method creates a command buffer and sumbits it to clear all the pixels in the underlying image to zero. Execution is blocked until the operation is completed.

copyTo(self, dst)

Immediately copies the content of this image into the destination.

This method creates a command buffer and sumbits it to copy the content of this image into dst. No valiation of destination image shape is performed. Execution is blocked until the operation is completed.

Parameters

dstImage or ImageView

Destination object.

createImageView(self, ImageFilterMode filterMode=ImageFilterMode.Nearest, ImageAddressMode addressMode=ImageAddressMode.Repeat, bool normalizedCoordinates=False, bool sampled=False)

Creates a new image view from this image.

Parameters

filterModestr. Defaults to ‘Nearest’.

Filtering more for reading pixels within a shader. Possible values are defined in lluvia.ImageFilterMode:

  • Nearest

  • Linear

addressModestr. Defaults to ‘Repeat’.

Addressing mode for reading pixels that are outside of the image boundaries. Possible values are defined in lluvia.ImageAddressMode:

  • Repeat

  • MirroredRepeat

  • ClampToEdge

  • ClampToBorder

  • MirrorClampToEdge

normalizedCoordinatesbool. Defaults to False.

Tells whether or not to use normalized coordinates to read pixels within a shader.

sampledbool. Defaults to False.

Tells whether or not to use a sampler object for reading pixels within a shader.

Returns

imgViewlluvia.ImageView

Image view object.

Raises

ValueErrorif either filterMode or addressMode

parameter have incorrect values.

RuntimeError : if the image view cannot be created.

depth
fromHost(self, ndarray arr)

Copies the content of a numpy array to this image.

The shape of the array must comply with the following rules.

  • If arr.ndim == 1, then this image must be 1D

    (height, depth and channels equal to 1) and img.width == arr.shape[0]

  • If arr.ndim == 2, then this image must be 2D

    (depth and channels equal to 1) and img.height == arr.shape[0] and img.width == arr.shape[1].

  • If arr.ndim == 3, then this image must be 2D (depth equal to 1)

    with the number of channels equal to arr.shape[2].

  • If arr.ndim == 4, then this image must be 3D and

    img.depth == arr.shape[0] and img.height == arr.shape[1] and img.width == arr.shape[2] and img.chhanels == arr.chape[3]

Parameters

arr : numpy.ndarray.

Raises

ValueError : if arr does not match this image shape.

height
layout
memory
minimumSize
session
shape
size
toHost(self, ndarray output=None)

Copies the content of this image into a numpy host array.

Parameters

output : numpy.ndarray. Defaults to None.

Raises

ValueError : if output is different than None and does not match this image shape.

usageFlags
width