diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-21 15:32:36 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-21 15:32:36 -0400 |
| commit | 4e2315e75769b80901498e75091ebd5a9dff80e9 (patch) | |
| tree | 2c79d104e9a45ec799a9b6c681ad6afbcc437998 /redo/yz_repaint_test.go | |
| parent | 2c305c878541c357f328c15c5d39386704112040 (diff) | |
Started implementing a test of Area.RepaintAll()/Repaint().
Diffstat (limited to 'redo/yz_repaint_test.go')
| -rw-r--r-- | redo/yz_repaint_test.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/redo/yz_repaint_test.go b/redo/yz_repaint_test.go new file mode 100644 index 0000000..99cc515 --- /dev/null +++ b/redo/yz_repaint_test.go @@ -0,0 +1,46 @@ +// 21 august 2014 + +package ui + +import ( + "image" +) + +type repainter struct { + img *image.RGBA + area Area + x TextField + y TextField + width TextField + height TextField + repaint Button + all Button + stack Stack +} + +func newRepainter(times int) *repainter { + r := new(repainter) + r.img = tileImage(times) + r.area = NewArea(r.img.Rect.Dx(), r.img.Rect.Dy(), r) + r.x = NewTextField() + r.y = NewTextField() + r.width = NewTextField() + r.height = NewTextField() + r.repaint = NewButton("Rect") + r.all = NewButton("All") + r.stack = NewHorizontalStack(r.x, r.y, r.width, r.height, r.repaint, r.all) + r.stack.SetStretchy(0) + r.stack.SetStretchy(1) + r.stack.SetStretchy(2) + r.stack.SetStretchy(3) + r.stack = NewVerticalStack(r.area, r.stack) + r.stack.SetStretchy(0) + return r +} + +func (r *repainter) Paint(rect image.Rectangle) *image.RGBA { + return r.img.SubImage(rect).(*image.RGBA) +} + +func (r *repainter) Mouse(me MouseEvent) {} +func (r *repainter) Key(ke KeyEvent) bool { return false } |
