Class: Encoder

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

Instance Method Summary collapse

Constructor Details

#initializeObject



51
52
53
54
55
# File 'ext/libsixel/libsixel.c', line 51

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

Instance Method Details

#encode(filename) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'ext/libsixel/libsixel.c', line 80

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



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'ext/libsixel/libsixel.c', line 58

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;
}