KImgIO
pic_io_handler.cpp
Go to the documentation of this file.
00001 00021 #include "pic_io_handler.h" 00022 #include "pic_rw.h" 00023 00024 bool SoftimagePICHandler::canRead() const { 00025 if (!SoftimagePICHandler::canRead(device())) { 00026 return false; 00027 } 00028 setFormat("pic"); 00029 return true; 00030 } 00031 00032 bool SoftimagePICHandler::read(QImage *image) { 00033 pic_read(device(), image); 00034 return true; 00035 } 00036 00037 bool SoftimagePICHandler::write(const QImage &image) { 00038 pic_write(device(), &image); 00039 return true; 00040 } 00041 00042 bool SoftimagePICHandler::canRead(QIODevice *device) { 00043 PICHeader hdr; 00044 if (picReadHeader(device, &hdr, true)) { 00045 if (strncmp(hdr.id, "PICT", 4) == 0) { 00046 return true; 00047 } 00048 } 00049 return false; 00050 } 00051 00052 QVariant SoftimagePICHandler::option(ImageOption option) const { 00053 if (option == Size) { 00054 PICHeader hdr; 00055 if (picReadHeader(device(), &hdr, true)) { 00056 return QSize(hdr.width, hdr.height); 00057 } else { 00058 return QSize(-1, -1); 00059 } 00060 } 00061 return QVariant(); 00062 } 00063 00064 bool SoftimagePICHandler::supportsOption(ImageOption option) const { 00065 return ( option == Size); 00066 } 00067 00068 QByteArray SoftimagePICHandler::name() const { 00069 return "pic"; 00070 } 00071
KDE 4.6 API Reference