Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Fun with Rectangles

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Fun with Rectangles

Avatar for mike castleman

mike castleman

April 07, 2014
Tweet

More Decks by mike castleman

Other Decks in Technology

Transcript

  1. . .

  2. . .

  3. 60

  4. shapes = { standalone: [ true, true ], top: [

    true, false ], top_dark: [ true, false ], bottom: [ false, true ], middle: [ false, false ] } modes = { resting: WHITE, pressed: pressed(WHITE), focused: ChunkyPNG::Color.rgb(193, 232, 247) }
  5. sizes.each do |dpi, factor| shapes.each do |shape, args| # compute

    bounds modes.each do |maincolor| png = ChunkyPNG::Image.new(width, height, TRANSPARENT) # draw shape and 9-patch bounds! fn = File.join(File.dirname(__FILE__), "..", "res" , "drawable -#{dpi}", "venuepicker_#{shape}_#{ mode}.9.png") png.save(fn) end end end