Compare commits

...

270 Commits

Author SHA1 Message Date
d1136c4bac GIT_SILENT Upgrade ECM and KF5 version requirements for 5.72.0 release. 2020-07-04 09:51:54 +00:00
a446331a5e GIT_SILENT Upgrade ECM and KF5 version requirements for 5.71.0 release. 2020-06-06 19:34:48 +00:00
37be13e3a4 GIT_SILENT increase KF_DISABLE_DEPRECATED_BEFORE_AND_AT 2020-06-05 10:40:11 +02:00
51d0b2ad86 GIT_SILENT: we don't use phabricator anymore 2020-05-19 07:13:43 +02:00
8562ce18f1 Add some sanity and bounds checking
Since QImage does sanity checking for overflows and stuff wrt.
dimensions and depth, check for QImage::isNull() as early as possible to
see if there's some funky business going on.

Also tried to add some checks wherever we wrote to "raw" memory.

Unit tests pass, and tested converting some files from
https://samples.ffmpeg.org/image-samples/ to pngs, and that seemed to
work.

Reviewed By: aacid

Differential Revision: https://phabricator.kde.org/D24367
2020-05-10 18:06:56 +02:00
f5b26cc9f9 GIT_SILENT increase KF_DISABLE_DEPRECATED_BEFORE_AND_AT 2020-05-10 00:38:45 +02:00
105d0fab46 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.70.0 release. 2020-05-02 21:58:20 +00:00
497b6b81bd Fix build on Windows.
We added our own implementation of rand_r to make sure we use the same
as Gimp, and to make Windows work. But we need to actually use it
everywhere.

Discussion in Differential:

Differential Revision: https://phabricator.kde.org/D25267
2020-04-15 09:46:54 +02:00
c60e77c048 Add support for modern Gimp images/XCF files
We now support up to and including version 11 of the XCF format, earlier
it only supported version 1 (from 1997, according to the XCF spec).

Biggest difference seems to be that they changed to 64bit for offsets
from version 11 and upwards, otherwise it's mostly just newer enum
values and theoretically major stuff that we don't really need to care
about to get a thumbnail (e. g. linear vs. perceptual RGB).

We still don't support all features, but now it handles that more
gracefully and should at least create thumbnails that are usable. It
should also be easier to update in the future if/when there comes new
versions.

Also added a test file created with the latest version of Gimp
(2.10.18).

Reviewed By: aacid

Differential Revision: https://phabricator.kde.org/D25937
2020-04-13 14:52:33 +02:00
f089e860e0 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.69.0 release. 2020-04-04 22:35:32 +00:00
551e7d44a8 Port the HDR plugin from sscanf() to QRegularExpression. Fixes FreeBSD. 2020-03-29 13:04:34 +02:00
232075f92e Port HDR plugin to qCDebug, to debug CI failure on FreeBSD
NO_CHANGELOG
2020-03-29 12:14:13 +02:00
1d12b345f9 GIT_SILENT add missing newline 2020-03-29 01:06:42 +01:00
becd7aff3a autotests: print QImageReader::supportedImageFormats, to debug CI failures 2020-03-29 00:47:47 +01:00
52fbe1863b GIT_SILENT increase KF_DISABLE_DEPRECATED_BEFORE_AND_AT 2020-03-25 00:54:05 +01:00
203f459536 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.68.0 release. 2020-03-07 08:52:35 +00:00
693bb34b69 GIT_SILENT: qtcreator created .cmake/ repo. 2020-02-12 07:12:24 +01:00
5c66570b9e GIT_SILENT increase KF_DISABLE_DEPRECATED_BEFORE_AND_AT 2020-02-09 20:26:37 +01:00
cba2328ae6 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.67.0 release. 2020-02-01 09:04:07 +00:00
961465a311 GIT_SILENT Bump KF5 deprecation level to 5.66 2020-01-12 12:46:21 +01:00
b7cd5cddc1 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.66.0 release. 2020-01-03 23:12:09 +00:00
ce56b97ee7 GIT_SILENT Upgrade Qt5 version requirement to 5.12.0. 2019-12-21 12:34:54 +01:00
500ce13265 Update the obsolete projects.kde.org URL
Use the generic redirect commits.kde.org.

Change discussed on the kde-frameworks-devel list:
https://mail.kde.org/pipermail/kde-frameworks-devel/2019-November/097564.html
2019-12-15 22:42:38 +01:00
f03739f222 pic: Fix Invalid-enum-value undefined behaviour
Summary:
Instead of directly casting the quint8 to PicChannelEncoding we just store the quint8
and compare it to the possible PicChannelEncoding values when needed

oss-fuzz/19344

Reviewers: dfaure

Reviewed By: dfaure

Subscribers: dfaure, security-team, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D25937
2019-12-14 21:05:02 +01:00
69effbf9f5 GIT_SILENT Bump KF5 deprecation level to 5.65 2019-12-14 12:22:02 +01:00
f06cf300f1 GIT_SILENT Bump KF5 deprecation level to 5.64 2019-12-14 11:45:23 +01:00
2a4d230717 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.65.0 release. 2019-12-07 19:43:41 +00:00
bdf23e45d5 GIT_SILENT QT_DEPRECATED_WARNINGS_SINCE will be done by ECM 2019-11-03 21:13:00 +01:00
e9b52df1d3 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.64.0 release. 2019-11-02 11:44:38 +00:00
dd98b2b717 Workaround crash in Qt due to -DQT_DISABLE_DEPRECATED_BEFORE=0x050d00
https://codereview.qt-project.org/c/qt/qtbase/+/279215

NO_CHANGELOG
2019-10-27 09:38:43 +01:00
dd76f41c38 GIT_SILENT disable use of deprecated KF5 API 2019-10-26 23:20:53 +02:00
940ca2b081 GIT_SILENT enable Qt deprecation warnings 2019-10-25 00:28:24 +02:00
b14ef357e5 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.63.0 release. 2019-10-06 09:35:52 +00:00
bf5502403e Add files for testing bug411327 2019-09-20 23:18:17 +02:00
5c4c05257c xcf: Fix regression when reading files with "unsupported" properties
Summary:
The fact that we don't know the property is most of the times not fatal,
so what we have to do is just "skip" the property and hope for the best

BUGS: 411327

Reviewers: cfeck, apol, vkrause

Reviewed By: vkrause

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D24114
2019-09-20 22:41:26 +02:00
7afaacb093 xcf: Properly read image resolution
Summary:
QDataStream reads 64 bits when reading into a float unless you tell it to use SinglePrecision,
since floats in xcf are 32 bit, do that

Reviewers: cfeck, apol, vkrause

Reviewed By: vkrause

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D24113
2019-09-20 22:41:03 +02:00
68bb1a0ee7 Port HDR (Radiance RGBE) image loader to Qt5
Tested with HDR images from hdrihaven.com
* Loading in KolourPaint works
* Thumbnails in Dolphin work

Reviewed by: aacid

Differential Revision: https://phabricator.kde.org/D23811
2019-09-14 14:05:30 +02:00
9a9ac6e8fe GIT_SILENT Upgrade ECM and KF5 version requirements for 5.62.0 release. 2019-09-07 12:35:26 +00:00
4bf2894bde Fix uninitialized memory read
Summary:
Make sure whole of pixel_size in pixel has data either because it was
read or because we set it to 0

oss-fuzz/14565

Reviewers: dfaure, apol, vkrause

Reviewed By: vkrause

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D23739
2019-09-05 20:05:35 +02:00
40353da5db GIT_SILENT Upgrade ECM and KF5 version requirements for 5.61.0 release. 2019-08-03 19:33:24 +00:00
068e711847 Remove explicit use of ECM_KDE_MODULE_DIR, is part of ECM_MODULE_PATH
GIT_SILENT
2019-08-02 22:54:45 +02:00
90ba55d982 Remove unused pnm.desktop file 2019-07-20 11:29:31 +02:00
e3603bc748 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.60.0 release. 2019-07-06 13:15:48 +00:00
75ef81a109 QImage::byteCount -> QImage::sizeInByes 2019-07-04 22:26:53 +02:00
bff22e2a76 GIT_SILENT Upgrade Qt5 version requirement to 5.11.0. 2019-07-04 19:23:58 +02:00
0196444a99 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.59.0 release. 2019-06-01 16:38:28 +00:00
90f340df24 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.58.0 release. 2019-05-04 22:44:00 +00:00
1a9b5d6cb6 tga: don't try to read more than max_palette_size into palette 2019-05-01 01:51:42 +02:00
96b1d7e7bc tga: memset dst if read fails 2019-05-01 01:51:39 +02:00
bcce48012e tga: memset the whole palette array, not only the palette_size 2019-05-01 01:44:47 +02:00
0db5c89c5f Initialize the unread bits of _starttab
oss-fuzz #14446
2019-04-25 23:08:17 +02:00
6fea48c4ee xcf: Fix uninitialized memory use on broken documents
oss-fuzz #14312
2019-04-17 20:09:49 +02:00
645daec1ef ras: Don't overread input on malformed files 2019-04-17 20:03:52 +02:00
aaa285a3b9 xcf: layer is const in copy and merge, mark it as such 2019-04-17 17:37:28 +02:00
35e64c44d8 No & is a bit faster here 2019-04-17 17:37:28 +02:00
26b796f67d const & is a bit faster here 2019-04-17 17:37:28 +02:00
4692a34a1c QStringLiteral is a bit faster here 2019-04-17 17:37:28 +02:00
c0656c5181 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.57.0 release. 2019-04-07 07:18:46 +00:00
83d1ca90d9 Fix compilation
Summary:
Seems only gcc can do a constexpr with strlen.

This fixes the build with clang, hopefully to with MSVC?

Reviewers: svuorela

Reviewed By: svuorela

Subscribers: svuorela, apol, pino, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D20149
2019-03-31 22:18:16 +02:00
fd4fb6f596 ora:kra: qstrcmp -> memcmp
i..e don't check strings but memory

Makes oss-fuzz happier.

Reviewers: svuorela

Reviewed By: svuorela

Subscribers: apol, pino, security-team, rempt, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D20143
2019-03-31 21:32:07 +02:00
a24ece396a autotests: Also exercise canRead 2019-03-31 20:58:26 +02:00
9fc6967f4f Fix RGBHandler::canRead
Summary:
As one can see in SGIImage::readImage the accepted images are

    _stream >> u16;
    if (u16 != 0x01da) {
        return false;
    }

    _stream >> _rle;
    if (_rle > 1) {
        return false;
    }

so not only \x01\xda\x01 but also \x01\xda\x00

Reviewers: svuorela

Reviewed By: svuorela

Subscribers: svuorela, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D20145
2019-03-31 19:44:21 +02:00
bd704045e6 xcf: Don't crash with files with unsupported layer modes 2019-03-31 01:35:33 +01:00
af7a89fea7 GIT_SILENT: add gitignore 2019-03-04 07:03:36 +01:00
5989bba56a GIT_SILENT Upgrade ECM and KF5 version requirements for 5.56.0 release. 2019-03-02 13:27:12 +00:00
20100a1e0e ras: fix crash on broken files
Replace QVector::operator[] with QVector::value() since we can't know for
sure the values will be on range so use value() that gives us a 0 if the
index is not on range

oss-fuzz/13462
2019-03-01 23:33:35 +01:00
297b168a52 Use auto here too 2019-02-28 23:03:25 +01:00
f1c6c15b06 compile without foreach
Summary: compile without foreach

Reviewers: dfaure, apol

Reviewed By: apol

Subscribers: apol, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D19317
2019-02-28 23:02:41 +01:00
156bac5e54 ras: protect the palette QVector too
oss-fuzz/13068
2019-02-13 23:50:36 +01:00
d79c11d280 ras: tweak max file check
better to do - 32 than + 32 otherwise we may overflow

oss-fuzz/13017
2019-02-11 22:57:33 +01:00
aeec934839 xcf: Fix uninitialized memory use on broken documents
oss-fuzz/12871
2019-02-08 23:27:03 +01:00
0c4f2f8e62 add const, helps understand the function better 2019-02-08 23:07:56 +01:00
4a8da73f0e ras: tweak max size that "fits" in a QVector
oss-fuzz/12951
2019-02-07 22:14:22 +01:00
039d7d8fbe ras: don't assert because we try to allicate a huge vector
oss-fuzz/12915
2019-02-06 22:06:58 +01:00
b072484dbb ras: Protect against divide by zero
oss-fuzz/12905
2019-02-05 19:51:24 +01:00
bad90cea4b xcf: Don't divide by 0
oss-fuzz/12815
2019-02-03 14:06:33 +01:00
a51cbd865f tga: fail gracefully if readRawData errors
oss-fuzz/12818
2019-02-03 13:49:11 +01:00
1a31500e55 ras: fail gracefully on height*width*bpp > length
oss-fuzz/12822
2019-02-03 13:38:44 +01:00
dd95a5bd0e GIT_SILENT Upgrade ECM and KF5 version requirements for 5.55.0 release. 2019-02-02 17:22:00 +00:00
8d0b625538 xcf: Fix fix for opacity being out of bounds
If max opacity is 255 we want the min between opacity and 255 and not the max
2019-02-01 11:30:28 +01:00
8e48d67568 Uncomment the qdebug includes
i've wasted enough time uncommenting and commenting them again
2019-01-31 01:37:09 +01:00
8b8330b0fe tga: Fix Use-of-uninitialized-value on broken files
oss-fuzz/12776
2019-01-31 01:35:39 +01:00
e7f3c0be44 max opacity is 255
Fixes oss-fuzz/12782
2019-01-31 01:25:38 +01:00
c3152506e2 xcf: Fix assert in files with two PROP_COLORMAP
It's most probably a broken file but better if we don't assert ^_^

oss-fuzz/12780
2019-01-31 01:19:52 +01:00
de7a9a8457 ras: Fix assert because of ColorMapLength being too big
oss-fuzz/12785
2019-01-31 01:03:17 +01:00
c2d2a9be66 pcx: Fix crash on fuzzed file
oss-fuzz/12784
2019-01-31 00:56:25 +01:00
4ee92527c4 xcf: Implement robustness for when PROP_APPLY_MASK is not on the file
fixes oss-fuzz/12754
2019-01-29 22:34:04 +01:00
1bad780baa xcf: loadHierarchy: Obey the layer.type and not the bpp
Otherwise we end up doing uninitialized memory reads on broken/fuzzed
files

oss-fuzz/12761
2019-01-29 20:36:15 +01:00
18e17d3a7a tga: Don't support more than 8 alpha bits
Fixes undefined left shift with negative values

oss-fuzz/12764
2019-01-29 12:39:52 +01:00
e34f53d6ae ras: Return false if allocating the image failed
Probably because it's too huge
2019-01-29 12:32:23 +01:00
6dcea7fd01 rgb: Fix integer overflow in fuzzed file
oss-fuzz/12763
2019-01-29 11:19:58 +01:00
4751e897ce rgb: Fix Heap-buffer-overflow in fuzzed file
oss-fuzz/12757
2019-01-29 10:54:25 +01:00
ac725cca68 psd: Fix crash on fuzzed file
oss-fuzz/12752
2019-01-29 10:53:30 +01:00
f61d64e0e5 xcf: Initialize x/y_offset
https://gitlab.gnome.org/GNOME/gimp/raw/master/devel-docs/xcf.txt
  When reading old XCF files that lack this property, assume (0,0).
2019-01-28 21:51:10 +01:00
e45b65e814 rgb: Fix crash in fuzzed image
An image without color channels makes no sense
2019-01-28 21:48:26 +01:00
7e86e62e86 pcx: Fix crash on fuzzed image 2019-01-28 21:40:42 +01:00
03c3c07004 Fix tests on jenkins
Qt also has a tga image plugin so unless we make sure ours is used first
tests are not testing what they should

On a side note their plugin fails our tests so someone with enough time
should report the failures to them
2019-01-28 21:27:22 +01:00
0e21713267 rgb: fix crash in fuzzed file 2019-01-28 21:10:18 +01:00
188271a5d0 xcf: initialize layer mode
https://gitlab.gnome.org/GNOME/gimp/raw/master/devel-docs/xcf.txt
  When reading old XCF files that lack this property, assume mode==0.
2019-01-28 21:05:29 +01:00
311296dd19 xcf: initialize layer opacity
https://gitlab.gnome.org/GNOME/gimp/raw/master/devel-docs/xcf.txt
  When reading old XCF files that lack this property, full opacity
  should be assumed.
2019-01-28 20:31:18 +01:00
d6ae11a691 xcf: set buffer to 0 if read less data that expected
Fixes MemorySanitizer: use-of-uninitialized-value on fuzzed file
2019-01-28 20:09:21 +01:00
3923c9b855 bzero -> memset
Seems bzero is less portable
2019-01-28 19:18:01 +01:00
51d710adda Fix various OOB reads and writes in kimg_tga and kimg_xcf
Summary:
I had a look at some image loading code in kimageformats and found memory
corruption bugs (there might be more):

- oobwrite4b.xcf: OOB write in kimg_xcf:

By overflowing the "size = 3 * ncolors + 4;" calculation, it's possible to make
size == 3 or size == 0, which then allows 1 or 4 bytes to be overwritten:
https://cgit.kde.org/kimageformats.git/tree/src/imageformats/xcf.cpp?id=3f2552f21b1cdef063c2a93cc95d42a8cf907fcf#n484
The values aren't arbitrary, so AFAICT DoS only.
Fix is to move the sanity check for size below the assignment.

- oobread.tga: OOB read in kimg_tga:

By overflowing the "size = tga.width * tga.height * pixel_size" calculation,
it's possible to cause OOB reads later on as the image data array is too small:
https://cgit.kde.org/kimageformats.git/tree/src/imageformats/tga.cpp?id=3f2552f21b1cdef063c2a93cc95d42a8cf907fcf#n192
Fix is to use a 64bit integer instead.

- oobwrite4b.tga/oobwrite507.tga: OOB write in kimg_tga

If RLE is enabled, any size checks are skipped, so it's possible to write
either 128 repetitions of an arbitrary four byte value (oobwrite4b.tga)
or or 507 arbitrary bytes (oobwrite507.tga) out of bounds.
https://cgit.kde.org/kimageformats.git/tree/src/imageformats/tga.cpp?id=3f2552f21b1cdef063c2a93cc95d42a8cf907fcf#n209
Fix is to check for "num" being negative before reading into the buffer.

Also, bail out early if there is no more data available (reading a 65kx65k px image from 14B data takes ages otherwise)

Test Plan:
Stopped crashing and valgrind don't complain anymore.

TGA preview still works for valid files.

Reviewers: aacid

Reviewed By: aacid

Subscribers: lbeltrame, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D18574
2019-01-28 14:21:27 +01:00
52a5959c08 pic: resize header id back if didn't read 4 bytes as expected 2019-01-28 01:56:12 +01:00
309cddbe83 xcf: bzero buffer if read less data than expected 2019-01-28 01:30:17 +01:00
47f46d4463 xcf: Only call setDotsPerMeterX/Y if PROP_RESOLUTION is found
https://gitlab.gnome.org/GNOME/gimp/blob/master/devel-docs/xcf.txt says
it's not really that important to be there
2019-01-27 13:14:30 +01:00
bff6142b44 xcf: initialize num_colors 2019-01-27 13:07:37 +01:00
09abfd8084 xcf: Initialize layer visible property
https://gitlab.gnome.org/GNOME/gimp/blob/master/devel-docs/xcf.txt says
	When reading old XCF files that lack this property, assume that layers are visible
