当前位置: 首页>>代码示例>>C++>>正文


C++ TIFFSetWarningHandler函数代码示例

本文整理汇总了C++中TIFFSetWarningHandler函数的典型用法代码示例。如果您正苦于以下问题:C++ TIFFSetWarningHandler函数的具体用法?C++ TIFFSetWarningHandler怎么用?C++ TIFFSetWarningHandler使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TIFFSetWarningHandler函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dealStack

/*
 * Deal the stacks into separated files and append them.
 */
void dealStack(const fs::path &outdir, const std::string &prefix,
               const fs::path &imgPath,
               const uint16_t nLayer) {
	TIFF *in, *out;
    static uint16_t iLayer = 0;

    // Suppress the warnings.
	TIFFErrorHandler oldhandler = TIFFSetWarningHandler(NULL);

	// Open the file.
	in = TIFFOpen(imgPath.string().c_str(), "r");
	if (in == NULL) {
		std::cerr << "Unable to read " << imgPath.filename() << std::endl;
		return;
	}

    // Identify the read mode.
	static char mode[3] = { 'x', 'b', 0 };
    // Overwrite on the first run, and append for rest of the page.
    mode[0] = (mode[0] == 'x') ? 'w' : 'a';
    mode[1] = (TIFFIsBigEndian(in)) ? 'b' : 'l';

	// Iterate through the directories.
	int iFile = 0;
	do {
        std::string s = genPath(outdir, prefix, iFile);
		out = TIFFOpen(s.c_str(), mode);
        try {
    		if (out == NULL) {
                throw -1;
    		} else if (!cpTiff(in, out, iLayer, nLayer)) {
                throw -2;
    		}
        } catch (int e) {
            if (e == -1) {
                std::cerr << "Unable to create output file" << std::endl;
            } else if (e == -2) {
                std::cerr << "Unable to copy the layer" << std::endl;
            } else {
                std::cerr << "Unknown error" << std::endl;
            }
            TIFFClose(in);
            TIFFClose(out);
            return;
        }
		TIFFClose(out);
		iFile++;
	} while (TIFFReadDirectory(in));

    // Increment the layer variable for next write.
    iLayer++;

	TIFFClose(in);

    // Restore the warning.
	TIFFSetWarningHandler(oldhandler);
}
开发者ID:liuyenting,项目名称:python-tiff-transpose,代码行数:60,代码来源:tiff.cpp

示例2: lock

bool
TIFFInput::seek_subimage (int subimage, int miplevel, ImageSpec &newspec)
{
    if (subimage < 0)       // Illegal
        return false;
    if (m_emulate_mipmap) {
        // Emulating MIPmap?  Pretend one subimage, many MIP levels.
        if (subimage != 0)
            return false;
        subimage = miplevel;
    } else {
        // No MIPmap emulation
        if (miplevel != 0)
            return false;
    }

    if (subimage == m_subimage) {
        // We're already pointing to the right subimage
        newspec = m_spec;
        return true;
    }

    // If we're emulating a MIPmap, only resolution is allowed to change
    // between MIP levels, so if we already have a valid level in m_spec,
    // we don't need to re-parse metadata, it's guaranteed to be the same.
    bool read_meta = !(m_emulate_mipmap && m_tif && m_subimage >= 0);

    if (! m_tif) {
        // Use our own error handler to keep libtiff from spewing to stderr
        lock_guard lock (lasterr_mutex);
        TIFFSetErrorHandler (my_error_handler);
        TIFFSetWarningHandler (my_error_handler);
    }

    if (! m_tif) {
        m_tif = TIFFOpen (m_filename.c_str(), "rm");
        if (m_tif == NULL) {
            error ("Could not open file: %s",
                   lasterr.length() ? lasterr.c_str() : m_filename.c_str());
            return false;
        }
        m_subimage = 0;
    }
    
    m_next_scanline = 0;   // next scanline we'll read
    if (TIFFSetDirectory (m_tif, subimage)) {
        m_subimage = subimage;
        readspec (read_meta);
        newspec = m_spec;
        if (newspec.format == TypeDesc::UNKNOWN) {
            error ("No support for data format of \"%s\"", m_filename.c_str());
            return false;
        }
        return true;
    } else {
        error ("%s", lasterr.length() ? lasterr.c_str() : m_filename.c_str());
        m_subimage = -1;
        return false;
    }
}
开发者ID:amanforindia,项目名称:oiio,代码行数:60,代码来源:tiffinput.cpp

