ui: split OpImage into OpImage and OpDraw

In preparation for an OpColor (and future OpGradient and similar).

Label and Editor no longer take an explicit source image. They
draw with the current image.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-06-01 12:43:33 +02:00
parent 29993af408
commit 0061c73a89
6 changed files with 78 additions and 49 deletions
+2 -1
View File
@@ -27,6 +27,7 @@ func (im Image) Layout(ops *ui.Ops, cs layout.Constraints) layout.Dimens {
dr := f32.Rectangle{
Max: f32.Point{X: float32(d.X), Y: float32(d.Y)},
}
draw.OpImage{Rect: dr, Src: im.Src, SrcRect: im.Rect}.Add(ops)
draw.OpImage{Img: im.Src, Rect: im.Rect}.Add(ops)
draw.OpDraw{Rect: dr}.Add(ops)
return layout.Dimens{Size: d, Baseline: d.Y}
}