From 3b107890adfdccf0ebfe509c1944635e7b4ac325 Mon Sep 17 00:00:00 2001 From: HaiVQ Date: Wed, 11 Dec 2024 16:46:54 +0700 Subject: [PATCH] Rename ARGB conversion functions to BGRA for consistency and clarity --- src/effects/Outline.cpp | 10 +++++----- src/effects/Outline.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/effects/Outline.cpp b/src/effects/Outline.cpp index e570c90e..ddbc813a 100644 --- a/src/effects/Outline.cpp +++ b/src/effects/Outline.cpp @@ -56,8 +56,8 @@ std::shared_ptr Outline::GetFrame(std::shared_ptr channels(4); @@ -95,7 +95,7 @@ std::shared_ptr Outline::GetFrame(std::shared_ptr new_frame_image = ARGBCvMatToQImage(final_image); + std::shared_ptr new_frame_image = BGRACvMatToQImage(final_image); // FIXME: The shared_ptr::swap does not work somehow // frame_image.swap(new_frame_image); @@ -105,11 +105,11 @@ std::shared_ptr Outline::GetFrame(std::shared_ptr& qimage) { +cv::Mat Outline::QImageToBGRACvMat(std::shared_ptr& qimage) { return cv::Mat(qimage->height(), qimage->width(), CV_8UC4, (uchar*)qimage->constBits(), qimage->bytesPerLine()); } -std::shared_ptr Outline::ARGBCvMatToQImage(cv::Mat img) { +std::shared_ptr Outline::BGRACvMatToQImage(cv::Mat img) { QImage qimage(img.data, img.cols, img.rows, img.step, QImage::Format_ARGB32); std::shared_ptr imgIn = std::make_shared(qimage.convertToFormat(QImage::Format_RGBA8888_Premultiplied)); return imgIn; diff --git a/src/effects/Outline.h b/src/effects/Outline.h index 23c3b15c..2cdb3392 100644 --- a/src/effects/Outline.h +++ b/src/effects/Outline.h @@ -42,8 +42,8 @@ namespace openshot // Although Frame class has GetImageCV, but it does not include alpha channel // so we need a separate methods which preserve alpha channel // Idea from: https://stackoverflow.com/a/78480103 - cv::Mat QImageToARGBCvMat(std::shared_ptr& qimage); - std::shared_ptr ARGBCvMatToQImage(cv::Mat img); + cv::Mat QImageToBGRACvMat(std::shared_ptr& qimage); + std::shared_ptr BGRACvMatToQImage(cv::Mat img); public: Keyframe width; ///< Width of the outline