File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
external_library/java/hype Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ load_library 'hype'
2+
3+ java_import 'hype.extended.colorist.HPixelColorist'
4+ java_import 'hype.extended.layout.HGridLayout'
5+ include_package 'hype'
6+
7+ CELL_SIZE = 25
8+
9+ def settings
10+ size ( 618 , 482 )
11+ end
12+
13+ def setup
14+ sketch_title 'Colorist'
15+ H . init ( self )
16+ H . background ( color ( '#242424' ) )
17+
18+ colors = HPixelColorist . new ( data_path ( 'phil_pai.jpg' ) )
19+ . fill_only
20+ # .strokeOnly
21+ # .fillAndStroke
22+ pool = HDrawablePool . new ( 576 )
23+ pool . autoAddToStage
24+ . add ( HRect . new . rounding ( 4 ) )
25+ . layout (
26+ HGridLayout . new
27+ . start_x ( 21 )
28+ . start_y ( 21 )
29+ . spacing ( CELL_SIZE + 1 , CELL_SIZE + 1 )
30+ . cols ( 24 )
31+ )
32+ . on_create do |obj |
33+ obj . no_stroke . anchor_at ( H ::CENTER ) . size ( CELL_SIZE )
34+ colors . applyColor ( obj )
35+ end . request_all
36+ H . draw_stage
37+ no_loop
38+ end
You can’t perform that action at this time.
0 commit comments