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_icons_test.go | |
| parent | 2c305c878541c357f328c15c5d39386704112040 (diff) | |
Started implementing a test of Area.RepaintAll()/Repaint().
Diffstat (limited to 'redo/yz_icons_test.go')
| -rw-r--r-- | redo/yz_icons_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/redo/yz_icons_test.go b/redo/yz_icons_test.go index 591807d..a85f58e 100644 --- a/redo/yz_icons_test.go +++ b/redo/yz_icons_test.go @@ -16,6 +16,8 @@ type icon struct { Name string } +var firstimg *image.RGBA + func readIcons() ([]icon, ImageList) { out := make([]icon, len(icons)) outil := NewImageList() @@ -27,6 +29,9 @@ func readIcons() ([]icon, ImageList) { } img := image.NewRGBA(png.Bounds()) draw.Draw(img, img.Rect, png, image.ZP, draw.Src) + if firstimg == nil { + firstimg = img + } out[i].Icon = ImageIndex(i) out[i].Name = icons[i].name outil.Append(img) @@ -34,6 +39,21 @@ func readIcons() ([]icon, ImageList) { return out, outil } +func tileImage(times int) *image.RGBA { + dx := firstimg.Rect.Dx() + dy := firstimg.Rect.Dy() + res := image.NewRGBA(image.Rect(0, 0, times * dx, times * dy)) + r := image.Rect(0, 0, dx, dy) + for y := 0; y < times; y++ { + rr := r.Add(image.Pt(0, y * dy)) + for x := 0; x < times; x++ { + draw.Draw(res, rr, firstimg, image.ZP, draw.Src) + rr = rr.Add(image.Pt(dx, 0)) + } + } + return res +} + var icons = []struct { data []byte name string |