2019-01-27 13:03:51 +01:00
964624ba40 xcf: Don't cast int to enum that can't hold that int value 2019-01-27 12:50:19 +01:00
3dee6f7c47 xcf: Do not overflow int on the setDotsPerMeterX/Y call 2019-01-27 12:29:07 +01:00
b8cb5e322c delete copy constructor and assignment operator of some internal classes
they are unused, but if anyone would use them things would go wrong, so protect us from it
2019-01-13 22:30:55 +01:00
8803ae9cd6 GIT_SILENT Upgrade Qt5 version requirement to 5.10.0. 2019-01-07 00:19:26 +01:00
e5b7b414df GIT_SILENT Upgrade ECM and KF5 version requirements for 5.54.0 release. 2019-01-04 21:42:58 +00:00
c3b8030674 GIT_SILENT Upgrade CMake version requirement to 3.5. 2018-12-01 23:56:44 +01:00
072b531b0d GIT_SILENT Upgrade ECM and KF5 version requirements for 5.53.0 release. 2018-12-01 14:40:14 +00:00
10f201e414 Use gimp to export simple-rgba-gimp-2.8.10.xcf to png again
This fixes the xcf test that was failing, i guess at some point someone
run optipng or something over the expected result and that was causing
the test to fail
2018-11-17 12:22:25 +01:00
1656913fbd GIT_SILENT Upgrade Qt5 version requirement to 5.9.0. 2018-11-17 11:18:21 +01:00
beaf20bd4a GIT_SILENT Upgrade ECM and KF5 version requirements for 5.52.0 release. 2018-11-03 12:00:43 +00:00
8ac949d459 Fix minor EBN issues 2018-10-22 19:58:24 +03:00
4c0c6c8d60 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.51.0 release. 2018-10-07 10:07:12 +00:00
f485719012 kimg_rgb: optimize away QRegExp and QString::fromLocal8Bit.
Summary:
The code is even simpler this way.

Found by using heaptrack.

Test Plan: the unittest for rgb still passes.

Reviewers: cfeck

Reviewed By: cfeck

Subscribers: jtamate, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15890
2018-10-03 00:51:29 +02:00
1db1b94657 [EPS] qWarning -> qCWarning 2018-09-17 11:56:58 +02:00
98c65a438d [EPS] Fix crash at app shutdown (being tried to persist clipboard image)
Summary:
Deny any capabilities when there is no QApp instance.

BUG: 397040

Test Plan:
Untested, as I do not experience the bug on my system and had no time to
invest into trying to.

Reviewers: zccrs, dfaure, pino

Reviewed By: dfaure

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15405
2018-09-17 11:54:18 +02:00
167967a145 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.50.0 release. 2018-08-31 22:22:12 +00:00
17239a7ea6 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.49.0 release. 2018-08-04 08:43:39 +00:00
118d262bec GIT_SILENT Upgrade ECM and KF5 version requirements for 5.48.0 release. 2018-07-07 21:52:47 +00:00
67a84f459d Use override 2018-06-12 07:01:11 +02:00
de2b942b33 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.47.0 release. 2018-06-02 16:28:21 +00:00
813a7bdddb Remove duplicated mime types from json files
Qt expects a bijection between keys and mime types.
2018-05-25 14:32:11 +03:00
a4d1f4db1d Use override 2018-05-23 08:06:50 +02:00
29d090f078 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.46.0 release. 2018-05-05 12:39:09 +00:00
19f33239e7 [XCF/GIMP loader] Raise maximimum allowed image size to 32767x32767 on 64 bit platforms
The GIMP image loader had a limit to 16K x 16K pixels, because this would
already exhaust the 2 GByte address space limit of 32 bit systems.

Remove this limit on 64 bit systems to allow the full 32K x 32K size.

BUG: 391970

Differential Revision: https://phabricator.kde.org/D12557
2018-05-02 02:10:26 +02:00
4668fbbcdc GIT_SILENT Upgrade ECM and KF5 version requirements for 5.45.0 release. 2018-04-07 07:47:44 +00:00
698ba297d3 We depend against 5.8.0 now 2018-03-27 08:01:04 +02:00
3a9bafdbbe GIT_SILENT Upgrade Qt5 version requirement to 5.8.0. 2018-03-24 13:34:11 +00:00
e5b226e804 Remove not necessary QtCore and co 2018-03-11 13:49:26 +01:00
871d0f976f GIT_SILENT Upgrade ECM and KF5 version requirements for 5.44.0 release. 2018-03-03 09:52:42 +00:00
7aa5333a3f kcoreaddons_add_plugin: remove effectless OBJECT_DEPENDS on json file
The JSON file argument is passed to Q_PLUGIN_METADATA, which is a no-code
macro at the C++ level and only used to note information used by moc
for the generated moc file.

So when the content of the JSON file has changed, this will not change
anything in the preprocessed source file itself. It only has an effect on
the content of the moc file generated based on it, which is either included
and thus already triggers a dependecy or generated by automoc and compiled
separately into the target with the needed dependencies.

It is automoc which needs to properly trigger a recreation of the moc
file when checking the sources (and at least in 3.9 & 10 does),
and this is nothing that can be influenced by dependency rules.
2018-02-23 19:09:18 +01:00
aeabd92eea GIT_SILENT Upgrade ECM and KF5 version requirements for 5.43.0 release. 2018-02-05 08:11:10 +00:00
64e719f329 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.42.0 release. 2018-01-05 23:41:49 +00:00
eef855b146 Remove obsolete reviewboardrc file 2018-01-05 13:24:38 +01:00
04e2ee01cb Set LIBRARY_OUTPUT_DIRECTORY so the autotests can run without the plugins installed
Do this properly by defining a function (inspired by kcoreaddons_add_plugin)
2018-01-05 11:19:18 +01:00
7f2c44add4 Use brace-initializer instead of nullptr in returning 0-QFlags
Differential Revision: https://phabricator.kde.org/D9182
2017-12-05 19:34:30 +01:00
ca67a8f342 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.41.0 release. 2017-12-02 10:14:43 +00:00
23759d0aef GIT_SILENT Upgrade ECM and KF5 version requirements for 5.40.0 release. 2017-11-04 21:43:30 +00:00
bfc02ddfe3 Add .arcconfig 2017-10-15 20:24:32 +02:00
a65b504a44 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.39.0 release. 2017-10-07 11:15:41 +00:00
78aeee7d36 GIT_SILENT Upgrade to ECM 5.38 and make tests run uninstalled 2017-08-14 15:15:23 +02:00
a2d0e43889 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.37.0 release. 2017-08-06 16:42:02 +00:00
e0bd85cbc3 GIT_SILENT Upgrade Qt5 version requirement to 5.7.0. 2017-08-06 16:02:31 +00:00
f16485a872 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.36.0 release. 2017-06-30 10:34:05 +00:00
e3afec9e75 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.35.0 release. 2017-06-03 09:02:51 +00:00
b040cf0f96 Use Q_FALLTHROUGH 2017-06-02 07:52:48 +02:00
7be2757c36 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.34.0 release. 2017-05-06 08:37:02 +00:00
a8562a8471 Upgrade ECM and KF5 version requirements for 5.33.0 release. 2017-04-01 17:33:21 +00:00
252b639638 Upgrade ECM and KF5 version requirements for 5.32.0 release. 2017-03-03 12:56:29 +00:00
b0c8c40dec Upgrade ECM and KF5 version requirements for 5.31.0 release. 2017-02-04 18:20:08 +00:00
1afb7681b7 Upgrade Qt5 version requirement to 5.6.0. 2017-02-03 23:44:22 +00:00
740fe5df0e Use nullptr everywhere
Differential Revision: https://phabricator.kde.org/D3987
2017-01-16 09:44:17 +01:00
e4aa067bd2 Upgrade ECM and KF5 version requirements for 5.30.0 release. 2017-01-08 15:31:27 +00:00
9f77675d91 Require CMake 3.0, as discussed on kde-frameworks-devel 2017-01-03 13:24:41 +01:00
8a8ef69b7c Add FreeBSD to metainfo.yaml.
REVIEW: 129472
2016-12-06 19:06:09 +01:00
95e14f8f60 Upgrade ECM and KF5 version requirements for 5.29.0 release. 2016-12-03 10:23:58 +00:00
1fca298a20 Upgrade ECM and KF5 version requirements for 5.28.0 release. 2016-11-05 11:02:19 +00:00
09b1ac5a16 imageformats/kra.h - overrides for KraPlugin capabilities() and create() 2016-10-16 11:50:18 -04:00
7f852d241a Upgrade ECM and KF5 version requirements for 5.27.0 release. 2016-10-02 08:00:57 +00:00
5fdcdff6e3 Drop obsolete version check
Frameworks already require Qt 5.5.0.

REVIEW: 128989
2016-09-23 00:51:41 +02:00
60b5866b77 Upgrade ECM and KF5 version requirements for 5.26.0 release. 2016-09-05 22:36:08 +00:00
f42c1b7423 Upgrade ECM and KF5 version requirements for 5.25.0 release. 2016-08-06 08:34:21 +00:00
ede3a4a3f3 Qt 5.5.0 is now required, as discussed on kde-frameworks-devel 2016-07-24 13:20:33 +00:00
1d2aed54fa Upgrade ECM and KF5 version requirements for 5.24.0 release. 2016-07-02 08:48:36 +00:00
b019a2a57e Promote Android support 2016-06-18 00:04:19 +02:00
a4de98aa4f Silence CMake policy CMP0063 warning
...by adding the NO_POLICY_SCOPE flag as recommended by ECM's
documentation.

REVIEW: 128139
2016-06-09 17:57:09 +02:00
172c494cff remove extra ';' 2016-06-09 10:57:48 +02:00
e8da107189 Upgrade ECM and KF5 version requirements for 5.23.0 release. 2016-06-06 09:31:22 +00:00
0ae43f7d35 update metainfo.yaml for new kapidox version 2016-05-22 12:10:06 +02:00
36b67d38bb Upgrade ECM and KF5 version requirements for 5.22.0 release. 2016-05-06 19:37:55 +00:00
c1164e4eda Upgrade Qt version requirement. 2016-04-03 20:33:17 +00:00
8630653eff Upgrade ECM and KF5 version requirements for 5.21.0 release. 2016-04-02 15:30:22 +00:00
d4009490c5 Upgrade ECM and KF5 version requirements for 5.20.0 release. 2016-03-04 22:17:55 +00:00
baf894ba19 Move to tier2
6934d54417 added an optional dependency
on karchive. This also means that it doesn't merely depend on Qt and a
small number of third-party libs anymore and needs to moved to tier 2.

REVIEW: 127015
2016-02-08 21:41:20 +01:00
5168d097b5 Upgrade ECM and KF5 version requirements for 5.19.0 release. 2016-02-06 09:37:42 +00:00
6934d54417 Add kra and ora imageio plugins (read-only)
kra is the native format for Krita and ora the interchange format
for krita, gimp and mypaint (it's also mypaint's native format).
Both formats are simply zip containers with an embedded png.

REVIEW:126675
2016-01-31 15:01:32 +01:00
5d7ef7c38e fix loading of RLE compressed PSD files
decodeRLEData() expects a quint16 as length, but the PSD loader calls it
 with a quint32.
We do need quint32 for PSD, otherwise it would overflow for images
bigger than 256x256 pixels (it's the pixel count there, i.e. width x
 height).

BUG: 354413
FIXED-IN: 5.19.0
REVIEW: 126684
2016-01-10 13:24:35 +01:00
a68bfe27ff Upgrade ECM and KF5 version requirements for 5.18.0 release. 2016-01-01 19:58:09 +00:00
9304510ee3 Upgrade ECM and KF5 version requirements for 5.17.0 release. 2015-12-06 14:06:19 +00:00
cc219211bb Upgrade ECM and KF5 version requirements for 5.16.0 release. 2015-11-08 11:08:43 +00:00
f2adcb81d1 Recognize image/vnd.adobe.photoshop instead of image/x-psd
REVIEW: 125790
2015-11-07 13:27:42 +01:00
814c7a2b30 Partially revert d7f457a to prevent crash on application exit
The change to QLatin1String to QStringLiteral had a very nasty
unintended side effect, causing many (but not all) applications to
crash on exit.

Laurent, please be wary with blanket changes on low level code as
they might break things in unexpected ways.

CCMAIL: montel@kde.org
CCMAIL: tittiatcoke@gmail.com
2015-11-04 23:51:53 +01:00
d7f457a124 Use QStringLiteral 2015-11-02 21:57:43 +01:00
69c4a4b84a Upgrade ECM and KF5 version requirements for 5.15.0 release. 2015-10-03 10:22:35 +00:00
e3473a53cf Upgrade ECM and KF5 version requirements for 5.14.0 release. 2015-09-04 20:13:45 +00:00
4a54da668a eps: fix includes related to Qt Caterogized Logging
Testing Done:
Build on OS X 10.8

Reviewed at https://git.reviewboard.kde.org/r/125025/
2015-09-03 18:15:54 +02:00
e5fce91de6 Remove DDS and JPEG-2000 plugins
They were already disabled when building with Qt >= 5.3 in commit
3d45b270ea because Qt has better plugins
for those image formats. Now that we depend on Qt 5.3 we can remove
them.

REVIEW: 124636
2015-08-06 00:57:14 +02:00
c7a04b0ed6 less verbose categorized logging, move to ecm module later 2015-08-02 13:01:54 +02:00
feddd046d7 Upgrade Qt version requirement to 5.3 2015-08-01 14:41:18 +02:00
5800e2f011 Upgrade ECM and KF5 version requirements for 5.13.0 release. 2015-08-01 12:14:00 +00:00
df707db404 Upgrade ECM and KF5 version requirements for 5.12.0 release. 2015-07-04 20:36:35 +00:00
e1bcc3b033 Upgrade ECM and KF5 version requirements for 5.11.0 release. 2015-06-06 09:28:19 +00:00
8c8db0fcd2 Add verbose message for when ECM is not found. 2015-05-13 20:41:18 -06:00
52c7839741 Initialize variable to silence warning [-Wsometimes-uninitialized]
It's uninitialized if the else {} is hit.
2015-05-02 23:32:24 +01:00
3dadfa564d Upgrade ECM and KF5 version requirements for 5.10.0 release. 2015-05-01 15:17:27 +00:00
0414b32297 Upgrade ECM and KF5 version requirements for 5.9.0 release. 2015-04-04 11:48:54 +00:00
55af097749 Don't warn the user/developer about something he can't fix
image formats are loaded via qimage/qimagereader and friends, the user/developer does not choose which ones will be used so giving him a warning about sequential devices not being supported is not going to help anyone, only spam their shell/logs.

REVIEW: 123156
Acked by David Edmundson
2015-03-29 23:21:17 +02:00
b7910e169e Fix build with Qt 5.5 (missing QDataStream include) 2015-02-27 19:03:29 +01:00
c27ba814fd Upgrade ECM and KF5 version requirements for 5.8.0 release. 2015-02-25 14:20:14 +00:00
873746d04b Build fix for OS/X.
CCMAIL: mk-lists@email.de
2015-02-21 11:41:58 +00:00
47e8043d45 Make PSD image reader endianess-agnostic.
By using the same strategy as the SoftImage PIC handler (and sharing
some code with it), we should avoid reading the image data incorrectly
on big-endian architectures.

REVIEW: 122650
BUG: 337918
2015-02-20 23:03:10 +00:00
ac2b63046f Use Q_DECL_OVERRIDE where possible
REVIEW: 122542
2015-02-13 13:31:27 +01:00
6b72930cb2 Upgrade ECM and KF5 version requirements for 5.7.0 release. 2015-01-23 20:40:27 +00:00
4cdcf3a98c Add missing QDataStream include
Fixes build with Qt 5.5
2015-01-17 03:40:59 +01:00
88518c5862 Update installation variables. 2015-01-10 17:46:30 +00:00
b870e9cd47 Upgrade ECM and KF5 version requirements for 5.6.0 release. 2014-12-31 14:23:36 +00:00
c21fc5982b Upgrade ECM and KF5 version requirements for 5.5.0 release. 2014-12-02 16:47:14 +00:00
8ffd5bb2f7 Upgrade ECM and KF5 version requirements for 5.4.0 release. 2014-10-31 20:17:43 +00:00
5ae66b99d9 Upgrade ECM and KF5 version requirements for 5.3.0 release. 2014-10-03 17:55:41 +00:00
f4bea644eb Upgrade ECM and KF5 version requirements for 5.2.0 release. 2014-09-07 23:25:44 +00:00
415850f3d3 Switch the brief descriptions around
Put the shorter description in metainfo.yaml, and the longer one in
README.md.
2014-08-15 18:41:16 +01:00
af19f49711 Add metadata about the QMake and CMake packages installed by this framework and remove Links from README.md 2014-08-13 10:04:37 +02:00
3d45b270ea Disable the DDS and JPEG-2000 plugins when Qt version is 5.3 or later
QtImageFormats 5.3 comes with DDS and JPEG-2000 plugins that support
more options and are generally better than our plugins. The only
advantage our plugins offer is that the Qt DDS plugin does not work on
sequential devices, while ours does. This is outweighed by other
improvements, though, such as supporting more variants.

REVIEW: 119590
2014-08-04 22:50:37 +01:00
c9ca1f1862 Rename headers to end with _p.h
Frameworks have a convention of naming uninstalled headers in src/ with
a _p at the end of the name, to make it clear they are not part of the
API. None of the headers in KImageFormats are installed, so it is not
really necessary to follow this convention, but we follow it anyway for
the benefit of both humans and tools (like kapidox).
2014-08-03 18:08:49 +01:00
a96a255f71 Upgrade ECM and KF5 version requirements for 5.1.0 release. 2014-08-02 08:19:18 +00:00
5b42b3b787 Upgrade ECM version requirement to 1.0.0 after all. 2014-07-01 20:16:27 +02:00
f98e508da4 Upgrade ECM and KF5 version requirements. 2014-07-01 15:32:05 +02:00
a92540f00d Upgrade ECM and KF5 version requirements. 2014-06-01 12:40:39 +02:00
2ec0d5abc6 Fix a compiler warning about signed/unsigned comparisons
The "+ 1" was causing an unsigned value to be cast to a signed value,
which was then compared with an unsigned value, causing the warning.
Making the constant unsigned fixes this.
2014-05-30 16:47:19 +01:00
cca4c545a4 Hide documented internal classes from Doxygen 2014-05-30 16:40:05 +01:00
87b545f9ed Make sure Doxygen does not interpret license headers as dox
The extra *s were confusing it.
2014-05-30 16:38:45 +01:00
1132abbf67 Update metainfo.yaml's short description and platform notes 2014-05-16 17:07:10 +01:00
2a8251c493 Upgrade ECM and KF5 version requirements. 2014-05-04 20:48:28 +02:00
51eca9b6a8 Rewrite the PIC image format handler
It now uses QDataStream to deal with endianness. It also supports
several QImageIOHandler options.

This comes with a more comprehensive test suite than the old code. Note
that the old test suite was incorrect as the old code wrote the floats
in the header out incorrectly (although no-one noticed because no
software seems to care about those values).

All the test PIC files in the test suite appear correct according to the
specification (by inspection with Okteta). Unfortunately, there is a
lack of other freely-available software that reads and writes PIC files
(the main application that uses them is proprietary), and so this is the
best I can do.

