diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-02-10 16:56:06 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-02-10 16:56:06 -0500 |
| commit | 430f97bed9d758de90a72b0c06b2be1989ba2b1d (patch) | |
| tree | 057a578389bfafe595ba415797908979c3d09add /layout/draw.go | |
| parent | 3ce04a4d3dc8d174b520d85804e5c8dce8c5d08f (diff) | |
| download | gui-430f97bed9d758de90a72b0c06b2be1989ba2b1d.zip | |
add rows layout
Diffstat (limited to 'layout/draw.go')
| -rw-r--r-- | layout/draw.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/layout/draw.go b/layout/draw.go index 760a149..1d341f4 100644 --- a/layout/draw.go +++ b/layout/draw.go @@ -18,6 +18,13 @@ func subimage(m draw.Image, r image.Rectangle) draw.Image { return m.(subimager).SubImage(r).(draw.Image) } +// drawSubimage translates a draw call onto the given subimage area. +func drawSubImage(f func(draw.Image) image.Rectangle, r image.Rectangle) func(draw.Image) image.Rectangle { + return func(img draw.Image) image.Rectangle { + return f(subimage(img, r)) + } +} + // drawBackground returns a draw call that fills the entire image with a color. func drawBackground(c color.Color) func(draw.Image) image.Rectangle { return func(img draw.Image) image.Rectangle { |