mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-05-28 00:30:23 -04:00
Remove the xv image format plugin
It appears to be some internal format of xview, although I cannot find any mention of such a thing on the internet. There does not appear to be any sort of mime type to associate with this file format, either. Therefore, I think it is reasonable to declare it obsolete. REVIEW: 115768
This commit is contained in:
parent
18ddd0920f
commit
3eafdc861a
@ -53,7 +53,6 @@ kimageformats_read_tests(
|
||||
rgb
|
||||
tga
|
||||
xcf
|
||||
xv
|
||||
)
|
||||
|
||||
# Basic write tests
|
||||
@ -70,5 +69,4 @@ kimageformats_write_tests(
|
||||
pic-lossless
|
||||
rgb-lossless
|
||||
tga # fixme: the alpha images appear not to be written properly
|
||||
xv
|
||||
)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 969 B |
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
@ -1,6 +0,0 @@
|
||||
P7 332
|
||||
#XVVERSION:
|
||||
#IMGINFO:
|
||||
#END_OF_COMMENTS:
|
||||
32 32 255
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>刍据菥灮抖兕襼瀧痪嘿究<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>蹚W澻紐>vjn懯q]Z殮暩];<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>蹚W}架<>?>>rf'K什~z7v殮箏?<3F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>刍哭<E5888D>繜灮媑k<E5AA91><6B><EFBFBD>炕哌<E78295>呖<EFBFBD><E59196><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>硂忹<E7A182><E5BFB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>{[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>~}~<7E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>寒<EFBFBD><E5AF92><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>紊<EFBFBD><E7B48A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>躔<EFBFBD><E8BA94><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>見望<E8A68B><E69C9B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>蝽铥<E89DBD><E993A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>講<EFBFBD><E8AC9B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>歽<EFBFBD><E6ADBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>葚<EFBFBD><E8919A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>礿<EFBFBD><E7A4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>oO<><4F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>oNR<4E><52><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>矏敽<E79F8F><E695BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>謺曏<E8ACBA><E69B8F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>縹~<7E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>薷皋<E896B7><E79A8B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>簈q<E7B088><71><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>++<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>蹞撣<E8B99E><E692A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
@ -125,11 +125,3 @@ target_link_libraries(kimg_xcf Qt5::Gui)
|
||||
install(TARGETS kimg_xcf DESTINATION ${QT_PLUGIN_INSTALL_DIR}/imageformats/)
|
||||
install(FILES xcf.desktop DESTINATION ${SERVICES_INSTALL_DIR}/qimageioplugins/)
|
||||
|
||||
##################################
|
||||
|
||||
add_library(kimg_xview MODULE xview.cpp)
|
||||
target_link_libraries(kimg_xview Qt5::Gui)
|
||||
|
||||
install(TARGETS kimg_xview DESTINATION ${QT_PLUGIN_INSTALL_DIR}/imageformats/)
|
||||
install(FILES xv.desktop DESTINATION ${SERVICES_INSTALL_DIR}/qimageioplugins/)
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Type=Service
|
||||
X-KDE-ServiceTypes=QImageIOPlugins
|
||||
X-KDE-ImageFormat=xv
|
||||
X-KDE-MimeType=
|
||||
X-KDE-Read=true
|
||||
X-KDE-Write=true
|
@ -1,242 +0,0 @@
|
||||
/**
|
||||
* QImageIO Routines to read/write XV images.
|
||||
* copyright (c) 1998 Torben Weis <weis@kde.org>
|
||||
* copyright (c) 1999 Oliver Eiden <o.eiden@pop.ruhr.de>
|
||||
*
|
||||
* This library is distributed under the conditions of the GNU LGPL.
|
||||
*/
|
||||
|
||||
#include "xview.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <QImage>
|
||||
|
||||
#define BUFSIZE 1024
|
||||
|
||||
static const int b_255_3[] = {0, 85, 170, 255}, // index*255/3
|
||||
rg_255_7[] = {0, 36, 72, 109, 145, 182, 218, 255}; // index *255/7
|
||||
|
||||
XVHandler::XVHandler()
|
||||
{
|
||||
}
|
||||
|
||||
bool XVHandler::canRead() const
|
||||
{
|
||||
if (canRead(device())) {
|
||||
setFormat("xv");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool XVHandler::read(QImage *retImage)
|
||||
{
|
||||
int x = -1;
|
||||
int y = -1;
|
||||
int maxval = -1;
|
||||
QIODevice *iodev = device();
|
||||
|
||||
char str[ BUFSIZE ];
|
||||
|
||||
// magic number must be "P7 332"
|
||||
iodev->readLine(str, BUFSIZE);
|
||||
if (strncmp(str, "P7 332", 6)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// next line #XVVERSION
|
||||
iodev->readLine(str, BUFSIZE);
|
||||
if (strncmp(str, "#XVVERSION", 10)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// now it gets interesting, #BUILTIN means we are out.
|
||||
// if IMGINFO comes, we are happy!
|
||||
iodev->readLine(str, BUFSIZE);
|
||||
if (strncmp(str, "#IMGINFO:", 9)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// after this an #END_OF_COMMENTS signals everything to be ok!
|
||||
iodev->readLine(str, BUFSIZE);
|
||||
if (strncmp(str, "#END_OF", 7)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// now a last line with width, height, maxval which is
|
||||
// supposed to be 255
|
||||
iodev->readLine(str, BUFSIZE);
|
||||
sscanf(str, "%d %d %d", &x, &y, &maxval);
|
||||
|
||||
if (maxval != 255) {
|
||||
return false;
|
||||
}
|
||||
int blocksize = x * y;
|
||||
if (x < 0 || y < 0 || blocksize < x || blocksize < y) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// now follows a binary block of x*y bytes.
|
||||
char *block = (char *) malloc(blocksize);
|
||||
if (!block) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (iodev->read(block, blocksize) != blocksize) {
|
||||
free(block);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create the image
|
||||
QImage image(x, y, QImage::Format_Indexed8);
|
||||
int numColors;
|
||||
numColors = qMin(maxval + 1, 0);
|
||||
numColors = qMax(0, maxval + 1);
|
||||
image.setColorCount(numColors);
|
||||
|
||||
// how do the color handling? they are absolute 24bpp
|
||||
// or at least can be calculated as such.
|
||||
int r, g, b;
|
||||
|
||||
for (int j = 0; j < 256; j++) {
|
||||
r = rg_255_7[((j >> 5) & 0x07)];
|
||||
g = rg_255_7[((j >> 2) & 0x07)];
|
||||
b = b_255_3[((j >> 0) & 0x03)];
|
||||
image.setColor(j, qRgb(r, g, b));
|
||||
}
|
||||
|
||||
for (int py = 0; py < y; py++) {
|
||||
uchar *data = image.scanLine(py);
|
||||
memcpy(data, block + py * x, x);
|
||||
}
|
||||
|
||||
*retImage = image;
|
||||
|
||||
free(block);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool XVHandler::write(const QImage &image)
|
||||
{
|
||||
QIODevice &f = *(device());
|
||||
|
||||
// Removed "f.open(...)" and "f.close()" (tanghus)
|
||||
|
||||
int w = image.width(), h = image.height();
|
||||
|
||||
char str[ 1024 ];
|
||||
|
||||
// magic number must be "P7 332"
|
||||
f.write("P7 332\n", 7);
|
||||
|
||||
// next line #XVVERSION
|
||||
f.write("#XVVERSION:\n", 12);
|
||||
|
||||
// now it gets interesting, #BUILTIN means we are out.
|
||||
// if IMGINFO comes, we are happy!
|
||||
f.write("#IMGINFO:\n", 10);
|
||||
|
||||
// after this an #END_OF_COMMENTS signals everything to be ok!
|
||||
f.write("#END_OF_COMMENTS:\n", 18);
|
||||
|
||||
// now a last line with width, height, maxval which is supposed to be 255
|
||||
sprintf(str, "%i %i 255\n", w, h);
|
||||
f.write(str, strlen(str));
|
||||
|
||||
QImage tmpImage(image);
|
||||
if (image.depth() == 1) {
|
||||
tmpImage = image.convertToFormat(QImage::Format_Indexed8, Qt::AutoColor);
|
||||
}
|
||||
|
||||
uchar *buffer = new uchar[ w ];
|
||||
|
||||
for (int py = 0; py < h; py++) {
|
||||
const uchar *data = tmpImage.scanLine(py);
|
||||
for (int px = 0; px < w; px++) {
|
||||
int r, g, b;
|
||||
if (tmpImage.depth() == 32) {
|
||||
const QRgb *data32 = (QRgb *) data;
|
||||
r = qRed(*data32) >> 5;
|
||||
g = qGreen(*data32) >> 5;
|
||||
b = qBlue(*data32) >> 6;
|
||||
data += sizeof(QRgb);
|
||||
} else {
|
||||
QRgb color = tmpImage.color(*data);
|
||||
r = qRed(color) >> 5;
|
||||
g = qGreen(color) >> 5;
|
||||
b = qBlue(color) >> 6;
|
||||
data++;
|
||||
}
|
||||
buffer[ px ] = (r << 5) | (g << 2) | b;
|
||||
}
|
||||
f.write((const char *)buffer, w);
|
||||
}
|
||||
delete[] buffer;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool XVHandler::canRead(QIODevice *device)
|
||||
{
|
||||
if (!device) {
|
||||
qWarning("XVHandler::canRead() called with no device");
|
||||
return false;
|
||||
}
|
||||
|
||||
qint64 oldPos = device->pos();
|
||||
|
||||
char head[6];
|
||||
qint64 readBytes = device->read(head, sizeof(head));
|
||||
if (readBytes != sizeof(head)) {
|
||||
if (device->isSequential()) {
|
||||
while (readBytes > 0) {
|
||||
device->ungetChar(head[readBytes-- - 1]);
|
||||
}
|
||||
} else {
|
||||
device->seek(oldPos);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (device->isSequential()) {
|
||||
while (readBytes > 0) {
|
||||
device->ungetChar(head[readBytes-- - 1]);
|
||||
}
|
||||
} else {
|
||||
device->seek(oldPos);
|
||||
}
|
||||
|
||||
return qstrncmp(head, "P7 332", 6) == 0;
|
||||
}
|
||||
|
||||
QImageIOPlugin::Capabilities XVPlugin::capabilities(QIODevice *device, const QByteArray &format) const
|
||||
{
|
||||
if (format == "xv") {
|
||||
return Capabilities(CanRead | CanWrite);
|
||||
}
|
||||
if (!format.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
if (!device->isOpen()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Capabilities cap;
|
||||
if (device->isReadable() && XVHandler::canRead(device)) {
|
||||
cap |= CanRead;
|
||||
}
|
||||
if (device->isWritable()) {
|
||||
cap |= CanWrite;
|
||||
}
|
||||
return cap;
|
||||
}
|
||||
|
||||
QImageIOHandler *XVPlugin::create(QIODevice *device, const QByteArray &format) const
|
||||
{
|
||||
QImageIOHandler *handler = new XVHandler;
|
||||
handler->setDevice(device);
|
||||
handler->setFormat(format);
|
||||
return handler;
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/**
|
||||
* QImageIO Routines to read/write XV images.
|
||||
* copyright (c) 1998 Torben Weis <weis@kde.org>
|
||||
* copyright (c) 1999 Oliver Eiden <o.eiden@pop.ruhr.de>
|
||||
*
|
||||
* This library is distributed under the conditions of the GNU LGPL.
|
||||
*
|
||||
*
|
||||
* Changelog:
|
||||
* 23.3.99 Oliver Eiden <o.eiden@pop.ruhr.de>
|
||||
* changed the mapping from 3-3-2 decoded pixels to 8-8-8 decoded true-color pixels
|
||||
* now it uses the same mapping as xv, this leads to better visual results
|
||||
* Patch merged in HEAD by Chris Spiegel <matrix@xirtam.org>
|
||||
*/
|
||||
#ifndef KIMG_XVIEW_H
|
||||
#define KIMG_XVIEW_H
|
||||
|
||||
#include <QImageIOPlugin>
|
||||
|
||||
class XVHandler : public QImageIOHandler
|
||||
{
|
||||
public:
|
||||
XVHandler();
|
||||
|
||||
virtual bool canRead() const;
|
||||
virtual bool read(QImage *image);
|
||||
virtual bool write(const QImage &image);
|
||||
|
||||
static bool canRead(QIODevice *device);
|
||||
};
|
||||
|
||||
class XVPlugin : public QImageIOPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "xview.json")
|
||||
|
||||
public:
|
||||
virtual Capabilities capabilities(QIODevice *device, const QByteArray &format) const;
|
||||
virtual QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const;
|
||||
};
|
||||
|
||||
#endif // KIMG_XVIEW_H
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"Keys": [ "xv" ],
|
||||
"MimeTypes": [ ]
|
||||
}
|
Loading…
Reference in New Issue
Block a user