Module: JPEG

Defined in:
lib/jpeg.rb,
lib/jpeg/version.rb,
ext/jpeg/jpeg.c

Defined Under Namespace

Classes: DecodeError, Decoder, EncodeError, Encoder, Meta

Constant Summary collapse

VERSION =
"0.10.0"

Class Method Summary collapse

Class Method Details

.broken?(data) ⇒ Boolean

Returns:

  • (Boolean)


3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
# File 'ext/jpeg/jpeg.c', line 3709

static VALUE
rb_test_image(VALUE self, VALUE data)
{
  VALUE ret;
  struct jpeg_decompress_struct cinfo;
  ext_error_t err_mgr;

  cinfo.raw_data_out = FALSE;
  cinfo.dct_method   = JDCT_FLOAT;

  if (setjmp(err_mgr.jmpbuf)) {
    ret = Qfalse;

  } else {
    jpeg_mem_src(&cinfo, (uint8_t*)RSTRING_PTR(data), RSTRING_LEN(data));
    jpeg_read_header(&cinfo, TRUE);
    jpeg_calc_output_dimensions(&cinfo);

    ret = Qtrue;
  }

  return ret;
}