Class: Pageflow::LinkmapPage::ColorMapFile

Inherits:
GeneratedImageFile show all
Defined in:
app/models/pageflow/linkmap_page/color_map_file.rb

Constant Summary collapse

SOURCE_FILE_OPTIONS =

Prevent anti aliasing. Otherwise, when processing color map images, borders between areas are blurred.

'-filter point'.freeze
PALETTE_PATH =
Pageflow::LinkmapPage::Engine.root
.join('lib', 'pageflow', 'linkmap_page', 'images', 'palette.png').freeze
CONVERT_OPTIONS =
[
  '-quality 70',
  '-interlace Plane',
  '-dither None',
  '-colors 64',
  "-remap #{PALETTE_PATH}",
].join(' ').freeze

Constants inherited from GeneratedImageFile

GeneratedImageFile::GEOMETRY

Instance Method Summary collapse

Methods inherited from GeneratedImageFile

#failed?, #prerequisite_files, #publish!, #ready?, #retry!, #retryable?

Instance Method Details

#bounding_box_for_color(color) ⇒ Object



79
80
81
# File 'app/models/pageflow/linkmap_page/color_map_file.rb', line 79

def bounding_box_for_color(color)
  attachment_colors[color]
end

#heightObject



63
64
65
# File 'app/models/pageflow/linkmap_page/color_map_file.rb', line 63

def height
  attachment_height
end

#present_colorsObject



75
76
77
# File 'app/models/pageflow/linkmap_page/color_map_file.rb', line 75

def present_colors
  attachment_colors ? attachment_colors.keys : []
end

#processed_attachmentObject



71
72
73
# File 'app/models/pageflow/linkmap_page/color_map_file.rb', line 71

def processed_attachment
  attachment.styles[:remapped]
end

#sprite_urlObject



55
56
57
# File 'app/models/pageflow/linkmap_page/color_map_file.rb', line 55

def sprite_url
  attachment.url(:sprite)
end

#urlObject



67
68
69
# File 'app/models/pageflow/linkmap_page/color_map_file.rb', line 67

def url
  attachment.url(:remapped)
end

#widthObject



59
60
61
# File 'app/models/pageflow/linkmap_page/color_map_file.rb', line 59

def width
  attachment_width
end