Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
Notes on progress and streams.
  • Loading branch information
jcupitt committed Dec 5, 2019
1 parent ec8dc51 commit 6dad4f1
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ On Windows, you'll need to set the `RUBY_DLL_PATH` environment variable to
point to the libvips bin directory.

Take a look in `examples/`. There is [full API
documentation](http://www.rubydoc.info/gems/ruby-vips).
documentation](http://www.rubydoc.info/gems/ruby-vips). The [`Vips` section
has an introduction with
examples](https://www.rubydoc.info/gems/ruby-vips/Vips).

# Example

Expand Down
43 changes: 40 additions & 3 deletions lib/vips.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ module GObject
require 'vips/gvalue'

# This module provides a binding for the [libvips image processing
# library](https://jcupitt.github.io/libvips/).
# library](https://libvips.github.io/libvips/).
#
# # Example
#
Expand Down Expand Up @@ -404,12 +404,12 @@ module GObject
# # Automatic YARD documentation
#
# The bulk of these API docs are generated automatically by
# {Vips::generate_yard}. It examines
# {Vips::Yard::generate}. It examines
# libvips and writes a summary of each operation and the arguments and options
# that that operation expects.
#
# Use the [C API
# docs](https://jcupitt.github.io/libvips/API/current)
# docs](https://libvips.github.io/libvips/API/current)
# for more detail.
#
# # Enums
Expand All @@ -434,6 +434,43 @@ module GObject
# If you want to avoid the copies, you'll need to call drawing operations
# yourself.
#
# # Progress
#
# You can attach signal handlers to images to watch computation progress. For
# example:
#
# ```ruby
# image = Vips::Image.black 1, 100000
# image.set_progress true
#
# def progress_to_s(name, progress)
# puts "#{name}:"
# puts " run = #{progress[:run]}"
# puts " eta = #{progress[:eta]}"
# puts " tpels = #{progress[:tpels]}"
# puts " npels = #{progress[:npels]}"
# puts " percent = #{progress[:percent]}"
# end
#
# image.signal_connect :preeval do |progress|
# progress_to_s("preeval", progress)
# end
#
# image.signal_connect :eval do |progress|
# progress_to_s("eval", progress)
# image.set_kill(true) if progress[:percent] > 50
# end
#
# image.signal_connect :posteval do |progress|
# progress_to_s("posteval", progress)
# end
#
# image.avg
# ```
#
# The `:eval` signal will fire for every tile that is processed. You can stop
# progress with Image#set_kill and processing will end with an exception.
#
# # Overloads
#
# The wrapper defines the usual set of arithmetic, boolean and relational
Expand Down

0 comments on commit 6dad4f1

Please sign in to comment.