23#ifndef VCL_IO_IMAGE_QT_LOAD_H
24#define VCL_IO_IMAGE_QT_LOAD_H
26#include <vclib/io/file_info.h>
36inline std::set<FileFormat> loadImageFormats()
39 FileFormat(
"bmp",
"Bitmap"),
41 std::vector<std::string> {
"jpg",
"jpeg"},
42 "Joint Photographic Experts Group"),
43 FileFormat(
"png",
"Portable Network Graphics"),
44 FileFormat(
"pbm",
"Portable Bitmap"),
45 FileFormat(
"pgm",
"Portable Graymap"),
46 FileFormat(
"ppm",
"Portable Pixmap"),
47 FileFormat(
"xbm",
"X11 Bitmap"),
48 FileFormat(
"xpm",
"X11 Pixmap"),
52inline std::shared_ptr<unsigned char> loadImageData(
53 const std::string& filename,
57 std::shared_ptr<unsigned char> ptr;
58 QImage img(filename.c_str());
60 img.convertTo(QImage::Format_RGBA8888);
62 ptr = std::shared_ptr<unsigned char>(
63 new unsigned char[img.width() * img.height() * 4]);
65 img.bits(), img.bits() + img.width() * img.height() * 4, ptr.get());
67 w = QImage(filename.c_str()).width();
68 h = QImage(filename.c_str()).height();