/* Copyright (C) 2017-2020, Dirk Krause SPDX-License-Identifier: BSD-3-Clause */ /* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: dk4bif.ctr */ /** @file dk4bif.c The dk4bif module. */ #line 371 "dk4bif.ctr" #ifndef DK4CONF_H_INCLUDED #include "dk4conf.h" #endif #ifndef DK4MEM_H_INCLUDED #include "dk4mem.h" #endif #ifndef DK4BIF_H_INCLUDED #include "dk4bif.h" #endif #ifndef BIF_H_INCLUDED #include "bif.h" #endif #ifndef DK4PATHD_H_INCLUDED #include "dk4pathd.h" #endif #ifndef DK4STRD_H_INCLUDED #include "dk4strd.h" #endif #ifndef DK4FOPD_H_INCLUDED #include "dk4fopd.h" #endif #if DK4_HAVE_ASSERT_H #ifndef ASSERT_H_INCLUDED #include #define ASSERT_H_INCLUDED 1 #endif #endif #line 409 "dk4bif.ctr" /** File name suffixes for bitmap image files. */ static const dkChar * const dk4bif_suffixes[] = { /* 0 */ dkT(".png"), /* 1 */ dkT(".jpg"), /* 2 */ dkT(".jpeg"), /* 3 */ dkT(".tif"), /* 4 */ dkT(".tiff"), /* 5 */ dkT(".pbm"), /* 6 */ dkT(".pgm"), /* 7 */ dkT(".ppm"), /* 8 */ dkT(".pnm"), /* 9 */ dkT(".pam"), NULL #line 426 "dk4bif.ctr" }; /** Keywords used by the module. */ static const dkChar * const dk4bif_kw[] = { /* 0 */ dkT("rb"), NULL #line 438 "dk4bif.ctr" }; void dk4bif_frame_close( dk4_bif_frame_t *frptr, int imgtype ) { #line 449 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != frptr); #endif if (NULL != frptr) { if (NULL != frptr->tsdata) { switch (imgtype) { case DK4_BIF_TYPE_PNG : { #if DK4_HAVE_PNG_H dk4bifpng_nc_release_per_frame_data(frptr->tsdata); #else dk4mem_release(frptr->tsdata); #endif } break; case DK4_BIF_TYPE_JPEG : { #if DK4_HAVE_JPEGLIB_H dk4bifjpeg_nc_release_per_frame_data(frptr->tsdata, frptr); #else dk4mem_release(frptr->tsdata); #endif } break; case DK4_BIF_TYPE_TIFF : { #if DK4_HAVE_TIFF_H dk4biftiff_nc_release_per_frame_data(frptr->tsdata); #else dk4mem_release(frptr->tsdata); #endif } break; case DK4_BIF_TYPE_NETPBM : { dk4bifnetpbm_nc_release_per_frame_data(frptr->tsdata); } break; default : { dk4mem_release(frptr->tsdata); } break; } frptr->tsdata = NULL; } dk4mem_free(frptr); } #line 488 "dk4bif.ctr" } void dk4bif_close( dk4_bif_t *bif ) { dk4_bif_frame_t *frptr; /* Traverse all frames */ #line 499 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); #endif if (NULL != bif) { if (NULL != bif->s_frames) { if (NULL != bif->i_frames) { dk4sto_it_reset(bif->i_frames); do { frptr = (dk4_bif_frame_t *)dk4sto_it_next(bif->i_frames); if (NULL != frptr) { dk4bif_frame_close(frptr, bif->imgtype); } } while(NULL != frptr); dk4sto_it_close(bif->i_frames); bif->i_frames = NULL; } dk4sto_close(bif->s_frames); bif->s_frames = NULL; } bif->cf = NULL; if (NULL != bif->tsdata) { switch (bif->imgtype) { case DK4_BIF_TYPE_PNG : { #if DK4_HAVE_PNG_H dk4bifpng_nc_release_per_file_data(bif->tsdata); #else dk4mem_release(bif->tsdata); #endif } break; case DK4_BIF_TYPE_JPEG : { #if 0 /* No per-file data stored for JPEG file */ #if DK4_HAVE_JPEGLIB_H dk4bifjpeg_nc_release_per_file_data(bif->tsdata); #else dk4mem_release(bif->tsdata); #endif #endif } break; case DK4_BIF_TYPE_TIFF : { #if 0 /* No per-file data stored for TIFF */ #if DK4_HAVE_TIFF_H dk4biftiff_nc_release_per_file_data(bif->tsdata); #else dk4mem_release(bif->tsdata); #endif #endif } break; case DK4_BIF_TYPE_NETPBM : { /* No per-file data stored for NetPBM. */ } break; default : { dk4mem_release(bif->tsdata); } break; } } dk4mem_release(bif->filename); bif->n_frames = 0; bif->imgtype = 0; dk4mem_free(bif); } #line 564 "dk4bif.ctr" } int dk4bif_type_for_suffix( dkChar const *fn ) { const dkChar *sptr; /* Pointer to dot of file name suffix */ int back = -1; #line 576 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != fn); #endif if (NULL != fn) { sptr = dk4path_get_suffix(fn, NULL); #line 582 "dk4bif.ctr" if (NULL != sptr) { switch (dk4str_array_index(dk4bif_suffixes, sptr, 0)) { case 0 : { back = DK4_BIF_TYPE_PNG; } break; case 1 : case 2 : { back = DK4_BIF_TYPE_JPEG; } break; case 3 : case 4 : { back = DK4_BIF_TYPE_TIFF; } break; case 5 : case 6 : case 7 : case 8 : case 9 : { back = DK4_BIF_TYPE_NETPBM; } break; } } } #line 600 "dk4bif.ctr" return back; } dk4_bif_t * dk4bif_open_file( FILE *fipo, dkChar const *fn, int ty, int honly, dk4_cs_conv_ctx_t const *pcsctx, dk4_er_t *erp ) { dk4_bif_png_clobbered_t pngcp; /* Clobber protected variables */ dk4_bif_jpg_clobbered_t jpgcp; /* Clobber protected variables */ dk4_bif_t *back = NULL; #line 619 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != fipo); #endif if (NULL == fipo) { dk4error_set_simple_error_code(erp, DK4_E_INVALID_ARGUMENTS); goto finished; } switch (ty) { case DK4_BIF_TYPE_PNG : { #if DK4_HAVE_PNG_H pngcp.back = NULL; pngcp.pfrpng = NULL; pngcp.ok = 0; back = dk4bifpng_nc_open_file(fipo, fn, honly, pcsctx, &pngcp, erp); #else dk4error_set_simple_error_code(erp, DK4_E_NOT_SUPPORTED); #endif } break; case DK4_BIF_TYPE_JPEG : { #if DK4_HAVE_JPEGLIB_H jpgcp.st = 0; jpgcp.ok = 0; jpgcp.back = NULL; back = dk4bifjpeg_nc_open_file(fipo,fn,honly,pcsctx,&jpgcp,erp); #else dk4error_set_simple_error_code(erp, DK4_E_NOT_SUPPORTED); #endif } break; case DK4_BIF_TYPE_NETPBM : { #line 649 "dk4bif.ctr" back = dk4bifnetpbm_nc_open_file(fipo, fn, honly, pcsctx, erp); #line 651 "dk4bif.ctr" } break; default : { dk4error_set_simple_error_code(erp, DK4_E_INVALID_ARGUMENTS); } break; } finished: #line 658 "dk4bif.ctr" return back; } dk4_bif_t * dk4bif_open_type( dkChar const *fn, int ty, int honly, dk4_cs_conv_ctx_t const *pcsctx, dk4_er_t *erp ) { FILE *inputfile; /* Input file */ dk4_bif_t *back = NULL; int tests = DK4_FOPEN_SC_IS_REGULAR; /* Tests for fopen */ #line 676 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != fn); #endif if (NULL == fn) { dk4error_set_simple_error_code(erp, DK4_E_INVALID_ARGUMENTS); goto finished; } if ((DK4_BIF_TYPE_MIN > ty) || (DK4_BIF_TYPE_MAX < ty)) { dk4error_set_simple_error_code(erp, DK4_E_INVALID_ARGUMENTS); goto finished; } switch (ty) { case DK4_BIF_TYPE_PNG : case DK4_BIF_TYPE_JPEG : case DK4_BIF_TYPE_NETPBM : { inputfile = dk4fopen(fn, dk4bif_kw[0], tests, erp); if (NULL != inputfile) { back = dk4bif_open_file(inputfile, fn, ty, honly, pcsctx, erp); fclose(inputfile); } } break; case DK4_BIF_TYPE_TIFF : { #if DK4_HAVE_TIFF_H back = dk4biftiff_nc_open_type(fn, pcsctx, erp); #else dk4error_set_simple_error_code(erp, DK4_E_NOT_SUPPORTED); #endif } break; } finished: #line 707 "dk4bif.ctr" return back; } dk4_bif_t * dk4bif_open( dkChar const *fn, int hdronly, dk4_cs_conv_ctx_t const *pcsctx, dk4_er_t *erp ) { dk4_bif_t *back = NULL; int tp; /* Bitmap image file type */ #line 723 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != fn); #endif if (NULL != fn) { tp = dk4bif_type_for_suffix(fn); if ((DK4_BIF_TYPE_MIN <= tp) && (DK4_BIF_TYPE_MAX >= tp)) { back = dk4bif_open_type(fn, tp, hdronly, pcsctx, erp); } else { dk4error_set_simple_error_code(erp, DK4_E_SYNTAX); } } else { dk4error_set_simple_error_code(erp, DK4_E_INVALID_ARGUMENTS); } #line 739 "dk4bif.ctr" return back; } size_t dk4bif_get_number_of_frames( dk4_bif_t const *bif ) { size_t back = 0; #line 751 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); #endif if (NULL != bif) { back = bif->n_frames; } #line 758 "dk4bif.ctr" return back; } int dk4bif_set_current_frame( dk4_bif_t *bif, size_t fno ) { int back = 0; #line 771 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); #endif /* Check arguments */ if (NULL == bif) { goto finished; } if ((NULL == bif->s_frames) || (NULL == bif->i_frames)) { goto finished; } /* Retrieve frames from storage iterator until found */ dk4sto_it_reset(bif->i_frames); do { bif->cf = (dk4_bif_frame_t *)dk4sto_it_next(bif->i_frames); if (NULL == bif->cf) { goto finished; } } while(0 < fno--); if (NULL != bif->cf) { back = 1; } /* Return */ finished: #line 798 "dk4bif.ctr" return back; } dk4_px_bit_depth_t dk4bif_get_original_bit_depth( dk4_bif_t const *bif ) { dk4_px_bit_depth_t back = 0; #line 810 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); #endif /* Check arguments */ if (NULL == bif) { goto finished; } if (NULL == bif->cf) { goto finished; } /* Retrieve bit depth from current frame */ back = (bif->cf)->l_bdepth; /* Return */ finished: #line 830 "dk4bif.ctr" return back; } int dk4bif_get_color_space( dk4_bif_t const *bif ) { int back = -1; #line 842 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); #endif /* Check arguments */ if (NULL == bif) { goto finished; } if (NULL == bif->cf) { goto finished; } /* Retrieve library color space from current frame */ back = (bif->cf)->l_cs; /* Return */ finished: #line 862 "dk4bif.ctr" return back; } int dk4bif_get_file_color_space( dk4_bif_t const *bif ) { int back = -1; #line 874 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); #endif /* Check arguments */ if (NULL == bif) { goto finished; } if (NULL == bif->cf) { goto finished; } /* Retrieve file color space from current frame */ back = (bif->cf)->f_cs; /* Return */ finished: #line 894 "dk4bif.ctr" return back; } int dk4bif_set_output_bit_depth( dk4_bif_t *bif, dk4_px_bit_depth_t bd ) { dk4_bif_frame_t *fptr; /* Traverse all frames in storage */ int back = 0; #line 908 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); #endif /* Check arguments */ if (NULL == bif) { goto finished; } if ((NULL == bif->s_frames) || (NULL == bif->i_frames)) { goto finished; } if (0 != bif->hdronly) { goto finished; } /* Traverse all frames, set required bit depth and resampler in frame */ dk4sto_it_reset(bif->i_frames); do { fptr = (dk4_bif_frame_t *)dk4sto_it_next(bif->i_frames); if (NULL != fptr) { #line 929 "dk4bif.ctr" if (0 != fptr->fmres) { dk4pxres_setup_from_maxval(&(fptr->resampler), fptr->fmrmv, bd); } else { dk4pxres_setup(&(fptr->resampler), fptr->l_bdepth, bd); } fptr->r_bdepth = bd; #line 937 "dk4bif.ctr" #line 938 "dk4bif.ctr" #line 939 "dk4bif.ctr" dk4mem_cpy( &(fptr->bg[0]), &(fptr->bglbd[0]), 4*sizeof(dk4_px_t), NULL ); if ((fptr->l_bdepth != bd) || (0 != fptr->fmres)) { dk4pxres_multiple(&(fptr->bg[0]), 4, &(fptr->resampler)); } #line 946 "dk4bif.ctr" #line 947 "dk4bif.ctr" #line 948 "dk4bif.ctr" } } while (NULL != fptr); /* Indicate success */ back = 1; /* Return */ finished: #line 959 "dk4bif.ctr" return back; } int dk4bif_set_background( dk4_bif_t *bif, dk4_px_t const *bg, size_t szbg, dk4_px_bit_depth_t bd, int force ) { dk4_px_resample_t bgres; /* Resample bg data to required bit depth */ dk4_bif_frame_t *fptr; /* Traverse all frames */ size_t i; /* Current bg component index */ int back = 0; #line 978 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); #endif /* Check arguments */ if ((NULL == bif) || (NULL == bg)) { goto finished; } if ((NULL == bif->s_frames) || (NULL == bif->i_frames)) { goto finished; } if (0 != bif->hdronly) { goto finished; } /* Correct number of background arguments */ if (szbg > 4) { szbg = 4; } /* Traverse all frames, set background in the frames bit depth */ dk4sto_it_reset(bif->i_frames); do { fptr = (dk4_bif_frame_t *)dk4sto_it_next(bif->i_frames); if (NULL != fptr) { if ((0 != force) || (0 == (bif->cf)->hbg)) { if (0 != fptr->fmres) { dk4pxres_setup_to_maxval(&bgres, bd, fptr->fmrmv); } else { dk4pxres_setup(&bgres, bd, (fptr->l_bdepth)); } for (i = 0; i < szbg; i++) { fptr->bg[i] = dk4pxres_get(&bgres, bg[i]); fptr->bglbd[i] = bg[i]; } } } } while (NULL != fptr); /* Indicate success */ back = 1; /* Return */ finished: #line 1027 "dk4bif.ctr" return back; } double dk4bif_get_xres( dk4_bif_t const *bif ) { double back = -1.0; #line 1039 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); #endif if (NULL == bif) { goto finished; } if (NULL == bif->cf) { goto finished; } /* Retrieve x resolution from current frame */ back = (bif->cf)->res_x; /* Return */ finished: #line 1056 "dk4bif.ctr" return back; } double dk4bif_get_yres( dk4_bif_t const *bif ) { double back = -1.0; #line 1068 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); #endif /* Check arguments */ if (NULL == bif) { goto finished; } if (NULL == bif->cf) { goto finished; } /* Retrieve y resolution from current frame */ back = (bif->cf)->res_y; /* Return */ finished: #line 1088 "dk4bif.ctr" return back; } int dk4bif_set_res( dk4_bif_t *bif, double xres, double yres, dk4_er_t *erp ) { int back = 0; #line 1103 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); #endif if ((NULL != bif) && (0.0 < xres) && (0.0 < yres)) { if (NULL != bif->cf) { #line 1108 "dk4bif.ctr" bif->cf->res_x = xres; bif->cf->res_y = yres; back = 1; } else { dk4error_set_simple_error_code(erp, DK4_E_INVALID_ARGUMENTS); } } else { dk4error_set_simple_error_code(erp, DK4_E_INVALID_ARGUMENTS); } #line 1120 "dk4bif.ctr" return back; } dk4_bif_dim_t dk4bif_get_width( dk4_bif_t const *bif ) { dk4_bif_dim_t back = -1L; #line 1132 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); #endif /* Check arguments */ if (NULL == bif) { goto finished; } if (NULL == bif->cf) { goto finished; } /* Retrieve width of current frame */ back = (bif->cf)->dim_x; /* Return */ finished: #line 1152 "dk4bif.ctr" return back; } dk4_bif_dim_t dk4bif_get_height( dk4_bif_t const *bif ) { dk4_bif_dim_t back = -1L; #line 1164 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); #endif /* Check arguments */ if (NULL == bif) { goto finished; } if (NULL == bif->cf) { goto finished; } /* Retrieve width from current frame */ back = (bif->cf)->dim_y; /* Return */ finished: #line 1184 "dk4bif.ctr" return back; } const dk4_cs_conv_ctx_t * dk4bif_get_cs_conv_ctx( dk4_bif_t const *bif ) { const dk4_cs_conv_ctx_t *back = NULL; #line 1197 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); #endif /* Check arguments */ if (NULL == bif) { goto finished; } /* Retrieve address of color space conversion context */ back = &(bif->cs_ctx); /* Return */ finished: #line 1214 "dk4bif.ctr" return back; } void dk4bif_set_cs_conv_ctx( dk4_bif_t *bif, dk4_cs_conv_ctx_t const *pctx ) { #line 1226 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); #endif if ((NULL != bif) && (NULL != pctx)) { DK4_MEMCPY(&(bif->cs_ctx), pctx, sizeof(dk4_cs_conv_ctx_t)); } #line 1233 "dk4bif.ctr" } int dk4bif_nc_get_original_pixel( dk4_px_t *dptr, size_t szdptr, dk4_bif_t const *bif, dk4_bif_dim_t rowno, dk4_bif_dim_t colno ) { int back = 0; #line 1248 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); assert(NULL != dptr); assert(0 < szdptr); #endif switch (bif->imgtype) { case DK4_BIF_TYPE_PNG : { #if DK4_HAVE_PNG_H back = dk4bifpng_nc_get_original_pixel(dptr, bif, rowno, colno); #endif } break; case DK4_BIF_TYPE_JPEG : { #if DK4_HAVE_JPEGLIB_H back = dk4bifjpeg_nc_get_original_pixel( dptr, szdptr, bif, rowno, colno ); #endif } break; case DK4_BIF_TYPE_TIFF : { #if DK4_HAVE_TIFF_H back = dk4biftiff_nc_get_original_pixel(dptr, bif, rowno, colno); #endif } break; case DK4_BIF_TYPE_NETPBM : { back = dk4bifnetpbm_nc_get_original_pixel(dptr, bif, rowno, colno); } break; /* ##### FURTHER IMAGE TYPES HERE */ } #line 1277 "dk4bif.ctr" return back; } #if TRACE_DEBUG static void show_pixel_data( dk4_px_t *dptr, size_t szdptr, int cs ) { size_t i; /* Index of current component to process */ size_t max; /* Number of components in color space */ max = dk4cs_color_space_size(cs); if (max > szdptr) { max = szdptr; } for (i = 0; i < max; i++) { #line 1298 "dk4bif.ctr" } } #endif int dk4bif_nc_get_pixel( dk4_px_t *dptr, size_t szdptr, dk4_bif_t const *bif, dk4_bif_dim_t rowno, dk4_bif_dim_t colno, int cs ) { dk4_px_t tmp[4]; /* Temporary pixel data */ size_t sztmp = DK4_SIZEOF(tmp,dk4_px_t); int back = 0; #line 1318 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); assert(NULL != dptr); assert(0 < szdptr); #endif if ((bif->cf)->l_cs == cs) { #line 1324 "dk4bif.ctr" /* Same color space */ back = dk4bif_nc_get_original_pixel(dptr, szdptr, bif, rowno, colno); #line 1329 "dk4bif.ctr" if (0 != back) { if ( ((bif->cf)->l_bdepth != (bif->cf)->r_bdepth) || (0 != bif->cf->fmres) ) { /* Bit depth correction required */ #line 1338 "dk4bif.ctr" dk4pxres_multiple( dptr, dk4cs_color_space_size(cs), &((bif->cf)->resampler) ); } } #if TRACE_DEBUG else { #line 1345 "dk4bif.ctr" } #endif } else { #line 1349 "dk4bif.ctr" /* Color space conversion required */ back = dk4bif_nc_get_original_pixel(tmp, sztmp, bif, rowno, colno); #line 1354 "dk4bif.ctr" if (0 != back) { if ( ((bif->cf)->l_bdepth != (bif->cf)->r_bdepth) || (0 != bif->cf->fmres) ) { #line 1361 "dk4bif.ctr" /* Bit depth correction required */ if ((bif->cf)->l_bdepth > (bif->cf)->r_bdepth) { #line 1366 "dk4bif.ctr" /* Color space conversion first, bit depth later */ dk4cs_nc_px_convert( dptr, cs, tmp, (bif->cf)->l_cs, &((bif->cf)->bglbd[0]), (dk4_px_t)((bif->cf)->resampler.denom), &(bif->cs_ctx) ); dk4pxres_multiple( dptr, dk4cs_color_space_size(cs), &((bif->cf)->resampler) ); } else { #line 1380 "dk4bif.ctr" /* Bit depth conversion first, color space later */ dk4pxres_multiple( tmp, dk4cs_color_space_size((bif->cf)->l_cs), &((bif->cf)->resampler) ); dk4cs_nc_px_convert( dptr, cs, tmp, (bif->cf)->l_cs, &((bif->cf)->bg[0]), (dk4_px_t)((bif->cf)->resampler.nom), &(bif->cs_ctx) ); } } else { #line 1394 "dk4bif.ctr" /* No bit depth correction, just change color space */ dk4cs_nc_px_convert( dptr, cs, tmp, (bif->cf)->l_cs, &((bif->cf)->bg[0]), (dk4_px_t)((bif->cf)->resampler.denom), &(bif->cs_ctx) ); } } #if TRACE_DEBUG else { #line 1404 "dk4bif.ctr" } #endif } #line 1408 "dk4bif.ctr" return back; } int dk4bif_get_pixel( dk4_px_t *dptr, size_t szdptr, dk4_bif_t const *bif, dk4_bif_dim_t rowno, dk4_bif_dim_t colno, int cs ) { int back = 0; #line 1425 "dk4bif.ctr" #if DK4_USE_ASSERT assert(NULL != bif); assert(NULL != dptr); assert(0 < szdptr); #endif /* Check arguments */ if ((NULL == dptr) || (NULL == bif)) { #line 1434 "dk4bif.ctr" goto finished; } if (0 != bif->hdronly) { #line 1437 "dk4bif.ctr" goto finished; } if (0 == dk4cs_check(cs)) { #line 1440 "dk4bif.ctr" goto finished; } if (szdptr < dk4cs_color_space_size(cs)) { #line 1443 "dk4bif.ctr" goto finished; } if (((dk4_bif_dim_t)0L > rowno) || ((bif->cf)->dim_y <= rowno)) { #line 1446 "dk4bif.ctr" goto finished; } if (((dk4_bif_dim_t)0L > colno) || ((bif->cf)->dim_x <= colno)) { #line 1449 "dk4bif.ctr" goto finished; } back = dk4bif_nc_get_pixel(dptr, szdptr, bif, rowno, colno, cs); #line 1453 "dk4bif.ctr" /* Return, fill default value 0 if there was any problem */ finished: if (0 == back) { if (NULL != dptr) { #line 1459 "dk4bif.ctr" while(0 < szdptr--) { *(dptr++) = 0; } } } #line 1465 "dk4bif.ctr" return back; } int dk4bif_get_image_type( dk4_bif_t const *bif ) { int back = -1; #if DK4_USE_ASSERT assert(NULL != bif); #endif if (NULL != bif) { back = bif->imgtype; } return back; } /* vim: set ai sw=4 ts=4 : */