简体   繁体   中英

What is the fastest way to copy a QImage's pixels to an array?

I'm planning to store an QImage 's pixel data in an array, then do some work with it in OpenCL.

What is the best approach to get all pixel data (colour code)?

uchar * QImage::bits () gives the pointer to the first pixel data. You can create an OpenCL buffer with CL_MEM_USE_HOST_POINTER flag by passing pointer returned from bits.

使用QImage::bits()QImage::byteCount()方法来获取指向图像数据的原始指针以及图像数据的字节大小。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM