Class: Vips::Argument::ArrayImageConst

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

Class Method Summary collapse

Class Method Details

.new(value) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/vips/argument.rb', line 62

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