Sha256: 9dc1c088ea428cc96fdcef2a8554c1de792a63235495c09a68e122362d342ce9

Contents?: true

Size: 938 Bytes

Versions: 113

Compression:

Stored size: 938 Bytes

Contents

# frozen_string_literal: true

# NOTE:
# This example displays images that can be freely downloaded from the Studio Ghibli website.

require 'glimmer-dsl-libui'
require 'chunky_png'
require 'open-uri'

include Glimmer

IMAGE_ROWS = []

50.times do |i|
  url = format('https://www.ghibli.jp/gallery/thumb-redturtle%03d.png', (i + 1))
  puts "Processing Image: #{url}"
  $stdout.flush # for Windows
  f = URI.open(url)
  canvas = ChunkyPNG::Canvas.from_io(f)
  f.close
  data = canvas.to_rgba_stream
  width = canvas.width
  height = canvas.height
  img = image {
    image_part(data, width, height, width * 4)
  }
  IMAGE_ROWS << [img] # array of one column cell
rescue StandardError => e
  warn url, e.message
end

window('The Red Turtle', 310, 350, false) {
  horizontal_box {
    table {
      image_column('www.ghibli.jp/works/red-turtle')
      
      cell_rows IMAGE_ROWS
    }
  }
  
  on_closing do
    puts 'Bye Bye'
  end
}.show

Version data entries

113 entries across 113 versions & 1 rubygems

Version Path
glimmer-dsl-libui-0.12.7 examples/basic_table_image3.rb
glimmer-dsl-libui-0.12.6 examples/basic_table_image3.rb
glimmer-dsl-libui-0.12.5 examples/basic_table_image3.rb
glimmer-dsl-libui-0.12.4 examples/basic_table_image3.rb
glimmer-dsl-libui-0.12.3 examples/basic_table_image3.rb
glimmer-dsl-libui-0.12.2 examples/basic_table_image3.rb
glimmer-dsl-libui-0.12.1 examples/basic_table_image3.rb
glimmer-dsl-libui-0.12.0 examples/basic_table_image3.rb
glimmer-dsl-libui-0.11.10 examples/basic_table_image3.rb
glimmer-dsl-libui-0.11.9 examples/basic_table_image3.rb
glimmer-dsl-libui-0.11.8 examples/basic_table_image3.rb
glimmer-dsl-libui-0.11.7 examples/basic_table_image3.rb
glimmer-dsl-libui-0.11.6 examples/basic_table_image3.rb
glimmer-dsl-libui-0.11.5 examples/basic_table_image3.rb
glimmer-dsl-libui-0.11.4 examples/basic_table_image3.rb
glimmer-dsl-libui-0.11.3 examples/basic_table_image3.rb
glimmer-dsl-libui-0.11.2 examples/basic_table_image3.rb
glimmer-dsl-libui-0.11.1 examples/basic_table_image3.rb
glimmer-dsl-libui-0.11.0 examples/basic_table_image3.rb
glimmer-dsl-libui-0.10.2 examples/basic_table_image3.rb