REVIEW: 117944
2014-05-04 13:42:30 +01:00
74906dd3bc Add framework information in metainfo.yaml files 2014-04-26 15:29:34 +02:00
c1a7769ecc Rename the yaml file per new policy 2014-04-26 12:21:53 +02:00
1eb5228cce Allow some fuzz in the jp2 unit test
See the comment added to the CMake file.

CCMAIL: jr@jriddell.org
2014-04-25 17:57:40 +01:00
889df138bb Update comment for kde4support -> kdelibs4support rename 2014-04-10 18:27:55 +01:00
101ba47b61 Upgrade ECM version requirement and KF5 version. 2014-03-28 19:17:00 +01:00
2ded57d50e Remove FindOpenEXR.cmake
The file has moved to the extra-cmake-modules repository.

REVIEW: 116713
2014-03-11 15:00:40 +01:00
0f795e6625 Implement fuzzy image matching in readtest
Images are converted to ARGB32 format, then each byte (ie: each pixel
channel) in the read image is allowed to deviate by some specified
amount from the corresponding byte in the expected image, to allow for
rounding errors etc.

By default, no deviation is permitted, but the XCF tests are allowed a
deviation of 1, as the alpha blending can result in rounding errors
(depending on whether hardware acceleration is used, for example).  In
the end, we are not too concerned about a small deviation that is
invisible to the human eye.

REVIEW: 116567
2014-03-05 12:10:45 +00:00
895305050c Extract QImage::Format parsing into its own header
Use the array-of-strings suggested by David Faure so that only one list
has to be maintained instead of three.

REVIEW: 116567
2014-03-05 12:10:31 +00:00
e29a897cb9 Add imagedump: a utility to dump the raw data of a QImage
This is intended as an aid when writing and debugging imageformat
plugins.  It creates a file containing the bytes of QImage::bits(),
which can then be viewed in Okteta.

REVIEW: 116532
2014-03-02 16:09:30 +00:00
6d24f585b1 read autotest: write out data when comparison fails
This helps with debugging, as we can just grab the data rather than
using imageconvertor.

Reviewed-by: David Faure
2014-03-01 14:49:38 +00:00
b4192f9f8b Upgrade ECM version requirement and KF5 version. 2014-03-01 12:51:00 +01:00
6375160828 Remove the WebP format
This will be in Qt 5.3.

REVIEW: 116026
2014-02-25 12:16:34 +00:00
89a3e64c0e Rename webp.xml to kf5-imagesformats-webp.xml on installation
This prevents a clash with kde-runtime 4, and is a better naming scheme
anyway (to prevent accidental clashes with mime packages from other
software).

REVIEW: 115913
2014-02-24 17:04:04 +00:00
6272954cc5 Only perform tests for plugins that are built
This both excludes the autotests and tests subdirs if the user sets
BUILD_TESTING off, and makes sure we do not run tests for formats that
were not built due to dependencies not being found.

REVIEW: 115504
2014-02-23 11:54:40 +00:00
4fbbc75429 WebP: use Q_DECL_OVERRIDE
In doing so, found a method that should not have been overridden, and so
removed it.

REVIEW: 115355
2014-02-20 12:56:17 +00:00
331a813662 WebP: remove unused include
REVIEW: 115355
2014-02-20 12:56:14 +00:00
30cff60296 Make WebP mimetype xml match the one in shared-mime-info-git
This includes the detection magic and an alias for image/webp.  It
should be in shared-mime-info 1.3.

Proposed by Jerome Leclanche <adys.wh@gmail.com>.

REVIEW: 115355
2014-02-20 12:56:10 +00:00
7177296335 Import the WebP image I/O code from kde-runtime
The plugin export mechanism has been patched up (including the addition
of the JSON file), and the FindWebP.cmake file is new.

Writing is currently disabled, as it produces broken images.

Autotests are generated using the cwebp and dwebp utilities distributed
with the libwebp reference library.

REVIEW: 115355
2014-02-20 12:56:00 +00:00
f490ab0761 Fix mimetype declarations in json files
There has to be one mimetype declaration for each format name.

REVIEW: 115686
2014-02-16 10:46:42 +00:00
3eafdc861a 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
2014-02-15 18:47:06 +00:00
18ddd0920f Upgrade ECM version requirement; fix KF5 version. 2014-02-05 00:02:37 +01:00
024db1f42b Move license information to its proper locations
The BSD license goes in the relevant CMake file, and
COPYING-CMAKE-SCRIPTS is removed.  README.md gets a License section
describing the overall license of the framework, as well as a note about
the CMake scripts.

As part of this commit, I release the existing autotest images (which I
created myself) as public domain (or license them under CC0 where public
domain does not apply), ensuring they are compatible with whatever
license the package is distributed under.

REVIEW: 115423
2014-02-04 12:30:22 +00:00
14b4932392 Disable EPS dumb read tests
Possibly unsurprisingly, the dark art of using GhostScript to render a
subset of PostScript is not entirely stable across versions of that
tool.  Additionally, we cannot even guarantee that GhostScript will be
available machines that run the tests.
2014-02-03 18:35:15 +00:00
63705e373e Use #pragma pack instead of __attribute__((packed))
This is available on all supported compilers, the attribute does not exist
for MSVC

REVIEW: 115345
2014-02-03 18:24:01 +01:00
a533bcd418 Use q{To,From}BigEndian instead of hton* and ntoh*
These functions don't seem to be available as inline functions on win32

REVIEW: 115345
2014-02-03 18:23:37 +01:00
bfea0e0e7c Do not do the stupid write test for EPS
EPS writing can be done either by pdftops from Poppler, or by
GhostScript.  These two tools produce very different output, so the
simple write test will always fail on some systems (currently ones
without poppler).
2014-02-03 15:38:46 +00:00
f0f6d14367 Add simple autotests
Two main tests: read the file and compare to a given image (loaded from
png), and write a file out and compare to a previously-written image.

The write test in particular is kind of fragile, but it should help
catch some errors where a code change was not intended to affect the
output of the plugin.

Tests are included for all the writable formats, as well as every
readable format that GIMP can write to (and so I could easily get an
example of).

REVIEW: 115430
2014-02-03 15:03:29 +00:00
32f7d48b3c Fix license header of imageconverter.cpp 2014-02-01 19:06:13 +00:00
e26bd0891d CMakeLists.txt tidy-ups
Indentation fixes and remove obsolete conditional from kdelibs
2014-02-01 17:24:18 +00:00
b1de3377d0 README.md syntax fixes
Use a common list style (-, not *) and escape the # (or else Doxygen
complains).
2014-02-01 17:22:36 +00:00
d5c589dae3 Use new kde_target_enable_exceptions() function from ECM 2014-01-27 12:42:26 +00:00
b2083df231 Add an imported target to FindOpenEXR.cmake
This simplifies using the find module.

REVIEW: 115123
2014-01-27 12:26:26 +00:00
0ee3ffb368 Clean up the CMake files (and a couple of other bits)
src/imageformats/CMakeLists.txt is now much clearer and more consistent.

Also, removed an unnecessary/unimplemented method from exr.cpp.

REVIEW: 115120
2014-01-27 11:43:17 +00:00
cd4a2de0c1 Remove unnecessary Mainpage.dox 2014-01-20 22:16:16 +00:00
b71ede5c0f The file format is JPEG-2000; JasPer is the library 2014-01-16 21:34:13 +00:00
aeff5cca5a Improve README.md
Organise and correct the format list.
2014-01-16 21:28:06 +00:00
7177dba8db Update REAMDE 2014-01-12 20:45:38 +01:00
4998e85b93 Add myself to the standard list of people to review changes 2014-01-11 19:07:23 +00:00
4384f8f5d9 add missing licence file 2014-01-09 00:31:43 +00:00
157 changed files with 5897 additions and 3586 deletions

22
.gitignore vendored Normal file
View File

@ -0,0 +1,22 @@
# Ignore the following files
*~
*.[oa]
*.diff
*.kate-swp
*.kdev4
.kdev_include_paths
*.kdevelop.pcs
*.moc
*.moc.cpp
*.orig
*.user
.*.swp
.swp.*
Doxyfile
Makefile
avail
random_seed
/build*/
CMakeLists.txt.user*
*.unc-backup*
.cmake/

View File

@ -1,4 +0,0 @@
REVIEWBOARD_URL = "https://git.reviewboard.kde.org"
REPOSITORY = 'git://anongit.kde.org/kimageformats'
BRANCH = 'master'
TARGET_GROUPS = 'kdeframeworks'

View File

@ -1,25 +1,61 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.5)
project(KImageFormats)
find_package(ECM 0.0.9 REQUIRED NO_MODULE)
# Add our own CMake dir for FindOpenEXR.cmake
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(KDEInstallDirs)
include(KDEFrameworkCompilerSettings)
include(KDECMakeSettings)
set (CMAKE_CXX_STANDARD 14)
include(FeatureSummary)
find_package(ECM 5.72.0 NO_MODULE)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules")
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
include(KDEInstallDirs)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
include(CheckIncludeFiles)
set(REQUIRED_QT_VERSION 5.2.0)
set(REQUIRED_QT_VERSION 5.12.0)
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
add_subdirectory(src)
add_subdirectory(tests)
find_package(KF5Archive)
set_package_properties(KF5Archive PROPERTIES
TYPE OPTIONAL
PURPOSE "Required for the QImage plugin for Krita and OpenRaster images"
)
if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
# EPS support depends on the gs utility; non-UNIX systems are unlikely to have
# this available in PATH
set(BUILD_EPS_PLUGIN FALSE)
if (UNIX)
find_package(Qt5PrintSupport ${REQUIRED_QT_VERSION} NO_MODULE)
set_package_properties(Qt5PrintSupport PROPERTIES
PURPOSE "Required for the QImage plugin for EPS images"
TYPE OPTIONAL
)
if (Qt5PrintSupport_FOUND)
set(BUILD_EPS_PLUGIN TRUE)
endif()
endif()
find_package(OpenEXR)
set_package_properties(OpenEXR PROPERTIES
TYPE OPTIONAL
PURPOSE "Required for the QImage plugin for OpenEXR images"
)
add_definitions(-DQT_NO_FOREACH)
# 050d00 (5.13) triggers a BIC in qimageiohandler.h, in Qt 5.13, so do not enable that until we can require 5.14
# https://codereview.qt-project.org/c/qt/qtbase/+/279215
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050c00)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054700)
add_subdirectory(src)
if (BUILD_TESTING)
add_subdirectory(autotests)
add_subdirectory(tests)
endif()
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

View File

@ -1,29 +0,0 @@
/** @mainpage ImageFormat Plugins
Provides imageformat plugins for Qt so that it can read more image file types.
@authors
Sirtaj Singh Kang \<taj@kde.org><br>
Dirk Schoenberger<br>
Torben Weis \<weis@kde.org><br>
Thomas Tanghus \<tanghus@kde.org><br>
Antonio Larossa \<larossa@kde.org\><br>
Sven Wiegand \<SWiegand@tfh-berlin.de><br>
Dominik Seichter \<domseichter@web.de><br>
Nadeem Hasan \<nhasan@kde.org><br>
Melchior Franz \<mfranz@kde.org><br>
Allen Barnett \<allen@lignumcomputing.com><br>
Ignacio Castaño \<castano@ludicon.com><br>
Christoph Hormann \<chris_hormann@gmx.de><br>
Michael Ritzert \<kde@ritzert.de>
@maintainers
[Unknown/None]
@licenses
@lgpl
*/
// DOXYGEN_SET_PROJECT_NAME = KImageFormats
// vim:ts=4:sw=4:expandtab:filetype=doxygen

View File

@ -1,5 +1,7 @@
# KImageFormats
Plugins to allow QImage to support extra file formats.
## Introduction
This framework provides additional image format plugins for QtGui. As
@ -7,7 +9,23 @@ such it is not required for the compilation of any other software, but
may be a runtime requirement for Qt-based software to support certain
image formats.
See the src/imagesformats directory for the provided image formats.
## Formats
The following image formats have read-only support:
- Gimp (xcf)
- OpenEXR (exr)
- Photoshop documents (psd)
- Sun Raster (ras)
The following image formats have read and write support:
- Encapsulated PostScript (eps)
- Personal Computer Exchange (pcx)
- SGI images (rgb, rgba, sgi, bw)
- Softimage PIC (pic)
- Targa (tga): supports more formats than Qt's version
- XView (xv)
## Contributing
@ -35,8 +53,11 @@ licensing. If anyone were willing to write fresh code to improve Qt's
TGA plugin, it would allow the TGA plugin in this framework to be
removed.
## Links
## License
This framework is licensed under the
[LGPLv2.1](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html#SEC1).
The CMake code in this framework is licensed under the
[BSD license](http://opensource.org/licenses/BSD-3-Clause).
- Mailing list: <https://mail.kde.org/mailman/listinfo/kde-frameworks-devel>
- IRC channel: #kde-devel on Freenode
- Git repository: <https://projects.kde.org/projects/frameworks/kimageformats/repository>

112
autotests/CMakeLists.txt Normal file
View File

@ -0,0 +1,112 @@
#find_package(Qt5Test ${REQUIRED_QT_VERSION} NO_MODULE)
include(ECMMarkAsTest)
include(CMakeParseArguments)
add_definitions(-DPLUGIN_DIR="${CMAKE_CURRENT_BINARY_DIR}/../bin")
remove_definitions(-DQT_NO_CAST_FROM_ASCII)
macro(kimageformats_read_tests)
cmake_parse_arguments(KIF_RT "" "FUZZ" "" ${ARGN})
set(_fuzzarg)
if (KIF_RT_FUZZ)
set(_fuzzarg -f ${KIF_RT_FUZZ})
endif()
if (NOT TARGET readtest)
add_executable(readtest readtest.cpp)
target_link_libraries(readtest Qt5::Gui)
target_compile_definitions(readtest
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/read")
ecm_mark_as_test(readtest)
endif()
foreach(_testname ${KIF_RT_UNPARSED_ARGUMENTS})
add_test(
NAME kimageformats-read-${_testname}
COMMAND readtest ${_fuzzarg} ${_testname}
)
endforeach(_testname)
endmacro()
macro(kimageformats_write_tests)
if (NOT TARGET writetest)
add_executable(writetest writetest.cpp)
target_link_libraries(writetest Qt5::Gui)
target_compile_definitions(writetest
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/write")
ecm_mark_as_test(writetest)
endif()
foreach(_testname ${ARGN})
string(REGEX MATCH "-lossless$" _is_lossless "${_testname}")
unset(lossless_arg)
if (_is_lossless)
set(lossless_arg "--lossless")
string(REGEX REPLACE "-lossless$" "" _testname "${_testname}")
endif()
add_test(
NAME kimageformats-write-${_testname}
COMMAND writetest ${lossless_arg} ${_testname}
)
endforeach(_testname)
endmacro()
# Basic read tests
# Loads each <format> image in read/<format>/, and compares the
# result against the data read from the corresponding png file
kimageformats_read_tests(
hdr
pcx
psd
ras
rgb
tga
)
if (KF5Archive_FOUND)
kimageformats_read_tests(
kra
ora
)
endif()
# Allow some fuzziness when reading this formats, to allow for
# rounding errors (eg: in alpha blending).
kimageformats_read_tests(FUZZ 1
xcf
)
# Basic write tests
# Loads each png image in write/, writes the data out
# as a <format> image, and compares the result against the
# the corresponding <format> file.
# You can append -lossless to the format to indicate that
# reading back the image data will result in an identical image.
kimageformats_write_tests(
pcx-lossless
pic-lossless
rgb-lossless
tga # fixme: the alpha images appear not to be written properly
)
# EPS read tests depend on the vagaries of GhostScript
# which we cannot even guarantee to find, so disable them for now
#if (BUILD_EPS_PLUGIN)
# kimageformats_read_tests(eps)
# kimageformats_write_tests(eps)
#endif()
if (OpenEXR_FOUND)
# FIXME: OpenEXR tests
endif()
find_package(Qt5Test ${REQUIRED_QT_VERSION} CONFIG QUIET)
if(NOT Qt5Test_FOUND)
message(STATUS "Qt5Test not found, some autotests will not be built.")
return()
endif()
add_executable(pictest pictest.cpp)
target_link_libraries(pictest Qt5::Gui Qt5::Test)
ecm_mark_as_test(pictest)
add_test(NAME kimageformats-pic COMMAND pictest)

BIN
autotests/long-runs.pic Normal file

Binary file not shown.

Binary file not shown.

BIN
autotests/pic/4x4-alpha.pic Normal file

Binary file not shown.

BIN
autotests/pic/4x4-alpha.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

BIN
autotests/pic/long-runs.pic Normal file

Binary file not shown.

BIN
autotests/pic/long-runs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

277
autotests/pictest.cpp Normal file
View File

@ -0,0 +1,277 @@
/*
* Copyright 2014 Alex Merry <alex.merry@kdemail.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3, or any
* later version accepted by the membership of KDE e.V. (or its
* successor approved by the membership of KDE e.V.), which shall
* act as a proxy defined in Section 6 of version 3 of the license.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <QBuffer>
#include <QFile>
#include <QFileInfo>
#include <QImage>
#include <QImageReader>
#include <QImageWriter>
#include <QTest>
#include <QUuid>
Q_DECLARE_METATYPE(QImage::Format)
class PicTests : public QObject
{
Q_OBJECT
private:
void common_data()
{
QTest::addColumn<QString>("picfile");
QTest::addColumn<QString>("pngfile");
QTest::addColumn<QString>("comment");
// whether the pic file has/should have an alpha channel
QTest::addColumn<bool>("alpha");
// the format to convert the png file to before writing
// or comparing to the read image; this can be used to
// induce loss of data (eg: make the image monochrome)
QTest::addColumn<QImage::Format>("pngformat");
QTest::addColumn<bool>("compress");
QTest::newRow("4x4 no alpha RLE")
<< QFINDTESTDATA("pic/4x4-simple-color.pic")
<< QFINDTESTDATA("pic/4x4-simple-color.png")
<< QString()
<< false
<< QImage::Format_RGB32
<< true;
QTest::newRow("4x4 no alpha raw")
<< QFINDTESTDATA("pic/4x4-simple-color-uncompressed.pic")
<< QFINDTESTDATA("pic/4x4-simple-color.png")
<< QString()
<< false
<< QImage::Format_RGB32
<< false;
QTest::newRow("Short comment")
<< QFINDTESTDATA("pic/short-comment.pic")
<< QFINDTESTDATA("pic/4x4-simple-color.png")
<< QStringLiteral("Test comment value")
<< false
<< QImage::Format_RGB32
<< true;
QTest::newRow("Long comment")
<< QFINDTESTDATA("pic/long-comment.pic")
<< QFINDTESTDATA("pic/4x4-simple-color.png")
<< QStringLiteral("Test comment value that goes right up to the end of the comment field and has no")
<< false
<< QImage::Format_RGB32
<< true;
QTest::newRow("Long run-lengths")
<< QFINDTESTDATA("pic/long-runs.pic")
<< QFINDTESTDATA("pic/long-runs.png")
<< QString()
<< false
<< QImage::Format_RGB32
<< true;
QTest::newRow("4x4 with alpha RLE")
<< QFINDTESTDATA("pic/4x4-alpha.pic")
<< QFINDTESTDATA("pic/4x4-alpha.png")
<< QString()
<< true
<< QImage::Format_ARGB32
<< true;
QTest::newRow("4x4 with alpha raw")
<< QFINDTESTDATA("pic/4x4-alpha-uncompressed.pic")
<< QFINDTESTDATA("pic/4x4-alpha.png")
<< QString()
<< true
<< QImage::Format_ARGB32
<< false;
}
private Q_SLOTS:
void initTestCase()
{
QCoreApplication::addLibraryPath(QStringLiteral(PLUGIN_DIR));
}
void testWrite_data()
{
common_data();
// NB: 4x4-simple-color only uses solid red, blue, green and white,
// so there is no actual data loss in converting to RGB16.
// This just tests that the pic plugin can deal with different
// input formats.
QTest::newRow("altered format")
<< QFINDTESTDATA("pic/4x4-simple-color.pic")
<< QFINDTESTDATA("pic/4x4-simple-color.png")
<< QString()
<< false
<< QImage::Format_RGB16
<< true;
}
void testRead_data()
{
common_data();
// TODO: test reading files with unusual channel setups
// (eg: one channel for each component)
}
void testWrite()
{
QFETCH(QString, picfile);
QFETCH(QString, pngfile);
QFETCH(QString, comment);
QFETCH(QImage::Format, pngformat);
QFETCH(bool, compress);
QImageReader pngReader(pngfile, "png");
QImage pngImage;
QVERIFY2(pngReader.read(&pngImage), qPrintable(pngReader.errorString()));
pngImage = pngImage.convertToFormat(pngformat);
QFile expFile(picfile);
QVERIFY2(expFile.open(QIODevice::ReadOnly), qPrintable(expFile.errorString()));
QByteArray expData = expFile.readAll();
QByteArray picData;
QBuffer buffer(&picData);
QImageWriter imgWriter(&buffer, "pic");
imgWriter.setText(QStringLiteral("Description"), comment);
imgWriter.setCompression(compress);
imgWriter.write(pngImage);
if (expData != picData) {
QString fileNameBase = QUuid::createUuid().toString()
.remove(QLatin1Char('{'))
.remove(QLatin1Char('}'));
QFile dumpFile(fileNameBase + QStringLiteral(".pic"));
QVERIFY2(dumpFile.open(QIODevice::WriteOnly), qPrintable(dumpFile.errorString()));
dumpFile.write(picData);
QString msg = QStringLiteral("Written data (")
+ dumpFile.fileName()
+ QStringLiteral(") differed from expected data (")
+ picfile
+ QLatin1Char(')');
QFAIL(qPrintable(msg));
}
}
void testRead()
{
QFETCH(QString, picfile);
QFETCH(QString, pngfile);
QFETCH(bool, alpha);
QFETCH(QImage::Format, pngformat);
QImageReader inputReader(picfile, "pic");
QImageReader expReader(pngfile, "png");
QImage inputImage;
QImage expImage;
QVERIFY2(expReader.read(&expImage), qPrintable(expReader.errorString()));
QVERIFY2(inputReader.read(&inputImage), qPrintable(inputReader.errorString()));
QCOMPARE(inputImage.width(), expImage.width());
QCOMPARE(inputImage.height(), expImage.height());
QCOMPARE(inputImage.hasAlphaChannel(), alpha);
QCOMPARE(inputImage.format(), alpha ? QImage::Format_ARGB32
: QImage::Format_RGB32);
expImage = expImage.convertToFormat(pngformat);
expImage = expImage.convertToFormat(alpha ? QImage::Format_ARGB32
: QImage::Format_RGB32);
if (inputImage != expImage) {
QString fileNameBase = QUuid::createUuid().toString()
.remove(QLatin1Char('{'))
.remove(QLatin1Char('}'));
QFile picDumpFile(fileNameBase + QStringLiteral("-expected.data"));
QVERIFY2(picDumpFile.open(QIODevice::WriteOnly), qPrintable(picDumpFile.errorString()));
picDumpFile.write(reinterpret_cast<const char *>(inputImage.bits()),
inputImage.sizeInBytes());
QFile pngDumpFile(fileNameBase + QStringLiteral("-actual.data"));
QVERIFY2(pngDumpFile.open(QIODevice::WriteOnly), qPrintable(pngDumpFile.errorString()));
pngDumpFile.write(reinterpret_cast<const char *>(expImage.bits()),
expImage.sizeInBytes());
QString msg = QStringLiteral("Read image (")
+ picDumpFile.fileName()
+ QStringLiteral(") differed from expected image (")
+ pngDumpFile.fileName()
+ QLatin1Char(')');
QFAIL(qPrintable(msg));
}
}
void testPreReadComment_data()
{
testRead_data();
}
void testPreReadComment()
{
QFETCH(QString, picfile);
QFETCH(QString, comment);
QImageReader inputReader(picfile, "pic");
QCOMPARE(inputReader.text(QStringLiteral("Description")), comment);
}
void testPreReadSize_data()
{
testRead_data();
}
void testPreReadSize()
{
QFETCH(QString, picfile);
QFETCH(QString, pngfile);
QImageReader inputReader(picfile, "pic");
QImageReader expReader(pngfile, "png");
QCOMPARE(inputReader.size(), expReader.size());
}
void testPreReadImageFormat_data()
{
testRead_data();
}
void testPreReadImageFormat()
{
QFETCH(QString, picfile);
QFETCH(bool, alpha);
QImageReader inputReader(picfile, "pic");
QCOMPARE(inputReader.imageFormat(),
alpha ? QImage::Format_ARGB32 : QImage::Format_RGB32);
}
};
QTEST_MAIN(PicTests)
#include "pictest.moc"

502
autotests/read/eps/bw.eps Normal file
View File

@ -0,0 +1,502 @@
%!PS-Adobe-3.0 EPSF-3.0
%Produced by poppler pdftops version: 0.24.5 (http://poppler.freedesktop.org)
%%Creator: KDE EPS image plugin
%%LanguageLevel: 2
%%DocumentSuppliedResources: (atend)
%%BoundingBox: 0 0 32 32
%%HiResBoundingBox: 0 0 32 32
%%DocumentSuppliedResources: (atend)
%%EndComments
%%BeginProlog
%%BeginResource: procset xpdf 3.00 0
%%Copyright: Copyright 1996-2011 Glyph & Cog, LLC
/xpdf 75 dict def xpdf begin
% PDF special state
/pdfDictSize 15 def
/pdfSetup {
/setpagedevice where {
pop 2 dict begin
/Policies 1 dict dup begin /PageSize 6 def end def
{ /Duplex true def } if
currentdict end setpagedevice
} {
pop
} ifelse
} def
/pdfSetupPaper {
2 array astore
/setpagedevice where {
pop 2 dict begin
/PageSize exch def
/ImagingBBox null def
currentdict end setpagedevice
} {
pop
} ifelse
} def
/pdfStartPage {
pdfDictSize dict begin
/pdfFillCS [] def
/pdfFillXform {} def
/pdfStrokeCS [] def
/pdfStrokeXform {} def
/pdfFill [0] def
/pdfStroke [0] def
/pdfFillOP false def
/pdfStrokeOP false def
/pdfLastFill false def
/pdfLastStroke false def
/pdfTextMat [1 0 0 1 0 0] def
/pdfFontSize 0 def
/pdfCharSpacing 0 def
/pdfTextRender 0 def
/pdfPatternCS false def
/pdfTextRise 0 def
/pdfWordSpacing 0 def
/pdfHorizScaling 1 def
/pdfTextClipPath [] def
} def
/pdfEndPage { end } def
% PDF color state
/cs { /pdfFillXform exch def dup /pdfFillCS exch def
setcolorspace } def
/CS { /pdfStrokeXform exch def dup /pdfStrokeCS exch def
setcolorspace } def
/sc { pdfLastFill not { pdfFillCS setcolorspace } if
dup /pdfFill exch def aload pop pdfFillXform setcolor
/pdfLastFill true def /pdfLastStroke false def } def
/SC { pdfLastStroke not { pdfStrokeCS setcolorspace } if
dup /pdfStroke exch def aload pop pdfStrokeXform setcolor
/pdfLastStroke true def /pdfLastFill false def } def
/op { /pdfFillOP exch def
pdfLastFill { pdfFillOP setoverprint } if } def
/OP { /pdfStrokeOP exch def
pdfLastStroke { pdfStrokeOP setoverprint } if } def
/fCol {
pdfLastFill not {
pdfFillCS setcolorspace
pdfFill aload pop pdfFillXform setcolor
pdfFillOP setoverprint
/pdfLastFill true def /pdfLastStroke false def
} if
} def
/sCol {
pdfLastStroke not {
pdfStrokeCS setcolorspace
pdfStroke aload pop pdfStrokeXform setcolor
pdfStrokeOP setoverprint
/pdfLastStroke true def /pdfLastFill false def
} if
} def
% build a font
/pdfMakeFont {
4 3 roll findfont
4 2 roll matrix scale makefont
dup length dict begin
{ 1 index /FID ne { def } { pop pop } ifelse } forall
/Encoding exch def
currentdict
end
definefont pop
} def
/pdfMakeFont16 {
exch findfont
dup length dict begin
{ 1 index /FID ne { def } { pop pop } ifelse } forall
/WMode exch def
currentdict
end
definefont pop
} def
% graphics state operators
/q { gsave pdfDictSize dict begin } def
/Q {
end grestore
/pdfLastFill where {
pop
pdfLastFill {
pdfFillOP setoverprint
} {
pdfStrokeOP setoverprint
} ifelse
} if
} def
/cm { concat } def
/d { setdash } def
/i { setflat } def
/j { setlinejoin } def
/J { setlinecap } def
/M { setmiterlimit } def
/w { setlinewidth } def
% path segment operators
/m { moveto } def
/l { lineto } def
/c { curveto } def
/re { 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
neg 0 rlineto closepath } def
/h { closepath } def
% path painting operators
/S { sCol stroke } def
/Sf { fCol stroke } def
/f { fCol fill } def
/f* { fCol eofill } def
% clipping operators
/W { clip newpath } def
/W* { eoclip newpath } def
/Ws { strokepath clip newpath } def
% text state operators
/Tc { /pdfCharSpacing exch def } def
/Tf { dup /pdfFontSize exch def
dup pdfHorizScaling mul exch matrix scale
pdfTextMat matrix concatmatrix dup 4 0 put dup 5 0 put
exch findfont exch makefont setfont } def
/Tr { /pdfTextRender exch def } def
/Tp { /pdfPatternCS exch def } def
/Ts { /pdfTextRise exch def } def
/Tw { /pdfWordSpacing exch def } def
/Tz { /pdfHorizScaling exch def } def
% text positioning operators
/Td { pdfTextMat transform moveto } def
/Tm { /pdfTextMat exch def } def
% text string operators
/xyshow where {
pop
/xyshow2 {
dup length array
0 2 2 index length 1 sub {
2 index 1 index 2 copy get 3 1 roll 1 add get
pdfTextMat dtransform
4 2 roll 2 copy 6 5 roll put 1 add 3 1 roll dup 4 2 roll put
} for
exch pop
xyshow
} def
}{
/xyshow2 {
currentfont /FontType get 0 eq {
0 2 3 index length 1 sub {
currentpoint 4 index 3 index 2 getinterval show moveto
2 copy get 2 index 3 2 roll 1 add get
pdfTextMat dtransform rmoveto
} for
} {
0 1 3 index length 1 sub {
currentpoint 4 index 3 index 1 getinterval show moveto
2 copy 2 mul get 2 index 3 2 roll 2 mul 1 add get
pdfTextMat dtransform rmoveto
} for
} ifelse
pop pop
} def
} ifelse
/cshow where {
pop
/xycp {
0 3 2 roll
{
pop pop currentpoint 3 2 roll
1 string dup 0 4 3 roll put false charpath moveto
2 copy get 2 index 2 index 1 add get
pdfTextMat dtransform rmoveto
2 add
} exch cshow
pop pop
} def
}{
/xycp {
currentfont /FontType get 0 eq {
0 2 3 index length 1 sub {
currentpoint 4 index 3 index 2 getinterval false charpath moveto
2 copy get 2 index 3 2 roll 1 add get
pdfTextMat dtransform rmoveto
} for
} {
0 1 3 index length 1 sub {
currentpoint 4 index 3 index 1 getinterval false charpath moveto
2 copy 2 mul get 2 index 3 2 roll 2 mul 1 add get
pdfTextMat dtransform rmoveto
} for
} ifelse
pop pop
} def
} ifelse
/Tj {
fCol
0 pdfTextRise pdfTextMat dtransform rmoveto
currentpoint 4 2 roll
pdfTextRender 1 and 0 eq {
2 copy xyshow2
} if
pdfTextRender 3 and dup 1 eq exch 2 eq or {
3 index 3 index moveto
2 copy
currentfont /FontType get 3 eq { fCol } { sCol } ifelse
xycp currentpoint stroke moveto
} if
pdfTextRender 4 and 0 ne {
4 2 roll moveto xycp
/pdfTextClipPath [ pdfTextClipPath aload pop
{/moveto cvx}
{/lineto cvx}
{/curveto cvx}
{/closepath cvx}
pathforall ] def
currentpoint newpath moveto
} {
pop pop pop pop
} ifelse
0 pdfTextRise neg pdfTextMat dtransform rmoveto
} def
/TJm { 0.001 mul pdfFontSize mul pdfHorizScaling mul neg 0
pdfTextMat dtransform rmoveto } def
/TJmV { 0.001 mul pdfFontSize mul neg 0 exch
pdfTextMat dtransform rmoveto } def
/Tclip { pdfTextClipPath cvx exec clip newpath
/pdfTextClipPath [] def } def
/Tclip* { pdfTextClipPath cvx exec eoclip newpath
/pdfTextClipPath [] def } def
% Level 2/3 image operators
/pdfImBuf 100 string def
/pdfImStr {
2 copy exch length lt {
2 copy get exch 1 add exch
} {
()
} ifelse
} def
/skipEOD {
{ currentfile pdfImBuf readline
not { pop exit } if
(%-EOD-) eq { exit } if } loop
} def
/pdfIm { image skipEOD } def
/pdfImM { fCol imagemask skipEOD } def
/pr { 2 index 2 index 3 2 roll putinterval 4 add } def
/pdfImClip {
gsave
0 2 4 index length 1 sub {
dup 4 index exch 2 copy
get 5 index div put
1 add 3 index exch 2 copy
get 3 index div put
} for
pop pop rectclip
} def
/pdfImClipEnd { grestore } def
% shading operators
/colordelta {
false 0 1 3 index length 1 sub {
dup 4 index exch get 3 index 3 2 roll get sub abs 0.004 gt {
pop true
} if
} for
exch pop exch pop
} def
/funcCol { func n array astore } def
/funcSH {
dup 0 eq {
true
} {
dup 6 eq {
false
} {
4 index 4 index funcCol dup
6 index 4 index funcCol dup
3 1 roll colordelta 3 1 roll
5 index 5 index funcCol dup
3 1 roll colordelta 3 1 roll
6 index 8 index funcCol dup
3 1 roll colordelta 3 1 roll
colordelta or or or
} ifelse
} ifelse
{
1 add
4 index 3 index add 0.5 mul exch 4 index 3 index add 0.5 mul exch
6 index 6 index 4 index 4 index 4 index funcSH
2 index 6 index 6 index 4 index 4 index funcSH
6 index 2 index 4 index 6 index 4 index funcSH
5 3 roll 3 2 roll funcSH pop pop
} {
pop 3 index 2 index add 0.5 mul 3 index 2 index add 0.5 mul
funcCol sc
dup 4 index exch mat transform m
3 index 3 index mat transform l
1 index 3 index mat transform l
mat transform l pop pop h f*
} ifelse
} def
/axialCol {
dup 0 lt {
pop t0
} {
dup 1 gt {
pop t1
} {
dt mul t0 add
} ifelse
} ifelse
func n array astore
} def
/axialSH {
dup 0 eq {
true
} {
dup 8 eq {
false
} {
2 index axialCol 2 index axialCol colordelta
} ifelse
} ifelse
{
1 add 3 1 roll 2 copy add 0.5 mul
dup 4 3 roll exch 4 index axialSH
exch 3 2 roll axialSH
} {
pop 2 copy add 0.5 mul
axialCol sc
exch dup dx mul x0 add exch dy mul y0 add
3 2 roll dup dx mul x0 add exch dy mul y0 add
dx abs dy abs ge {
2 copy yMin sub dy mul dx div add yMin m
yMax sub dy mul dx div add yMax l
2 copy yMax sub dy mul dx div add yMax l
yMin sub dy mul dx div add yMin l
h f*
} {
exch 2 copy xMin sub dx mul dy div add xMin exch m
xMax sub dx mul dy div add xMax exch l
exch 2 copy xMax sub dx mul dy div add xMax exch l
xMin sub dx mul dy div add xMin exch l
h f*
} ifelse
} ifelse
} def
/radialCol {
dup t0 lt {
pop t0
} {
dup t1 gt {
pop t1
} if
} ifelse
func n array astore
} def
/radialSH {
dup 0 eq {
true
} {
dup 8 eq {
false
} {
2 index dt mul t0 add radialCol
2 index dt mul t0 add radialCol colordelta
} ifelse
} ifelse
{
1 add 3 1 roll 2 copy add 0.5 mul
dup 4 3 roll exch 4 index radialSH
exch 3 2 roll radialSH
} {
pop 2 copy add 0.5 mul dt mul t0 add
radialCol sc
encl {
exch dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
0 360 arc h
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
360 0 arcn h f
} {
2 copy
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a1 a2 arcn
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a2 a1 arcn h
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a1 a2 arc
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a2 a1 arc h f
} ifelse
} ifelse
} def
end
%%EndResource
%%EndProlog
%%BeginSetup
xpdf begin
%%EndSetup
pdfStartPage
[] 0 d
1 i
0 j
0 J
10 M
1 w
/DeviceGray {} cs
[0] sc
/DeviceGray {} CS
[0] SC
false op
false OP
{} settransfer
0 0 32 32 re
W
q
/DeviceRGB {} cs
[0 0 0] sc
/DeviceRGB {} CS
[0 0 0] SC
[1 0 0 -1 0 32] cm
q
q
Q
Q
q
q
q
[1 0 0 1 0 0] cm
[32 0 0 -32 0 32] cm
/DeviceRGB setcolorspace
<<
/ImageType 1
/Width 32
/Height 32
/ImageMatrix [32 0 0 -32 0 32]
/BitsPerComponent 8
/Decode [0 1 0 1 0 1]
/DataSource currentfile
/ASCII85Decode filter
<< >> /DCTDecode filter
>>
pdfIm
s4IA0!"_al8O`[\!<E0k!([(is4[N@!!30%!W`<'!WiE)!WiE*"Tni/!s8`1"9Sf4
"pYA<"pYA=#n%%F#RUhB#7:nI$4@7N$k*@I%M'!W%LW[R%0,&^6NI5i!WrN,"p4r3
$j[(D$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ
$k30O!"fJ:+93Md!?qLF&HMtG!WU(<*rl9A"T\W)!<E3$z!!!!"!WrQ/"pYD?$4Hm
P!4<@<!W`B*!X&T/"U"r.!!.KK!WrE*&Hrdj0gQ!W;.0\RE>10ZOeE%*6F"?A;UOt
Z1LbBV#mqFa(`=5<-7:2j.Ps"@2`NfY6UX@47n?3D;cHat='/U/@q9._B4u!oF*)P
JGBeCZK7nr5LPUeEP*;,qQC!u,R\HRQV5C/hWN*81['d?O\@K2f_o0O6a2lBFdaQ^
rf%8R-g>V&OjQ5OekiqC&o(2MHp@n@XqZ"J6*ru?D!<E3%!<E3%!<<*"!!!!"!WrQ
/"pYD?$4HmP!4<C=!W`?*"9Sc3"U"r.!<RHF!<N?8"9fr'"qj4!#@VTc+u4]T'LIq
UZ,$_k1K*]W@WKj'(*k`q-1Mcg)&ahL-n-W'2E*TU3^Z;(7Rp!@8lJ\h<``C+>%;)
SAnPdkC3+K>G'A1VH@gd&KnbA=M2II[Pa.Q$R$jD;USO``Vl6SpZEppG[^WcW]#)A
'`Q#s>ai`&\eCE.%f\,!<j5f=akNM0qo(2MHp@n@XqZ#7L$j-M1!YGMH!'^J^BE%s
`Q[ch>,l[jrG5O;H4@((,Nu7daD.`FnrL6**b\LH,D=SYd",m^?i=l4k#>Y&g9bUO
>MtTa;Y#@t+:FeG9N]V>#1:nBP>^,H<Xa\&[!aI?'6uhG.,.T@e?5D#_rr@Yb0!Ms
rN7qV%pM`e<#$Di["F`gj5:Si-rrBm_r]g2Pi93&5#Ca_N')YD#cKpI1VVR`"G%EX
@*FZrXV0tH*!!N,t!.q]X8,]]A5(CE_ir9#3PN#*LMfE5YgM6Sih.[I+D+6(5b@cc
G]RTni-.='e5N&$f,_@oPe/ga&,EF3"BFt:;l!LD5!,US+f+\4m`r=@l+`@\b!qEF
lMI#lQ%eAR[36>9-p&$>GXA=[:$]!_#_qfCOpC4P?DSg0,)pr1_K`8=Zq8`L8#+t-
(fDZ)=I=JaBepM&/?8)KLP/oBHd_ANBj^7d-n,*jV<rW/OB`?-fHo]aT7qpscJ%%(
R-n[*E0dKT>q+1!H,_-(pWAX?K!.Y%%~>
%-EOD-
Q
Q
Q
Q
showpage
%%PageTrailer
pdfEndPage
%%Trailer
end
%%DocumentSuppliedResources:
%%EOF

BIN
autotests/read/eps/bw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,134 @@
%!PS-Adobe-3.0 EPSF-3.0
%%Creator: GIMP PostScript file plugin V 1.17 by Peter Kirchgessner
%%Title: rgb-gimp-2.8.10.eps
%%CreationDate: Sun Feb 2 02:52:43 2014
%%DocumentData: Clean7Bit
%%LanguageLevel: 2
%%Pages: 1
%%BoundingBox: 14 14 47 47
%%EndComments
%%BeginProlog
% Use own dictionary to avoid conflicts
10 dict begin
%%EndProlog
%%Page: 1 1
% Translate for offset
14.173228346456694 14.173228346456694 translate
% Translate to begin of first scanline
0 32 translate
32 -32 scale
% Image geometry
32 32 8
% Transformation matrix
[ 32 0 0 32 0 0 ]
% Strings to hold RGB-samples per scanline
/rstr 32 string def
/gstr 32 string def
/bstr 32 string def
{currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop}
{currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop}
{currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop}
true 3
%%BeginData: 2062 ASCII Bytes
colorimage
iW"E~>
iW"E~>
iW"E~>
iW"E~>
iW"E~>
iW"E~>
rr3l8qtTj[qY'@Go(;YFp\t!Umd0N=o(_nMr;Q_H~>
rr3i7qYL3ks8Murs8DQZo^(l=rV?9dq>(!grVqB~>
r;RQ3p?_#1q>0g\p$Lr7o'Pf>qXX=HmJ?e]J,~>
s8O,=nBneOeC:XDIuUA;Vpk(NI>;j;^80&UU>,VGs*t~>
s8O#:mE3iKrr2]^qto3FY/,OEk3:(>i7$6GnbW7bJ,~>
rVm`6lE4o2NnVdeaJsl,X.4m!h9;V"Fb\WIrr7K~>
s8O,:dtV1_a1#Lk*\DP`CmWLr:eDd]L5N6=1n+(:s*t~>
s8O,9a`ji]s8DBPr:?UcD3._\p<BGMc*bj_hs^ODs*t~>
rVm`2``!BaL!tg.P)5E?Jo4/5k)G";*GsX+rr7K~>
s8O,:dtV(?^W)3l,qa=M0ic')HZVDbS;t:!3h5jBs*t~>
s8O,9a`jcXrr2Q\rUZO=,XY[bjk[5SdDjJqi:$XEs*t~>
rVm`2b&TI#Ia!RuR(;e8\XeMEkdHG>:6"Q8rr7K~>
s8O,=nBnbIg$IS)PE2AfH[*g.m,5FVe(Eg,Y20$Us*t~>
s8O#:mE3fIrr;omrVXuD-qC)gq"Nk)m-X34oD8IdJ,~>
rVm`6m`W8Uc0*E]bh_dWnF>o5qX3(qb0feZrr7K~>
rr3l7qY0[\rr)Zao'<Q'S)F8FrqZ9br;QQdr;Q_H~>
rr3*!q>(!drsA"DC2M)hs8W&qrr)rurr)kI~>
r;QcrrqZotrVH6_nF#iCrVm'#r;HNirr)kI~>
o`#*]D]DU%r:L#>~>
o`#*gdG)_'rUg,?~>
o`#'lkK`2coDa=~>
o`#*[H#7uerq-5@~>
o`#'no'Z#CoDa=~>
o`#*gZ>Z<!rq-5@~>
o`#'d]WK!>oDa=~>
o`#'i_0NiloDa=~>
o`#*aTT+KQr:L#>~>
o`#'gaMuR#oDa=~>
o`#']HqJeMoDa=~>
o`#*f[sXLurUg,?~>
o`#'lmdBWBoDa=~>
o`#*bTnJ`jrq-5@~>
o`#*^Fs'K#qt0o=~>
o`#*let9hLrq-5@~>
o`#*dRnn@_rUg,?~>
o`#*^O+_r,qt0o=~>
o`#*e[A0PUr:L#>~>
o`#*\D&P^Yqt0o=~>
o`#*idD*iirq-5@~>
o`#*lkNM+#rq-5@~>
o`#*]KlLYGqt0o=~>
o`#*fVI,eXrq-5@~>
o`#'i_L98qoDa=~>
o`#*e]s+j,rq-5@~>
o`#']O+WDVoDa=~>
o`#'^Mf+C>oDa=~>
o`#'hd*U,5oDa=~>
o`#'bW,J^-oDa=~>
o`#'fb/qQooDa=~>
o`#'iiRHrdoDa=~>
p&>3phcL\*lLY%+~>
o`#'g\8\hKoDa=~>
p&>3pn>0Kmp%/36~>
p&>3ne9R:Bm.:7-~>
o`#*[A///#rq-5@~>
o`#*YB.IWRrq-5@~>
p&>3pn)*Top[eE8~>
o`#*ZH<=7\q=O];~>
o`#*[Is$k#r:L#>~>
o`#*kdu]gJr:L#>~>
o`#*cWIfZ,p@SB8~>
o`#*^QC4Ghq=O];~>
o`#*dPqb(co^r06~>
o`#*j`eT>iq=O];~>
o`#*f\#$+Gq"4T:~>
o`#*cSRH!"oCW'5~>
o`#*eS2)jio^r06~>
o`#*nmIB`8rUg,?~>
o`#*kcF::.qXjf<~>
o`#*eWI&uko^r06~>
o`#*op#Y<.rq-5@~>
o`#*kcA.2#qXjf<~>
o`#*keZlC0qXjf<~>
o`#*nldaPOrUg,?~>
o`#*eRkZXeo^r06~>
o`#*i\R8gUq"4T:~>
o`#*lfp\A_qt0o=~>
o`#*eWdB)mo^r06~>
o`#*fWB32@p%897~>
o`#*hZU7*dp[nK9~>
o`#*mk2YLar:L#>~>
o`#*mh4:+mr:L#>~>
o`#*mhO^=qr:L#>~>
oD\pjq"XdYs*t~>
oD\pjo^r(Qs*t~>
oD\pjo^r(Qs*t~>
iW"E~>
iW"E~>
iW"E~>
iW"E~>
%%EndData
showpage
%%Trailer
end
%%EOF

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

505
autotests/read/eps/rgb.eps Normal file
View File

@ -0,0 +1,505 @@
%!PS-Adobe-3.0 EPSF-3.0
%Produced by poppler pdftops version: 0.24.5 (http://poppler.freedesktop.org)
%%Creator: KDE EPS image plugin
%%LanguageLevel: 2
%%DocumentSuppliedResources: (atend)
%%BoundingBox: 0 0 32 32
%%HiResBoundingBox: 0 0 32 32
%%DocumentSuppliedResources: (atend)
%%EndComments
%%BeginProlog
%%BeginResource: procset xpdf 3.00 0
%%Copyright: Copyright 1996-2011 Glyph & Cog, LLC
/xpdf 75 dict def xpdf begin
% PDF special state
/pdfDictSize 15 def
/pdfSetup {
/setpagedevice where {
pop 2 dict begin
/Policies 1 dict dup begin /PageSize 6 def end def
{ /Duplex true def } if
currentdict end setpagedevice
} {
pop
} ifelse
} def
/pdfSetupPaper {
2 array astore
/setpagedevice where {
pop 2 dict begin
/PageSize exch def
/ImagingBBox null def
currentdict end setpagedevice
} {
pop
} ifelse
} def
/pdfStartPage {
pdfDictSize dict begin
/pdfFillCS [] def
/pdfFillXform {} def
/pdfStrokeCS [] def
/pdfStrokeXform {} def
/pdfFill [0] def
/pdfStroke [0] def
/pdfFillOP false def
/pdfStrokeOP false def
/pdfLastFill false def
/pdfLastStroke false def
/pdfTextMat [1 0 0 1 0 0] def
/pdfFontSize 0 def
/pdfCharSpacing 0 def
/pdfTextRender 0 def
/pdfPatternCS false def
/pdfTextRise 0 def
/pdfWordSpacing 0 def
/pdfHorizScaling 1 def
/pdfTextClipPath [] def
} def
/pdfEndPage { end } def
% PDF color state
/cs { /pdfFillXform exch def dup /pdfFillCS exch def
setcolorspace } def
/CS { /pdfStrokeXform exch def dup /pdfStrokeCS exch def
setcolorspace } def
/sc { pdfLastFill not { pdfFillCS setcolorspace } if
dup /pdfFill exch def aload pop pdfFillXform setcolor
/pdfLastFill true def /pdfLastStroke false def } def
/SC { pdfLastStroke not { pdfStrokeCS setcolorspace } if
dup /pdfStroke exch def aload pop pdfStrokeXform setcolor
/pdfLastStroke true def /pdfLastFill false def } def
/op { /pdfFillOP exch def
pdfLastFill { pdfFillOP setoverprint } if } def
/OP { /pdfStrokeOP exch def
pdfLastStroke { pdfStrokeOP setoverprint } if } def
/fCol {
pdfLastFill not {
pdfFillCS setcolorspace
pdfFill aload pop pdfFillXform setcolor
pdfFillOP setoverprint
/pdfLastFill true def /pdfLastStroke false def
} if
} def
/sCol {
pdfLastStroke not {
pdfStrokeCS setcolorspace
pdfStroke aload pop pdfStrokeXform setcolor
pdfStrokeOP setoverprint
/pdfLastStroke true def /pdfLastFill false def
} if
} def
% build a font
/pdfMakeFont {
4 3 roll findfont
4 2 roll matrix scale makefont
dup length dict begin
{ 1 index /FID ne { def } { pop pop } ifelse } forall
/Encoding exch def
currentdict
end
definefont pop
} def
/pdfMakeFont16 {
exch findfont
dup length dict begin
{ 1 index /FID ne { def } { pop pop } ifelse } forall
/WMode exch def
currentdict
end
definefont pop
} def
% graphics state operators
/q { gsave pdfDictSize dict begin } def
/Q {
end grestore
/pdfLastFill where {
pop
pdfLastFill {
pdfFillOP setoverprint
} {
pdfStrokeOP setoverprint
} ifelse
} if
} def
/cm { concat } def
/d { setdash } def
/i { setflat } def
/j { setlinejoin } def
/J { setlinecap } def
/M { setmiterlimit } def
/w { setlinewidth } def
% path segment operators
/m { moveto } def
/l { lineto } def
/c { curveto } def
/re { 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
neg 0 rlineto closepath } def
/h { closepath } def
% path painting operators
/S { sCol stroke } def
/Sf { fCol stroke } def
/f { fCol fill } def
/f* { fCol eofill } def
% clipping operators
/W { clip newpath } def
/W* { eoclip newpath } def
/Ws { strokepath clip newpath } def
% text state operators
/Tc { /pdfCharSpacing exch def } def
/Tf { dup /pdfFontSize exch def
dup pdfHorizScaling mul exch matrix scale
pdfTextMat matrix concatmatrix dup 4 0 put dup 5 0 put
exch findfont exch makefont setfont } def
/Tr { /pdfTextRender exch def } def
/Tp { /pdfPatternCS exch def } def
/Ts { /pdfTextRise exch def } def
/Tw { /pdfWordSpacing exch def } def
/Tz { /pdfHorizScaling exch def } def
% text positioning operators
/Td { pdfTextMat transform moveto } def
/Tm { /pdfTextMat exch def } def
% text string operators
/xyshow where {
pop
/xyshow2 {
dup length array
0 2 2 index length 1 sub {
2 index 1 index 2 copy get 3 1 roll 1 add get
pdfTextMat dtransform
4 2 roll 2 copy 6 5 roll put 1 add 3 1 roll dup 4 2 roll put
} for
exch pop
xyshow
} def
}{
/xyshow2 {
currentfont /FontType get 0 eq {
0 2 3 index length 1 sub {
currentpoint 4 index 3 index 2 getinterval show moveto
2 copy get 2 index 3 2 roll 1 add get
pdfTextMat dtransform rmoveto
} for
} {
0 1 3 index length 1 sub {
currentpoint 4 index 3 index 1 getinterval show moveto
2 copy 2 mul get 2 index 3 2 roll 2 mul 1 add get
pdfTextMat dtransform rmoveto
} for
} ifelse
pop pop
} def
} ifelse
/cshow where {
pop
/xycp {
0 3 2 roll
{
pop pop currentpoint 3 2 roll
1 string dup 0 4 3 roll put false charpath moveto
2 copy get 2 index 2 index 1 add get
pdfTextMat dtransform rmoveto
2 add
} exch cshow
pop pop
} def
}{
/xycp {
currentfont /FontType get 0 eq {
0 2 3 index length 1 sub {
currentpoint 4 index 3 index 2 getinterval false charpath moveto
2 copy get 2 index 3 2 roll 1 add get
pdfTextMat dtransform rmoveto
} for
} {
0 1 3 index length 1 sub {
currentpoint 4 index 3 index 1 getinterval false charpath moveto
2 copy 2 mul get 2 index 3 2 roll 2 mul 1 add get
pdfTextMat dtransform rmoveto
} for
} ifelse
pop pop
} def
} ifelse
/Tj {
fCol
0 pdfTextRise pdfTextMat dtransform rmoveto
currentpoint 4 2 roll
pdfTextRender 1 and 0 eq {
2 copy xyshow2
} if
pdfTextRender 3 and dup 1 eq exch 2 eq or {
3 index 3 index moveto
2 copy
currentfont /FontType get 3 eq { fCol } { sCol } ifelse
xycp currentpoint stroke moveto
} if
pdfTextRender 4 and 0 ne {
4 2 roll moveto xycp
/pdfTextClipPath [ pdfTextClipPath aload pop
{/moveto cvx}
{/lineto cvx}
{/curveto cvx}
{/closepath cvx}
pathforall ] def
currentpoint newpath moveto
} {
pop pop pop pop
} ifelse
0 pdfTextRise neg pdfTextMat dtransform rmoveto
} def
/TJm { 0.001 mul pdfFontSize mul pdfHorizScaling mul neg 0
pdfTextMat dtransform rmoveto } def
/TJmV { 0.001 mul pdfFontSize mul neg 0 exch
pdfTextMat dtransform rmoveto } def
/Tclip { pdfTextClipPath cvx exec clip newpath
/pdfTextClipPath [] def } def
/Tclip* { pdfTextClipPath cvx exec eoclip newpath
/pdfTextClipPath [] def } def
% Level 2/3 image operators
/pdfImBuf 100 string def
/pdfImStr {
2 copy exch length lt {
2 copy get exch 1 add exch
} {
()
} ifelse
} def
/skipEOD {
{ currentfile pdfImBuf readline
not { pop exit } if
(%-EOD-) eq { exit } if } loop
} def
/pdfIm { image skipEOD } def
/pdfImM { fCol imagemask skipEOD } def
/pr { 2 index 2 index 3 2 roll putinterval 4 add } def
/pdfImClip {
gsave
0 2 4 index length 1 sub {
dup 4 index exch 2 copy
get 5 index div put
1 add 3 index exch 2 copy
get 3 index div put
} for
pop pop rectclip
} def
/pdfImClipEnd { grestore } def
% shading operators
/colordelta {
false 0 1 3 index length 1 sub {
dup 4 index exch get 3 index 3 2 roll get sub abs 0.004 gt {
pop true
} if
} for
exch pop exch pop
} def
/funcCol { func n array astore } def
/funcSH {
dup 0 eq {
true
} {
dup 6 eq {
false
} {
4 index 4 index funcCol dup
6 index 4 index funcCol dup
3 1 roll colordelta 3 1 roll
5 index 5 index funcCol dup
3 1 roll colordelta 3 1 roll
6 index 8 index funcCol dup
3 1 roll colordelta 3 1 roll
colordelta or or or
} ifelse
} ifelse
{
1 add
4 index 3 index add 0.5 mul exch 4 index 3 index add 0.5 mul exch
6 index 6 index 4 index 4 index 4 index funcSH
2 index 6 index 6 index 4 index 4 index funcSH
6 index 2 index 4 index 6 index 4 index funcSH
5 3 roll 3 2 roll funcSH pop pop
} {
pop 3 index 2 index add 0.5 mul 3 index 2 index add 0.5 mul
funcCol sc
dup 4 index exch mat transform m
3 index 3 index mat transform l
1 index 3 index mat transform l
mat transform l pop pop h f*
} ifelse
} def
/axialCol {
dup 0 lt {
pop t0
} {
dup 1 gt {
pop t1
} {
dt mul t0 add
} ifelse
} ifelse
func n array astore
} def
/axialSH {
dup 0 eq {
true
} {
dup 8 eq {
false
} {
2 index axialCol 2 index axialCol colordelta
} ifelse
} ifelse
{
1 add 3 1 roll 2 copy add 0.5 mul
dup 4 3 roll exch 4 index axialSH
exch 3 2 roll axialSH
} {
pop 2 copy add 0.5 mul
axialCol sc
exch dup dx mul x0 add exch dy mul y0 add
3 2 roll dup dx mul x0 add exch dy mul y0 add
dx abs dy abs ge {
2 copy yMin sub dy mul dx div add yMin m
yMax sub dy mul dx div add yMax l
2 copy yMax sub dy mul dx div add yMax l
yMin sub dy mul dx div add yMin l
h f*
} {
exch 2 copy xMin sub dx mul dy div add xMin exch m
xMax sub dx mul dy div add xMax exch l
exch 2 copy xMax sub dx mul dy div add xMax exch l
xMin sub dx mul dy div add xMin exch l
h f*
} ifelse
} ifelse
} def
/radialCol {
dup t0 lt {
pop t0
} {
dup t1 gt {
pop t1
} if
} ifelse
func n array astore
} def
/radialSH {
dup 0 eq {
true
} {
dup 8 eq {
false
} {
2 index dt mul t0 add radialCol
2 index dt mul t0 add radialCol colordelta
} ifelse
} ifelse
{
1 add 3 1 roll 2 copy add 0.5 mul
dup 4 3 roll exch 4 index radialSH
exch 3 2 roll radialSH
} {
pop 2 copy add 0.5 mul dt mul t0 add
radialCol sc
encl {
exch dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
0 360 arc h
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
360 0 arcn h f
} {
2 copy
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a1 a2 arcn
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a2 a1 arcn h
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a1 a2 arc
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a2 a1 arc h f
} ifelse
} ifelse
} def
end
%%EndResource
%%EndProlog
%%BeginSetup
xpdf begin
%%EndSetup
pdfStartPage
[] 0 d
1 i
0 j
0 J
10 M
1 w
/DeviceGray {} cs
[0] sc
/DeviceGray {} CS
[0] SC
false op
false OP
{} settransfer
0 0 32 32 re
W
q
/DeviceRGB {} cs
[0 0 0] sc
/DeviceRGB {} CS
[0 0 0] SC
[1 0 0 -1 0 32] cm
q
q
Q
Q
q
q
q
[1 0 0 1 0 0] cm
[32 0 0 -32 0 32] cm
/DeviceRGB setcolorspace
<<
/ImageType 1
/Width 32
/Height 32
/ImageMatrix [32 0 0 -32 0 32]
/BitsPerComponent 8
/Decode [0 1 0 1 0 1]
/DataSource currentfile
/ASCII85Decode filter
<< >> /DCTDecode filter
>>
pdfIm
s4IA0!"_al8O`[\!<E0k!([(is4[N@!!30%!W`<'!WiE)!WiE*"Tni/!s8`1"9Sf4
"pYA<"pYA=#n%%F#RUhB#7:nI$4@7N$k*@I%M'!W%LW[R%0,&^6NI5i!WrN,"p4r3
$j[(D$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ
$k30O!"fJ:+93Md!?qLF&HMtG!WU(<*rl9A"T\W)!<E3$z!!!!"!WrQ/"pYD?$4Hm
P!4<@<!W`B*!X&T/"U"r.!!.KK!WrE*&Hrdj0gQ!W;.0\RE>10ZOeE%*6F"?A;UOt
Z1LbBV#mqFa(`=5<-7:2j.Ps"@2`NfY6UX@47n?3D;cHat='/U/@q9._B4u!oF*)P
JGBeCZK7nr5LPUeEP*;,qQC!u,R\HRQV5C/hWN*81['d?O\@K2f_o0O6a2lBFdaQ^
rf%8R-g>V&OjQ5OekiqC&o(2MHp@n@XqZ"J6*ru?D!<E3%!<E3%!<<*"!!!!"!WrQ
/"pYD?$4HmP!4<C=!W`?*"9Sc3"U"r.!<RHF!<N?8"9fr'"qj4!#@VTc+u4]T'LIq
UZ,$_k1K*]W@WKj'(*k`q-1Mcg)&ahL-n-W'2E*TU3^Z;(7Rp!@8lJ\h<``C+>%;)
SAnPdkC3+K>G'A1VH@gd&KnbA=M2II[Pa.Q$R$jD;USO``Vl6SpZEppG[^WcW]#)A
'`Q#s>ai`&\eCE.%f\,!<j5f=akNM0qo(2MHp@n@XqZ#7L$j-M1!YGMH!'^J^[J7H
*)od=>n_Shppj9lmgH&*&Z5`-0!&G^+@?%=sWQn:&Z!JmV>Q3<j(;FIbL>(78UA/^
<WG/37&CF$Q0s_&>N/i2JRek1>=8iOIiX'uaq]C(*rY9%6hVL.U[YF1+o2#E2rZgV
fAtg!5rLlk%;jl*n<+SZT8_SR;=skUV066U1.p=mFr6"gf2][jPofDZ&\`7@/-r'!
;,l&`4))eYGD-KF%4Q#*6m7m-&ibs?(?PB?TXYaa<m(u:lbhFsTbaCt4hKdqnoWN-
,-f^7-GbXos*uB0>%2C(@*]]s]E087&>\*L"WW)s0NHRN"Ia3BM^PX0A?"k)FD":7
Zape3'Q25[,qME[RXmKi%7R$RY-ahd^2Mq#oHbDPloej\L\<u;(;Pe(roA.6'\>ps
H'BN#QqXg'$f%32o+9)<E*7qSo%=Z>=0tktVb?\UUL)@Rm9:'aT6=iISQ2.kIjQ"\
%_ROO<=2Wb\MS98hQG^TuG$9X6EFe(Kg?r;t$)Qpec%CS=pnp0%dOlMsGLMhk<;`4
`K1YFe4Dk#>F*pbBZ'QZsG'6YnmBb4>:XPI-!+d5f%ibMn4q,rTa=JCm8q9KN(pJ_
E6F)2g+:rKf>4``l^LjY[CVCPY(ZDD*'3X"&qXqOb/bQNI^2+A(eWj>@,<bR&bn,Q
e'afdE[n5C'ffj+UH1OZ,hW)L6\hS>-V.Fe`[b"_:aa,33f`~>
%-EOD-
Q
Q
Q
Q
showpage
%%PageTrailer
pdfEndPage
%%Trailer
end
%%DocumentSuppliedResources:
%%EOF

BIN
autotests/read/eps/rgb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
autotests/read/hdr/rgb.hdr Normal file

Binary file not shown.

BIN
autotests/read/hdr/rgb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
autotests/read/kra/src.kra Normal file

Binary file not shown.

BIN
autotests/read/kra/src.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
autotests/read/ora/src.ora Normal file

Binary file not shown.

BIN
autotests/read/ora/src.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
autotests/read/pcx/bw.pcx Normal file

Binary file not shown.

BIN
autotests/read/pcx/bw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
autotests/read/pcx/rgb.pcx Normal file

Binary file not shown.

BIN
autotests/read/pcx/rgb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

BIN
autotests/read/rgb/bw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

BIN
autotests/read/rgb/bw.rgb Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

BIN
autotests/read/rgb/rgb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
autotests/read/rgb/rgb.rgb Normal file

Binary file not shown.

BIN
autotests/read/tga/bw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 763 B

BIN
autotests/read/tga/bw.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
autotests/read/tga/bwa.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

BIN
autotests/read/tga/bwa.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
autotests/read/tga/rgb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
autotests/read/tga/rgb.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
autotests/read/tga/rgba.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
autotests/read/tga/rgba.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

225
autotests/readtest.cpp Normal file
View File

@ -0,0 +1,225 @@
/*
* Copyright 2014 Alex Merry <alex.merry@kdemail.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3, or any
* later version accepted by the membership of KDE e.V. (or its
* successor approved by the membership of KDE e.V.), which shall
* act as a proxy defined in Section 6 of version 3 of the license.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <QCommandLineParser>
#include <QCoreApplication>
#include <QDir>
#include <QFileInfo>
#include <QImage>
#include <QImageReader>
#include <QTextStream>
#include "../tests/format-enum.h"
static void writeImageData(const char *name, const QString &filename, const QImage &image)
{
QFile file(filename);
if (file.open(QIODevice::WriteOnly)) {
qint64 written = file.write(reinterpret_cast<const char *>(image.bits()), image.sizeInBytes());
if (written == image.sizeInBytes()) {
QTextStream(stdout) << " " << name
<< " written to " << filename << "\n";
} else {
QTextStream(stdout) << " could not write " << name
<< " to " << filename << ":"
<< file.errorString() << "\n";
}
} else {
QTextStream(stdout) << " could not open "
<< filename << ":"
<< file.errorString() << "\n";
}
}
// allow each byte to be different by up to 1, to allow for rounding errors
static bool fuzzyeq(const QImage &im1, const QImage &im2, uchar fuzziness)
{
const int height = im1.height();
const int width = im1.width();
for (int i = 0; i < height; ++i) {
const uchar *line1 = im1.scanLine(i);
const uchar *line2 = im2.scanLine(i);
for (int j = 0; j < width; ++j) {
if (line1[j] > line2[j]) {
if (line1[j] - line2[j] > fuzziness)
return false;
} else {
if (line2[j] - line1[j] > fuzziness)
return false;
}
}
}
return true;
}
int main(int argc, char ** argv)
{
QCoreApplication app(argc, argv);
QCoreApplication::removeLibraryPath(QStringLiteral(PLUGIN_DIR));
QCoreApplication::addLibraryPath(QStringLiteral(PLUGIN_DIR));
QCoreApplication::setApplicationName(QStringLiteral("readtest"));
QCoreApplication::setApplicationVersion(QStringLiteral("1.0.0"));
QCommandLineParser parser;
parser.setApplicationDescription(QStringLiteral("Performs basic image conversion checking."));
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument(QStringLiteral("format"), QStringLiteral("format to test"));
QCommandLineOption fuzz(
QStringList() << QStringLiteral("f") << QStringLiteral("fuzz"),
QStringLiteral("Allow for some deviation in ARGB data."),
QStringLiteral("max"));
parser.addOption(fuzz);
parser.process(app);
const QStringList args = parser.positionalArguments();
if (args.count() < 1) {
QTextStream(stderr) << "Must provide a format\n";
parser.showHelp(1);
} else if (args.count() > 1) {
QTextStream(stderr) << "Too many arguments\n";
parser.showHelp(1);
}
uchar fuzziness = 0;
if (parser.isSet(fuzz)) {
bool ok;
uint fuzzarg = parser.value(fuzz).toUInt(&ok);
if (!ok || fuzzarg > 255) {
QTextStream(stderr) << "Error: max fuzz argument must be a number between 0 and 255\n";
parser.showHelp(1);
}
fuzziness = uchar(fuzzarg);
}
QString suffix = args.at(0);
QByteArray format = suffix.toLatin1();
QDir imgdir(QLatin1String(IMAGEDIR "/") + suffix);
imgdir.setNameFilters(QStringList(QLatin1String("*.") + suffix));
imgdir.setFilter(QDir::Files);
int passed = 0;
int failed = 0;
QTextStream(stdout) << "********* "
<< "Starting basic read tests for "
<< suffix << " images *********\n";
const QList<QByteArray> formats = QImageReader::supportedImageFormats();
QStringList formatStrings;
formatStrings.reserve(formats.size());
std::transform(formats.begin(), formats.end(), std::back_inserter(formatStrings), [](const QByteArray &format) { return QString(format); });
QTextStream(stdout) << "QImageReader::supportedImageFormats: " << formatStrings.join(", ") << "\n";
const QFileInfoList lstImgDir = imgdir.entryInfoList();
for (const QFileInfo &fi : lstImgDir) {
int suffixPos = fi.filePath().count() - suffix.count();
QString inputfile = fi.filePath();
QString expfile = fi.filePath().replace(suffixPos, suffix.count(), QStringLiteral("png"));
QString expfilename = QFileInfo(expfile).fileName();
QImageReader inputReader(inputfile, format);
QImageReader expReader(expfile, "png");
QImage inputImage;
QImage expImage;
if (!expReader.read(&expImage)) {
QTextStream(stdout) << "ERROR: " << fi.fileName()
<< ": could not load " << expfilename
<< ": " << expReader.errorString()
<< "\n";
++failed;
continue;
}
if (!inputReader.canRead()) {
QTextStream(stdout) << "FAIL : " << fi.fileName()
<< ": failed can read: "
<< inputReader.errorString()
<< "\n";
++failed;
continue;
}
if (!inputReader.read(&inputImage)) {
QTextStream(stdout) << "FAIL : " << fi.fileName()
<< ": failed to load: "
<< inputReader.errorString()
<< "\n";
++failed;
continue;
}
if (expImage.width() != inputImage.width()) {
QTextStream(stdout) << "FAIL : " << fi.fileName()
<< ": width was " << inputImage.width()
<< " but " << expfilename << " width was "
<< expImage.width() << "\n";
++failed;
} else if (expImage.height() != inputImage.height()) {
QTextStream(stdout) << "FAIL : " << fi.fileName()
<< ": height was " << inputImage.height()
<< " but " << expfilename << " height was "
<< expImage.height() << "\n";
++failed;
} else {
if (inputImage.format() != QImage::Format_ARGB32) {
QTextStream(stdout) << "INFO : " << fi.fileName()
<< ": converting " << fi.fileName()
<< " from " << formatToString(inputImage.format())
<< " to ARGB32\n";
inputImage = inputImage.convertToFormat(QImage::Format_ARGB32);
}
if (expImage.format() != QImage::Format_ARGB32) {
QTextStream(stdout) << "INFO : " << fi.fileName()
<< ": converting " << expfilename
<< " from " << formatToString(expImage.format())
<< " to ARGB32\n";
expImage = expImage.convertToFormat(QImage::Format_ARGB32);
}
if (fuzzyeq(inputImage, expImage, fuzziness)) {
QTextStream(stdout) << "PASS : " << fi.fileName() << "\n";
++passed;
} else {
QTextStream(stdout) << "FAIL : " << fi.fileName()
<< ": differs from " << expfilename << "\n";
writeImageData("expected data",
fi.fileName() + QLatin1String("-expected.data"),
expImage);
writeImageData("actual data",
fi.fileName() + QLatin1String("-actual.data"),
inputImage);
++failed;
}
}
}
QTextStream(stdout) << "Totals: "
<< passed << " passed, "
<< failed << " failed\n";
QTextStream(stdout) << "********* "
<< "Finished basic read tests for "
<< suffix << " images *********\n";
return failed == 0 ? 0 : 1;
}

502
autotests/write/bw.eps Normal file
View File

@ -0,0 +1,502 @@
%!PS-Adobe-3.0 EPSF-3.0
%Produced by poppler pdftops version: 0.24.5 (http://poppler.freedesktop.org)
%%Creator: KDE EPS image plugin
%%LanguageLevel: 2
%%DocumentSuppliedResources: (atend)
%%BoundingBox: 0 0 32 32
%%HiResBoundingBox: 0 0 32 32
%%DocumentSuppliedResources: (atend)
%%EndComments
%%BeginProlog
%%BeginResource: procset xpdf 3.00 0
%%Copyright: Copyright 1996-2011 Glyph & Cog, LLC
/xpdf 75 dict def xpdf begin
% PDF special state
/pdfDictSize 15 def
/pdfSetup {
/setpagedevice where {
pop 2 dict begin
/Policies 1 dict dup begin /PageSize 6 def end def
{ /Duplex true def } if
currentdict end setpagedevice
} {
pop
} ifelse
} def
/pdfSetupPaper {
2 array astore
/setpagedevice where {
pop 2 dict begin
/PageSize exch def
/ImagingBBox null def
currentdict end setpagedevice
} {
pop
} ifelse
} def
/pdfStartPage {
pdfDictSize dict begin
/pdfFillCS [] def
/pdfFillXform {} def
/pdfStrokeCS [] def
/pdfStrokeXform {} def
/pdfFill [0] def
/pdfStroke [0] def
/pdfFillOP false def
/pdfStrokeOP false def
/pdfLastFill false def
/pdfLastStroke false def
/pdfTextMat [1 0 0 1 0 0] def
/pdfFontSize 0 def
/pdfCharSpacing 0 def
/pdfTextRender 0 def
/pdfPatternCS false def
/pdfTextRise 0 def
/pdfWordSpacing 0 def
/pdfHorizScaling 1 def
/pdfTextClipPath [] def
} def
/pdfEndPage { end } def
% PDF color state
/cs { /pdfFillXform exch def dup /pdfFillCS exch def
setcolorspace } def
/CS { /pdfStrokeXform exch def dup /pdfStrokeCS exch def
setcolorspace } def
/sc { pdfLastFill not { pdfFillCS setcolorspace } if
dup /pdfFill exch def aload pop pdfFillXform setcolor
/pdfLastFill true def /pdfLastStroke false def } def
/SC { pdfLastStroke not { pdfStrokeCS setcolorspace } if
dup /pdfStroke exch def aload pop pdfStrokeXform setcolor
/pdfLastStroke true def /pdfLastFill false def } def
/op { /pdfFillOP exch def
pdfLastFill { pdfFillOP setoverprint } if } def
/OP { /pdfStrokeOP exch def
pdfLastStroke { pdfStrokeOP setoverprint } if } def
/fCol {
pdfLastFill not {
pdfFillCS setcolorspace
pdfFill aload pop pdfFillXform setcolor
pdfFillOP setoverprint
/pdfLastFill true def /pdfLastStroke false def
} if
} def
/sCol {
pdfLastStroke not {
pdfStrokeCS setcolorspace
pdfStroke aload pop pdfStrokeXform setcolor
pdfStrokeOP setoverprint
/pdfLastStroke true def /pdfLastFill false def
} if
} def
% build a font
/pdfMakeFont {
4 3 roll findfont
4 2 roll matrix scale makefont
dup length dict begin
{ 1 index /FID ne { def } { pop pop } ifelse } forall
/Encoding exch def
currentdict
end
definefont pop
} def
/pdfMakeFont16 {
exch findfont
dup length dict begin
{ 1 index /FID ne { def } { pop pop } ifelse } forall
/WMode exch def
currentdict
end
definefont pop
} def
% graphics state operators
/q { gsave pdfDictSize dict begin } def
/Q {
end grestore
/pdfLastFill where {
pop
pdfLastFill {
pdfFillOP setoverprint
} {
pdfStrokeOP setoverprint
} ifelse
} if
} def
/cm { concat } def
/d { setdash } def
/i { setflat } def
/j { setlinejoin } def
/J { setlinecap } def
/M { setmiterlimit } def
/w { setlinewidth } def
% path segment operators
/m { moveto } def
/l { lineto } def
/c { curveto } def
/re { 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
neg 0 rlineto closepath } def
/h { closepath } def
% path painting operators
/S { sCol stroke } def
/Sf { fCol stroke } def
/f { fCol fill } def
/f* { fCol eofill } def
% clipping operators
/W { clip newpath } def
/W* { eoclip newpath } def
/Ws { strokepath clip newpath } def
% text state operators
/Tc { /pdfCharSpacing exch def } def
/Tf { dup /pdfFontSize exch def
dup pdfHorizScaling mul exch matrix scale
pdfTextMat matrix concatmatrix dup 4 0 put dup 5 0 put
exch findfont exch makefont setfont } def
/Tr { /pdfTextRender exch def } def
/Tp { /pdfPatternCS exch def } def
/Ts { /pdfTextRise exch def } def
/Tw { /pdfWordSpacing exch def } def
/Tz { /pdfHorizScaling exch def } def
% text positioning operators
/Td { pdfTextMat transform moveto } def
/Tm { /pdfTextMat exch def } def
% text string operators
/xyshow where {
pop
/xyshow2 {
dup length array
0 2 2 index length 1 sub {
2 index 1 index 2 copy get 3 1 roll 1 add get
pdfTextMat dtransform
4 2 roll 2 copy 6 5 roll put 1 add 3 1 roll dup 4 2 roll put
} for
exch pop
xyshow
} def
}{
/xyshow2 {
currentfont /FontType get 0 eq {
0 2 3 index length 1 sub {
currentpoint 4 index 3 index 2 getinterval show moveto
2 copy get 2 index 3 2 roll 1 add get
pdfTextMat dtransform rmoveto
} for
} {
0 1 3 index length 1 sub {
currentpoint 4 index 3 index 1 getinterval show moveto
2 copy 2 mul get 2 index 3 2 roll 2 mul 1 add get
pdfTextMat dtransform rmoveto
} for
} ifelse
pop pop
} def
} ifelse
/cshow where {
pop
/xycp {
0 3 2 roll
{
pop pop currentpoint 3 2 roll
1 string dup 0 4 3 roll put false charpath moveto
2 copy get 2 index 2 index 1 add get
pdfTextMat dtransform rmoveto
2 add
} exch cshow
pop pop
} def
}{
/xycp {
currentfont /FontType get 0 eq {
0 2 3 index length 1 sub {
currentpoint 4 index 3 index 2 getinterval false charpath moveto
2 copy get 2 index 3 2 roll 1 add get
pdfTextMat dtransform rmoveto
} for
} {
0 1 3 index length 1 sub {
currentpoint 4 index 3 index 1 getinterval false charpath moveto
2 copy 2 mul get 2 index 3 2 roll 2 mul 1 add get
pdfTextMat dtransform rmoveto
} for
} ifelse
pop pop
} def
} ifelse
/Tj {
fCol
0 pdfTextRise pdfTextMat dtransform rmoveto
currentpoint 4 2 roll
pdfTextRender 1 and 0 eq {
2 copy xyshow2
} if
pdfTextRender 3 and dup 1 eq exch 2 eq or {
3 index 3 index moveto
2 copy
currentfont /FontType get 3 eq { fCol } { sCol } ifelse
xycp currentpoint stroke moveto
} if
pdfTextRender 4 and 0 ne {
4 2 roll moveto xycp
/pdfTextClipPath [ pdfTextClipPath aload pop
{/moveto cvx}
{/lineto cvx}
{/curveto cvx}
{/closepath cvx}
pathforall ] def
currentpoint newpath moveto
} {
pop pop pop pop
} ifelse
0 pdfTextRise neg pdfTextMat dtransform rmoveto
} def
/TJm { 0.001 mul pdfFontSize mul pdfHorizScaling mul neg 0
pdfTextMat dtransform rmoveto } def
/TJmV { 0.001 mul pdfFontSize mul neg 0 exch
pdfTextMat dtransform rmoveto } def
/Tclip { pdfTextClipPath cvx exec clip newpath
/pdfTextClipPath [] def } def
/Tclip* { pdfTextClipPath cvx exec eoclip newpath
/pdfTextClipPath [] def } def
% Level 2/3 image operators
/pdfImBuf 100 string def
/pdfImStr {
2 copy exch length lt {
2 copy get exch 1 add exch
} {
()
} ifelse
} def
/skipEOD {
{ currentfile pdfImBuf readline
not { pop exit } if
(%-EOD-) eq { exit } if } loop
} def
/pdfIm { image skipEOD } def
/pdfImM { fCol imagemask skipEOD } def
/pr { 2 index 2 index 3 2 roll putinterval 4 add } def
/pdfImClip {
gsave
0 2 4 index length 1 sub {
dup 4 index exch 2 copy
get 5 index div put
1 add 3 index exch 2 copy
get 3 index div put
} for
pop pop rectclip
} def
/pdfImClipEnd { grestore } def
% shading operators
/colordelta {
false 0 1 3 index length 1 sub {
dup 4 index exch get 3 index 3 2 roll get sub abs 0.004 gt {
pop true
} if
} for
exch pop exch pop
} def
/funcCol { func n array astore } def
/funcSH {
dup 0 eq {
true
} {
dup 6 eq {
false
} {
4 index 4 index funcCol dup
6 index 4 index funcCol dup
3 1 roll colordelta 3 1 roll
5 index 5 index funcCol dup
3 1 roll colordelta 3 1 roll
6 index 8 index funcCol dup
3 1 roll colordelta 3 1 roll
colordelta or or or
} ifelse
} ifelse
{
1 add
4 index 3 index add 0.5 mul exch 4 index 3 index add 0.5 mul exch
6 index 6 index 4 index 4 index 4 index funcSH
2 index 6 index 6 index 4 index 4 index funcSH
6 index 2 index 4 index 6 index 4 index funcSH
5 3 roll 3 2 roll funcSH pop pop
} {
pop 3 index 2 index add 0.5 mul 3 index 2 index add 0.5 mul
funcCol sc
dup 4 index exch mat transform m
3 index 3 index mat transform l
1 index 3 index mat transform l
mat transform l pop pop h f*
} ifelse
} def
/axialCol {
dup 0 lt {
pop t0
} {
dup 1 gt {
pop t1
} {
dt mul t0 add
} ifelse
} ifelse
func n array astore
} def
/axialSH {
dup 0 eq {
true
} {
dup 8 eq {
false
} {
2 index axialCol 2 index axialCol colordelta
} ifelse
} ifelse
{
1 add 3 1 roll 2 copy add 0.5 mul
dup 4 3 roll exch 4 index axialSH
exch 3 2 roll axialSH
} {
pop 2 copy add 0.5 mul
axialCol sc
exch dup dx mul x0 add exch dy mul y0 add
3 2 roll dup dx mul x0 add exch dy mul y0 add
dx abs dy abs ge {
2 copy yMin sub dy mul dx div add yMin m
yMax sub dy mul dx div add yMax l
2 copy yMax sub dy mul dx div add yMax l
yMin sub dy mul dx div add yMin l
h f*
} {
exch 2 copy xMin sub dx mul dy div add xMin exch m
xMax sub dx mul dy div add xMax exch l
exch 2 copy xMax sub dx mul dy div add xMax exch l
xMin sub dx mul dy div add xMin exch l
h f*
} ifelse
} ifelse
} def
/radialCol {
dup t0 lt {
pop t0
} {
dup t1 gt {
pop t1
} if
} ifelse
func n array astore
} def
/radialSH {
dup 0 eq {
true
} {
dup 8 eq {
false
} {
2 index dt mul t0 add radialCol
2 index dt mul t0 add radialCol colordelta
} ifelse
} ifelse
{
1 add 3 1 roll 2 copy add 0.5 mul
dup 4 3 roll exch 4 index radialSH
exch 3 2 roll radialSH
} {
pop 2 copy add 0.5 mul dt mul t0 add
radialCol sc
encl {
exch dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
0 360 arc h
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
360 0 arcn h f
} {
2 copy
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a1 a2 arcn
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a2 a1 arcn h
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a1 a2 arc
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a2 a1 arc h f
} ifelse
} ifelse
} def
end
%%EndResource
%%EndProlog
%%BeginSetup
xpdf begin
%%EndSetup
pdfStartPage
[] 0 d
1 i
0 j
0 J
10 M
1 w
/DeviceGray {} cs
[0] sc
/DeviceGray {} CS
[0] SC
false op
false OP
{} settransfer
0 0 32 32 re
W
q
/DeviceRGB {} cs
[0 0 0] sc
/DeviceRGB {} CS
[0 0 0] SC
[1 0 0 -1 0 32] cm
q
q
Q
Q
q
q
q
[1 0 0 1 0 0] cm
[32 0 0 -32 0 32] cm
/DeviceRGB setcolorspace
<<
/ImageType 1
/Width 32
/Height 32
/ImageMatrix [32 0 0 -32 0 32]
/BitsPerComponent 8
/Decode [0 1 0 1 0 1]
/DataSource currentfile
/ASCII85Decode filter
<< >> /DCTDecode filter
>>
pdfIm
s4IA0!"_al8O`[\!<E0k!([(is4[N@!!30%!W`<'!WiE)!WiE*"Tni/!s8`1"9Sf4
"pYA<"pYA=#n%%F#RUhB#7:nI$4@7N$k*@I%M'!W%LW[R%0,&^6NI5i!WrN,"p4r3
$j[(D$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ
$k30O!"fJ:+93Md!?qLF&HMtG!WU(<*rl9A"T\W)!<E3$z!!!!"!WrQ/"pYD?$4Hm
P!4<@<!W`B*!X&T/"U"r.!!.KK!WrE*&Hrdj0gQ!W;.0\RE>10ZOeE%*6F"?A;UOt
Z1LbBV#mqFa(`=5<-7:2j.Ps"@2`NfY6UX@47n?3D;cHat='/U/@q9._B4u!oF*)P
JGBeCZK7nr5LPUeEP*;,qQC!u,R\HRQV5C/hWN*81['d?O\@K2f_o0O6a2lBFdaQ^
rf%8R-g>V&OjQ5OekiqC&o(2MHp@n@XqZ"J6*ru?D!<E3%!<E3%!<<*"!!!!"!WrQ
/"pYD?$4HmP!4<C=!W`?*"9Sc3"U"r.!<RHF!<N?8"9fr'"qj4!#@VTc+u4]T'LIq
UZ,$_k1K*]W@WKj'(*k`q-1Mcg)&ahL-n-W'2E*TU3^Z;(7Rp!@8lJ\h<``C+>%;)
SAnPdkC3+K>G'A1VH@gd&KnbA=M2II[Pa.Q$R$jD;USO``Vl6SpZEppG[^WcW]#)A
'`Q#s>ai`&\eCE.%f\,!<j5f=akNM0qo(2MHp@n@XqZ#7L$j-M1!YGMH!'^J^BE%s
`Q[ch>,l[jrG5O;H4@((,Nu7daD.`FnrL6**b\LH,D=SYd",m^?i=l4k#>Y&g9bUO
>MtTa;Y#@t+:FeG9N]V>#1:nBP>^,H<Xa\&[!aI?'6uhG.,.T@e?5D#_rr@Yb0!Ms
rN7qV%pM`e<#$Di["F`gj5:Si-rrBm_r]g2Pi93&5#Ca_N')YD#cKpI1VVR`"G%EX
@*FZrXV0tH*!!N,t!.q]X8,]]A5(CE_ir9#3PN#*LMfE5YgM6Sih.[I+D+6(5b@cc
G]RTni-.='e5N&$f,_@oPe/ga&,EF3"BFt:;l!LD5!,US+f+\4m`r=@l+`@\b!qEF
lMI#lQ%eAR[36>9-p&$>GXA=[:$]!_#_qfCOpC4P?DSg0,)pr1_K`8=Zq8`L8#+t-
(fDZ)=I=JaBepM&/?8)KLP/oBHd_ANBj^7d-n,*jV<rW/OB`?-fHo]aT7qpscJ%%(
R-n[*E0dKT>q+1!H,_-(pWAX?K!.Y%%~>
%-EOD-
Q
Q
Q
Q
showpage
%%PageTrailer
pdfEndPage
%%Trailer
end
%%DocumentSuppliedResources:
%%EOF

BIN
autotests/write/bw.pcx Normal file

Binary file not shown.

BIN
autotests/write/bw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

BIN
autotests/write/bw.rgb Normal file

Binary file not shown.

BIN
autotests/write/bw.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
autotests/write/bw.xv Normal file

Binary file not shown.

BIN
autotests/write/bwa.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

BIN
autotests/write/bwa.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
autotests/write/bwa.xv Normal file

Binary file not shown.

505
autotests/write/rgb.eps Normal file
View File

@ -0,0 +1,505 @@
%!PS-Adobe-3.0 EPSF-3.0
%Produced by poppler pdftops version: 0.24.5 (http://poppler.freedesktop.org)
%%Creator: KDE EPS image plugin
%%LanguageLevel: 2
%%DocumentSuppliedResources: (atend)
%%BoundingBox: 0 0 32 32
%%HiResBoundingBox: 0 0 32 32
%%DocumentSuppliedResources: (atend)
%%EndComments
%%BeginProlog
%%BeginResource: procset xpdf 3.00 0
%%Copyright: Copyright 1996-2011 Glyph & Cog, LLC
/xpdf 75 dict def xpdf begin
% PDF special state
/pdfDictSize 15 def
/pdfSetup {
/setpagedevice where {
pop 2 dict begin
/Policies 1 dict dup begin /PageSize 6 def end def
{ /Duplex true def } if
currentdict end setpagedevice
} {
pop
} ifelse
} def
/pdfSetupPaper {
2 array astore
/setpagedevice where {
pop 2 dict begin
/PageSize exch def
/ImagingBBox null def
currentdict end setpagedevice
} {
pop
} ifelse
} def
/pdfStartPage {
pdfDictSize dict begin
/pdfFillCS [] def
/pdfFillXform {} def
/pdfStrokeCS [] def
/pdfStrokeXform {} def
/pdfFill [0] def
/pdfStroke [0] def
/pdfFillOP false def
/pdfStrokeOP false def
/pdfLastFill false def
/pdfLastStroke false def
/pdfTextMat [1 0 0 1 0 0] def
/pdfFontSize 0 def
/pdfCharSpacing 0 def
/pdfTextRender 0 def
/pdfPatternCS false def
/pdfTextRise 0 def
/pdfWordSpacing 0 def
/pdfHorizScaling 1 def
/pdfTextClipPath [] def
} def
/pdfEndPage { end } def
% PDF color state
/cs { /pdfFillXform exch def dup /pdfFillCS exch def
setcolorspace } def
/CS { /pdfStrokeXform exch def dup /pdfStrokeCS exch def
setcolorspace } def
/sc { pdfLastFill not { pdfFillCS setcolorspace } if
dup /pdfFill exch def aload pop pdfFillXform setcolor
/pdfLastFill true def /pdfLastStroke false def } def
/SC { pdfLastStroke not { pdfStrokeCS setcolorspace } if
dup /pdfStroke exch def aload pop pdfStrokeXform setcolor
/pdfLastStroke true def /pdfLastFill false def } def
/op { /pdfFillOP exch def
pdfLastFill { pdfFillOP setoverprint } if } def
/OP { /pdfStrokeOP exch def
pdfLastStroke { pdfStrokeOP setoverprint } if } def
/fCol {
pdfLastFill not {
pdfFillCS setcolorspace
pdfFill aload pop pdfFillXform setcolor
pdfFillOP setoverprint
/pdfLastFill true def /pdfLastStroke false def
} if
} def
/sCol {
pdfLastStroke not {
pdfStrokeCS setcolorspace
pdfStroke aload pop pdfStrokeXform setcolor
pdfStrokeOP setoverprint
/pdfLastStroke true def /pdfLastFill false def
} if
} def
% build a font
/pdfMakeFont {
4 3 roll findfont
4 2 roll matrix scale makefont
dup length dict begin
{ 1 index /FID ne { def } { pop pop } ifelse } forall
/Encoding exch def
currentdict
end
definefont pop
} def
/pdfMakeFont16 {
exch findfont
dup length dict begin
{ 1 index /FID ne { def } { pop pop } ifelse } forall
/WMode exch def
currentdict
end
definefont pop
} def
% graphics state operators
/q { gsave pdfDictSize dict begin } def
/Q {
end grestore
/pdfLastFill where {
pop
pdfLastFill {
pdfFillOP setoverprint
} {
pdfStrokeOP setoverprint
} ifelse
} if
} def
/cm { concat } def
/d { setdash } def
/i { setflat } def
/j { setlinejoin } def
/J { setlinecap } def
/M { setmiterlimit } def
/w { setlinewidth } def
% path segment operators
/m { moveto } def
/l { lineto } def
/c { curveto } def
/re { 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
neg 0 rlineto closepath } def
/h { closepath } def
% path painting operators
/S { sCol stroke } def
/Sf { fCol stroke } def
/f { fCol fill } def
/f* { fCol eofill } def
% clipping operators
/W { clip newpath } def
/W* { eoclip newpath } def
/Ws { strokepath clip newpath } def
% text state operators
/Tc { /pdfCharSpacing exch def } def
/Tf { dup /pdfFontSize exch def
dup pdfHorizScaling mul exch matrix scale
pdfTextMat matrix concatmatrix dup 4 0 put dup 5 0 put
exch findfont exch makefont setfont } def
/Tr { /pdfTextRender exch def } def
/Tp { /pdfPatternCS exch def } def
/Ts { /pdfTextRise exch def } def
/Tw { /pdfWordSpacing exch def } def
/Tz { /pdfHorizScaling exch def } def
% text positioning operators
/Td { pdfTextMat transform moveto } def
/Tm { /pdfTextMat exch def } def
% text string operators
/xyshow where {
pop
/xyshow2 {
dup length array
0 2 2 index length 1 sub {
2 index 1 index 2 copy get 3 1 roll 1 add get
pdfTextMat dtransform
4 2 roll 2 copy 6 5 roll put 1 add 3 1 roll dup 4 2 roll put
} for
exch pop
xyshow
} def
}{
/xyshow2 {
currentfont /FontType get 0 eq {
0 2 3 index length 1 sub {
currentpoint 4 index 3 index 2 getinterval show moveto
2 copy get 2 index 3 2 roll 1 add get
pdfTextMat dtransform rmoveto
} for
} {
0 1 3 index length 1 sub {
currentpoint 4 index 3 index 1 getinterval show moveto
2 copy 2 mul get 2 index 3 2 roll 2 mul 1 add get
pdfTextMat dtransform rmoveto
} for
} ifelse
pop pop
} def
} ifelse
/cshow where {
pop
/xycp {
0 3 2 roll
{
pop pop currentpoint 3 2 roll
1 string dup 0 4 3 roll put false charpath moveto
2 copy get 2 index 2 index 1 add get
pdfTextMat dtransform rmoveto
2 add
} exch cshow
pop pop
} def
}{
/xycp {
currentfont /FontType get 0 eq {
0 2 3 index length 1 sub {
currentpoint 4 index 3 index 2 getinterval false charpath moveto
2 copy get 2 index 3 2 roll 1 add get
pdfTextMat dtransform rmoveto
} for
} {
0 1 3 index length 1 sub {
currentpoint 4 index 3 index 1 getinterval false charpath moveto
2 copy 2 mul get 2 index 3 2 roll 2 mul 1 add get
pdfTextMat dtransform rmoveto
} for
} ifelse
pop pop
} def
} ifelse
/Tj {
fCol
0 pdfTextRise pdfTextMat dtransform rmoveto
currentpoint 4 2 roll
pdfTextRender 1 and 0 eq {
2 copy xyshow2
} if
pdfTextRender 3 and dup 1 eq exch 2 eq or {
3 index 3 index moveto
2 copy
currentfont /FontType get 3 eq { fCol } { sCol } ifelse
xycp currentpoint stroke moveto
} if
pdfTextRender 4 and 0 ne {
4 2 roll moveto xycp
/pdfTextClipPath [ pdfTextClipPath aload pop
{/moveto cvx}
{/lineto cvx}
{/curveto cvx}
{/closepath cvx}
pathforall ] def
currentpoint newpath moveto
} {
pop pop pop pop
} ifelse
0 pdfTextRise neg pdfTextMat dtransform rmoveto
} def
/TJm { 0.001 mul pdfFontSize mul pdfHorizScaling mul neg 0
pdfTextMat dtransform rmoveto } def
/TJmV { 0.001 mul pdfFontSize mul neg 0 exch
pdfTextMat dtransform rmoveto } def
/Tclip { pdfTextClipPath cvx exec clip newpath
/pdfTextClipPath [] def } def
/Tclip* { pdfTextClipPath cvx exec eoclip newpath
/pdfTextClipPath [] def } def
% Level 2/3 image operators
/pdfImBuf 100 string def
/pdfImStr {
2 copy exch length lt {
2 copy get exch 1 add exch
} {
()
} ifelse
} def
/skipEOD {
{ currentfile pdfImBuf readline
not { pop exit } if
(%-EOD-) eq { exit } if } loop
} def
/pdfIm { image skipEOD } def
/pdfImM { fCol imagemask skipEOD } def
/pr { 2 index 2 index 3 2 roll putinterval 4 add } def
/pdfImClip {
gsave
0 2 4 index length 1 sub {
dup 4 index exch 2 copy
get 5 index div put
1 add 3 index exch 2 copy
get 3 index div put
} for
pop pop rectclip
} def
/pdfImClipEnd { grestore } def
% shading operators
/colordelta {
false 0 1 3 index length 1 sub {
dup 4 index exch get 3 index 3 2 roll get sub abs 0.004 gt {
pop true
} if
} for
exch pop exch pop
} def
/funcCol { func n array astore } def
/funcSH {
dup 0 eq {
true
} {
dup 6 eq {
false
} {
4 index 4 index funcCol dup
6 index 4 index funcCol dup
3 1 roll colordelta 3 1 roll
5 index 5 index funcCol dup
3 1 roll colordelta 3 1 roll
6 index 8 index funcCol dup
3 1 roll colordelta 3 1 roll
colordelta or or or
} ifelse
} ifelse
{
1 add
4 index 3 index add 0.5 mul exch 4 index 3 index add 0.5 mul exch
6 index 6 index 4 index 4 index 4 index funcSH
2 index 6 index 6 index 4 index 4 index funcSH
6 index 2 index 4 index 6 index 4 index funcSH
5 3 roll 3 2 roll funcSH pop pop
} {
pop 3 index 2 index add 0.5 mul 3 index 2 index add 0.5 mul
funcCol sc
dup 4 index exch mat transform m
3 index 3 index mat transform l
1 index 3 index mat transform l
mat transform l pop pop h f*
} ifelse
} def
/axialCol {
dup 0 lt {
pop t0
} {
dup 1 gt {
pop t1
} {
dt mul t0 add
} ifelse
} ifelse
func n array astore
} def
/axialSH {
dup 0 eq {
true
} {
dup 8 eq {
false
} {
2 index axialCol 2 index axialCol colordelta
} ifelse
} ifelse
{
1 add 3 1 roll 2 copy add 0.5 mul
dup 4 3 roll exch 4 index axialSH
exch 3 2 roll axialSH
} {
pop 2 copy add 0.5 mul
axialCol sc
exch dup dx mul x0 add exch dy mul y0 add
3 2 roll dup dx mul x0 add exch dy mul y0 add
dx abs dy abs ge {
2 copy yMin sub dy mul dx div add yMin m
yMax sub dy mul dx div add yMax l
2 copy yMax sub dy mul dx div add yMax l
yMin sub dy mul dx div add yMin l
h f*
} {
exch 2 copy xMin sub dx mul dy div add xMin exch m
xMax sub dx mul dy div add xMax exch l
exch 2 copy xMax sub dx mul dy div add xMax exch l
xMin sub dx mul dy div add xMin exch l
h f*
} ifelse
} ifelse
} def
/radialCol {
dup t0 lt {
pop t0
} {
dup t1 gt {
pop t1
} if
} ifelse
func n array astore
} def
/radialSH {
dup 0 eq {
true
} {
dup 8 eq {
false
} {
2 index dt mul t0 add radialCol
2 index dt mul t0 add radialCol colordelta
} ifelse
} ifelse
{
1 add 3 1 roll 2 copy add 0.5 mul
dup 4 3 roll exch 4 index radialSH
exch 3 2 roll radialSH
} {
pop 2 copy add 0.5 mul dt mul t0 add
radialCol sc
encl {
exch dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
0 360 arc h
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
360 0 arcn h f
} {
2 copy
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a1 a2 arcn
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a2 a1 arcn h
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a1 a2 arc
dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add
a2 a1 arc h f
} ifelse
} ifelse
} def
end
%%EndResource
%%EndProlog
%%BeginSetup
xpdf begin
%%EndSetup
pdfStartPage
[] 0 d
1 i
0 j
0 J
10 M
1 w
/DeviceGray {} cs
[0] sc
/DeviceGray {} CS
[0] SC
false op
false OP
{} settransfer
0 0 32 32 re
W
q
/DeviceRGB {} cs
[0 0 0] sc
/DeviceRGB {} CS
[0 0 0] SC
[1 0 0 -1 0 32] cm
q
q
Q
Q
q
q
q
[1 0 0 1 0 0] cm
[32 0 0 -32 0 32] cm
/DeviceRGB setcolorspace
<<
/ImageType 1
/Width 32
/Height 32
/ImageMatrix [32 0 0 -32 0 32]
/BitsPerComponent 8
/Decode [0 1 0 1 0 1]
/DataSource currentfile
/ASCII85Decode filter
<< >> /DCTDecode filter
>>
pdfIm
s4IA0!"_al8O`[\!<E0k!([(is4[N@!!30%!W`<'!WiE)!WiE*"Tni/!s8`1"9Sf4
"pYA<"pYA=#n%%F#RUhB#7:nI$4@7N$k*@I%M'!W%LW[R%0,&^6NI5i!WrN,"p4r3
$j[(D$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ$k*OQ
$k30O!"fJ:+93Md!?qLF&HMtG!WU(<*rl9A"T\W)!<E3$z!!!!"!WrQ/"pYD?$4Hm
P!4<@<!W`B*!X&T/"U"r.!!.KK!WrE*&Hrdj0gQ!W;.0\RE>10ZOeE%*6F"?A;UOt
Z1LbBV#mqFa(`=5<-7:2j.Ps"@2`NfY6UX@47n?3D;cHat='/U/@q9._B4u!oF*)P
JGBeCZK7nr5LPUeEP*;,qQC!u,R\HRQV5C/hWN*81['d?O\@K2f_o0O6a2lBFdaQ^
rf%8R-g>V&OjQ5OekiqC&o(2MHp@n@XqZ"J6*ru?D!<E3%!<E3%!<<*"!!!!"!WrQ
/"pYD?$4HmP!4<C=!W`?*"9Sc3"U"r.!<RHF!<N?8"9fr'"qj4!#@VTc+u4]T'LIq
UZ,$_k1K*]W@WKj'(*k`q-1Mcg)&ahL-n-W'2E*TU3^Z;(7Rp!@8lJ\h<``C+>%;)
SAnPdkC3+K>G'A1VH@gd&KnbA=M2II[Pa.Q$R$jD;USO``Vl6SpZEppG[^WcW]#)A
'`Q#s>ai`&\eCE.%f\,!<j5f=akNM0qo(2MHp@n@XqZ#7L$j-M1!YGMH!'^J^[J7H
*)od=>n_Shppj9lmgH&*&Z5`-0!&G^+@?%=sWQn:&Z!JmV>Q3<j(;FIbL>(78UA/^
<WG/37&CF$Q0s_&>N/i2JRek1>=8iOIiX'uaq]C(*rY9%6hVL.U[YF1+o2#E2rZgV
fAtg!5rLlk%;jl*n<+SZT8_SR;=skUV066U1.p=mFr6"gf2][jPofDZ&\`7@/-r'!
;,l&`4))eYGD-KF%4Q#*6m7m-&ibs?(?PB?TXYaa<m(u:lbhFsTbaCt4hKdqnoWN-
,-f^7-GbXos*uB0>%2C(@*]]s]E087&>\*L"WW)s0NHRN"Ia3BM^PX0A?"k)FD":7
Zape3'Q25[,qME[RXmKi%7R$RY-ahd^2Mq#oHbDPloej\L\<u;(;Pe(roA.6'\>ps
H'BN#QqXg'$f%32o+9)<E*7qSo%=Z>=0tktVb?\UUL)@Rm9:'aT6=iISQ2.kIjQ"\
%_ROO<=2Wb\MS98hQG^TuG$9X6EFe(Kg?r;t$)Qpec%CS=pnp0%dOlMsGLMhk<;`4
`K1YFe4Dk#>F*pbBZ'QZsG'6YnmBb4>:XPI-!+d5f%ibMn4q,rTa=JCm8q9KN(pJ_
E6F)2g+:rKf>4``l^LjY[CVCPY(ZDD*'3X"&qXqOb/bQNI^2+A(eWj>@,<bR&bn,Q
e'afdE[n5C'ffj+UH1OZ,hW)L6\hS>-V.Fe`[b"_:aa,33f`~>
%-EOD-
Q
Q
Q
Q
showpage
%%PageTrailer
pdfEndPage
%%Trailer
end
%%DocumentSuppliedResources:
%%EOF

BIN
autotests/write/rgb.pcx Normal file

Binary file not shown.

BIN
autotests/write/rgb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
autotests/write/rgb.rgb Normal file

Binary file not shown.

BIN
autotests/write/rgb.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

6
autotests/write/rgb.xv Normal file
View File

@ -0,0 +1,6 @@
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><EFBFBD><EFBFBD>~<7E>{<7B><><EFBFBD>پ<EFBFBD><D9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۏW<DB8F>ܼ~>vjn<6A><6E>q]Z<17><><EFBFBD><EFBFBD>];<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۏW}<7D>ܝ?>>rf'Kʲ~z7v<37><76><EFBFBD>~?<3F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۻ<EFBFBD><DBBB><EFBFBD>߿<EFBFBD><DFBF><EFBFBD><EFBFBD>gk<67><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD><DFBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>o<EFBFBD><6F><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>{[<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><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><D28A><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>v<EFBFBD><76><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>y<EFBFBD><79><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>j<EFBFBD><6A><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><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><D695><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>>><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><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><DEB8><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>qq<71><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>ۓ<EFBFBD><DB93><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>

BIN
autotests/write/rgba.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
autotests/write/rgba.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
autotests/write/rgba.xv Normal file

Binary file not shown.

171
autotests/writetest.cpp Normal file
View File

@ -0,0 +1,171 @@
/*
* Copyright 2014 Alex Merry <alex.merry@kdemail.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3, or any
* later version accepted by the membership of KDE e.V. (or its
* successor approved by the membership of KDE e.V.), which shall
* act as a proxy defined in Section 6 of version 3 of the license.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <QBuffer>
#include <QCommandLineParser>
#include <QCoreApplication>
#include <QDir>
#include <QFileInfo>
#include <QImage>
#include <QImageReader>
#include <QImageWriter>
#include <QTextStream>
int main(int argc, char ** argv)
{
QCoreApplication app(argc, argv);
QCoreApplication::removeLibraryPath(QStringLiteral(PLUGIN_DIR));
QCoreApplication::addLibraryPath(QStringLiteral(PLUGIN_DIR));
QCoreApplication::setApplicationName(QStringLiteral("readtest"));
QCoreApplication::setApplicationVersion(QStringLiteral("1.0.0"));
QCommandLineParser parser;
parser.setApplicationDescription(QStringLiteral("Performs basic image conversion checking."));
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument(QStringLiteral("format"), QStringLiteral("format to test."));
QCommandLineOption lossless(
QStringList() << QStringLiteral("l") << QStringLiteral("lossless"),
QStringLiteral("Check that reading back the data gives the same image."));
parser.addOption(lossless);
parser.process(app);
const QStringList args = parser.positionalArguments();
if (args.count() < 1) {
QTextStream(stderr) << "Must provide a format\n";
parser.showHelp(1);
} else if (args.count() > 1) {
QTextStream(stderr) << "Too many arguments\n";
parser.showHelp(1);
}
QString suffix = args.at(0);
QByteArray format = suffix.toLatin1();
QDir imgdir(QStringLiteral(IMAGEDIR));
imgdir.setNameFilters(QStringList(QLatin1String("*.") + suffix));
imgdir.setFilter(QDir::Files);
int passed = 0;
int failed = 0;
QTextStream(stdout) << "********* "
<< "Starting basic write tests for "
<< suffix << " images *********\n";
const QFileInfoList lstImgDir = imgdir.entryInfoList();
for (const QFileInfo &fi : lstImgDir) {
int suffixPos = fi.filePath().count() - suffix.count();
QString pngfile = fi.filePath().replace(suffixPos, suffix.count(), QStringLiteral("png"));
QString pngfilename = QFileInfo(pngfile).fileName();
QImageReader pngReader(pngfile, "png");
QImage pngImage;
if (!pngReader.read(&pngImage)) {
QTextStream(stdout) << "ERROR: " << fi.fileName()
<< ": could not load " << pngfilename
<< ": " << pngReader.errorString()
<< "\n";
++failed;
continue;
}
QFile expFile(fi.filePath());
if (!expFile.open(QIODevice::ReadOnly)) {
QTextStream(stdout) << "ERROR: " << fi.fileName()
<< ": could not open " << fi.fileName()
<< ": " << expFile.errorString()
<< "\n";
++failed;
continue;
}
QByteArray expData = expFile.readAll();
if (expData.isEmpty()) {
// check if there was actually anything to read
expFile.reset();
char buf[1];
qint64 result = expFile.read(buf, 1);
if (result < 0) {
QTextStream(stdout) << "ERROR: " << fi.fileName()
<< ": could not load " << fi.fileName()
<< ": " << expFile.errorString()
<< "\n";
++failed;
continue;
}
}
QByteArray writtenData;
{
QBuffer buffer(&writtenData);
QImageWriter imgWriter(&buffer, format.constData());
if (!imgWriter.write(pngImage)) {
QTextStream(stdout) << "FAIL : " << fi.fileName()
<< ": failed to write image data\n";
++failed;
continue;
}
}
if (expData != writtenData) {
QTextStream(stdout) << "FAIL : " << fi.fileName()
<< ": written data differs from " << fi.fileName() << "\n";
++failed;
continue;
}
QImage reReadImage;
{
QBuffer buffer(&writtenData);
QImageReader imgReader(&buffer, format.constData());
if (!imgReader.read(&reReadImage)) {
QTextStream(stdout) << "FAIL : " << fi.fileName()
<< ": could not read back the written data\n";
++failed;
continue;
}
reReadImage = reReadImage.convertToFormat(pngImage.format());
}
if (parser.isSet(lossless)) {
if (pngImage != reReadImage) {
QTextStream(stdout) << "FAIL : " << fi.fileName()
<< ": re-reading the data resulted in a different image\n";
++failed;
continue;
}
}
QTextStream(stdout) << "PASS : " << fi.fileName() << "\n";
++passed;
}
QTextStream(stdout) << "Totals: "
<< passed << " passed, "
<< failed << " failed\n";
QTextStream(stdout) << "********* "
<< "Finished basic write tests for "
<< suffix << " images *********\n";
return failed == 0 ? 0 : 1;
}

View File

@ -1,103 +0,0 @@
# Try to find the OpenEXR libraries
#
# This will define:
#
# OpenEXR_FOUND - True if OpenEXR is available
# OpenEXR_LIBRARIES - Link to these to use OpenEXR
# OpenEXR_INCLUDE_DIRS - Include directory for OpenEXR
# OpenEXR_DEFINITIONS - Compiler flags required to link against OpenEXR
#
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
# Copyright (c) 2013, Alex Merry, <alex.merry@kdemail.net>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
pkg_check_modules(PC_OpenEXR QUIET OpenEXR)
set(OpenEXR_DEFINITIONS ${PC_OpenEXR_CFLAGS_OTHER})
find_path(OpenEXR_INCLUDE_DIR ImfRgbaFile.h
PATHS
${PC_OpenEXR_INCLUDEDIR}
${PC_OpenEXR_INCLUDE_DIRS}
PATH_SUFFIXES OpenEXR
)
# Required libraries for OpenEXR
find_library(OpenEXR_HALF_LIBRARY NAMES Half
PATHS
${PC_OpenEXR_LIBDIR}
${PC_OpenEXR_LIBRARY_DIRS}
)
find_library(OpenEXR_IEX_LIBRARY NAMES Iex
PATHS
${PC_OpenEXR_LIBDIR}
${PC_OpenEXR_LIBRARY_DIRS}
)
find_library(OpenEXR_IMATH_LIBRARY NAMES Imath
PATHS
${PC_OpenEXR_LIBDIR}
${PC_OpenEXR_LIBRARY_DIRS}
)
find_library(OpenEXR_ILMTHREAD_LIBRARY NAMES IlmThread
PATHS
${PC_OpenEXR_LIBDIR}
${PC_OpenEXR_LIBRARY_DIRS}
)
# This is the actual OpenEXR library
find_library(OpenEXR_ILMIMF_LIBRARY NAMES IlmImf
PATHS
${PC_OpenEXR_LIBDIR}
${PC_OpenEXR_LIBRARY_DIRS}
)
set(OpenEXR_LIBRARIES
${OpenEXR_HALF_LIBRARY}
${OpenEXR_IEX_LIBRARY}
${OpenEXR_IMATH_LIBRARY}
${OpenEXR_ILMIMF_LIBRARY}
${OpenEXR_ILMTHREAD_LIBRARY})
if (OpenEXR_INCLUDE_DIR AND EXISTS "${OpenEXR_INCLUDE_DIR}/OpenEXRConfig.h")
file(STRINGS "${OpenEXR_INCLUDE_DIR}/OpenEXRConfig.h" openexr_version_str
REGEX "^#define[\t ]+OPENEXR_VERSION_STRING[\t ]+\"[^\"]*\"")
string(REGEX REPLACE "^#define[\t ]+OPENEXR_VERSION_STRING[\t ]+\"([^\"]*).*"
"\\1" OpenEXR_VERSION_STRING "${openexr_version_str}")
unset(openexr_version_str)
endif ()
include(FindPackageHandleStandardArgs)
# find_package_handle_standard_args reports the value of the first variable
# on success, so make sure this is the actual OpenEXR library
find_package_handle_standard_args(OpenEXR
FOUND_VAR OpenEXR_FOUND
REQUIRED_VARS
OpenEXR_ILMIMF_LIBRARY
OpenEXR_HALF_LIBRARY
OpenEXR_IEX_LIBRARY
OpenEXR_IMATH_LIBRARY
OpenEXR_ILMTHREAD_LIBRARY
OpenEXR_INCLUDE_DIR
VERSION_VAR OpenEXR_VERSION_STRING)
set(OpenEXR_INCLUDE_DIRS ${OpenEXR_INCLUDE_DIR})
include(FeatureSummary)
set_package_properties(OpenEXR PROPERTIES
URL http://www.openexr.com/
DESCRIPTION "A library for reading and writing OpenEXR high dynamic-range image files")
mark_as_advanced(
OpenEXR_INCLUDE_DIR
OpenEXR_LIBRARIES
OpenEXR_DEFINITIONS
OpenEXR_ILMIMF_LIBRARY
OpenEXR_ILMTHREAD_LIBRARY
OpenEXR_IMATH_LIBRARY
OpenEXR_IEX_LIBRARY
OpenEXR_HALF_LIBRARY
)

View File

@ -1 +0,0 @@
tier: 1

Some files were not shown because too many files have changed in this diff Show More