Commit Graph

57 Commits

Author SHA1 Message Date
Lovell Fuller 3ca21ee2e8 Increase minimum glib-2.0 dependency to v2.15 (released March 2012) 2020-03-26 19:13:21 +00:00
John Cupitt d4f12a9999 move VipsGInputStream to public API
Since we will need it for pdfload as well.
2020-03-11 17:17:45 +00:00
John Cupitt 6605029bc3 revise svg detection
We weren't checking svgz files as far in.
2020-01-15 09:01:38 +00:00
John Cupitt 252996e3ff make check passes after stream -> source rename 2019-12-30 12:48:20 +00:00
John Cupitt 4c5873809f experiment with renaming stream
rename as VipsConnection, VipsSource, VipsTarget etc.

see https://github.com/libvips/libvips/issues/1494#issuecomment-569498619

renamed with this script:

```

set -e

edit() {
        sed -i -E "$1" rename
}

for i in $*; do
        cp $i rename

        edit s/VIPS_STREAMOU/VIPS_TARGET_CUSTOM/g
        edit s/VIPS_STREAMO/VIPS_TARGET/g
        edit s/VIPS_STREAMIU/VIPS_SOURCE_CUSTOM/g
        edit s/VIPS_STREAMI/VIPS_SOURCE/g
        edit s/VIPS_STREAM/VIPS_CONNECTION/g

        edit s/vips_streamou/vips_target_custom/g
        edit s/vips_streamo/vips_target/g
        edit s/vips_streamiu/vips_source_custom/g
        edit s/vips_streami/vips_source/g
        edit s/vips_stream/vips_connection/g

        edit s/VipsStreamou/VipsTargetCustom/g
        edit s/VipsStreamo/VipsTarget/g
        edit s/VipsStreamiu/VipsSourceCustom/g
        edit s/VipsStreami/VipsSource/g
        edit s/VipsStream/VipsConnection/g

        # eg. VIPS_TYPE_STREAM or VIPS_IS_STREAM
        edit "s/VIPS_([A-Z]+)_STREAMOU/VIPS_\1_TARGET_CUSTOM/g"
        edit "s/VIPS_([A-Z]+)_STREAMO/VIPS_\1_TARGET/g"
        edit "s/VIPS_([A-Z]+)_STREAMIU/VIPS_\1_SOURCE_CUSTOM/g"
        edit "s/VIPS_([A-Z]+)_STREAMI/VIPS_\1_SOURCE/g"
        edit "s/VIPS_([A-Z]+)_STREAM/VIPS_\1_CONNECTION/g"

        edit s/streamou/target_custom/g
        edit s/streamo/target/g
        edit s/streamiu/source_custom/g
        edit s/streami/source/g

        # various identifiers which also change
        edit s/is_a_stream/is_a_source/g
        edit s/find_load_stream/find_load_source/g
        edit s/find_save_stream/find_save_target/g
        edit s/new_from_stream/new_from_source/g
        edit s/write_to_stream/write_to_target/g
        edit s/vips_thumbnail_stream/vips_thumbnail_source/g

        # eg. vips_webpload_stream
        edit "s/vips_([a-z]+)load_stream/vips_\1load_source/g"

        # eg. vips_webpsave_stream
        edit "s/vips_([a-z]+)save_stream/vips_\1save_target/g"

        mv rename $i
done
```
2019-12-29 21:40:21 +00:00
John Cupitt 561f410f0a rework pngload
To match the new radload pattern.
2019-12-24 07:55:06 +00:00
John Cupitt 861f6d1ef4 radload was not setting priority correctly
We used to have separate subclasses for file, buffer and stream load,
but only set ->priority in one of them.

Rework radload as a base class plus a set of implementations.
2019-12-23 17:22:15 +00:00
John Cupitt 74ac881938 Merge branch 'master' into add-stream-object 2019-11-20 16:56:19 +00:00
John Cupitt b686110496 tiny formatting fix 2019-11-20 15:53:04 +00:00
John Cupitt 9a193f6f4c test for gio
It seems glib added gio in 2.15, though I don't know if svgload will
actually work with a glib that old.
2019-11-19 17:05:12 +00:00
John Cupitt a129cef9dd add streamo_steal
and start converting some old dbuf code
2019-11-19 06:47:24 +00:00
John Cupitt c7f622d646 try simplifying vips_g_input_stream_skip()
Just does a `SEEK_CUR` now.
2019-11-18 15:28:14 +00:00
John Cupitt 73dd7eebe5 move streamiw inside svgload
since that's the only place it is used
2019-11-18 15:07:37 +00:00
John Cupitt f5a4f41edf rename VipsStream* variables
The convention is now:

	VipStreami *streami;

We had `input` in many places, a left-over from the old VipStreamInput
name.
2019-11-11 09:09:34 +00:00
John Cupitt 998b5eea45 fix svgload sniff
by adding vips_streami_sniff_at_most()
2019-11-11 07:53:36 +00:00
John Cupitt 441f61f3ff svgload from a stream 2019-11-10 17:23:28 +00:00
Kleis Auke Wolthuizen 41c08b0ffb Add svgload_stream to the descriptors test
Seems to work!
2019-11-10 12:32:18 +01:00
Kleis Auke Wolthuizen 609fdb4fb6 WiP: Add svgload_stream
TODO: Should we `#ifdef HAVE_RSVG` the VipsStreamiw class?
2019-11-09 18:19:54 +01:00
Lovell Fuller 894ec7db84 Ensure SVG dimensions are rounded correctly
when scaling or setting density via cairo
2019-11-01 18:26:53 +00:00
John Cupitt e505d56079 experiment with svgload as a sequential loader
see https://github.com/libvips/libvips/issues/1425
2019-09-11 16:58:20 +01:00
John Cupitt 55e49831b8 add "unlimited" to svgload
By default librsvg blocks SVGs > 10MB for security. This patch adds an
"unlimited" flag to remove this check.

