Skip to content

Commit

Permalink
Adding package level Available func
Browse files Browse the repository at this point in the history
  • Loading branch information
kenshaw committed Nov 20, 2023
1 parent c1e4fd3 commit 48a9f45
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions rasterm.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
// TermType is a terminal graphics type.
type TermType uint8

// Term types.
// Terminal graphics types.
const (
Default TermType = ^TermType(0)
Kitty TermType = iota
Expand All @@ -27,7 +27,7 @@ func (typ TermType) String() string {
return fmt.Sprintf("TermType(%d)", uint8(typ))
}

// Available returns true when the term type is available.
// Available returns true when the terminal graphics type is available.
func (typ TermType) Available() bool {
if r, ok := encoders[typ]; ok {
return r.Available()
Expand Down Expand Up @@ -58,11 +58,16 @@ func init() {
}
}

// Encode encodes the image to w.
// Encode encodes the image to w using the [Default] encoder.
func Encode(w io.Writer, img image.Image) error {
return Default.Encode(w, img)
}

// Available returns true the [Default] encoder is available.
func Available() bool {
return Default.Available()
}

// Error is an error.
type Error string

Expand Down

0 comments on commit 48a9f45

Please # to comment.