Skip to content
Snippets Groups Projects
Commit 58009410 authored by Andrew E. Torda's avatar Andrew E. Torda
Browse files

Before deleting the img image. Next step will be to try to just put text behind.

parent 7f3f2bad
Branches
No related tags found
No related merge requests found
......@@ -4,27 +4,37 @@ package main
import (
"fmt"
"github.com/gizak/termui/v3/drawille"
"image"
"image/color"
"image/draw"
ui "github.com/gizak/termui/v3"
"github.com/gizak/termui/v3/widgets"
"image"
)
func breaker(x interface{}) {}
func scrnPlt(pi, stdErr []float32) error {
ui.Theme.Plot.Axes = ui.ColorBlack
nrmlStyle := ui.NewStyle (ui.ColorBlack, ui.ColorClear)
// invisStyle := ui.NewStyle (ui.ColorClear, ui.ColorClear)
thm := ui.Theme
thm.Default = ui.NewStyle(ui.ColorBlack, ui.ColorWhite, ui.ModifierReverse)
thm.Default.Fg = ui.ColorBlack
thm.Default.Bg = ui.ColorWhite
thm.Plot.Lines = []ui.Color{ui.ColorBlack}
thm.Paragraph.Text = ui.NewStyle(ui.ColorBlack, ui.ColorWhite)
thm.Block.Title = nrmlStyle
thm.Plot.Axes = ui.ColorBlack
thm.Default = ui.NewStyle(ui.ColorBlack, ui.ColorClear)
thm.Block.Border = nrmlStyle
ui.Theme = thm
ptxt := widgets.NewParagraph()
ptxt.Text = "Hello World!"
ptxt.SetRect(0, 0, 25, 5)
for i := 0; i < 24; i++ {
for j := 0; j < 800; j++ {
ptxt.Text += "."
}
ptxt.Text += " \n"
}
ptxt.SetRect(0, 0, 80, 24)
ptxt.TextStyle = ui.NewStyle(ui.ColorWhite, ui.ColorWhite)
p1 := widgets.NewPlot()
p1.Title = "π"
......@@ -38,28 +48,35 @@ func scrnPlt(pi, stdErr []float32) error {
}
p1.Data = data
}
breaker(thm)
p1.SetRect(5, 5, 80, 80)
p1.AxesColor = ui.ColorBlack
p1.LineColors = []ui.Color{ui.ColorRed}
p1.SetRect(2, 2, 80, 24)
p1.Block.TitleStyle = nrmlStyle
p1.AxesColor = ui.ColorBlack
// p1.LineColors = []ui.Color{ui.ColorBlack, ui.ColorBlack}
p1.SetRect (0, 0, 80, 24)
p1.Marker = widgets.MarkerBraille
p1.PlotType = widgets.ScatterPlot
// next: syntax OK, just doesn't work
r := image.Rectangle(image.Rect(0, 0, 100, 100))
buf := ui.NewBuffer(r)
p1.Border = false
breaker(thm)
cell := drawille.Cell{Color:7}
fmt.Println (cell)
// buf.Fill(cell, r)
p1.Block.Draw(buf)
m := image.NewRGBA(image.Rect(0, 0, 80, 24))
// draw.Draw(m, m.Bounds(), &image.Uniform{color.White}, image.ZP, draw.Src)
draw.Draw(m, m.Bounds(), &image.Uniform{color.White}, image.ZP, draw.Src)
img := widgets.NewImage(m)
img.SetRect(0, 0, 100, 50)
defer fmt.Println ("m bounds", m.Bounds())
if err := ui.Init(); err != nil {
return fmt.Errorf("failed to initialize termui: %w", err)
return err
}
defer ui.Close()
ui.Render(p1, ptxt)
ui.Render(img, ptxt, p1)
for e := range ui.PollEvents() {
if e.Type == ui.KeyboardEvent {
break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment