Class: VIPS::Reader

Inherits:
Object
  • Object
show all
Includes:
Header
Defined in:
lib/vips/reader.rb,
ext/reader.c

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Header

#band_fmt, #bands, #exif, #exif?, #get, #icc, #icc?, #n_elements, #set, #sizeof_element, #sizeof_line, #sizeof_pel, #x_offset, #x_res, #y_offset, #y_res

Constructor Details

#initialize(path, options = {}) ⇒ Reader

Returns a new instance of Reader.



5
6
7
8
# File 'lib/vips/reader.rb', line 5

def initialize(path, options={})
  @path = path
  @_im = nil
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/vips/reader.rb', line 3

def path
  @path
end

Class Method Details

.recognized?(path) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


26
27
28
29
30
31
32
33
34
35
# File 'ext/reader.c', line 26

static VALUE
reader_s_recognized_p(VALUE klass, VALUE path)
{
    VipsFormatClass *fmt_class = reader_get_fmt_class(klass);

    if (fmt_class && fmt_class->is_a && fmt_class->is_a(StringValuePtr(path)))
        return Qtrue;

    return Qfalse;
}

Instance Method Details

#readObject



10
11
12
13
14
15
16
# File 'lib/vips/reader.rb', line 10

def read
  # in case the sub-class has not read it
  if not @_im 
      @_im = read_internal @path, 0
  end
  @_im
end

#x_sizeObject

support these two for compat with older ruby-vips



19
20
21
# File 'lib/vips/reader.rb', line 19

def x_size
    @_im.x_size
end

#y_sizeObject



23
24
25
# File 'lib/vips/reader.rb', line 23

def y_size
    @_im.y_size
end