示例3: TIFFSetErrorHandler

Tiio::Reader *Tiio::makeTziReader() {
#ifdef _DEBUG
  TIFFSetErrorHandler(MyErrorHandler);
  TIFFSetWarningHandler(MyWarningHandler);
#endif
  return new TifReader(true);
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:7,代码来源:tiio_tif.cpp

示例4: image_write_tif

void image_write_tif(const char *name, int w, int h, int c, int b, int n, void **p)
{
    TIFF *T = 0;

    TIFFSetWarningHandler(0);

    if ((T = TIFFOpen(name, "w")))
    {
        uint32 k, i, s;

        for (k = 0; k < n; ++k)
        {
            TIFFSetField(T, TIFFTAG_IMAGEWIDTH,      w);
            TIFFSetField(T, TIFFTAG_IMAGELENGTH,     h);
            TIFFSetField(T, TIFFTAG_BITSPERSAMPLE, 8*b);
            TIFFSetField(T, TIFFTAG_SAMPLESPERPIXEL, c);

            TIFFSetField(T, TIFFTAG_PHOTOMETRIC,  PHOTOMETRIC_RGB);
            TIFFSetField(T, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
            TIFFSetField(T, TIFFTAG_ICCPROFILE,   sRGB_icc_len, sRGB_icc);

            if (b == 4)
                TIFFSetField(T, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);

            s = (uint32) TIFFScanlineSize(T);

            for (i = 0; i < h; ++i)
                TIFFWriteScanline(T, (uint8 *) p[k] + (h - i - 1) * s, i, 0);

            TIFFWriteDirectory(T);
        }
        TIFFClose(T);
    }
}
开发者ID:treeffle,项目名称:CSC4356,代码行数:34,代码来源:image.c

示例5: width

// Read 3D image data
unsigned char *						// (OUTPUT) buffer containing the read image data
	iomanager::tiff3D::readData(
	std::string img_path,			// (INPUT) image filepath
	int & img_width,				// (INPUT/OUTPUT) image width  (in pixels)
	int & img_height,				// (INPUT/OUTPUT) image height (in pixels)
	int & img_depth,				// (INPUT/OUTPUT) image depth (in pixels)
	int & img_bytes_x_chan,			// (INPUT/OUTPUT) number of bytes per channel
	int & img_chans,				// (INPUT/OUTPUT) number of channels to be read
	unsigned char *data,			// (INPUT) image data
	int z0,							// (INPUT)	region of interest [x0,x1)[y0,y1)[z0,z1) to be set on the image
	int z1,							// (INPUT)	region of interest [x0,x1)[y0,y1)[z0,z1) to be set on the image
	const std::string & params)		// (INPUT) additional parameters <param1=val, param2=val, ...> 
throw (iom::exception) 
{
	//throw iom::exception(iom::strprintf("not implemented yet"), __iom__current__function__);

	/**/iom::debug(iom::LEV3, iom::strprintf("img_path = %s, img_width = %d, img_height = %d, img_depth = %d, img_bytes_x_chan = %d, img_chans = %d, data = %p, z0 = %d, z1 = %d, params = \"%s\"",
		img_path.c_str(), img_width, img_height, img_depth,	img_bytes_x_chan, img_chans, data, z0, z1, params.c_str()).c_str(), __iom__current__function__);

	//disable warning handler to avoid messages on unrecognized tags
	TIFFSetWarningHandler(0);

	unsigned int _width;
	unsigned int _height;
	unsigned int _depth;
	int _bytes_x_chan;
	unsigned int _chans;
	int b_swap;
	void *fhandle;
	int header_len;
	char *err_Tiff3Dfmt;

	if ( !data ) { // recover the metadata, allocate the buffer and set parameters
		if ( (err_Tiff3Dfmt = loadTiff3D2Metadata((char *)img_path.c_str(),_width,_height,_depth,_chans,_bytes_x_chan,b_swap,fhandle,header_len)) != 0 ) {
			throw iom::exception(iom::strprintf("(%s) unable to read meta data of tiff file %s",err_Tiff3Dfmt,img_path.c_str()), __iom__current__function__);
		}
		closeTiff3DFile(fhandle);

		data = new unsigned char[_width * _height * _depth * _chans * _bytes_x_chan];
		img_width        = _width;
		img_height       = _height;
		img_depth        = _depth;
		img_bytes_x_chan = _bytes_x_chan;
		img_chans        = _chans;
	}

	// set the ROI
	z0 = (z0 < 0) ? 0: z0;
	z1 = (z1 < 0) ? img_depth  : z1;

	if ( z0 >= z1 )
		throw iom::exception(iom::strprintf("wrong slice indices (z0 = %d, z1 = %d)",z0, z1), __iom__current__function__);

	// get the image
	if ( (err_Tiff3Dfmt = readTiff3DFile2Buffer((char *)img_path.c_str(),data,img_width,img_height,z0,z1-1)) != 0 ) {
		throw iom::exception(iom::strprintf("(%s) unable to read tiff file %s in page range [%d,%d]",err_Tiff3Dfmt,img_path.c_str(),z0,z1-1), __iom__current__function__);
	}

	return data;
}
开发者ID:CBL-ORION,项目名称:v3d_external-1,代码行数:61,代码来源:tiff3D.cpp

示例6: tiff_open

TIFF *
tiff_open (GFile        *file,
           const gchar  *mode,
           GError      **error)
{
  gchar *filename = g_file_get_path (file);

  TIFFSetWarningHandler (tiff_warning);
  TIFFSetErrorHandler (tiff_error);

#ifdef G_OS_WIN32
  gunichar2 *utf16_filename = g_utf8_to_utf16 (filename, -1, NULL, NULL, error);

  if (utf16_filename)
    {
      TIFF *tif = TIFFOpenW (utf16_filename, mode);

      g_free (utf16_filename);

      return tif;
    }

  return NULL;
#else
  return TIFFOpen (filename, mode);
#endif
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:27,代码来源:file-tiff-io.c

示例7: TIFFSetWarningHandler

void *image_read_tif(const char *name, int *w, int *h, int *c, int *b, int n)
{
    TIFF *T = 0;
    void *p = 0;

    TIFFSetWarningHandler(0);

    if ((T = TIFFOpen(name, "r")))
    {
        if ((n == 0) || TIFFSetDirectory(T, n))
        {
            uint32 i, s = (uint32) TIFFScanlineSize(T);
            uint32 W, H;
            uint16 B, C;

            TIFFGetField(T, TIFFTAG_IMAGEWIDTH,      &W);
            TIFFGetField(T, TIFFTAG_IMAGELENGTH,     &H);
            TIFFGetField(T, TIFFTAG_BITSPERSAMPLE,   &B);
            TIFFGetField(T, TIFFTAG_SAMPLESPERPIXEL, &C);

            if ((p = malloc(H * s)))
            {
                for (i = 0; i < H; ++i)
                    TIFFReadScanline(T, (uint8 *) p + i * s, i, 0);

                *w = (int) W;
                *h = (int) H;
                *b = (int) B / 8;
                *c = (int) C;
            }
        }
        TIFFClose(T);
    }
    return p;
}
开发者ID:treeffle,项目名称:CSC4356,代码行数:35,代码来源:image.c

示例8: run

static void
run (const gchar      *name,
     gint              nparams,
     const GimpParam  *param,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  static GimpParam   values[2];
  GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
  GimpParasite      *parasite;
  gint32             image;
  gint32             drawable;
  gint32             orig_image;
  GimpExportReturn   export = GIMP_EXPORT_CANCEL;
  GError            *error  = NULL;

  run_mode = param[0].data.d_int32;

  INIT_I18N ();
  gegl_init (NULL, NULL);

  *nreturn_vals = 1;
  *return_vals  = values;

  values[0].type          = GIMP_PDB_STATUS;
  values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;

  TIFFSetWarningHandler (tiff_warning);
  TIFFSetErrorHandler (tiff_error);

  if ((strcmp (name, SAVE_PROC) == 0) ||
      (strcmp (name, SAVE2_PROC) == 0))
    {
      /* Plug-in is either file_tiff_save or file_tiff_save2 */
      image = orig_image = param[1].data.d_int32;
      drawable = param[2].data.d_int32;

      /* Do this right this time, if POSSIBLE query for parasites, otherwise
         or if there isn't one, choose the default comment from the gimprc. */

      /*  eventually export the image */
      switch (run_mode)
        {
        case GIMP_RUN_INTERACTIVE:
        case GIMP_RUN_WITH_LAST_VALS:
          gimp_ui_init (PLUG_IN_BINARY, FALSE);
          export = gimp_export_image (&image, &drawable, NULL,
                                      (GIMP_EXPORT_CAN_HANDLE_RGB |
                                       GIMP_EXPORT_CAN_HANDLE_GRAY |
                                       GIMP_EXPORT_CAN_HANDLE_INDEXED |
                                       GIMP_EXPORT_CAN_HANDLE_ALPHA ));
          if (export == GIMP_EXPORT_CANCEL)
            {
              values[0].data.d_status = GIMP_PDB_CANCEL;
              return;
            }
          break;
        default:
          break;
        }
开发者ID:saifthe1,项目名称:gimp,代码行数:60,代码来源:file-tiff-save.c

示例9: sendRecvStatus

void
sendRecvStatus(const char* modem, char* tag)
{
    DIR* dir = opendir(FAX_RECVDIR);
    if (dir != NULL) {
	struct dirent* dp;

	TIFFSetErrorHandler(NULL);
	TIFFSetWarningHandler(NULL);
	while (dp = readdir(dir)) {
	    char entry[1024];
	    struct stat sb;
	    int fd;

	    if (strncmp(dp->d_name, "fax", 3) != 0)
		continue;
	    sprintf(entry, "%s/%s", FAX_RECVDIR, dp->d_name);
	    if (stat(entry, &sb) < 0 || (sb.st_mode & S_IFMT) != S_IFREG)
		continue;
	    fd = open(entry, RECV_OMODE);
	    if (fd > 0) {
		int beingReceived =
		   (flock(fd, LOCK_EX|LOCK_NB) < 0 && errno == EWOULDBLOCK);
		(void) readQFile(fd, entry, beingReceived, &sb);
		close(fd);
	    }
	}
	closedir(dir);
    } else
	sendAndLogError("Can not access receive queue directory \"%s\".",
	    FAX_RECVDIR);
}
开发者ID:jonathangray,项目名称:freebsd-1.x-ports,代码行数:32,代码来源:status.c

示例10: main_rpc_warpabt

int main_rpc_warpabt(int c, char *v[])
{
	TIFFSetWarningHandler(NULL);//suppress warnings

	// input arguments
	if (c != 9) {
		fprintf(stderr, "usage:\n\t"
		"%s a.{tiff,rpc} b.{tiff,rpc} ax ay in.tif out.tif\n", *v);
		//0 1       2    3       4    5  6  7      8
		return 1;
	}
	char *filename_a    = v[1];
	char *filename_rpca = v[2];
	char *filename_b    = v[3];
	char *filename_rpcb = v[4];
	double axyh[3] ={atof(v[5]), atof(v[6]), 0};
	char *filename_h0   = v[7];
	char *filename_out  = v[8];

	// read input images
	int megabytes = 800;
	struct tiff_tile_cache ta[1], tb[1];
	tiff_tile_cache_init(ta, filename_a, megabytes);
	tiff_tile_cache_init(tb, filename_b, megabytes);
	int pd = ta->i->spp;
	if (pd != tb->i->spp) fail("image color depth mismatch\n");

	// read input rpcs
	struct rpc rpca[1];
	struct rpc rpcb[1];
	read_rpc_file_xml(rpca, filename_rpca);
	read_rpc_file_xml(rpcb, filename_rpcb);

	// read initialized raster
	int w, h;
	float *in_h0 = iio_read_image_float(filename_h0, &w, &h);

	// allocate space for output raster
	float *out_h = xmalloc(w * h * sizeof*out_h);

	// run the algorithm
	float alpha2 = ALPHA()*ALPHA();
	int niter = NITER();
	int nwarps = NWARPS();
	for (int i = 0; i < nwarps; i++)
	{
		mnehs_rpc(out_h, in_h0, w,h,ta,rpca,tb,rpcb,axyh, alpha2,niter);
		memcpy(in_h0, out_h, w*h*sizeof*in_h0);
	}

	// save the output raster
	iio_save_image_float(filename_out, out_h, w, h);

	// cleanup and exit
	free(in_h0);
	free(out_h);
	tiff_tile_cache_free(ta);
	tiff_tile_cache_free(tb);
	return 0;
}
开发者ID:Fahdben,项目名称:imscript,代码行数:60,代码来源:rpc_mnehs.c

示例11: strlen

char *openTiff3DFile ( char *filename, char *mode, void *&fhandle ) {
	char *completeFilename = (char *) 0;
	int fname_len = (int) strlen(filename);
	char *suffix = strstr(filename,".tif");
	while ( suffix && (fname_len - (suffix-filename) > 5) )
		suffix = strstr(suffix+4,".tif");
	//if ( (suffix != 0) && (fname_len - (suffix-filename) <= 5) ) { // a substring ".tif is already at the end of the filename
	if ( suffix ) { // a substring ".tif is already at the very end of the filename
		completeFilename = new char[fname_len+1];
		strcpy(completeFilename,filename);
	}
	else {	
		completeFilename = new char[fname_len+4+1];
		strcpy(completeFilename,filename);
		strcat(completeFilename,".");
		strcat(completeFilename,TIFF3D_SUFFIX);
	}

	//disable warning and error handlers to avoid messages on unrecognized tags
	TIFFSetWarningHandler(0);
	TIFFSetErrorHandler(0);

	fhandle = TIFFOpen(completeFilename,mode);
	if (!fhandle)
    {
		return ((char *) "Cannot open the file.");
    }
	return ((char *) 0);
}
开发者ID:coocoky,项目名称:TeraStitcher,代码行数:29,代码来源:Tiff3DMngr.cpp

示例12: TERAFLY_TIME_START

char *readTiff3DFile2Buffer ( char *filename, unsigned char *img, unsigned int img_width, unsigned int img_height, unsigned int first, unsigned int last, 
																						  int downsamplingFactor, int starti, int endi, int startj, int endj ) {

    // 2015-01-30. Alessandro. @ADDED performance (time) measurement in all most time-consuming methods.
    #ifdef _VAA3D_TERAFLY_PLUGIN_MODE
    TERAFLY_TIME_START(TiffLoadData)
    #endif

    TIFF *input;

	//disable warning and error handlers to avoid messages on unrecognized tags
	TIFFSetWarningHandler(0);
	TIFFSetErrorHandler(0);

	input=TIFFOpen(filename,"r");
	if (!input)
    {
		//throw iim::IOException(strprintf("in IOManager::readTiffMultipage(...): Cannot open the file %s",finName).c_str());
		return ((char *) "Cannot open the file.");
    }
    
	int b_swap=TIFFIsByteSwapped(input);
	char *err_msg = readTiff3DFile2Buffer(input,img,img_width,img_height,first,last,b_swap,downsamplingFactor,starti,endi,startj,endj);

	TIFFClose(input);

    // 2015-01-30. Alessandro. @ADDED performance (time) measurement in all most time-consuming methods.
    #ifdef _VAA3D_TERAFLY_PLUGIN_MODE
    TERAFLY_TIME_STOP(TiffLoadData, tf::IO, tf::strprintf("loaded block x(%d), y(%d), z(%d-%d) from 3D tiff \"%s\"", img_width, img_height, first, last, filename))
    #endif

	return err_msg;
}
开发者ID:coocoky,项目名称:TeraStitcher,代码行数:33,代码来源:Tiff3DMngr.cpp

示例13: filepath

// Append a single slice at the bottom of a 3D image file
void 
	iomanager::tiff3D::appendSlice(
	std::string img_path,			// (INPUT)	image filepath (it includes the file extension)
	unsigned char * raw_img,		// (INPUT)	slice to be saved into the file
	int img_height,					// (INPUT)	slice height (in pixels)
	int img_width,					// (INPUT)	slice width (in pixels)
	int img_bytes_x_chan,			// (INPUT)  number of bytes per channel
	int img_chans,					// (INPUT)	number of channels
	int y0,							// (INPUT)	region of interest [x0,x1)[y0,y1) to be set on the image
	int y1,							// (INPUT)	region of interest [x0,x1)[y0,y1) to be set on the image
	int x0,							// (INPUT)	region of interest [x0,x1)[y0,y1) to be set on the image
	int x1,							// (INPUT)	region of interest [x0,x1)[y0,y1) to be set on the image
	int slice,						// (INPUT)  slice index 
	const std::string & params)		// (INPUT) additional parameters <param1=val, param2=val, ...> 
throw (iom::exception)
{
	//throw iom::exception(iom::strprintf("not implemented yet"), __iom__current__function__);

	/**/iom::debug(iom::LEV3, iom::strprintf("img_path = %s, img_width = %d, img_height = %d, img_bytes_x_chan = %d, img_chans = %d, y0 = %d, y1 = %d, x0 = %d, x1 = %d, params = \"%s\"",
		img_path.c_str(), img_width, img_height, img_bytes_x_chan, img_chans, y0, y1, x0, x1, params.c_str()).c_str(), __iom__current__function__);

	//disable warning handler to avoid messages on unrecognized tags
	TIFFSetWarningHandler(0);

	iim::sint64 stridex  = img_width * img_chans * img_bytes_x_chan;
	unsigned char *buf; // to scan the input buffer

	char *err_Tiff3Dfmt;

	y0 = (y0 < 0) ? 0: y0;
	y1 = (y1 < 0) ? img_height : y1;
	x0 = (x0 < 0) ? 0: x0;
	x1 = (x1 < 0) ? img_width  : x1;

	if ( y0 >= y1 || x0 >= x1 )
		throw iom::exception(iom::strprintf("wrong ROI (y0 = %d, y1 = %d, x0 = %d, x1 = %d)", y0, y1, x0, x1), __iom__current__function__);

	// append a slice

	buf = raw_img + x0*stridex + y0*img_chans*img_bytes_x_chan; // buf points to the first byte to be written

	if ( x0 == 0 && x1 == img_width && y0 == 0 && y1 == img_height ) { // all buffer must be written
		if ( (err_Tiff3Dfmt = appendSlice2Tiff3DFile((char *)img_path.c_str(),slice,buf,img_width,img_height)) != 0 ) {
			throw iom::exception(iom::strprintf("(%s) unable to write slice %d into file %s",err_Tiff3Dfmt,slice,img_path.c_str()), __iom__current__function__);
		}
	}
	else { // copy to a sub buffer before writing
		iim::sint64 stridex_ROI    = (x1-x0) * img_chans * img_bytes_x_chan;
		iim::sint64 stridexy_ROI   = stridex_ROI * (y1-y0); // just because required by 'copyBlock2SubBuf', not actually used
		iim::sint64 stridexy       = stridex * img_height; // just because required by 'copyBlock2SubBuf', not actually used
		unsigned char *raw_img_ROI = new unsigned char[(y1-y0) * (x1-x0) * img_chans * img_bytes_x_chan];

		iim::VirtualFmtMngr::copyBlock2SubBuf(buf,raw_img_ROI,(y1-y0),(x1-x0),1,img_bytes_x_chan,stridex,stridexy,stridex_ROI,stridexy_ROI);

		if ( (err_Tiff3Dfmt = appendSlice2Tiff3DFile((char *)img_path.c_str(),slice,raw_img_ROI,(x1-x0),(y1-y0))) != 0 ) {
			throw iom::exception(iom::strprintf("(%s) unable to write slice %d into file %s",err_Tiff3Dfmt,slice,img_path.c_str()), __iom__current__function__);
		}
		delete []raw_img_ROI;
	}
}
开发者ID:CBL-ORION,项目名称:v3d_external-1,代码行数:61,代码来源:tiff3D.cpp

示例14: DllMain

// Only include the DLLMain with the dll build of pano13
BOOL WINAPI
DllMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
{
    switch (dwReason)
    {
        case DLL_PROCESS_ATTACH:
	    hDllInstance = (HINSTANCE)hDll;
           // Code to run when the DLL is loaded

			// FS+
			// disable warnings for unknown tags
			TIFFSetWarningHandler( 0 );
			// FS-

			break;

        case DLL_PROCESS_DETACH:
           // Code to run when the DLL is freed
            break;

        case DLL_THREAD_ATTACH:
            // Code to run when a thread is created during the DLL's lifetime
            break;

        case DLL_THREAD_DETACH:
            // Code to run when a thread ends normally.
            break;
    }
    return TRUE;
}
开发者ID:xelmirage,项目名称:libpano,代码行数:31,代码来源:sys_win.c

示例15: TIFFSetWarningHandler

WidthAndHeight TifImageInfo::getSize(boost::filesystem::path & aPath)
{
	WidthAndHeight result;

	static BOOL bFirstRun = true;
	if (bFirstRun) {
		TIFFSetWarningHandler(NULL);
		TIFFSetErrorHandler(NULL);
		bFirstRun = false;
	}

	TIFF *tif = TIFFOpen(aPath.file_string().data(), "r");
	if (!tif)
	{
		throw std::runtime_error("cannot open file [" + aPath.file_string() + "]");
	}

	BOOL	success	= FALSE;

	TIFFGetField(tif, TIFFTAG_IMAGEWIDTH,		&result.width);
	TIFFGetField(tif, TIFFTAG_IMAGELENGTH,		&result.height);

	TIFFClose(tif);

	return result;
}
开发者ID:dwangarc,项目名称:stabilization,代码行数:26,代码来源:ImageInfo.cpp


注:本文中的TIFFSetWarningHandler函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。