Class: Writexlsx::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/write_xlsx/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(row, col, image, x_offset, y_offset, x_scale, y_scale, url, tip, anchor, description, decorative) ⇒ Image

Returns a new instance of Image.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/write_xlsx/image.rb', line 11

def initialize(
      row, col, image, x_offset, y_offset, x_scale, y_scale,
      url, tip, anchor, description, decorative
    )
  @row         = row
  @col         = col
  @image       = ImageProperty.new(image)
  @x_offset    = x_offset
  @y_offset    = y_offset
  @x_scale     = x_scale
  @y_scale     = y_scale
  @url         = url
  @tip         = tip
  @anchor      = anchor
  @description = description
  @decorative  = decorative
end

Instance Attribute Details

#anchorObject (readonly)

Returns the value of attribute anchor.



9
10
11
# File 'lib/write_xlsx/image.rb', line 9

def anchor
  @anchor
end

#colObject (readonly)

Returns the value of attribute col.



8
9
10
# File 'lib/write_xlsx/image.rb', line 8

def col
  @col
end

#decorativeObject (readonly)

Returns the value of attribute decorative.



9
10
11
# File 'lib/write_xlsx/image.rb', line 9

def decorative
  @decorative
end

#descriptionObject (readonly)

Returns the value of attribute description.



9
10
11
# File 'lib/write_xlsx/image.rb', line 9

def description
  @description
end

#rowObject (readonly)

Returns the value of attribute row.



8
9
10
# File 'lib/write_xlsx/image.rb', line 8

def row
  @row
end

#tipObject (readonly)

Returns the value of attribute tip.



9
10
11
# File 'lib/write_xlsx/image.rb', line 9

def tip
  @tip
end

#urlObject (readonly)

Returns the value of attribute url.



9
10
11
# File 'lib/write_xlsx/image.rb', line 9

def url
  @url
end

#x_offsetObject (readonly)

Returns the value of attribute x_offset.



8
9
10
# File 'lib/write_xlsx/image.rb', line 8

def x_offset
  @x_offset
end

#x_scaleObject (readonly)

Returns the value of attribute x_scale.



8
9
10
# File 'lib/write_xlsx/image.rb', line 8

def x_scale
  @x_scale
end

#y_offsetObject (readonly)

Returns the value of attribute y_offset.



8
9
10
# File 'lib/write_xlsx/image.rb', line 8

def y_offset
  @y_offset
end

#y_scaleObject (readonly)

Returns the value of attribute y_scale.



8
9
10
# File 'lib/write_xlsx/image.rb', line 8

def y_scale
  @y_scale
end

Instance Method Details

#filenameObject



77
78
79
# File 'lib/write_xlsx/image.rb', line 77

def filename
  @image.filename
end

#heightObject



57
58
59
# File 'lib/write_xlsx/image.rb', line 57

def height
  @image.height
end

#height_emusObject



41
42
43
# File 'lib/write_xlsx/image.rb', line 41

def height_emus
  (0.5 + (scaled_height * 9_525)).to_i
end

#imageObject



45
46
47
# File 'lib/write_xlsx/image.rb', line 45

def image
  @image.filename
end

#md5Object



73
74
75
# File 'lib/write_xlsx/image.rb', line 73

def md5
  @image.md5
end

#nameObject



61
62
63
# File 'lib/write_xlsx/image.rb', line 61

def name
  @image.name
end

#positionObject



81
82
83
# File 'lib/write_xlsx/image.rb', line 81

def position
  @image.position
end

#ref_idObject



85
86
87
# File 'lib/write_xlsx/image.rb', line 85

def ref_id
  @image.ref_id
end

#scaled_heightObject



33
34
35
# File 'lib/write_xlsx/image.rb', line 33

def scaled_height
  height * y_scale * 96.0 / y_dpi
end

#scaled_widthObject



29
30
31
# File 'lib/write_xlsx/image.rb', line 29

def scaled_width
  width * x_scale * 96.0 / x_dpi
end

#typeObject



49
50
51
# File 'lib/write_xlsx/image.rb', line 49

def type
  @image.type
end

#widthObject



53
54
55
# File 'lib/write_xlsx/image.rb', line 53

def width
  @image.width
end

#width_emusObject



37
38
39
# File 'lib/write_xlsx/image.rb', line 37

def width_emus
  (0.5 + (scaled_width * 9_525)).to_i
end

#x_dpiObject



65
66
67
# File 'lib/write_xlsx/image.rb', line 65

def x_dpi
  @image.x_dpi
end

#y_dpiObject



69
70
71
# File 'lib/write_xlsx/image.rb', line 69

def y_dpi
  @image.y_dpi
end