Class: Encoder

Inherits:
Object
  • Object
show all
Defined in:
ext/libsixel/libsixel.c

Instance Method Summary collapse

Constructor Details

#initializeObject



59
60
61
62
63
# File 'ext/libsixel/libsixel.c', line 59

static VALUE
sixel_ruby_encoder_initialize(VALUE self)
{
    return Qnil;
}

Instance Method Details

#encode(filename) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'ext/libsixel/libsixel.c', line 88

static VALUE
sixel_ruby_encoder_encode(VALUE self, VALUE filename)
{
    sixel_encoder_t *encoder;
    SIXELSTATUS status;

    Data_Get_Struct(self, sixel_encoder_t, encoder);

    status = sixel_encoder_encode(encoder, StringValueCStr(filename));
    if (SIXEL_FAILED(status)) {
        rb_raise(rb_eRuntimeError,
                 "sixel_encoder_encode() failed: %s / %s",
                 sixel_helper_format_error(status),
                 sixel_helper_get_additional_message());
    }

    return Qnil;
}

#setopt(option, optval) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'ext/libsixel/libsixel.c', line 66

static VALUE
sixel_ruby_encoder_setopt(VALUE self, VALUE option, VALUE optval)
{
    sixel_encoder_t *encoder;
    SIXELSTATUS status;

    Data_Get_Struct(self, sixel_encoder_t, encoder);

    status = sixel_encoder_setopt(encoder,
                                  *StringValueCStr(option),
                                  StringValueCStr(optval));
    if (SIXEL_FAILED(status)) {
        rb_raise(rb_eRuntimeError,
                 "sixel_encoder_setopt() failed: %s / %s",
                 sixel_helper_format_error(status),
                 sixel_helper_get_additional_message());
    }

    return Qnil;
}