Class: JPEG::Decoder
- Inherits:
-
Object
- Object
- JPEG::Decoder
- Defined in:
- ext/jpeg/jpeg.c
Instance Method Summary collapse
-
#decode(jpeg) ⇒ String
(also: #decompress, #<<)
decode JPEG data.
-
#initialize(opts) ⇒ Object
constructor
initialize decoder object.
-
#read_header(jpeg) ⇒ JPEG::Meta
read meta data.
- #set(opt) ⇒ Object
Constructor Details
#initialize(opts) ⇒ Object
initialize decoder object
2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 |
# File 'ext/jpeg/jpeg.c', line 2001
static VALUE
rb_decoder_initialize( int argc, VALUE *argv, VALUE self)
{
jpeg_decode_t* ptr;
VALUE exc;
VALUE opt;
/*
* initialize
*/
TypedData_Get_Struct(self, jpeg_decode_t, &jpeg_decoder_data_type, ptr);
/*
* parse arguments
*/
rb_scan_args( argc, argv, "0:", &opt);
/*
* set context
*/
exc = set_decoder_context(ptr, opt);
/*
* post process
*/
if (RTEST(exc)) rb_exc_raise(exc);
return Qtrue;
}
|
Instance Method Details
#decode(jpeg) ⇒ String Also known as: decompress, <<
decode JPEG data
3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 |
# File 'ext/jpeg/jpeg.c', line 3635
static VALUE
rb_decoder_decode(VALUE self, VALUE data)
{
VALUE ret;
jpeg_decode_t* ptr;
int state;
/*
* initialize
*/
ret = Qnil;
state = 0;
TypedData_Get_Struct(self, jpeg_decode_t, &jpeg_decoder_data_type, ptr);
/*
* argument check
*/
Check_Type(data, T_STRING);
/*
* prepare
*/
SET_DATA(ptr, data);
/*
* do decode
*/
ret = rb_protect(do_decode, (VALUE)ptr, &state);
/*
* post process
*/
CLR_DATA(ptr);
if (state != 0) rb_jump_tag(state);
return ret;
}
|
#read_header(jpeg) ⇒ JPEG::Meta
read meta data
2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 |
# File 'ext/jpeg/jpeg.c', line 2986
static VALUE
rb_decoder_read_header(VALUE self, VALUE data)
{
VALUE ret;
jpeg_decode_t* ptr;
int state;
/*
* initialize
*/
ret = Qnil;
state = 0;
TypedData_Get_Struct(self, jpeg_decode_t, &jpeg_decoder_data_type, ptr);
/*
* argument check
*/
Check_Type(data, T_STRING);
/*
* prepare
*/
SET_DATA(ptr, data);
/*
* do encode
*/
ret = rb_protect(do_read_header, (VALUE)ptr, &state);
/*
* post process
*/
CLR_DATA(ptr);
if (state != 0) rb_jump_tag(state);
return ret;
}
|
#set(opt) ⇒ Object
2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 |
# File 'ext/jpeg/jpeg.c', line 2031
static VALUE
rb_decoder_set(VALUE self, VALUE opt)
{
jpeg_decode_t* ptr;
VALUE exc;
/*
* initialize
*/
TypedData_Get_Struct(self, jpeg_decode_t, &jpeg_decoder_data_type, ptr);
/*
* check argument
*/
Check_Type(opt, T_HASH);
/*
* set context
*/
exc = set_decoder_context(ptr, opt);
/*
* post process
*/
if (RTEST(exc)) rb_exc_raise(exc);
return Qtrue;
}
|