diff --git a/src/immvision/image.h b/src/immvision/image.h index b3091d6..55fa809 100644 --- a/src/immvision/image.h +++ b/src/immvision/image.h @@ -313,6 +313,7 @@ namespace ImmVision const cv::Mat& mat, ImVec2* size, bool refreshImage = false, + bool resizable = true, bool showOptionsButton = false, bool isBgrOrBgra = true ); diff --git a/src/immvision/internal/image.cpp b/src/immvision/internal/image.cpp index 39ee5d2..5e1a87e 100644 --- a/src/immvision/internal/image.cpp +++ b/src/immvision/internal/image.cpp @@ -682,10 +682,12 @@ namespace ImmVision const cv::Mat& mat, ImVec2* size, bool refreshImage, + bool resizable, bool showOptionsButton, bool isBgrOrBgra ) { + IM_ASSERT(size != nullptr && "ImageDisplayResizable: size must not be null"); ImGuiID id = ImGui::GetID(label_id.c_str()); static std::map s_Params; if (s_Params.find(id) == s_Params.end()) @@ -699,7 +701,7 @@ namespace ImmVision { params.ShowOptionsButton = showOptionsButton; params.ImageDisplaySize = imageDisplaySize; - params.CanResize = true; + params.CanResize = resizable; params.RefreshImage = refreshImage; params.IsColorOrderBGR = isBgrOrBgra; @@ -709,8 +711,6 @@ namespace ImmVision std::string hiddenLabel = std::string("##") + label_id; Image(hiddenLabel, mat, ¶ms); - - *size = ImVec2((float)params.ImageDisplaySize.width, (float)params.ImageDisplaySize.height); return params.MouseInfo.MousePosition; } diff --git a/src_all_in_one/immvision/immvision.cpp b/src_all_in_one/immvision/immvision.cpp index d3a5123..e10176c 100644 --- a/src_all_in_one/immvision/immvision.cpp +++ b/src_all_in_one/immvision/immvision.cpp @@ -326,6 +326,7 @@ namespace ImmVision const cv::Mat& mat, ImVec2* size, bool refreshImage = false, + bool resizable = true, bool showOptionsButton = false, bool isBgrOrBgra = true ); @@ -10116,7 +10117,6 @@ namespace ImmVision s_Params[id] = params; } - ImageParams& params = s_Params.at(id); { params.ShowOptionsButton = showOptionsButton; @@ -10137,10 +10137,12 @@ namespace ImmVision const cv::Mat& mat, ImVec2* size, bool refreshImage, + bool resizable, bool showOptionsButton, bool isBgrOrBgra ) { + IM_ASSERT(size != nullptr && "ImageDisplayResizable: size must not be null"); ImGuiID id = ImGui::GetID(label_id.c_str()); static std::map s_Params; if (s_Params.find(id) == s_Params.end()) @@ -10154,7 +10156,7 @@ namespace ImmVision { params.ShowOptionsButton = showOptionsButton; params.ImageDisplaySize = imageDisplaySize; - params.CanResize = true; + params.CanResize = resizable; params.RefreshImage = refreshImage; params.IsColorOrderBGR = isBgrOrBgra; @@ -10164,8 +10166,6 @@ namespace ImmVision std::string hiddenLabel = std::string("##") + label_id; Image(hiddenLabel, mat, ¶ms); - - *size = ImVec2((float)params.ImageDisplaySize.width, (float)params.ImageDisplaySize.height); return params.MouseInfo.MousePosition; } diff --git a/src_all_in_one/immvision/immvision.h b/src_all_in_one/immvision/immvision.h index 7d7663e..f51efa1 100644 --- a/src_all_in_one/immvision/immvision.h +++ b/src_all_in_one/immvision/immvision.h @@ -321,6 +321,7 @@ namespace ImmVision const cv::Mat& mat, ImVec2* size, bool refreshImage = false, + bool resizable = true, bool showOptionsButton = false, bool isBgrOrBgra = true );