Skip to content

Commit

Permalink
remove sixel.Options and address pX conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Feb 19, 2025
1 parent 8705df7 commit 01e9042
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions ansi/graphics.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,17 @@ func SixelGraphics(p1, p2, p3 int, payload []byte) string {
var buf bytes.Buffer

buf.WriteString("\x1bP")
buf.WriteString(strconv.Itoa(p1))
if p1 >= 0 {
buf.WriteString(strconv.Itoa(p1))
}
buf.WriteByte(';')
buf.WriteString(strconv.Itoa(p2))
if p2 >= 0 {
buf.WriteString(strconv.Itoa(p2))
}
buf.WriteByte(';')
buf.WriteString(strconv.Itoa(p3))
if p3 >= 0 {
buf.WriteString(strconv.Itoa(p3))
}
buf.WriteString(";q")
buf.Write(payload)
buf.WriteString("\x1b\\")
Expand All @@ -49,11 +55,7 @@ func SixelGraphics(p1, p2, p3 int, payload []byte) string {
// WriteSixelGraphics encodes an image as sixels into the provided io.Writer.
// Options is provided in expectation of future options (such as dithering), but
// none are yet implemented. o can be nil to use the default options.
func WriteSixelGraphics(w io.Writer, m image.Image, o *sixel.Options) error {
if o == nil {
o = &sixel.Options{}
}

func WriteSixelGraphics(w io.Writer, m image.Image) error {
e := &sixel.Encoder{}

data := bytes.NewBuffer(nil)
Expand Down

0 comments on commit 01e9042

Please sign in to comment.