mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
macOS: Fix CGBitmapInfo C++26 enum compilation error
This commit is contained in:
@@ -28,7 +28,7 @@ CGImageRef MatToCGImage(const cv::Mat& image) {
|
|||||||
|
|
||||||
// Preserve alpha transparency, if exists
|
// Preserve alpha transparency, if exists
|
||||||
bool alpha = image.channels() == 4;
|
bool alpha = image.channels() == 4;
|
||||||
CGBitmapInfo bitmapInfo = (alpha ? kCGImageAlphaLast : kCGImageAlphaNone) | kCGBitmapByteOrderDefault;
|
CGBitmapInfo bitmapInfo = (CGBitmapInfo)(alpha ? kCGImageAlphaLast : kCGImageAlphaNone) | (CGBitmapInfo)kCGBitmapByteOrderDefault;
|
||||||
|
|
||||||
// Creating CGImage from cv::Mat
|
// Creating CGImage from cv::Mat
|
||||||
CGImageRef imageRef = CGImageCreate(image.cols,
|
CGImageRef imageRef = CGImageCreate(image.cols,
|
||||||
@@ -73,8 +73,8 @@ void CGImageToMat(const CGImageRef image, cv::Mat& m, bool alphaExist) {
|
|||||||
colorSpace = CGColorSpaceCreateDeviceRGB();
|
colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||||
m.create(rows, cols, CV_8UC4); // 8 bits per component, 4 channels
|
m.create(rows, cols, CV_8UC4); // 8 bits per component, 4 channels
|
||||||
if (!alphaExist)
|
if (!alphaExist)
|
||||||
bitmapInfo = kCGImageAlphaNoneSkipLast |
|
bitmapInfo = (CGBitmapInfo)kCGImageAlphaNoneSkipLast |
|
||||||
kCGBitmapByteOrderDefault;
|
(CGBitmapInfo)kCGBitmapByteOrderDefault;
|
||||||
else
|
else
|
||||||
m = cv::Scalar(0);
|
m = cv::Scalar(0);
|
||||||
contextRef = CGBitmapContextCreate(m.data, m.cols, m.rows, 8,
|
contextRef = CGBitmapContextCreate(m.data, m.cols, m.rows, 8,
|
||||||
@@ -86,8 +86,8 @@ void CGImageToMat(const CGImageRef image, cv::Mat& m, bool alphaExist) {
|
|||||||
{
|
{
|
||||||
m.create(rows, cols, CV_8UC4); // 8 bits per component, 4 channels
|
m.create(rows, cols, CV_8UC4); // 8 bits per component, 4 channels
|
||||||
if (!alphaExist)
|
if (!alphaExist)
|
||||||
bitmapInfo = kCGImageAlphaNoneSkipLast |
|
bitmapInfo = (CGBitmapInfo)kCGImageAlphaNoneSkipLast |
|
||||||
kCGBitmapByteOrderDefault;
|
(CGBitmapInfo)kCGBitmapByteOrderDefault;
|
||||||
else
|
else
|
||||||
m = cv::Scalar(0);
|
m = cv::Scalar(0);
|
||||||
contextRef = CGBitmapContextCreate(m.data, m.cols, m.rows, 8,
|
contextRef = CGBitmapContextCreate(m.data, m.cols, m.rows, 8,
|
||||||
|
|||||||
Reference in New Issue
Block a user