No commit activity in last 3 years
No release in over 3 years
Bevel - Glimmer Custom Shape
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

= 2.4.9
~> 3.5.0
= 2.0.5

Runtime

>= 4.18.7.4, < 5.0.0.0
 Project Readme

Bevel 0.1.1

Gem Version

Glimmer DSL for SWT Bevel Custom Shape.

bevel is the Glimmer GUI DSL keyword provided by this gem.

Screenshot

Every square is a bevel custom shape instance with a varying base color.

bevel screenshot

Actual Use

It is used in Glimmer Tetris.

Glimmer Tetris

Setup

Bundler

Add the follwing to Gemfile:

gem 'glimmer-cp-bevel', '~> 0.1.1'

Run bundle install or bundle:

bundle

Direct

Run:

gem install glimmer-cp-bevel

API

First, add this to your Ruby file:

require 'glimmer-cp-bevel'

Then, use this keyword: bevel(options) { properties }

Options (keyword args) are:

  • :base_color (required): base background color to produce bevel effect for
  • :size (required): size in pixels for width and height (resulting in bevel squares having that size)
  • :bevel_pixel_size (optional): adjusts the bevel area
  • :x (default: 0) (optional): starting location x coordinate within parent
  • :y (default: 0) (optional): starting location y coordinate within parent

Properties are:

  • base_color (same as option above)

Example

Glimmer GUI DSL code snippet:

require 'glimmer-cp-bevel'

include Glimmer

shell {
  text 'Glimmer Tetris Icon'
  label {
    text 'Check out the application icon!'
    font height: 20
  }
  icon_block_size = 64
  icon_bevel_size = icon_block_size.to_f / 25.to_f
  icon_bevel_pixel_size = 0.16*icon_block_size.to_f
  icon_size = 8
  icon_pixel_size = icon_block_size * icon_size
  image(icon_pixel_size, icon_pixel_size) {
    icon_size.times { |row|
      icon_size.times { |column|
        colored = row >= 1 && column.between?(1, 6)
        color = colored ? color(([:white] + [:cyan, :blue, :dark_yellow, :yellow, :green, :magenta, :red]).sample) : color(:white)
        x = column * icon_block_size
        y = row * icon_block_size
        bevel(x: x, y: y, base_color: color, size: icon_block_size)
      }
    }
  }
}.open

Produces this Glimmer Tetris icon image:

Tetris Icon

Contributing to glimmer-cp-bevel

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

TODO

TODO.md

Change Log

CHANGELOG.md

License

MIT

Copyright (c) 2021 - Andy Maleh.

--

Built for Glimmer DSL for SWT (JRuby Desktop Development GUI Framework).