-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
image: add sixel image output to lui -a
This implements a stdimg for lui in console mode. Images are sixel encoded and written to stdout, if they are not assigned to a variable. Example: A blue rectangle `img ⌶20 20⍴0xFF
- Loading branch information
Showing
4 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package u | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/ktye/iv/apl" | ||
sixel "github.com/mattn/go-sixel" | ||
) | ||
|
||
// Sxl implements an apl.ImageWriter to serve as a stdimg device in a sixel capable terminal. | ||
type Sxl struct { | ||
io.Writer | ||
} | ||
|
||
func (dev Sxl) WriteImage(m apl.Image) error { | ||
// TODO animations | ||
|
||
e := sixel.NewEncoder(dev.Writer) | ||
return e.Encode(m.Im[0]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters