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
3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 |
# File 'ext/jpeg/jpeg.c', line 3669
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
3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 |
# File 'ext/jpeg/jpeg.c', line 3020
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;
}
|