Mercurial > octave-libgccjit
diff libinterp/dldfcn/__magick_read__.cc @ 17787:175b392e91fe
Use GNU style coding conventions for code in libinterp/
* libinterp/corefcn/Cell.h, libinterp/corefcn/__contourc__.cc,
libinterp/corefcn/__dispatch__.cc, libinterp/corefcn/__lin_interpn__.cc,
libinterp/corefcn/__pchip_deriv__.cc, libinterp/corefcn/__qp__.cc,
libinterp/corefcn/balance.cc, libinterp/corefcn/besselj.cc,
libinterp/corefcn/betainc.cc, libinterp/corefcn/bitfcns.cc,
libinterp/corefcn/bsxfun.cc, libinterp/corefcn/c-file-ptr-stream.cc,
libinterp/corefcn/c-file-ptr-stream.h, libinterp/corefcn/cellfun.cc,
libinterp/corefcn/colloc.cc, libinterp/corefcn/comment-list.h,
libinterp/corefcn/conv2.cc, libinterp/corefcn/daspk.cc,
libinterp/corefcn/dasrt.cc, libinterp/corefcn/dassl.cc,
libinterp/corefcn/data.cc, libinterp/corefcn/debug.cc,
libinterp/corefcn/defaults.cc, libinterp/corefcn/defaults.in.h,
libinterp/corefcn/defun-int.h, libinterp/corefcn/defun.cc,
libinterp/corefcn/det.cc, libinterp/corefcn/dirfns.cc,
libinterp/corefcn/display.cc, libinterp/corefcn/dlmread.cc,
libinterp/corefcn/dot.cc, libinterp/corefcn/dynamic-ld.cc,
libinterp/corefcn/dynamic-ld.h, libinterp/corefcn/eig.cc,
libinterp/corefcn/ellipj.cc, libinterp/corefcn/error.cc,
libinterp/corefcn/error.h, libinterp/corefcn/event-queue.h,
libinterp/corefcn/fft.cc, libinterp/corefcn/fft2.cc, libinterp/corefcn/fftn.cc,
libinterp/corefcn/file-io.cc, libinterp/corefcn/filter.cc,
libinterp/corefcn/find.cc, libinterp/corefcn/gammainc.cc,
libinterp/corefcn/gcd.cc, libinterp/corefcn/getgrent.cc,
libinterp/corefcn/getpwent.cc, libinterp/corefcn/getrusage.cc,
libinterp/corefcn/givens.cc, libinterp/corefcn/gl-render.cc,
libinterp/corefcn/gl2ps-renderer.cc, libinterp/corefcn/gl2ps-renderer.h,
libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h,
libinterp/corefcn/gripes.cc, libinterp/corefcn/gripes.h,
libinterp/corefcn/help.cc, libinterp/corefcn/hess.cc,
libinterp/corefcn/hex2num.cc, libinterp/corefcn/input.cc,
libinterp/corefcn/input.h, libinterp/corefcn/inv.cc,
libinterp/corefcn/jit-ir.h, libinterp/corefcn/jit-typeinfo.cc,
libinterp/corefcn/jit-typeinfo.h, libinterp/corefcn/jit-util.h,
libinterp/corefcn/kron.cc, libinterp/corefcn/load-path.cc,
libinterp/corefcn/load-path.h, libinterp/corefcn/load-save.cc,
libinterp/corefcn/load-save.h, libinterp/corefcn/lookup.cc,
libinterp/corefcn/ls-ascii-helper.cc, libinterp/corefcn/ls-hdf5.cc,
libinterp/corefcn/ls-hdf5.h, libinterp/corefcn/ls-mat-ascii.cc,
libinterp/corefcn/ls-mat-ascii.h, libinterp/corefcn/ls-mat4.cc,
libinterp/corefcn/ls-mat5.cc, libinterp/corefcn/ls-mat5.h,
libinterp/corefcn/ls-oct-ascii.cc, libinterp/corefcn/lsode.cc,
libinterp/corefcn/lu.cc, libinterp/corefcn/luinc.cc,
libinterp/corefcn/mappers.cc, libinterp/corefcn/matrix_type.cc,
libinterp/corefcn/max.cc, libinterp/corefcn/md5sum.cc,
libinterp/corefcn/mex.cc, libinterp/corefcn/mexproto.h,
libinterp/corefcn/mgorth.cc, libinterp/corefcn/mxarray.in.h,
libinterp/corefcn/nproc.cc, libinterp/corefcn/oct-hist.cc,
libinterp/corefcn/oct-lvalue.h, libinterp/corefcn/oct-map.cc,
libinterp/corefcn/oct-map.h, libinterp/corefcn/oct-obj.h,
libinterp/corefcn/oct-prcstrm.h, libinterp/corefcn/oct-stdstrm.h,
libinterp/corefcn/oct-stream.cc, libinterp/corefcn/oct-stream.h,
libinterp/corefcn/octave-link.cc, libinterp/corefcn/octave-link.h,
libinterp/corefcn/pager.cc, libinterp/corefcn/pinv.cc,
libinterp/corefcn/pr-output.cc, libinterp/corefcn/procstream.h,
libinterp/corefcn/profiler.cc, libinterp/corefcn/pt-jit.cc,
libinterp/corefcn/pt-jit.h, libinterp/corefcn/quad.cc,
libinterp/corefcn/quadcc.cc, libinterp/corefcn/qz.cc,
libinterp/corefcn/rand.cc, libinterp/corefcn/rcond.cc,
libinterp/corefcn/regexp.cc, libinterp/corefcn/schur.cc,
libinterp/corefcn/sighandlers.cc, libinterp/corefcn/sighandlers.h,
libinterp/corefcn/sparse-xdiv.cc, libinterp/corefcn/sparse-xdiv.h,
libinterp/corefcn/sparse-xpow.cc, libinterp/corefcn/sparse.cc,
libinterp/corefcn/spparms.cc, libinterp/corefcn/sqrtm.cc,
libinterp/corefcn/str2double.cc, libinterp/corefcn/strfind.cc,
libinterp/corefcn/strfns.cc, libinterp/corefcn/sub2ind.cc,
libinterp/corefcn/svd.cc, libinterp/corefcn/syl.cc,
libinterp/corefcn/symtab.cc, libinterp/corefcn/symtab.h,
libinterp/corefcn/syscalls.cc, libinterp/corefcn/sysdep.cc,
libinterp/corefcn/sysdep.h, libinterp/corefcn/time.cc,
libinterp/corefcn/toplev.cc, libinterp/corefcn/toplev.h,
libinterp/corefcn/tril.cc, libinterp/corefcn/txt-eng-ft.cc,
libinterp/corefcn/txt-eng-ft.h, libinterp/corefcn/txt-eng.h,
libinterp/corefcn/typecast.cc, libinterp/corefcn/urlwrite.cc,
libinterp/corefcn/utils.cc, libinterp/corefcn/variables.cc,
libinterp/corefcn/variables.h, libinterp/corefcn/xdiv.cc,
libinterp/corefcn/xdiv.h, libinterp/corefcn/xnorm.h, libinterp/corefcn/xpow.cc,
libinterp/corefcn/xpow.h, libinterp/corefcn/zfstream.cc,
libinterp/corefcn/zfstream.h, libinterp/dldfcn/__delaunayn__.cc,
libinterp/dldfcn/__dsearchn__.cc, libinterp/dldfcn/__eigs__.cc,
libinterp/dldfcn/__fltk_uigetfile__.cc, libinterp/dldfcn/__glpk__.cc,
libinterp/dldfcn/__init_fltk__.cc, libinterp/dldfcn/__init_gnuplot__.cc,
libinterp/dldfcn/__magick_read__.cc, libinterp/dldfcn/__voronoi__.cc,
libinterp/dldfcn/amd.cc, libinterp/dldfcn/ccolamd.cc, libinterp/dldfcn/chol.cc,
libinterp/dldfcn/colamd.cc, libinterp/dldfcn/convhulln.cc,
libinterp/dldfcn/dmperm.cc, libinterp/dldfcn/fftw.cc, libinterp/dldfcn/qr.cc,
libinterp/dldfcn/symbfact.cc, libinterp/dldfcn/symrcm.cc,
libinterp/dldfcn/tsearch.cc, libinterp/octave-value/ov-base-diag.cc,
libinterp/octave-value/ov-base-diag.h, libinterp/octave-value/ov-base-int.cc,
libinterp/octave-value/ov-base-int.h, libinterp/octave-value/ov-base-mat.h,
libinterp/octave-value/ov-base-scalar.cc,
libinterp/octave-value/ov-base-scalar.h,
libinterp/octave-value/ov-base-sparse.cc,
libinterp/octave-value/ov-base-sparse.h, libinterp/octave-value/ov-base.cc,
libinterp/octave-value/ov-base.h, libinterp/octave-value/ov-bool-mat.cc,
libinterp/octave-value/ov-bool-mat.h, libinterp/octave-value/ov-bool-sparse.cc,
libinterp/octave-value/ov-bool-sparse.h, libinterp/octave-value/ov-bool.cc,
libinterp/octave-value/ov-bool.h, libinterp/octave-value/ov-builtin.cc,
libinterp/octave-value/ov-builtin.h, libinterp/octave-value/ov-cell.cc,
libinterp/octave-value/ov-cell.h, libinterp/octave-value/ov-ch-mat.cc,
libinterp/octave-value/ov-ch-mat.h, libinterp/octave-value/ov-class.cc,
libinterp/octave-value/ov-class.h, libinterp/octave-value/ov-colon.h,
libinterp/octave-value/ov-complex.cc, libinterp/octave-value/ov-complex.h,
libinterp/octave-value/ov-cx-diag.cc, libinterp/octave-value/ov-cx-diag.h,
libinterp/octave-value/ov-cx-mat.cc, libinterp/octave-value/ov-cx-mat.h,
libinterp/octave-value/ov-cx-sparse.cc, libinterp/octave-value/ov-cx-sparse.h,
libinterp/octave-value/ov-dld-fcn.h, libinterp/octave-value/ov-fcn-handle.cc,
libinterp/octave-value/ov-fcn-handle.h,
libinterp/octave-value/ov-fcn-inline.cc,
libinterp/octave-value/ov-fcn-inline.h, libinterp/octave-value/ov-fcn.h,
libinterp/octave-value/ov-float.cc, libinterp/octave-value/ov-float.h,
libinterp/octave-value/ov-flt-complex.cc,
libinterp/octave-value/ov-flt-complex.h,
libinterp/octave-value/ov-flt-cx-diag.cc,
libinterp/octave-value/ov-flt-cx-diag.h,
libinterp/octave-value/ov-flt-cx-mat.cc,
libinterp/octave-value/ov-flt-cx-mat.h,
libinterp/octave-value/ov-flt-re-diag.cc,
libinterp/octave-value/ov-flt-re-diag.h,
libinterp/octave-value/ov-flt-re-mat.cc,
libinterp/octave-value/ov-flt-re-mat.h, libinterp/octave-value/ov-int16.cc,
libinterp/octave-value/ov-int32.cc, libinterp/octave-value/ov-int64.cc,
libinterp/octave-value/ov-int8.cc, libinterp/octave-value/ov-intx.h,
libinterp/octave-value/ov-java.cc, libinterp/octave-value/ov-lazy-idx.h,
libinterp/octave-value/ov-mex-fcn.cc, libinterp/octave-value/ov-mex-fcn.h,
libinterp/octave-value/ov-null-mat.cc, libinterp/octave-value/ov-null-mat.h,
libinterp/octave-value/ov-oncleanup.cc, libinterp/octave-value/ov-perm.cc,
libinterp/octave-value/ov-perm.h, libinterp/octave-value/ov-range.cc,
libinterp/octave-value/ov-range.h, libinterp/octave-value/ov-re-diag.cc,
libinterp/octave-value/ov-re-diag.h, libinterp/octave-value/ov-re-mat.cc,
libinterp/octave-value/ov-re-mat.h, libinterp/octave-value/ov-re-sparse.cc,
libinterp/octave-value/ov-re-sparse.h, libinterp/octave-value/ov-scalar.cc,
libinterp/octave-value/ov-scalar.h, libinterp/octave-value/ov-str-mat.cc,
libinterp/octave-value/ov-str-mat.h, libinterp/octave-value/ov-struct.cc,
libinterp/octave-value/ov-struct.h, libinterp/octave-value/ov-type-conv.h,
libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov-typeinfo.h,
libinterp/octave-value/ov-uint16.cc, libinterp/octave-value/ov-uint32.cc,
libinterp/octave-value/ov-uint64.cc, libinterp/octave-value/ov-uint8.cc,
libinterp/octave-value/ov-usr-fcn.cc, libinterp/octave-value/ov-usr-fcn.h,
libinterp/octave-value/ov.cc, libinterp/octave-value/ov.h, libinterp/octave.cc,
libinterp/operators/op-b-bm.cc, libinterp/operators/op-b-sbm.cc,
libinterp/operators/op-bm-b.cc, libinterp/operators/op-bm-bm.cc,
libinterp/operators/op-cdm-cdm.cc, libinterp/operators/op-chm.cc,
libinterp/operators/op-class.cc, libinterp/operators/op-cm-cm.cc,
libinterp/operators/op-cm-cs.cc, libinterp/operators/op-cm-s.cc,
libinterp/operators/op-cm-scm.cc, libinterp/operators/op-cm-sm.cc,
libinterp/operators/op-cs-cm.cc, libinterp/operators/op-cs-cs.cc,
libinterp/operators/op-cs-scm.cc, libinterp/operators/op-cs-sm.cc,
libinterp/operators/op-dm-dm.cc, libinterp/operators/op-dm-scm.cc,
libinterp/operators/op-double-conv.cc, libinterp/operators/op-fcdm-fcdm.cc,
libinterp/operators/op-fcm-fcm.cc, libinterp/operators/op-fcm-fcs.cc,
libinterp/operators/op-fcm-fm.cc, libinterp/operators/op-fcm-fs.cc,
libinterp/operators/op-fcs-fcm.cc, libinterp/operators/op-fcs-fcs.cc,
libinterp/operators/op-fcs-fm.cc, libinterp/operators/op-fcs-fs.cc,
libinterp/operators/op-fdm-fdm.cc, libinterp/operators/op-float-conv.cc,
libinterp/operators/op-fm-fcm.cc, libinterp/operators/op-fm-fcs.cc,
libinterp/operators/op-fm-fm.cc, libinterp/operators/op-fm-fs.cc,
libinterp/operators/op-fs-fcm.cc, libinterp/operators/op-fs-fcs.cc,
libinterp/operators/op-fs-fm.cc, libinterp/operators/op-fs-fs.cc,
libinterp/operators/op-m-cm.cc, libinterp/operators/op-m-cs.cc,
libinterp/operators/op-m-m.cc, libinterp/operators/op-m-s.cc,
libinterp/operators/op-m-scm.cc, libinterp/operators/op-m-sm.cc,
libinterp/operators/op-pm-scm.cc, libinterp/operators/op-range.cc,
libinterp/operators/op-s-cm.cc, libinterp/operators/op-s-cs.cc,
libinterp/operators/op-s-scm.cc, libinterp/operators/op-sbm-b.cc,
libinterp/operators/op-sbm-bm.cc, libinterp/operators/op-sbm-sbm.cc,
libinterp/operators/op-scm-cm.cc, libinterp/operators/op-scm-cs.cc,
libinterp/operators/op-scm-m.cc, libinterp/operators/op-scm-s.cc,
libinterp/operators/op-scm-scm.cc, libinterp/operators/op-scm-sm.cc,
libinterp/operators/op-sm-cm.cc, libinterp/operators/op-sm-m.cc,
libinterp/operators/op-sm-s.cc, libinterp/operators/op-sm-scm.cc,
libinterp/operators/op-sm-sm.cc, libinterp/operators/op-str-m.cc,
libinterp/operators/op-str-s.cc, libinterp/operators/op-str-str.cc,
libinterp/operators/ops.h, libinterp/parse-tree/lex.h,
libinterp/parse-tree/parse.h, libinterp/parse-tree/pt-arg-list.cc,
libinterp/parse-tree/pt-arg-list.h, libinterp/parse-tree/pt-assign.cc,
libinterp/parse-tree/pt-assign.h, libinterp/parse-tree/pt-binop.cc,
libinterp/parse-tree/pt-binop.h, libinterp/parse-tree/pt-bp.h,
libinterp/parse-tree/pt-cbinop.cc, libinterp/parse-tree/pt-check.cc,
libinterp/parse-tree/pt-colon.cc, libinterp/parse-tree/pt-colon.h,
libinterp/parse-tree/pt-const.cc, libinterp/parse-tree/pt-decl.cc,
libinterp/parse-tree/pt-decl.h, libinterp/parse-tree/pt-eval.cc,
libinterp/parse-tree/pt-except.h, libinterp/parse-tree/pt-exp.h,
libinterp/parse-tree/pt-fcn-handle.cc, libinterp/parse-tree/pt-id.cc,
libinterp/parse-tree/pt-id.h, libinterp/parse-tree/pt-idx.cc,
libinterp/parse-tree/pt-idx.h, libinterp/parse-tree/pt-loop.h,
libinterp/parse-tree/pt-mat.cc, libinterp/parse-tree/pt-misc.cc,
libinterp/parse-tree/pt-misc.h, libinterp/parse-tree/pt-pr-code.cc,
libinterp/parse-tree/pt-select.h, libinterp/parse-tree/pt-stmt.h,
libinterp/parse-tree/token.h, libinterp/version.cc:
Use GNU style coding conventions for code in libinterp/
author | Rik <rik@octave.org> |
---|---|
date | Mon, 28 Oct 2013 19:51:46 -0700 |
parents | d63878346099 |
children | aacb9da13df6 |
line wrap: on
line diff
--- a/libinterp/dldfcn/__magick_read__.cc Mon Oct 28 21:04:48 2013 -0400 +++ b/libinterp/dldfcn/__magick_read__.cc Mon Oct 28 19:51:46 2013 -0700 @@ -211,12 +211,12 @@ T img = T (dim_vector (nRows, nCols, 1, nFrames)); P* img_fvec = img.fortran_vec (); - const octave_idx_type row_start = region["row_start"]; - const octave_idx_type col_start = region["col_start"]; - const octave_idx_type row_shift = region["row_shift"]; - const octave_idx_type col_shift = region["col_shift"]; - const octave_idx_type row_cache = region["row_cache"]; - const octave_idx_type col_cache = region["col_cache"]; + const octave_idx_type row_start = region["row_start"]; + const octave_idx_type col_start = region["col_start"]; + const octave_idx_type row_shift = region["row_shift"]; + const octave_idx_type col_shift = region["col_shift"]; + const octave_idx_type row_cache = region["row_cache"]; + const octave_idx_type col_cache = region["col_cache"]; // When reading PixelPackets from the Image Pixel Cache, they come in // row major order. So we keep moving back and forth there so we can @@ -242,7 +242,7 @@ } retval(0) = octave_value (img); -// Only bother reading the colormap if it was requested as output. + // Only bother reading the colormap if it was requested as output. if (nargout > 1) { // In theory, it should be possible for each frame of an image to @@ -303,12 +303,12 @@ // reading to get information about the image. const octave_idx_type def_elem = frameidx(0); - const octave_idx_type row_start = region["row_start"]; - const octave_idx_type col_start = region["col_start"]; - const octave_idx_type row_shift = region["row_shift"]; - const octave_idx_type col_shift = region["col_shift"]; - const octave_idx_type row_cache = region["row_cache"]; - const octave_idx_type col_cache = region["col_cache"]; + const octave_idx_type row_start = region["row_start"]; + const octave_idx_type col_start = region["col_start"]; + const octave_idx_type row_shift = region["row_shift"]; + const octave_idx_type col_shift = region["col_shift"]; + const octave_idx_type row_cache = region["row_cache"]; + const octave_idx_type col_cache = region["col_cache"]; // GraphicsMagick (GM) keeps the image values in memory using whatever // QuantumDepth it was built with independently of the original image @@ -362,7 +362,9 @@ // Grayscale + Alpha = 4 // We won't bother with case 3 (palette) since those should be // read by the function to read indexed images - const std::string type_str = imvec[0].attribute ("PNG:IHDR.color-type-orig"); + const std::string type_str + = imvec[0].attribute ("PNG:IHDR.color-type-orig"); + if (type_str == "0") type = Magick::GrayscaleType; else if (type_str == "2") @@ -506,8 +508,8 @@ break; } - case Magick::PaletteMatteType: // Indexed color (palette) image with opacity - case Magick::TrueColorMatteType: // Truecolor image with opacity + case Magick::PaletteMatteType: // Indexed color image with opacity + case Magick::TrueColorMatteType: // Truecolor image with opacity { img = T (dim_vector (nRows, nCols, 3, nFrames)); T alpha (dim_vector (nRows, nCols, 1, nFrames)); @@ -547,7 +549,7 @@ break; } - case Magick::ColorSeparationType: // Cyan/Yellow/Magenta/Black (CYMK) image + case Magick::ColorSeparationType: // Cyan/Magenta/Yellow/Black (CMYK) image { img = T (dim_vector (nRows, nCols, 4, nFrames)); P *img_fvec = img.fortran_vec (); @@ -676,7 +678,8 @@ const char *static_locale = setlocale (LC_ALL, NULL); const std::string locale (static_locale); - const std::string program_name = octave_env::get_program_invocation_name (); + const std::string program_name + = octave_env::get_program_invocation_name (); Magick::InitializeMagick (program_name.c_str ()); // Restore locale from before GraphicsMagick initialisation @@ -692,7 +695,7 @@ #endif DEFUN_DLD (__magick_read__, args, nargout, - "-*- texinfo -*-\n\ + "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{img}, @var{map}, @var{alpha}] =} __magick_read__ (@var{fname}, @var{options})\n\ Read image with GraphicsMagick or ImageMagick.\n\ \n\ @@ -854,15 +857,15 @@ img.depth (bitdepth); switch (type) { - case Magick::GrayscaleMatteType: - case Magick::TrueColorMatteType: - case Magick::ColorSeparationMatteType: - case Magick::PaletteMatteType: - img.matte (true); - break; + case Magick::GrayscaleMatteType: + case Magick::TrueColorMatteType: + case Magick::ColorSeparationMatteType: + case Magick::PaletteMatteType: + img.matte (true); + break; - default: - img.matte (false); + default: + img.matte (false); } return img; @@ -914,9 +917,9 @@ // values (no indexes), then set the image as PseudoClass and GM // would create a colormap for us. However, we wouldn't have control // over the order of that colormap. And that's why we set both. - Magick::PixelPacket* pix = m_img.getPixels (0, 0, nCols, nRows); - Magick::IndexPacket* ind = m_img.getIndexes (); - const P* img_fvec = img.fortran_vec (); + Magick::PixelPacket* pix = m_img.getPixels (0, 0, nCols, nRows); + Magick::IndexPacket* ind = m_img.getIndexes (); + const P* img_fvec = img.fortran_vec (); octave_idx_type GM_idx = 0; for (octave_idx_type column = 0; column < nCols; column++) @@ -988,11 +991,11 @@ const T& img, const T& alpha) { typedef typename T::element_type P; - const octave_idx_type channels = img.ndims () < 3 ? 1 : img.dims ()(2); - const octave_idx_type nFrames = img.ndims () < 4 ? 1 : img.dims ()(3); - const octave_idx_type nRows = img.rows (); - const octave_idx_type nCols = img.columns (); - const octave_idx_type bitdepth = bitdepth_from_class<T> (); + const octave_idx_type channels = img.ndims () < 3 ? 1 : img.dims ()(2); + const octave_idx_type nFrames = img.ndims () < 4 ? 1 : img.dims ()(3); + const octave_idx_type nRows = img.rows (); + const octave_idx_type nCols = img.columns (); + const octave_idx_type bitdepth = bitdepth_from_class<T> (); Magick::ImageType type; const bool has_alpha = ! alpha.is_empty (); @@ -1034,7 +1037,8 @@ // From GM documentation: // Color arguments are must be scaled to fit the Quantum size according to // the range of MaxRGB - const double divisor = static_cast<double>((uint64_t (1) << bitdepth) - 1) / MaxRGB; + const double divisor = static_cast<double>((uint64_t (1) << bitdepth) - 1) + / MaxRGB; const P *img_fvec = img.fortran_vec (); const P *a_fvec = alpha.fortran_vec (); @@ -1277,7 +1281,7 @@ #endif DEFUN_DLD (__magick_write__, args, , - "-*- texinfo -*-\n\ + "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __magick_write__ (@var{fname}, @var{fmt}, @var{img}, @var{map}, @var{options})\n\ Write image with GraphicsMagick or ImageMagick.\n\ \n\ @@ -1345,8 +1349,10 @@ uint32NDArray clip_alpha; if (img.is_single_type ()) { - clip_img = img_float2uint<FloatNDArray> (img.float_array_value ()); - clip_alpha = img_float2uint<FloatNDArray> (alpha.float_array_value ()); + clip_img = img_float2uint<FloatNDArray> + (img.float_array_value ()); + clip_alpha = img_float2uint<FloatNDArray> + (alpha.float_array_value ()); } else { @@ -1394,7 +1400,7 @@ std::vector<Magick::Image> ini_imvec; read_file (filename, ini_imvec); if (error_state) - return retval; + return retval; if (ini_imvec.size () > 0) { ini_imvec.insert (ini_imvec.end (), imvec.begin (), imvec.end ()); @@ -1420,7 +1426,7 @@ // this, we need to read the image once for imfinfo to set defaults (which is // done in Octave language), and then again for the actual reading. DEFUN_DLD (__magick_ping__, args, , - "-*- texinfo -*-\n\ + "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __magick_ping__ (@var{fname}, @var{idx})\n\ Ping image information with GraphicsMagick or ImageMagick.\n\ \n\ @@ -1480,24 +1486,24 @@ { switch (magick) { - case Magick::NoCompression: - return octave_value ("none"); - case Magick::BZipCompression: - return octave_value ("bzip"); - case Magick::FaxCompression: - return octave_value ("fax3"); - case Magick::Group4Compression: - return octave_value ("fax4"); - case Magick::JPEGCompression: - return octave_value ("jpeg"); - case Magick::LZWCompression: - return octave_value ("lzw"); - case Magick::RLECompression: - // This is named "rle" for the HDF, but the same thing is named - // "ccitt" and "PackBits" for binary and non-binary images in TIFF. - return octave_value ("rle"); - case Magick::ZipCompression: - return octave_value ("deflate"); + case Magick::NoCompression: + return octave_value ("none"); + case Magick::BZipCompression: + return octave_value ("bzip"); + case Magick::FaxCompression: + return octave_value ("fax3"); + case Magick::Group4Compression: + return octave_value ("fax4"); + case Magick::JPEGCompression: + return octave_value ("jpeg"); + case Magick::LZWCompression: + return octave_value ("lzw"); + case Magick::RLECompression: + // This is named "rle" for the HDF, but the same thing is named + // "ccitt" and "PackBits" for binary and non-binary images in TIFF. + return octave_value ("rle"); + case Magick::ZipCompression: + return octave_value ("deflate"); // The following are present only in recent versions of GraphicsMagick. // At the moment the only use of this would be to have imfinfo report @@ -1505,16 +1511,16 @@ // the Compression option for imwrite in which case a macro in // configure.ac will have to check for their presence of this. // See bug #39913 -// case Magick::LZMACompression: -// return octave_value ("lzma"); -// case Magick::JPEG2000Compression: -// return octave_value ("jpeg2000"); -// case Magick::JBIG1Compression: -// return octave_value ("jbig1"); -// case Magick::JBIG2Compression: -// return octave_value ("jbig2"); - default: - return octave_value ("undefined"); + // case Magick::LZMACompression: + // return octave_value ("lzma"); + // case Magick::JPEG2000Compression: + // return octave_value ("jpeg2000"); + // case Magick::JBIG1Compression: + // return octave_value ("jbig1"); + // case Magick::JBIG2Compression: + // return octave_value ("jbig2"); + default: + return octave_value ("undefined"); } } @@ -1523,12 +1529,12 @@ { switch (magick) { - case Magick::LSBEndian: - return octave_value ("little-endian"); - case Magick::MSBEndian: - return octave_value ("big-endian"); - default: - return octave_value ("undefined"); + case Magick::LSBEndian: + return octave_value ("little-endian"); + case Magick::MSBEndian: + return octave_value ("big-endian"); + default: + return octave_value ("undefined"); } } @@ -1538,24 +1544,24 @@ switch (magick) { // Values come from the TIFF6 spec - case Magick::TopLeftOrientation: - return octave_value (1); - case Magick::TopRightOrientation: - return octave_value (2); - case Magick::BottomRightOrientation: - return octave_value (3); - case Magick::BottomLeftOrientation: - return octave_value (4); - case Magick::LeftTopOrientation: - return octave_value (5); - case Magick::RightTopOrientation: - return octave_value (6); - case Magick::RightBottomOrientation: - return octave_value (7); - case Magick::LeftBottomOrientation: - return octave_value (8); - default: - return octave_value (1); + case Magick::TopLeftOrientation: + return octave_value (1); + case Magick::TopRightOrientation: + return octave_value (2); + case Magick::BottomRightOrientation: + return octave_value (3); + case Magick::BottomLeftOrientation: + return octave_value (4); + case Magick::LeftTopOrientation: + return octave_value (5); + case Magick::RightTopOrientation: + return octave_value (6); + case Magick::RightBottomOrientation: + return octave_value (7); + case Magick::LeftBottomOrientation: + return octave_value (8); + default: + return octave_value (1); } } @@ -1564,12 +1570,12 @@ { switch (magick) { - case Magick::PixelsPerInchResolution: - return octave_value ("Inch"); - case Magick::PixelsPerCentimeterResolution: - return octave_value ("Centimeter"); - default: - return octave_value ("undefined"); + case Magick::PixelsPerInchResolution: + return octave_value ("Inch"); + case Magick::PixelsPerCentimeterResolution: + return octave_value ("Centimeter"); + default: + return octave_value ("undefined"); } } @@ -1671,7 +1677,7 @@ #endif DEFUN_DLD (__magick_finfo__, args, , - "-*- texinfo -*-\n\ + "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __magick_finfo__ (@var{fname})\n\ Read image information with GraphicsMagick or ImageMagick.\n\ \n\ @@ -1721,55 +1727,55 @@ // where only the third image has a colormap. static const char *fields[] = - { - // These are fields that must always appear for Matlab. - "Filename", - "FileModDate", - "FileSize", - "Format", - "FormatVersion", - "Width", - "Height", - "BitDepth", - "ColorType", + { + // These are fields that must always appear for Matlab. + "Filename", + "FileModDate", + "FileSize", + "Format", + "FormatVersion", + "Width", + "Height", + "BitDepth", + "ColorType", - // These are format specific or not existent in Matlab. The most - // annoying thing is that Matlab may have different names for the - // same thing in different formats. - "DelayTime", - "DisposalMethod", - "LoopCount", - "ByteOrder", - "Gamma", - "Chromaticities", - "Comment", - "Quality", - "Compression", // same as CompressionType - "Colormap", // same as ColorTable (in PNG) - "Orientation", - "ResolutionUnit", - "XResolution", - "YResolution", - "Software", // sometimes is an Exif tag - "Make", // actually an Exif tag - "Model", // actually an Exif tag - "DateTime", // actually an Exif tag - "ImageDescription", // actually an Exif tag - "Artist", // actually an Exif tag - "Copyright", // actually an Exif tag - "DigitalCamera", - "GPSInfo", - // Notes for the future: GM allows to get many attributes, and even has - // attribute() to obtain arbitrary ones, that may exist in only some - // cases. The following is a list of some methods and into what possible - // Matlab compatible values they may be converted. - // - // colorSpace() -> PhotometricInterpretation - // backgroundColor() -> BackgroundColor - // interlaceType() -> Interlaced, InterlaceType, and PlanarConfiguration - // label() -> Title - 0 - }; + // These are format specific or not existent in Matlab. The most + // annoying thing is that Matlab may have different names for the + // same thing in different formats. + "DelayTime", + "DisposalMethod", + "LoopCount", + "ByteOrder", + "Gamma", + "Chromaticities", + "Comment", + "Quality", + "Compression", // same as CompressionType + "Colormap", // same as ColorTable (in PNG) + "Orientation", + "ResolutionUnit", + "XResolution", + "YResolution", + "Software", // sometimes is an Exif tag + "Make", // actually an Exif tag + "Model", // actually an Exif tag + "DateTime", // actually an Exif tag + "ImageDescription", // actually an Exif tag + "Artist", // actually an Exif tag + "Copyright", // actually an Exif tag + "DigitalCamera", + "GPSInfo", + // Notes for the future: GM allows to get many attributes, and even has + // attribute() to obtain arbitrary ones, that may exist in only some + // cases. The following is a list of some methods and into what possible + // Matlab compatible values they may be converted. + // + // colorSpace() -> PhotometricInterpretation + // backgroundColor() -> BackgroundColor + // interlaceType() -> Interlaced, InterlaceType, and PlanarConfiguration + // label() -> Title + 0 + }; // The one we will return at the end octave_map info (dim_vector (nFrames, 1), string_vector (fields)); @@ -1807,7 +1813,7 @@ info_frame.setfield ("Width", octave_value (img.columns ())); info_frame.setfield ("Height", octave_value (img.rows ())); info_frame.setfield ("BitDepth", - octave_value (get_depth (const_cast<Magick::Image&> (img)))); + octave_value (get_depth (const_cast<Magick::Image&> (img)))); // Stuff related to colormap, image class and type // Because GM is too smart for us... Read the comments in is_indexed() @@ -1817,36 +1823,37 @@ if (is_indexed (img)) { color_type = "indexed"; - cmap = read_maps (const_cast<Magick::Image&> (img))(0).matrix_value (); + cmap = + read_maps (const_cast<Magick::Image&> (img))(0).matrix_value (); } else { switch (img.type ()) { - case Magick::BilevelType: - case Magick::GrayscaleType: - case Magick::GrayscaleMatteType: - color_type = "grayscale"; - break; + case Magick::BilevelType: + case Magick::GrayscaleType: + case Magick::GrayscaleMatteType: + color_type = "grayscale"; + break; - case Magick::TrueColorType: - case Magick::TrueColorMatteType: - color_type = "truecolor"; - break; + case Magick::TrueColorType: + case Magick::TrueColorMatteType: + color_type = "truecolor"; + break; - case Magick::PaletteType: - case Magick::PaletteMatteType: - // we should never get here or is_indexed needs to be fixed - color_type = "indexed"; - break; + case Magick::PaletteType: + case Magick::PaletteMatteType: + // we should never get here or is_indexed needs to be fixed + color_type = "indexed"; + break; - case Magick::ColorSeparationType: - case Magick::ColorSeparationMatteType: - color_type = "CMYK"; - break; + case Magick::ColorSeparationType: + case Magick::ColorSeparationMatteType: + color_type = "CMYK"; + break; - default: - color_type = "undefined"; + default: + color_type = "undefined"; } } info_frame.setfield ("ColorType", octave_value (color_type)); @@ -1868,22 +1875,23 @@ info_frame.setfield ("Chromaticities", octave_value (chromaticities)); } - info_frame.setfield ("Gamma", octave_value (img.gamma ())); - info_frame.setfield ("XResolution", octave_value (img.xResolution ())); - info_frame.setfield ("YResolution", octave_value (img.yResolution ())); - info_frame.setfield ("DelayTime", octave_value (img.animationDelay ())); - info_frame.setfield ("LoopCount", octave_value (img.animationIterations ())); - info_frame.setfield ("Quality", octave_value (img.quality ())); - info_frame.setfield ("Comment", octave_value (img.comment ())); + info_frame.setfield ("Gamma", octave_value (img.gamma ())); + info_frame.setfield ("XResolution", octave_value (img.xResolution ())); + info_frame.setfield ("YResolution", octave_value (img.yResolution ())); + info_frame.setfield ("DelayTime", octave_value (img.animationDelay ())); + info_frame.setfield ("LoopCount", + octave_value (img.animationIterations ())); + info_frame.setfield ("Quality", octave_value (img.quality ())); + info_frame.setfield ("Comment", octave_value (img.comment ())); info_frame.setfield ("Compression", - magick_to_octave_value (img.compressType ())); + magick_to_octave_value (img.compressType ())); info_frame.setfield ("Orientation", - magick_to_octave_value (img.orientation ())); + magick_to_octave_value (img.orientation ())); info_frame.setfield ("ResolutionUnit", - magick_to_octave_value (img.resolutionUnits ())); + magick_to_octave_value (img.resolutionUnits ())); info_frame.setfield ("ByteOrder", - magick_to_octave_value (img.endian ())); + magick_to_octave_value (img.endian ())); // It is not possible to know if there's an Exif field so we just // check for the Exif Version value. If it does exists, then we @@ -1898,7 +1906,8 @@ // exists outside the Exif tag. // See Section 4.6.4, table 4, page 28 of Exif specs version 2.3 // (CIPA DC- 008-Translation- 2010) - static const char *base_exif_str_fields[] = { + static const char *base_exif_str_fields[] = + { "DateTime", "ImageDescription", "Make", @@ -1913,7 +1922,7 @@ for (octave_idx_type field = 0; field < n_base_exif_str; field++) { info_frame.setfield (base_exif_str[field], - octave_value (cimg.attribute (base_exif_str[field]))); + octave_value (cimg.attribute (base_exif_str[field]))); fill_exif (info_frame, cimg, base_exif_str[field]); } @@ -1925,7 +1934,8 @@ // of Exif specs version 2.3 (CIPA DC- 008-Translation- 2010) // Listed on the Exif specs as being of type ASCII. - static const char *exif_str_fields[] = { + static const char *exif_str_fields[] = + { "RelatedSoundFile", "DateTimeOriginal", "DateTimeDigitized", @@ -1952,7 +1962,8 @@ fill_exif (camera, cimg, exif_str[field]); // Listed on the Exif specs as being of type SHORT or LONG. - static const char *exif_int_fields[] = { + static const char *exif_int_fields[] = + { "ColorSpace", "ExifImageWidth", // PixelXDimension (CPixelXDimension in Matlab) "ExifImageHeight", // PixelYDimension (CPixelYDimension in Matlab) @@ -1995,7 +2006,8 @@ fill_exif_ints (camera, cimg, exif_int[field]); // Listed as RATIONAL or SRATIONAL - static const char *exif_float_fields[] = { + static const char *exif_float_fields[] = + { "Gamma", "CompressedBitsPerPixel", "ExposureTime", @@ -2030,7 +2042,8 @@ // See Section 4.6.6, table 15 on page 68 of Exif specs // version 2.3 (CIPA DC- 008-Translation- 2010) - static const char *gps_str_fields[] = { + static const char *gps_str_fields[] = + { "GPSLatitudeRef", "GPSLongitudeRef", "GPSAltitudeRef", @@ -2053,7 +2066,8 @@ for (octave_idx_type field = 0; field < n_gps_str; field++) fill_exif (gps, cimg, gps_str[field]); - static const char *gps_int_fields[] = { + static const char *gps_int_fields[] = + { "GPSDifferential", 0 }; @@ -2062,7 +2076,8 @@ for (octave_idx_type field = 0; field < n_gps_int; field++) fill_exif_ints (gps, cimg, gps_int[field]); - static const char *gps_float_fields[] = { + static const char *gps_float_fields[] = + { "GPSAltitude", "GPSDOP", "GPSSpeed", @@ -2117,7 +2132,7 @@ */ DEFUN_DLD (__magick_formats__, args, , - "-*- texinfo -*-\n\ + "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __magick_imformats__ (@var{formats})\n\ Fill formats info with GraphicsMagick CoderInfo.\n\ \n\