Class: Vips::Argument::ArrayImageConst

Inherits:
Vips::ArrayImage
  • Object
show all
Defined in:
lib/vips8/argument.rb

Overview

:nodoc:

Class Method Summary (collapse)

Class Method Details

+ (Object) new(value)



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vips8/argument.rb', line 44

def self.new(value)
    if not value.is_a? Array
        value = [value]
    end

    match_image = value.find {|x| x.is_a? Vips::Image}
    if match_image == nil
        raise Vips::Error, 
            "Argument must contain at least one image."
    end

    value = value.map {|x| Argument::imageize match_image, x}

    # we'd like to just 
    #   super(value)
    # to construct, but the gobject-introspection gem does not
    # support new from object array ... instead, we build in stages
    array = Vips::ArrayImage.empty
    value.each {|x| array = array.append(x)}

    return array
end