Commit Graph

28 Commits

Author SHA1 Message Date
John Cupitt d27dfbe55d revise help text for loaders
Hopefully to make it clearer and more consistent.

See https://github.com/libvips/libvips/discussions/2982
2022-08-10 12:50:53 +01:00
Kleis Auke Wolthuizen 1214f942f9
Prefer to use `flags |=` everywhere (#2854)
Use the bitwise OR assignment operator to ensure that derived
classes does not overwrite the flags from the base class. Also,
move the flags from `openslideload_source` to its base class.
2022-06-11 15:40:39 +01:00
Kleis Auke Wolthuizen 0337c09700
Cleanup gettext handling (#2695)
Use GLib's i18n support instead of copying and pasting that
logic into its own header. This deprecates the vips/intl.h
header in favour of glib/gi18n.h.
2022-02-27 15:27:28 +00:00
John Cupitt cb58d7d960 _source loaders should all be nocache
When we image_new_from_source, the source object has some of the loader
state: it tracks the current read position of the load library. This
means that we mustn't keep source loaders in the operation cache, since
a second call could give a different result because the source object
read position might have changed.

Also: add a rewind to get_flags_source in spngload, and jp2k needs to
tag its load region as having no thread ownership or you'll get assert
fails in the test suite with debug enabled.
2021-11-19 13:55:49 +00:00
John Cupitt 1f321d366b disable webp shrink-on-load if it will judder
Webp decode can only shrink-on-load to int boundaries. This means that frames
in an animation which only update part of the canvas can get displaced by
up to 0.5 pixels, causing juddering.

see https://github.com/libvips/libvips/issues/2379
2021-10-27 13:25:04 +01:00
John Cupitt b2527da531
allow utf-8 header for svg detection (#2481)
* allow utf-8 header for svg detection

We were checking that the first 24 chars of an SVG were plain ASCII,
but that's not always the case, for example:

	<svg id="レイヤー_1のコピー"
		data-name="レイヤー 1のコピー"
		xmlns="http://www.w3.org/2000/svg"
		viewBox="0 0 100 100">
	</svg>

We now test for the string "<svg" being in the first 1000 bytes, and
everything up to that being valid utf-8.

See https://github.com/libvips/libvips/issues/2438

* raise priority of webpload

it was very low priority before, for some reason
2021-10-15 13:21:50 +01:00
John Cupitt 63d54e5df2 final code cleanups after stream -> source rename 2019-12-30 14:23:51 +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 f2f2ab200d revise webpload for improved loader pattern 2019-12-24 13:49:53 +00:00
John Cupitt 562da3e5ab rename new_from_filename as new_from_file
So VipsStreami matches VipsImage. Same for new_to_filename.
2019-11-22 17:13:20 +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 8eeb415b09 Merge branch 'master' into add-stream-object 2019-10-28 05:10:11 +00:00
John Cupitt ee3270f8e9 more refactoring 2019-10-22 11:08:54 +01:00
John Cupitt 98410042ac add webpload stream
webp uses the new VipsStreamInput mmap interface
2019-10-15 15:46:37 +01:00
John Cupitt 394f9baa5e deprecate webpload @shrink, use @scale instead
We need a fractional scale for thumbnail on webp to work well. @shrink
still works, but @scale overrides it.
2019-04-30 18:29:16 +01:00
John Cupitt e106e1d100 add n/page params to webpload
and renumber all optional load args
2018-11-01 20:43:07 +00:00
Alistair Thomas 0506c49444 Update GObject introspection annotations for libvips/foreign directory 2017-09-26 23:39:06 +01:00
John Cupitt d5934d606a polishing 2016-11-08 14:42:54 +00:00
John Cupitt c90b8be0b8 add tiffsave_buffer
add tests

also some cleanups to foreign include files

see https://github.com/jcupitt/libvips/issues/417
2016-10-15 12:29:14 +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
John Cupitt 19a838470b add webp shrink-on-load
and vipsthumbnail knows about it too

see https://github.com/jcupitt/libvips/issues/398
2016-02-28 14:36:21 +00:00
John Cupitt 6ca9a907b8 reorder load tests
and a slight memory saving on ifthenelse
2016-01-13 20:32:23 +00:00
John Cupitt c85dd26627 oops, better filename set on foreign load
we were setting the filename in the wrong place
2014-06-10 13:46:05 +01:00
John Cupitt d0f50febbb added vips_foreign_load_buffer() 2014-04-22 16:27:43 +01:00
John Cupitt dd835bdac9 fix webp load from buffer
was broken horribly, see

fa8b7e66ca
2014-02-24 09:46:52 +00:00
John Cupitt d029461bc0 redo im_tone_build*() as classes
start vips_hist_percent() as well
2013-09-20 14:33:34 +01:00
John Cupitt e9afbe59e2 added webpsave boilerplate 2013-08-06 16:18:30 +01:00
John Cupitt 1af06d5ac9 boilerplate for webp read 2013-08-06 10:01:50 +01:00