|
|
@ -322,7 +322,7 @@ type Dismiss struct {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (d *Dismiss) Add(gtx layout.Context) {
|
|
|
|
func (d *Dismiss) Add(gtx layout.Context) {
|
|
|
|
defer op.Push(gtx.Ops).Pop()
|
|
|
|
defer op.Save(gtx.Ops).Load()
|
|
|
|
pointer.Rect(image.Rectangle{Max: gtx.Constraints.Min}).Add(gtx.Ops)
|
|
|
|
pointer.Rect(image.Rectangle{Max: gtx.Constraints.Min}).Add(gtx.Ops)
|
|
|
|
pointer.InputOp{Tag: d, Types: pointer.Press}.Add(gtx.Ops)
|
|
|
|
pointer.InputOp{Tag: d, Types: pointer.Press}.Add(gtx.Ops)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -824,41 +824,41 @@ func drawLogo(ops *op.Ops, size int) {
|
|
|
|
tx := op.Offset(f32.Pt(off, 0))
|
|
|
|
tx := op.Offset(f32.Pt(off, 0))
|
|
|
|
ty := op.Offset(f32.Pt(0, off))
|
|
|
|
ty := op.Offset(f32.Pt(0, off))
|
|
|
|
|
|
|
|
|
|
|
|
st := op.Push(ops)
|
|
|
|
st := op.Save(ops)
|
|
|
|
defer st.Pop()
|
|
|
|
defer st.Load()
|
|
|
|
|
|
|
|
|
|
|
|
// First row of discs.
|
|
|
|
// First row of discs.
|
|
|
|
row := op.Push(ops)
|
|
|
|
row := op.Save(ops)
|
|
|
|
drawDisc(ops, discDia, rgb(0x54514d))
|
|
|
|
drawDisc(ops, discDia, rgb(0x54514d))
|
|
|
|
tx.Add(ops)
|
|
|
|
tx.Add(ops)
|
|
|
|
drawDisc(ops, discDia, rgb(0x54514d))
|
|
|
|
drawDisc(ops, discDia, rgb(0x54514d))
|
|
|
|
tx.Add(ops)
|
|
|
|
tx.Add(ops)
|
|
|
|
drawDisc(ops, discDia, rgb(0x54514d))
|
|
|
|
drawDisc(ops, discDia, rgb(0x54514d))
|
|
|
|
row.Pop()
|
|
|
|
row.Load()
|
|
|
|
|
|
|
|
|
|
|
|
ty.Add(ops)
|
|
|
|
ty.Add(ops)
|
|
|
|
// Second row.
|
|
|
|
// Second row.
|
|
|
|
row = op.Push(ops)
|
|
|
|
row = op.Save(ops)
|
|
|
|
drawDisc(ops, discDia, rgb(0xfffdfa))
|
|
|
|
drawDisc(ops, discDia, rgb(0xfffdfa))
|
|
|
|
tx.Add(ops)
|
|
|
|
tx.Add(ops)
|
|
|
|
drawDisc(ops, discDia, rgb(0xfffdfa))
|
|
|
|
drawDisc(ops, discDia, rgb(0xfffdfa))
|
|
|
|
tx.Add(ops)
|
|
|
|
tx.Add(ops)
|
|
|
|
drawDisc(ops, discDia, rgb(0xfffdfa))
|
|
|
|
drawDisc(ops, discDia, rgb(0xfffdfa))
|
|
|
|
row.Pop()
|
|
|
|
row.Load()
|
|
|
|
|
|
|
|
|
|
|
|
ty.Add(ops)
|
|
|
|
ty.Add(ops)
|
|
|
|
// Third row.
|
|
|
|
// Third row.
|
|
|
|
row = op.Push(ops)
|
|
|
|
row = op.Save(ops)
|
|
|
|
drawDisc(ops, discDia, rgb(0x54514d))
|
|
|
|
drawDisc(ops, discDia, rgb(0x54514d))
|
|
|
|
tx.Add(ops)
|
|
|
|
tx.Add(ops)
|
|
|
|
drawDisc(ops, discDia, rgb(0xfffdfa))
|
|
|
|
drawDisc(ops, discDia, rgb(0xfffdfa))
|
|
|
|
tx.Add(ops)
|
|
|
|
tx.Add(ops)
|
|
|
|
drawDisc(ops, discDia, rgb(0x54514d))
|
|
|
|
drawDisc(ops, discDia, rgb(0x54514d))
|
|
|
|
row.Pop()
|
|
|
|
row.Load()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func drawImage(gtx layout.Context, img paint.ImageOp, size unit.Value) layout.Dimensions {
|
|
|
|
func drawImage(gtx layout.Context, img paint.ImageOp, size unit.Value) layout.Dimensions {
|
|
|
|
defer op.Push(gtx.Ops).Pop()
|
|
|
|
defer op.Save(gtx.Ops).Load()
|
|
|
|
img.Add(gtx.Ops)
|
|
|
|
img.Add(gtx.Ops)
|
|
|
|
sz := img.Size()
|
|
|
|
sz := img.Size()
|
|
|
|
aspect := float32(sz.Y) / float32(sz.X)
|
|
|
|
aspect := float32(sz.Y) / float32(sz.X)
|
|
|
@ -871,7 +871,7 @@ func drawImage(gtx layout.Context, img paint.ImageOp, size unit.Value) layout.Di
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func drawDisc(ops *op.Ops, radius float32, col color.NRGBA) {
|
|
|
|
func drawDisc(ops *op.Ops, radius float32, col color.NRGBA) {
|
|
|
|
defer op.Push(ops).Pop()
|
|
|
|
defer op.Save(ops).Load()
|
|
|
|
r2 := radius * .5
|
|
|
|
r2 := radius * .5
|
|
|
|
dr := f32.Rectangle{Max: f32.Pt(radius, radius)}
|
|
|
|
dr := f32.Rectangle{Max: f32.Pt(radius, radius)}
|
|
|
|
clip.RRect{
|
|
|
|
clip.RRect{
|
|
|
@ -914,7 +914,7 @@ type fill struct {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (f fill) Layout(gtx layout.Context, sz image.Point) layout.Dimensions {
|
|
|
|
func (f fill) Layout(gtx layout.Context, sz image.Point) layout.Dimensions {
|
|
|
|
defer op.Push(gtx.Ops).Pop()
|
|
|
|
defer op.Save(gtx.Ops).Load()
|
|
|
|
clip.Rect(image.Rectangle{Max: sz}).Add(gtx.Ops)
|
|
|
|
clip.Rect(image.Rectangle{Max: sz}).Add(gtx.Ops)
|
|
|
|
paint.ColorOp{Color: f.col}.Add(gtx.Ops)
|
|
|
|
paint.ColorOp{Color: f.col}.Add(gtx.Ops)
|
|
|
|
paint.PaintOp{}.Add(gtx.Ops)
|
|
|
|
paint.PaintOp{}.Add(gtx.Ops)
|
|
|
|