mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-17 01:15:06 +03:00
py: Support controls that use an array of Rectangles
The Python bindings will now accept, or return, a list or tuple of libcamera.Rectangle objects for such controls. This had previously been omitted, but now we have, for example, the AfWindows control which requires this feature. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
1bd74b91be
commit
a6b1ff2e6c
1 changed files with 3 additions and 5 deletions
|
@ -46,10 +46,8 @@ py::object controlValueToPy(const ControlValue &cv)
|
|||
return valueOrTuple<float>(cv);
|
||||
case ControlTypeString:
|
||||
return py::cast(cv.get<std::string>());
|
||||
case ControlTypeRectangle: {
|
||||
const Rectangle *v = reinterpret_cast<const Rectangle *>(cv.data().data());
|
||||
return py::cast(v);
|
||||
}
|
||||
case ControlTypeRectangle:
|
||||
return valueOrTuple<Rectangle>(cv);
|
||||
case ControlTypeSize: {
|
||||
const Size *v = reinterpret_cast<const Size *>(cv.data().data());
|
||||
return py::cast(v);
|
||||
|
@ -88,7 +86,7 @@ ControlValue pyToControlValue(const py::object &ob, ControlType type)
|
|||
case ControlTypeString:
|
||||
return ControlValue(ob.cast<std::string>());
|
||||
case ControlTypeRectangle:
|
||||
return ControlValue(ob.cast<Rectangle>());
|
||||
return controlValueMaybeArray<Rectangle>(ob);
|
||||
case ControlTypeSize:
|
||||
return ControlValue(ob.cast<Size>());
|
||||
case ControlTypeNone:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue