本文整理汇总了C++中TIFFClientOpen函数的典型用法代码示例。如果您正苦于以下问题:C++ TIFFClientOpen函数的具体用法?C++ TIFFClientOpen怎么用?C++ TIFFClientOpen使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TIFFClientOpen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IMG_isTIF
int IMG_isTIF(SDL_RWops* src)
{
TIFF* tiff;
TIFFErrorHandler prev_handler;
/* Suppress output from libtiff */
prev_handler = TIFFSetErrorHandler(NULL);
/* Attempt to process the given file data */
/* turn off memory mapped access with the m flag */
tiff = TIFFClientOpen("SDL_image", "rm", (thandle_t)src,
tiff_read, tiff_write, tiff_seek, tiff_close, tiff_size, NULL, NULL);
/* Reset the default error handler, since it can be useful for info */
TIFFSetErrorHandler(prev_handler);
/* If it's not a TIFF, then tiff will be NULL. */
if(!tiff)
return 0;
/* Free up any dynamically allocated memory libtiff uses */
TIFFClose(tiff);
return 1;
}
示例2: process
static gboolean
process(GeglOperation *operation,
GeglBuffer *input,
const GeglRectangle *result,
int level)
{
GeglProperties *o = GEGL_PROPERTIES(operation);
Priv *p = g_new0(Priv, 1);
gboolean status = TRUE;
GError *error = NULL;
g_assert(p != NULL);
o->user_data = (void*) p;
p->stream = gegl_gio_open_output_stream(NULL, o->path, &p->file, &error);
if (p->stream != NULL && p->file != NULL)
p->can_seek = g_seekable_can_seek(G_SEEKABLE(p->stream));
if (p->stream == NULL)
{
status = FALSE;
g_warning("%s", error->message);
goto cleanup;
}
TIFFSetErrorHandler(error_handler);
TIFFSetWarningHandler(warning_handler);
p->tiff = TIFFClientOpen("GEGL-tiff-save", "w", (thandle_t) p,
read_from_stream, write_to_stream,
seek_in_stream, close_stream,
get_file_size, NULL, NULL);
if (p->tiff == NULL)
{
status = FALSE;
g_warning("failed to open TIFF from %s", o->path);
goto cleanup;
}
if (export_tiff(operation, input, result))
{
status = FALSE;
g_warning("could not export TIFF file");
goto cleanup;
}
cleanup:
cleanup(operation);
if (o->user_data != NULL)
g_free(o->user_data);
o->user_data = NULL;
if (error != NULL)
g_error_free(error);
return status;
}
示例3: qxe_TIFFClientOpen
TIFF *
qxe_TIFFClientOpen (const char *x1, const char *x2,
thandle_t x3,
TIFFReadWriteProc x4, TIFFReadWriteProc x5,
TIFFSeekProc x6, TIFFCloseProc x7,
TIFFSizeProc x8,
TIFFMapFileProc x9, TIFFUnmapFileProc x10)
{
return TIFFClientOpen (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10);
}
示例4: IMG_LoadTIF_RW
SDL_Surface* IMG_LoadTIF_RW(SDL_RWops* src)
{
TIFF* tiff;
SDL_Surface* surface = NULL;
Uint32 img_width, img_height;
Uint32 Rmask, Gmask, Bmask, Amask, mask;
Uint32 x, y;
Uint32 half;
if ( !src ) {
/* The error message has been set in SDL_RWFromFile */
return NULL;
}
/* turn off memory mapped access with the m flag */
tiff = TIFFClientOpen("SDL_image", "rm", (thandle_t)src,
tiff_read, tiff_write, tiff_seek, tiff_close, tiff_size, NULL, NULL);
if(!tiff)
return NULL;
/* Retrieve the dimensions of the image from the TIFF tags */
TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &img_width);
TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &img_height);
Rmask = 0x000000FF;
Gmask = 0x0000FF00;
Bmask = 0x00FF0000;
Amask = 0xFF000000;
surface = SDL_AllocSurface(SDL_SWSURFACE, img_width, img_height, 32,
Rmask, Gmask, Bmask, Amask);
if(!surface)
return NULL;
if(!TIFFReadRGBAImage(tiff, img_width, img_height, surface->pixels, 0))
return NULL;
/* libtiff loads the image upside-down, flip it back */
half = img_height / 2;
for(y = 0; y < half; y++)
{
Uint32 *top = (Uint32 *)surface->pixels + y * surface->pitch/4;
Uint32 *bot = (Uint32 *)surface->pixels
+ (img_height - y - 1) * surface->pitch/4;
for(x = 0; x < img_width; x++)
{
Uint32 tmp = top[x];
top[x] = bot[x];
bot[x] = tmp;
}
}
TIFFClose(tiff);
return surface;
}
示例5: TIFFwxOpen
TIFF*
TIFFwxOpen(wxOutputStream &stream, const char* name, const char* mode)
{
TIFF* tif = TIFFClientOpen(name, mode,
(thandle_t) &stream,
wxTIFFNullProc, wxTIFFWriteProc,
wxTIFFSeekOProc, wxTIFFCloseOProc, wxTIFFSizeProc,
wxTIFFMapProc, wxTIFFUnmapProc);
return tif;
}
示例6: TIFFwxOpen
TIFF*
TIFFwxOpen(wxOutputStream &stream, const char* name, const char* mode)
{
TIFF* tif = TIFFClientOpen(name, mode,
(thandle_t) &stream,
_tiffNullProc, _tiffWriteProc,
_tiffSeekOProc, _tiffCloseProc, _tiffSizeProc,
_tiffMapProc, _tiffUnmapProc);
return tif;
}
示例7: TIFFFdOpen
/*
* Open a TIFF file descriptor for read/writing.
*/
TIFF*
TIFFFdOpen(int fd, const char* name, const char* mode)
{
TIFF* tif;
tif = TIFFClientOpen(name, mode, (thandle_t) fd,
_tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc,
_tiffSizeProc, _tiffMapProc, _tiffUnmapProc);
if (tif)
tif->tif_fd = fd;
return (tif);
}
示例8: gdk_pixbuf__tiff_image_stop_load
static gboolean
gdk_pixbuf__tiff_image_stop_load (gpointer data,
GError **error)
{
TiffContext *context = data;
TIFF *tiff;
gboolean retval;
g_return_val_if_fail (data != NULL, FALSE);
tiff_push_handlers ();
tiff = TIFFClientOpen ("libtiff-pixbuf", "r", data,
tiff_load_read, tiff_load_write,
tiff_load_seek, tiff_load_close,
tiff_load_size,
tiff_load_map_file, tiff_load_unmap_file);
if (!tiff || global_error) {
tiff_set_error (error,
GDK_PIXBUF_ERROR_FAILED,
_("Failed to load TIFF image"));
retval = FALSE;
} else {
GdkPixbuf *pixbuf;
pixbuf = tiff_image_parse (tiff, context, error);
if (pixbuf)
g_object_unref (pixbuf);
retval = pixbuf != NULL;
if (global_error)
{
tiff_set_error (error,
GDK_PIXBUF_ERROR_FAILED,
_("Failed to load TIFF image"));
tiff_pop_handlers ();
retval = FALSE;
}
}
if (tiff)
TIFFClose (tiff);
g_assert (!global_error);
g_free (context->buffer);
g_free (context);
tiff_pop_handlers ();
return retval;
}
示例9: TIFFClientOpen
static TIFF *imb_tiff_client_open(ImbTIFFMemFile *memFile, unsigned char *mem, size_t size)
{
/* open the TIFF client layer interface to the in-memory file */
memFile->mem = mem;
memFile->offset = 0;
memFile->size = size;
return TIFFClientOpen("(Blender TIFF Interface Layer)",
"r", (thandle_t)(memFile),
imb_tiff_ReadProc, imb_tiff_WriteProc,
imb_tiff_SeekProc, imb_tiff_CloseProc,
imb_tiff_SizeProc, imb_tiff_DummyMapProc, imb_tiff_DummyUnmapProc);
}
示例10: _TIFFFdOpen
TIFF*
_TIFFFdOpen(void* fd, const char* name, const char* mode)
{
TIFF* tif;
tif = TIFFClientOpen(name, mode,
(thandle_t) fd,
_tiffReadProcEx, _tiffWriteProcEx, _tiffSeekProcEx, _tiffCloseProcEx,
_tiffSizeProcEx, _tiffMapProcEx, _tiffUnmapProcEx);
if (tif)
tif->tif_fd = reinterpret_cast<int>(fd);
return (tif);
}
示例11: HILL_read_tiff
void HILL_read_tiff(
HILL_input_stream i,
struct HILL_image_data *img
){
TIFF *t;
uint32_t width=0;
uint32_t height=0;
uint32_t bytes=0;
TIFFSetErrorHandler(read_tiff_error_handler);
TIFFSetWarningHandler(read_tiff_error_handler);
t=TIFFClientOpen(
"Memory",
"r",
(thandle_t)i,
read_tiff_read,
read_tiff_write,
read_tiff_seek,
read_tiff_close,
read_tiff_size,
NULL,
NULL
);
if(t==NULL)
{
img->err=HILL_IMAGE_LIBRARY_ERROR;
return;
}
TIFFGetField(t, TIFFTAG_IMAGEWIDTH, &width);
TIFFGetField(t, TIFFTAG_IMAGELENGTH, &height);
bytes=width*height*sizeof(uint32_t);
img->w=width;
img->h=height;
img->fmt=HILL_RGBA8;
img->data=malloc(bytes);
if(TIFFReadRGBAImageOriented(t, width, height, (uint32_t *)img->data, ORIENTATION_TOPLEFT, 1) != 0)
{
img->err=HILL_IMAGE_NO_ERROR;
TIFFClose(t);
}
else
{
img->err=HILL_IMAGE_NOT_SUPPORTED;
free(img->data);
TIFFClose(t);
}
}
示例12: DECLARE3
/*
* Open a TIFF file descriptor for read/writing.
*/
TIFF*
DECLARE3(TIFFFdOpen, int, fd, const char*, name, const char*, mode)
{
TIFF *tif;
tif = TIFFClientOpen(name, mode,
(void*) fd,
_tiffReadProc, _tiffWriteProc,
_tiffSeekProc, _tiffCloseProc, _tiffSizeProc,
_tiffMapProc, _tiffUnmapProc);
if (tif)
tif->tif_fd = fd;
return (tif);
}
示例13: _TIFFFdOpen
TIFF*
_TIFFFdOpen(void* fd, const char* name, const char* mode)
{
TIFF* tif;
tif = TIFFClientOpen(name, mode,
(thandle_t) fd,
_tiffReadProcEx, _tiffWriteProcEx, _tiffSeekProcEx, _tiffCloseProcEx,
_tiffSizeProcEx, _tiffMapProcEx, _tiffUnmapProcEx);
#ifndef _LINUX
if (tif)
tif->tif_fd = fd;
#endif
return (tif);
}
示例14: TIFFFdOpen
/*
* Open a TIFF file descriptor for read/writing.
* Note that TIFFFdOpen and TIFFOpen recognise the character 'u' in the mode
* string, which forces the file to be opened unmapped.
*/
TIFF*
TIFFFdOpen(int ifd, const char* name, const char* mode)
{
TIFF* tif;
BOOL fSuppressMap = (mode[1] == 'u' || (mode[1]!=0 && mode[2] == 'u'));
tif = TIFFClientOpen(name, mode, (thandle_t)ifd,
_tiffReadProc, _tiffWriteProc,
_tiffSeekProc, _tiffCloseProc, _tiffSizeProc,
fSuppressMap ? _tiffDummyMapProc : _tiffMapProc,
fSuppressMap ? _tiffDummyUnmapProc : _tiffUnmapProc);
if (tif)
tif->tif_fd = ifd;
return (tif);
}
示例15: TIFFOpen
/*
* Open a TIFF file for read/writing.
*/
TIFF*
TIFFOpen(const char* name, const char* mode)
{
static const char module[] = "TIFFOpen";
int i, a_out;
char szAccess[32];
VSILFILE *fp;
TIFF *tif;
char *pszAccess = szAccess;
a_out = 0;
pszAccess[0] = '\0';
for( i = 0; mode[i] != '\0'; i++ )
{
if( mode[i] == 'r'
|| mode[i] == 'w'
|| mode[i] == '+'
|| mode[i] == 'a' )
{
szAccess[a_out++] = mode[i];
szAccess[a_out] = '\0';
}
}
strcat( szAccess, "b" );
fp = VSIFOpenL( name, szAccess );
if (fp == NULL) {
if( errno >= 0 )
TIFFError(module,"%s: %s", name, VSIStrerror( errno ) );
else
TIFFError(module, "%s: Cannot open", name);
return ((TIFF *)0);
}
tif = TIFFClientOpen(name, mode,
(thandle_t) fp,
_tiffReadProc, _tiffWriteProc,
_tiffSeekProc, _tiffCloseProc, _tiffSizeProc,
_tiffMapProc, _tiffUnmapProc);
if( tif != NULL )
tif->tif_fd = 0;
else
CPL_IGNORE_RET_VAL_INT(VSIFCloseL( fp ));
return tif;
}