Commit Graph

144 Commits

Author SHA1 Message Date
Kleis Auke Wolthuizen bd45fbd25c
Minor GIR fixes (#3261)
* Ensure GIR file is aware of `create/` sources

It was missing the comments for the `VipsTextWrap` enum.

* Avoid new lines in enum members
2023-01-04 19:05:00 +00:00
John Cupitt ef2646ef6a
add a "wrap" option to vips_text() (#3130)
see:

https://github.com/libvips/libvips/discussions/2073

https://github.com/libvips/libvips/discussions/3126
2022-11-10 15:46:46 +00:00
John Cupitt 976db37f84
Revised threading system (#3105)
* reimplement threadpool

just a set of threads that get recycled

"ninja test" passes and dzsave seems to work, though pytest fails for
some reason

* clean up threading code a bit

move base stuff into thread.c, so we have a simple

	thread -> threadset -> threadpool

layering

* start trying to revert g_threadpool

based on the original commit

* working!

nice low systime again

still need to repply cnages to threadpool.c since 80e0cc3d1

* reapply fixes from master

so threadpool.c is now up to date

* rename VipsThread as VipsWorker

a bit less confusing

* use a semaphore to count workers in a pool

* tidy up

* formatting

* dynamic threadpool sizing

based on counting the number of blocked threads in each pool

it works, but the improvement is not great :(

* add "concurrency" metadata item

so operators can hint threadpool size (dzsave especially)

* don't use thinstrip for small images

* add RGB mode to openslide

since flatten was taking 20% of CPU time for dzsave

* fix up rgb mode

now actually works

* make the tile buffer per thread

in the new openslideload rgb mode

* fix dynamic pool downsize

* mild refactoring

* fix the buffer system

oops, turned it off by mistake

* all done!

* revise changelog

* Update libvips/iofuncs/threadset.c

Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>

* Update libvips/iofuncs/threadset.c

Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>

* LSan: add libMagickCore to suppression file

* Revert "Remove mutex lock for VipsThreadStartFn"

This reverts commit 41440491.

* add VIPS_MAX_THREADS

to set a hard limit on the threadset size

* Revert "Revert "Remove mutex lock for VipsThreadStartFn""

This reverts commit 77e8520966ba79194fff3b4e648bbd295cd5c260.

* remove sslock from sink.c

* move fixed threadpool build to init

not first use

* add some doc comments

* revert test suite threshold change

* add a test for MAX_THREADS

and move the test tmp/ area into the builddir

* limit VIPS_MAX_THREADS to sane values

* use tabs rather than spaces

Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
2022-10-26 15:25:19 +01:00
John Cupitt 1f8e547d99 Merge branch '8.13' 2022-09-21 19:09:44 +01:00
Kleis Auke Wolthuizen e88e5f0d2a
text: simplify check for 32k pixel limit (#3057) 2022-09-21 19:06:49 +01:00
John Cupitt 538aa2a841
remove autotools (#2941)
* remove autotools

It seems to all work. I tested with gtk-doc enabled. I probably missed a
few things argh.

* oop, forgot m4/
2022-07-24 11:14:52 +01:00
John Cupitt d9f31be67d configure should add meson files to make dist
add meson.build etc. to EXTRA_DIST

see https://github.com/libvips/libvips/issues/2876
2022-06-20 15:04:33 +01:00
Kleis Auke Wolthuizen bae0342d95
Update C++ binding and function list (#2851)
* Update C++ binding and function list

Also, start with a capital letter in descriptions whenever possible.

* Ensure `dzsave_target` is generated
2022-06-10 14:43:44 +01:00
Kleis Auke Wolthuizen 45a99238e2
text: use MT-safe `pango_cairo_font_map_get_default` (#2848)
* text: use MT-safe `pango_cairo_font_map_get_default`

* Increase minimum Pango version to v1.32.6 (released Jan 2013)
2022-06-08 16:06:45 +01:00
Kleis Auke Wolthuizen 5106e9b49e
text: ensure fontconfig cache of Pango is invalidated (#2847)
See: https://gitlab.gnome.org/GNOME/pango/-/issues/551
2022-06-08 15:20:19 +01:00
Kleis Auke Wolthuizen 07edfe37b1
Improve symbol visibility (#2688)
* Improve symbol visibility

* Decorate required internal symbols with VIPS_API

* Remove a couple of stray header decls

* Incorporate review comment

- Ensure symbol visibility is also set on static libraries.
- Prefer to use `cc.has_function_attribute('visibility:hidden')`.

* Don't export internal deprecated symbols

* Move deprecated symbols to vips7compat.h

* `IM_FORMAT_H` -> `VIPS_FORMAT_H`

* Move `vips_window_ref` compat stub to `vips7compat.c`

* Disable deprecation warnings internally

* `vips_image_get_kill` -> `vips_image_iskilled`

* Ensure API compatibility

* Add missing include directives

* Move `vips__init` decl to vips7compat

* Move `vips__get_sizeof_vipsobject` to vips7compat

* Fix introspection build

* Fix 2 introspection warnings

* Ensure compatibility with vipsdisp

/usr/bin/ld: tilesource.o: in function `tile_source_new_from_source':
vipsdisp/tilesource.c:1627: undefined reference to `vips__region_no_ownership'
2022-04-16 10:58:55 +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
Corentin Noël 02901436d4
Add meson build system (#2637)
Allows to use the Meson build system to build the project.
2022-02-08 15:19:36 +00:00
John Cupitt e412d5bdf0 fix copy/paste error in description 2021-11-01 15:45:03 +00:00
John Cupitt d21ee5aa2b remove double space 2021-07-19 07:51:44 +01:00
John Cupitt 2cebec9a80 stop text output getting too large
see https://github.com/libvips/libvips/issues/2300
2021-07-18 18:53:47 +01:00
John Cupitt 757d031005 always check the return of vips_image_pipeline()
For consistency. Although I don't think it can meaningfully fail.
2021-06-29 16:12:17 +01:00
John Cupitt 98d35dda28 vips_text() was missing a couple of unlocks 2021-05-25 14:07:28 +01:00
John Cupitt ee2255da00 only warn if fontfile load fails
since it can fail for things like adding the same font twice from
different files

thanks molfar

see https://github.com/libvips/libvips/issues/2220
2021-04-22 15:27:18 +01:00
Kleis Auke Wolthuizen 4af8b9b265 Add fontconfig as dependency
pangocairo does not list fontconfig as a dependency.
2021-04-21 14:20:51 +02:00
John Cupitt 31fe274626 fix mono rendering
always render RGBA, then in mono mode just use the alpha
2021-04-12 17:29:54 +01:00
John Cupitt 985a3e2282 reenable fontfile 2021-04-12 15:46:56 +01:00
John Cupitt f53959b824 switch font rendering to pangocairo
to make colour font rendering work
2021-04-12 15:11:18 +01:00
John Cupitt 8412b8233c start adding colour text rendering
try eg.

	vips text x.png 😀 --rgba --dpi 300

But it's not working :( need to tyweak something else?
2021-04-12 10:59:50 +01:00
John Cupitt 2772ecbb9e add "seed" param to perlin, worley and gaussnoise
see https://github.com/libvips/libvips/issues/1884
2020-11-16 09:14:06 +00:00
Kleis Auke Wolthuizen 6155b6d093 Fix test failure on ARM-based Windows
The optional parameters of vips_gaussnoise were incorrectly
passed within vips_fractsurf. This was discovered when running
the libvips testsuite on Windows 10 IoT (ARM32).
2020-09-25 12:52:31 +02:00
John Cupitt 285ab2e6cc better mask sizing for gaussmat
We were calculating the mask size incorrectly for small masks.

Thanks johntrunc

see https://github.com/libvips/libvips/issues/1793
2020-08-31 13:37:08 +01:00
John Cupitt e7988f88ac move matrixinvert init to mosaicing
and regen potfiles
2020-06-28 14:01:43 +01:00
John Cupitt 5540fa97f4 small cleanups for disable deprecated
- move matrixinvert to mosaicing, fix a leak
- add note to changelog
- small fixes

see https://github.com/libvips/libvips/pull/1593
2020-06-28 12:14:13 +01:00
Kleis Auke Wolthuizen 45f9999e7e Add vips_matrixinvert for inverting matrices
From im_matinv
2020-06-18 14:34:43 +02:00
John Cupitt 951540f4fe revise text docs
To clarify the meaning of VipsAlign in this context.

See https://github.com/libvips/libvips/issues/1654#issuecomment-629671463
2020-05-16 17:57:31 +01:00
John Cupitt 63649629e0 fix doc error
Hopefully clearer, see https://github.com/libvips/libvips/issues/1654
2020-05-16 12:37:20 +01:00
John Cupitt 9cdbf3ee07 don't add fontfiles repeatedly in text
It seems fontconfig will let you add a file repeatedly. This patch adds a
table which is used to block repeated additions and prevents memory growth
and slowdown.

see https://github.com/libvips/libvips/issues/1655
2020-05-16 12:28:12 +01:00
John Cupitt c84a43f277 fix memleak in vips_text()
We were not unreffing PangoLayout. Thank you uint128!

See https://github.com/libvips/libvips/issues/1508
2019-12-21 12:56:09 +00:00
John Cupitt a50405c1f7 fix some run-time errors from clang
Travis is now running with some amount of run-time checking enabled and
it spotted a couple of harmless things.
2019-12-05 14:14:27 +00:00
John Cupitt f01023e222 fix a compiler warning
gcc could warn (incorrectly) about used before set in text.c
2019-09-17 13:32:37 +01:00
John Cupitt 01a92679b5 oop left some DEBUG turned on 2019-06-27 17:34:07 +01:00
John Cupitt 80648c2d2f text autofit could sometimes underfit
The autofit loop would terminate if either width or height fitted exactly,
but this could happen very early by chance. This patch makes it keep
looping until it finds a dpi which just fits.

See https://github.com/libvips/libvips/issues/1352
2019-06-27 17:19:53 +01:00
John Cupitt da15285bf9 add support for justified text
And set xoffset/yoffset to the top line of text output.

https://github.com/libvips/libvips/issues/1258
2019-03-16 11:53:09 +00:00
John Cupitt 65a259a025 prevent /0 in freq mask for very small masks
see https://github.com/libvips/libvips/issues/1236
2019-02-20 15:15:50 +00:00
John Cupitt 2fb81b8ed6 prevent /0 in eye for width/height 1
see https://github.com/libvips/libvips/issues/1236
2019-02-20 15:00:00 +00:00
John Cupitt 2835948070 fix typo in docs 2019-01-25 05:04:24 +00:00
John Cupitt 0d5eced964 break on dpi too high as well 2018-12-07 13:09:22 +00:00
John Cupitt da31d0f31a fix autofit loop on non-scaleable fonts
see https://github.com/libvips/libvips/issues/1178
2018-12-07 12:57:44 +00:00
John Cupitt ac4897abee Fix up vips_text()
Fixes two issues:

1. vips_text() in autofit mode could set the wrong DPI, since it set the
DPI in its own copy of the variable, but did not do a final update on
the DPI setting that FT uses for rendering.

2. vips_text() in autofit mode allocated a new context each time, rather
than reusing the context for that call. This caused a small memory leak.

See https://github.com/libvips/libvips/issues/1174
2018-12-05 14:24:26 +00:00
Angel Sánchez 256cf494a3 use VIPS_PI instead of M_PI as the former is already defined, added missing includes with their macro protection 2018-05-31 13:50:50 +02:00
John Cupitt 4d683559aa add a fontfile option to text
use @fontfile to give a font to load ... note that this just loads the
font, you'll need to set it with @font as well

see https://github.com/jcupitt/libvips/issues/950
2018-04-26 21:03:40 +01:00
John Cupitt aebb8af803 create funcs always make MULTIBAND
Before, they could make B_W for one-band output. This caused problems
with (for example) two black image bandjoined: the second band then
looked like an alpha to hasalpha() and enabled premultiply/unpremultiply
for operations like affine.

Now, it's always MULTIBAND. This is the generic multiband image type, so
you don't get any unexpected alpha handling.
2018-04-04 09:22:57 +01:00
John Cupitt 754a1e5419 Merge branch 'master' into add-canny 2018-03-14 14:18:39 +00:00
John Cupitt 878c77a035 better handling of some fonts
fonts with very large overlapping edges copuld clip in `text`, see
https://stackoverflow.com/a/49169747/894763
2018-03-12 18:11:25 +00:00