python_vali.PySurfaceRotator

class python_vali.PySurfaceRotator

CUDA-accelerated Surface rotator.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: python_vali._python_vali.PySurfaceRotator, gpu_id: int) -> None

    Constructor for PySurfaceRotator with GPU ID.

    Creates a new instance of PySurfaceRotator that will run on the specified GPU. The CUDA stream will be automatically created and managed.

    param gpu_id:

    The ID of the GPU to use for rotation

    type gpu_id:

    int

    raises RuntimeError:

    If the specified GPU is not available

  2. __init__(self: python_vali._python_vali.PySurfaceRotator, gpu_id: int, stream: int) -> None

    Constructor for PySurfaceRotator with GPU ID and CUDA stream.

    Creates a new instance of PySurfaceRotator that will run on the specified GPU using the provided CUDA stream.

    param gpu_id:

    The ID of the GPU to use for rotation

    type gpu_id:

    int

    param stream:

    The CUDA stream to use for rotation

    type stream:

    int

    raises RuntimeError:

    If the specified GPU is not available

Methods

Run(self, src, dst, angle[, shift_x, shift_y])

Rotate input Surface synchronously.

RunAsync(self, src, dst, angle[, shift_x, ...])

Rotate input Surface asynchronously.

__init__(*args, **kwargs)

Overloaded function.

Attributes

Stream

Get the CUDA stream associated with this instance.

SupportedFormats

Get list of supported pixel formats for rotation.

Run(self: python_vali._python_vali.PySurfaceRotator, src: python_vali._python_vali.Surface, dst: python_vali._python_vali.Surface, angle: float, shift_x: float = 0.0, shift_y: float = 0.0) tuple[bool, python_vali._python_vali.TaskExecInfo]

Rotate input Surface synchronously.

Processes the input surface and stores the rotated result in the output surface. This method blocks until the rotation is complete. For 90-degree rotations with no shift, the method optimizes the operation by handling display matrix rotation cases.

Parameters:
  • src (Surface) – Input surface to be rotated

  • dst (Surface) – Output surface to store the rotated result

  • angle (float) – Rotation angle in degrees

  • shift_x (float) – Shift along X axis in pixels (default: 0.0)

  • shift_y (float) – Shift along Y axis in pixels (default: 0.0)

Returns:

Tuple containing: - success (bool): True if rotation was successful, False otherwise - info (TaskExecInfo): Detailed execution information

Return type:

tuple[bool, TaskExecInfo]

Raises:

RuntimeError – If the rotation fails

RunAsync(self: python_vali._python_vali.PySurfaceRotator, src: python_vali._python_vali.Surface, dst: python_vali._python_vali.Surface, angle: float, shift_x: float = 0.0, shift_y: float = 0.0) tuple[bool, python_vali._python_vali.TaskExecInfo]

Rotate input Surface asynchronously.

Processes the input surface and stores the rotated result in the output surface. This method returns immediately without waiting for the rotation to complete. For 90-degree rotations with no shift, the method optimizes the operation by handling display matrix rotation cases.

Parameters:
  • src (Surface) – Input surface to be rotated

  • dst (Surface) – Output surface to store the rotated result

  • angle (float) – Rotation angle in degrees

  • shift_x (float) – Shift along X axis in pixels (default: 0.0)

  • shift_y (float) – Shift along Y axis in pixels (default: 0.0)

Returns:

Tuple containing: - success (bool): True if rotation was successful, False otherwise - info (TaskExecInfo): Detailed execution information

Return type:

tuple[bool, TaskExecInfo]

Raises:

RuntimeError – If the rotation fails

property Stream

Get the CUDA stream associated with this instance.

Returns the handle to the CUDA stream used for rotation processing.

Returns:

CUDA stream handle

Return type:

int

property SupportedFormats

Get list of supported pixel formats for rotation.

Returns a list of pixel formats that can be processed by the rotator. Supported formats include: Y, GRAY12, RGB, BGR, RGB_PLANAR, YUV420, YUV422, YUV444, RGB_32F, RGB_32F_PLANAR, YUV444_10bit, YUV420_10bit.

Returns:

List of supported pixel formats

Return type:

list[Pixel_Format]