Adjust to final animated GIF interface

This commit is contained in:
Tom Hughes 2019-05-13 20:17:01 +01:00
parent b88b699f49
commit a6ea75a2e2
3 changed files with 12 additions and 19 deletions

View file

@ -117,7 +117,7 @@ gem "canonical-rails"
gem "logstasher"
# Used to generate images for traces
gem "gd2-ffij", :git => "https://github.com/mmd-osm/gd2-ffij.git", :branch => "animated_gif"
gem "gd2-ffij", "= 0.4.0.dev"
# Used for browser detection
gem "browser"

View file

@ -1,11 +1,3 @@
GIT
remote: https://github.com/mmd-osm/gd2-ffij.git
revision: c92057a8f699a36b5f6d208db3d11eb3bae185dd
branch: animated_gif
specs:
gd2-ffij (0.3.1)
ffi (>= 1.0.0)
GEM
remote: https://rubygems.org/
specs:
@ -181,6 +173,8 @@ GEM
multipart-post (>= 1.2, < 3)
ffi (1.10.0)
fspath (3.1.0)
gd2-ffij (0.4.0.dev)
ffi (>= 1.0.0)
geoip (1.6.4)
globalid (0.4.2)
activesupport (>= 4.2.0)
@ -468,7 +462,7 @@ DEPENDENCIES
factory_bot_rails
fakefs
faraday
gd2-ffij!
gd2-ffij (= 0.4.0.dev)
geoip
htmlentities
http_accept_language (~> 2.0.0)
@ -518,4 +512,4 @@ DEPENDENCIES
webmock
BUNDLED WITH
1.16.6
1.17.2

View file

@ -100,16 +100,15 @@ module GPX
end
end
res = GD2::AnimatedGif.gif_anim_begin(frames[0])
res << GD2::AnimatedGif.gif_anim_add(frames[0], nil, delay)
(1...nframes).each do |n|
res << GD2::AnimatedGif.gif_anim_add(frames[n],
(frames[n] == frames[n - 1] ? nil : frames[n - 1]),
delay)
image = GD2::AnimatedGif.new
frames.each do |frame|
image.add(frame, :delay => delay)
end
res << GD2::AnimatedGif.gif_anim_end
image.end
res
output = StringIO.new
image.export(output)
output.read
end
def icon(min_lat, min_lon, max_lat, max_lon)