@@ -238,6 +238,17 @@ inline void register_python(py::module_& m) {
238238 .value (" POWER_OF_TWO_SMALLER" , ResizeMethod::POWER_OF_TWO_SMALLER)
239239 .value (" POWER_OF_TWO_NEAREST" , ResizeMethod::POWER_OF_TWO_NEAREST);
240240
241+ py::class_<ResizeBounds>(ImageConversion, " ResizeBounds" )
242+ .def (py::init ())
243+ .def (py::init<uint16_t >())
244+ .def (py::init<uint16_t , uint16_t >())
245+ .def (py::init<uint16_t , uint16_t , uint16_t , uint16_t >())
246+ .def_rw (" resize_min_width" , &ResizeBounds::resizeMinWidth)
247+ .def_rw (" resize_max_width" , &ResizeBounds::resizeMaxWidth)
248+ .def_rw (" resize_min_height" , &ResizeBounds::resizeMinHeight)
249+ .def_rw (" resize_max_height" , &ResizeBounds::resizeMaxHeight)
250+ .def (" clamp" , &ResizeBounds::clamp, " width" _a, " height" _a);
251+
241252 ImageConversion.def (" get_resized_dim" , &getResizedDim, " n" _a, " resize_method" _a);
242253 ImageConversion.def (" get_resized_dims" , [](uint16_t width, ResizeMethod widthResize, uint16_t height, ResizeMethod heightResize) -> std::pair<uint16_t , uint16_t > {
243254 setResizedDims (width, widthResize, height, heightResize);
@@ -579,8 +590,7 @@ inline void register_python(py::module_& m) {
579590 .def_rw (" height_resize_method" , &VTF::CreationOptions::heightResizeMethod)
580591 .def_rw (" filter" , &VTF::CreationOptions::filter)
581592 .def_rw (" flags" , &VTF::CreationOptions::flags)
582- .def_rw (" requested_resize_width" , &VTF::CreationOptions::requestedResizeWidth)
583- .def_rw (" requested_resize_height" , &VTF::CreationOptions::requestedResizeHeight)
593+ .def_rw (" resize_bounds" , &VTF::CreationOptions::resizeBounds)
584594 .def_rw (" initial_frame_count" , &VTF::CreationOptions::initialFrameCount)
585595 .def_rw (" start_frame" , &VTF::CreationOptions::startFrame)
586596 .def_rw (" is_cubemap" , &VTF::CreationOptions::isCubeMap)
@@ -707,7 +717,7 @@ inline void register_python(py::module_& m) {
707717 .def (" set_image" , [](VTF& self, const py::bytes& imageData, ImageFormat format, uint16_t width, uint16_t height, ImageConversion::ResizeFilter filter = ImageConversion::ResizeFilter::DEFAULT, uint8_t mip = 0 , uint16_t frame = 0 , uint8_t face = 0 , uint16_t slice = 0 , float quality = ImageConversion::DEFAULT_COMPRESSED_QUALITY) {
708718 return self.setImage ({static_cast <const std::byte*>(imageData.data ()), imageData.size ()}, format, width, height, filter, mip, frame, face, slice, quality);
709719 }, " image_data" _a, " format" _a, " width" _a, " height" _a, " filter" _a, " mip" _a = 0 , " frame" _a = 0 , " face" _a = 0 , " slice" _a = 0 , " quality" _a = ImageConversion::DEFAULT_COMPRESSED_QUALITY)
710- .def (" set_image_from_file" , py::overload_cast<const std::filesystem::path&, ImageConversion::ResizeFilter, uint8_t , uint16_t , uint8_t , uint16_t , float , uint16_t , uint16_t >(&VTF::setImage), " image_path" _a, " filter" _a = ImageConversion::ResizeFilter::DEFAULT, " mip" _a = 0 , " frame" _a = 0 , " face" _a = 0 , " slice" _a = 0 , " quality" _a = ImageConversion::DEFAULT_COMPRESSED_QUALITY, " requested_resize_width " _a = 0 , " requested_resize_height " _a = 0 )
720+ .def (" set_image_from_file" , py::overload_cast<const std::filesystem::path&, ImageConversion::ResizeFilter, uint8_t , uint16_t , uint8_t , uint16_t , float , ImageConversion::ResizeBounds >(&VTF::setImage), " image_path" _a, " filter" _a = ImageConversion::ResizeFilter::DEFAULT, " mip" _a = 0 , " frame" _a = 0 , " face" _a = 0 , " slice" _a = 0 , " quality" _a = ImageConversion::DEFAULT_COMPRESSED_QUALITY, " resize_bounds " _a = ImageConversion::ResizeBounds{} )
711721 .def (" save_image" , [](const VTF& self, uint8_t mip = 0 , uint16_t frame = 0 , uint8_t face = 0 , uint16_t slice = 0 , ImageConversion::FileFormat fileFormat = ImageConversion::FileFormat::DEFAULT) {
712722 const auto d = self.saveImageToFile (mip, frame, face, slice, fileFormat);
713723 return py::bytes{d.data (), d.size ()};
0 commit comments