Mercurial > octave-libtiff
diff 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 |
line wrap: on
line diff
--- a/libinterp/corefcn/__tiff__.cc Fri Sep 02 20:52:47 2022 +0200 +++ b/libinterp/corefcn/__tiff__.cc Fri Sep 02 21:20:56 2022 +0200 @@ -3348,6 +3348,31 @@ #endif } + DEFUN (__tiff_is_big_endian__, args, , + "Get the whether the tiff file is big-endian") + { +#if defined (HAVE_TIFF) + int nargin = args.length (); + + if (nargin != 1) + error ("Wrong number of arguments\n"); + + octave_tiff_handle *tiff_handle + = octave_tiff_handle::get_tiff_handle (args(0)); + check_closed (tiff_handle); + + set_internal_handlers (); + + TIFF *tif = tiff_handle->get_file (); + + bool is_big_endian = TIFFIsBigEndian (tif); + + return ovl (is_big_endian); +#else + err_disabled_feature ("isBigEndian", "Tiff"); +#endif + } + DEFUN (__tiff_current_directory__, args, , "Get the index of the current directory") { @@ -3559,6 +3584,31 @@ #endif } + DEFUN (__tiff_get_directory_offset__, args, , + "Get the offset of the current directory in file") + { +#if defined (HAVE_TIFF) + int nargin = args.length (); + + if (nargin != 1) + error ("Wrong number of arguments\n"); + + octave_tiff_handle *tiff_handle + = octave_tiff_handle::get_tiff_handle (args(0)); + check_closed (tiff_handle); + + set_internal_handlers (); + + TIFF *tif = tiff_handle->get_file (); + + uint64_t offset = TIFFCurrentDirOffset (tif); + + return ovl (offset); +#else + err_disabled_feature ("getDirectoryOffset", "Tiff"); +#endif + } + DEFUN (__tiff_version__, , , "Get the version stamp of LibTIFF") {