Sha256: c82e532c0f087fcb5418064165810d978ba92a26db937429f811043fb5e4c915
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
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 = [] 5.times do |i| url = format('https://www.ghibli.jp/gallery/thumb-redturtle%03d.png', (i + 1)) puts "Processing Image: #{url}" 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(width, height) { image_part(data, width, height, width * 4) } text = url.sub('https://www.ghibli.jp/gallery/thumb-redturtle', '').sub('.png', '') IMAGE_ROWS << [[img, text], text, text, [img, text]] rescue StandardError => e warn url, e.message end window('The Red Turtle', 900, 350) { horizontal_box { table { image_text_column('image/number') text_column('number') text_column('number (editable)') { editable true } image_text_column('image/number (editable)') { editable true } cell_rows IMAGE_ROWS } } }.show
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
glimmer-dsl-libui-0.0.22 | examples/basic_table_image_text.rb |
glimmer-dsl-libui-0.0.21 | examples/basic_table_image_text.rb |