comparison libinterp/corefcn/__tiff__.cc @ 31202:be6ccdcd5775

Tiff: added isBigEndian and getDirectoryOffset methods to the class * scripts/io/Tiff.m: added isBigEndian and getDirectoryOffset methods to the class. * libtinterp/corefcn/tiff.cc: added __tiff_is_big_endian__ and __tiff_get_directory_offset__ as internal functions for isBigEndian and getDirectoryOffset repectively. * scripts/image/private/__tiff_imfinfo__.m: used the two new methods to get the corresponding info fields.
author magedrifaat <magedrifaat@gmail.com>
date Fri, 02 Sep 2022 21:20:56 +0200
parents e5e8cb049b4b
children fa50e2c17568
comparison
equal deleted inserted replaced
31201:e5e8cb049b4b 31202:be6ccdcd5775
3346 #else 3346 #else
3347 err_disabled_feature ("getDefaultStripLength", "Tiff"); 3347 err_disabled_feature ("getDefaultStripLength", "Tiff");
3348 #endif 3348 #endif
3349 } 3349 }
3350 3350
3351 DEFUN (__tiff_is_big_endian__, args, ,
3352 "Get the whether the tiff file is big-endian")
3353 {
3354 #if defined (HAVE_TIFF)
3355 int nargin = args.length ();
3356
3357 if (nargin != 1)
3358 error ("Wrong number of arguments\n");
3359
3360 octave_tiff_handle *tiff_handle
3361 = octave_tiff_handle::get_tiff_handle (args(0));
3362 check_closed (tiff_handle);
3363
3364 set_internal_handlers ();
3365
3366 TIFF *tif = tiff_handle->get_file ();
3367
3368 bool is_big_endian = TIFFIsBigEndian (tif);
3369
3370 return ovl (is_big_endian);
3371 #else
3372 err_disabled_feature ("isBigEndian", "Tiff");
3373 #endif
3374 }
3375
3351 DEFUN (__tiff_current_directory__, args, , 3376 DEFUN (__tiff_current_directory__, args, ,
3352 "Get the index of the current directory") 3377 "Get the index of the current directory")
3353 { 3378 {
3354 #if defined (HAVE_TIFF) 3379 #if defined (HAVE_TIFF)
3355 int nargin = args.length (); 3380 int nargin = args.length ();
3554 error ("Failed to switch to the sub directory"); 3579 error ("Failed to switch to the sub directory");
3555 3580
3556 return octave_value_list (); 3581 return octave_value_list ();
3557 #else 3582 #else
3558 err_disabled_feature ("setSubDirectory", "Tiff"); 3583 err_disabled_feature ("setSubDirectory", "Tiff");
3584 #endif
3585 }
3586
3587 DEFUN (__tiff_get_directory_offset__, args, ,
3588 "Get the offset of the current directory in file")
3589 {
3590 #if defined (HAVE_TIFF)
3591 int nargin = args.length ();
3592
3593 if (nargin != 1)
3594 error ("Wrong number of arguments\n");
3595
3596 octave_tiff_handle *tiff_handle
3597 = octave_tiff_handle::get_tiff_handle (args(0));
3598 check_closed (tiff_handle);
3599
3600 set_internal_handlers ();
3601
3602 TIFF *tif = tiff_handle->get_file ();
3603
3604 uint64_t offset = TIFFCurrentDirOffset (tif);
3605
3606 return ovl (offset);
3607 #else
3608 err_disabled_feature ("getDirectoryOffset", "Tiff");
3559 #endif 3609 #endif
3560 } 3610 }
3561 3611
3562 DEFUN (__tiff_version__, , , 3612 DEFUN (__tiff_version__, , ,
3563 "Get the version stamp of LibTIFF") 3613 "Get the version stamp of LibTIFF")