We have to switch to using gio to get the librsvg API for this This
needs testing on the platforms we support.

We'll also need to bump the min version of librsvg we require in
configure.ac.

See https://github.com/libvips/libvips/issues/1354
2019-06-28 13:48:18 +01:00
John Cupitt 90ca1d8038 tiny format polish 2019-02-27 18:23:11 +00:00
John Cupitt e106e1d100 add n/page params to webpload
and renumber all optional load args
2018-11-01 20:43:07 +00:00
John Cupitt 495e0b2d14 bump svg header size to 1000 bytes
see https://github.com/jcupitt/libvips/pull/543
2018-06-06 08:17:08 +01:00
John Cupitt be4803677d limit memory use on svg load
keep the max memuse down a bit, see https://github.com/jcupitt/libvips/pull/969
2018-05-10 10:50:18 +01:00
Lovell Fuller 76bc64ca3c Reduce SVG re-renders with larger cache tiles 2018-05-09 20:20:01 +01:00
John Cupitt 5176b4a17e better header sniffing for small files
vips__get_bytes() used to fail if the file was too small for the
allocated buffer, which was a problem for svg, since files can be extremely
small.

This change makes vips__get_bytes() return the number of bytes read, so
the is_a testers can work on files smaller than the max header size.
2018-03-22 12:08:39 +00:00
John Cupitt 5a1ab5968b move svg_ia_a into the base class
feels a bit more logical
2018-03-22 10:43:01 +00:00
Lovell Fuller 63cab9bc62 Add is_a support to SVG file class loader 2018-03-21 16:55:55 +00:00
Alistair Thomas 0506c49444 Update GObject introspection annotations for libvips/foreign directory 2017-09-26 23:39:06 +01:00
John Cupitt b2f66a3968 add note on svgload improvement 2017-09-17 05:20:48 +01:00
John Cupitt 99053d41cb Merge pull request #724 from lovell/svg-scale
Correct scaling of SVG input without width and height attributes
2017-09-17 05:12:44 +01:00
John Cupitt 6641773719 note change in svgload header 2017-09-09 12:28:27 +01:00
John Cupitt 592710dd6d limit tile width for svgload
librsvg starts to fail if any single tiles has an axis over 32767
pixels. Break up very wide images to fix this.

See:

https://github.com/jcupitt/libvips/issues/732
2017-09-09 12:23:11 +01:00
Lovell Fuller 980095a8cc Scale SVG without width/height attrs using cairo 2017-09-03 20:11:16 +01:00
John Cupitt 060bdd2cf0 fix svgload resolution again
use rsvg_handle_set_dpi() rather than cairo_scale() to avoid int
truncation on dimensions

see https://github.com/jcupitt/libvips/issues/688
2017-07-08 16:03:56 +01:00
John Cupitt 64fe910fc5 fix DPI mixup
librsvg defaulted to 90 DPI, but libvips to 72 DPI -- add a correction
factor

thanks Fosk!

see https://github.com/jcupitt/libvips/issues/688
2017-07-08 12:31:36 +01:00
John Cupitt 79c21dfcf8 seems to be done! 2017-01-18 14:39:27 +00:00
John Cupitt 0518e290f6 bump svg header test to first 300 bytes
to allow for longer comment lines
2016-10-20 09:31:35 +01:00
Lovell Fuller de6a415832 Increase SVG buffer check length by 50 bytes
Provides support for files exported by Illustrator
2016-10-19 21:40:25 +01:00
John Cupitt e439c5f78f add .svg.gz suffix
allow .x.y suffixes
2016-08-01 14:57:33 +01:00
John Cupitt b0e3035590 small cleanups to svgz support 2016-08-01 14:28:35 +01:00
Felix Bünemann 5ab0001ec6 Add configure check for zlib with inflateInit2
and replace old unused and poorly named FIND_ZIP. The new code prefers
pkgconfig and only falls back to manual detection if needed.

This also prioritizes detected zlib flags and includes to be preferred
over the ones that are added by pkgconfig for libpng, tifflib etc. which
would otherwise have caused the system default zlib to be used.
2016-06-27 03:03:45 +02:00
Felix Bünemann 14953c19e7 Add support for .svgz files to svgload 2016-06-27 01:54:53 +02:00
John Cupitt 916e5b5589 set filename on file read for more types
the new loaders were missing the line to set the output filename, so
`vipsheader fred.pdf` was not displaying the filename correctly
2016-06-01 09:14:01 +01:00
John Cupitt 50468a07a2 clean up foreign
various cosmetic changes:

- pngsave_buffer now uses Write, not WriteBuf, same change for
  radsave_buffer

- move C wrappers out to class defs from foreign.c

- use g_free() not vips_free() for buffer free from low-level savers

- fix var names in some comments

- various style changes for radiance.c
2016-05-24 10:57:02 +01:00
Felix Bünemann 6418ab2307 Extract shared pdfload/svgload code into cairo.c 2016-05-09 00:16:48 +02:00
John Cupitt ddd7ab7459 doc fixups 2016-03-25 10:56:59 +00:00
John Cupitt bd985731eb unpremultiply svgload / pdfload
cairo uses premultipled ARGB, we need to undo this for transparency to
work correctly
2016-02-11 09:06:09 +00:00
John Cupitt 9f2da7d0ee small fixes
use 255 for PDF background
2016-02-10 15:19:00 +00:00