Add (or replace) pixel data to the frame
| 710 | |
| 711 | // Add (or replace) pixel data to the frame |
| 712 | void Frame::AddImage( |
| 713 | int new_width, int new_height, int bytes_per_pixel, |
| 714 | QImage::Format type, const unsigned char *pixels_) |
| 715 | { |
| 716 | if (has_image_data) { |
| 717 | // Delete the previous QImage |
| 718 | image.reset(); |
| 719 | } |
| 720 | |
| 721 | // Create new image object from pixel data |
| 722 | auto new_image = std::make_shared<QImage>( |
| 723 | pixels_, |
| 724 | new_width, new_height, |
| 725 | new_width * bytes_per_pixel, |
| 726 | type, |
| 727 | (QImageCleanupFunction) &openshot::cleanUpBuffer, |
| 728 | (void*) pixels_ |
| 729 | ); |
| 730 | AddImage(new_image); |
| 731 | } |
| 732 | |
| 733 | // Add (or replace) pixel data to the frame |
| 734 | void Frame::AddImage(std::shared_ptr<QImage> new_image) |
no test coverage detected