Blame tools/tiffgt.c

Packit 7838c8
/* $Id: tiffgt.c,v 1.15 2015-09-06 20:42:20 bfriesen Exp $ */
Packit 7838c8
Packit 7838c8
/*
Packit 7838c8
 * Copyright (c) 1988-1997 Sam Leffler
Packit 7838c8
 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
Packit 7838c8
 * Copyright (c) 2003, Andrey Kiselev <dron@ak4719.spb.edu>
Packit 7838c8
 *
Packit 7838c8
 * Permission to use, copy, modify, distribute, and sell this software and 
Packit 7838c8
 * its documentation for any purpose is hereby granted without fee, provided
Packit 7838c8
 * that (i) the above copyright notices and this permission notice appear in
Packit 7838c8
 * all copies of the software and related documentation, and (ii) the names of
Packit 7838c8
 * Sam Leffler and Silicon Graphics may not be used in any advertising or
Packit 7838c8
 * publicity relating to the software without the specific, prior written
Packit 7838c8
 * permission of Sam Leffler and Silicon Graphics.
Packit 7838c8
 * 
Packit 7838c8
 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
Packit 7838c8
 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
Packit 7838c8
 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
Packit 7838c8
 * 
Packit 7838c8
 * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
Packit 7838c8
 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
Packit 7838c8
 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
Packit 7838c8
 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
Packit 7838c8
 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
Packit 7838c8
 * OF THIS SOFTWARE.
Packit 7838c8
 */
Packit 7838c8
Packit 7838c8
#include "tif_config.h"
Packit 7838c8
#include <stdio.h>
Packit 7838c8
#include <stdlib.h>
Packit 7838c8
#include <string.h>
Packit 7838c8
#include <unistd.h>
Packit 7838c8
Packit 7838c8
#ifdef HAVE_OPENGL_GL_H
Packit 7838c8
# include <OpenGL/gl.h>
Packit 7838c8
#else
Packit 7838c8
# include <GL/gl.h>
Packit 7838c8
#endif
Packit 7838c8
#ifdef HAVE_GLUT_GLUT_H
Packit 7838c8
# include <GLUT/glut.h>
Packit 7838c8
#else
Packit 7838c8
# include <GL/glut.h>
Packit 7838c8
#endif
Packit 7838c8
Packit 7838c8
#include "tiffio.h"
Packit 7838c8
#include "tiffiop.h"
Packit 7838c8
Packit 7838c8
#ifndef HAVE_GETOPT
Packit 7838c8
extern int getopt(int, char**, char*);
Packit 7838c8
#endif
Packit 7838c8
Packit 7838c8
static  uint32  width = 0, height = 0;          /* window width & height */
Packit 7838c8
static  uint32* raster = NULL;                  /* displayable image */
Packit 7838c8
static TIFFRGBAImage img;
Packit 7838c8
static int      order0 = 0, order;
Packit 7838c8
static uint16   photo0 = (uint16) -1, photo;
Packit 7838c8
static int      stoponerr = 0;                  /* stop on read error */
Packit 7838c8
static int      verbose = 0;
Packit 7838c8
#define TITLE_LENGTH    1024
Packit 7838c8
static char     title[TITLE_LENGTH];            /* window title line */
Packit 7838c8
static uint32   xmax, ymax;
Packit 7838c8
static char**   filelist = NULL;
Packit 7838c8
static int      fileindex;
Packit 7838c8
static int      filenum;
Packit 7838c8
static TIFFErrorHandler oerror;
Packit 7838c8
static TIFFErrorHandler owarning;
Packit 7838c8
Packit 7838c8
static void	cleanup_and_exit(void);
Packit 7838c8
static int	initImage(void);
Packit 7838c8
static int	prevImage(void);
Packit 7838c8
static int	nextImage(void);
Packit 7838c8
static void	setWindowSize(void);
Packit 7838c8
static void	usage(void);
Packit 7838c8
static uint16	photoArg(const char*);
Packit 7838c8
static void	raster_draw(void);
Packit 7838c8
static void	raster_reshape(int, int);
Packit 7838c8
static void	raster_keys(unsigned char, int, int);
Packit 7838c8
static void	raster_special(int, int, int);
Packit 7838c8
Packit 7838c8
#if !HAVE_DECL_OPTARG
Packit 7838c8
extern  char* optarg;
Packit 7838c8
extern  int optind;
Packit 7838c8
#endif
Packit 7838c8
Packit 7838c8
/* GLUT framework on MacOS X produces deprecation warnings */
Packit 7838c8
# if defined(__GNUC__) && defined(__APPLE__)
Packit 7838c8
#  pragma GCC diagnostic push
Packit 7838c8
#  pragma GCC diagnostic ignored "-Wdeprecated-declarations"
Packit 7838c8
# endif
Packit 7838c8
Packit 7838c8
static TIFF* tif = NULL;
Packit 7838c8
Packit 7838c8
int
Packit 7838c8
main(int argc, char* argv[])
Packit 7838c8
{
Packit 7838c8
        int c;
Packit 7838c8
        int dirnum = -1;
Packit 7838c8
        uint32 diroff = 0;
Packit 7838c8
Packit 7838c8
        oerror = TIFFSetErrorHandler(NULL);
Packit 7838c8
        owarning = TIFFSetWarningHandler(NULL);
Packit 7838c8
        while ((c = getopt(argc, argv, "d:o:p:eflmsvw?")) != -1)
Packit 7838c8
            switch (c) {
Packit 7838c8
            case 'd':
Packit 7838c8
                dirnum = atoi(optarg);
Packit 7838c8
                break;
Packit 7838c8
            case 'e':
Packit 7838c8
                oerror = TIFFSetErrorHandler(oerror);
Packit 7838c8
                break;
Packit 7838c8
            case 'l':
Packit 7838c8
                order0 = FILLORDER_LSB2MSB;
Packit 7838c8
                break;
Packit 7838c8
            case 'm':
Packit 7838c8
                order0 = FILLORDER_MSB2LSB;
Packit 7838c8
                break;
Packit 7838c8
            case 'o':
Packit 7838c8
                diroff = strtoul(optarg, NULL, 0);
Packit 7838c8
                break;
Packit 7838c8
            case 'p':
Packit 7838c8
                photo0 = photoArg(optarg);
Packit 7838c8
                break;
Packit 7838c8
            case 's':
Packit 7838c8
                stoponerr = 1;
Packit 7838c8
                break;
Packit 7838c8
            case 'w':
Packit 7838c8
                owarning = TIFFSetWarningHandler(owarning);
Packit 7838c8
                break;
Packit 7838c8
            case 'v':
Packit 7838c8
                verbose = 1;
Packit 7838c8
                break;
Packit 7838c8
            case '?':
Packit 7838c8
                usage();
Packit 7838c8
                /*NOTREACHED*/
Packit 7838c8
            }
Packit 7838c8
        filenum = argc - optind;
Packit 7838c8
        if ( filenum < 1)
Packit 7838c8
                usage();
Packit 7838c8
Packit 7838c8
        glutInit(&argc, argv);
Packit 7838c8
        glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
Packit 7838c8
Packit 7838c8
        /*
Packit 7838c8
         * Get the screen size
Packit 7838c8
         */
Packit 7838c8
        xmax = glutGet(GLUT_SCREEN_WIDTH);
Packit 7838c8
        ymax = glutGet(GLUT_SCREEN_HEIGHT);
Packit 7838c8
Packit 7838c8
        /*
Packit 7838c8
         * Use 90% of the screen size
Packit 7838c8
         */
Packit 7838c8
        xmax = xmax - xmax / 10.0;
Packit 7838c8
        ymax = ymax - ymax / 10.0;
Packit 7838c8
Packit 7838c8
        filelist = (char **) _TIFFmalloc(filenum * sizeof(char*));
Packit 7838c8
        if (!filelist) {
Packit 7838c8
                TIFFError(argv[0], "Can not allocate space for the file list.");
Packit 7838c8
                return 1;
Packit 7838c8
        }
Packit 7838c8
        _TIFFmemcpy(filelist, argv + optind, filenum * sizeof(char*));
Packit 7838c8
        fileindex = -1;
Packit 7838c8
        if (nextImage() < 0) {
Packit 7838c8
                _TIFFfree(filelist);
Packit 7838c8
                return 2;
Packit 7838c8
        }
Packit 7838c8
        /*
Packit 7838c8
         * Set initial directory if user-specified
Packit 7838c8
         * file was opened successfully.
Packit 7838c8
         */
Packit 7838c8
        if (dirnum != -1 && !TIFFSetDirectory(tif, dirnum))
Packit 7838c8
            TIFFError(argv[0], "Error, seeking to directory %d", dirnum);
Packit 7838c8
        if (diroff != 0 && !TIFFSetSubDirectory(tif, diroff))
Packit 7838c8
            TIFFError(argv[0], "Error, setting subdirectory at %#x", diroff);
Packit 7838c8
        order = order0;
Packit 7838c8
        photo = photo0;
Packit 7838c8
	if (initImage() < 0){
Packit 7838c8
                _TIFFfree(filelist);
Packit 7838c8
                return 3;
Packit 7838c8
        }
Packit 7838c8
        /*
Packit 7838c8
         * Create a new window or reconfigure an existing
Packit 7838c8
         * one to suit the image to be displayed.
Packit 7838c8
         */
Packit 7838c8
        glutInitWindowSize(width, height);
Packit 7838c8
        snprintf(title, TITLE_LENGTH - 1, "%s [%u]", filelist[fileindex],
Packit 7838c8
                (unsigned int) TIFFCurrentDirectory(tif));
Packit 7838c8
        glutCreateWindow(title);
Packit 7838c8
        glutDisplayFunc(raster_draw);
Packit 7838c8
        glutReshapeFunc(raster_reshape);
Packit 7838c8
        glutKeyboardFunc(raster_keys);
Packit 7838c8
        glutSpecialFunc(raster_special);
Packit 7838c8
        glutMainLoop();
Packit 7838c8
Packit 7838c8
        cleanup_and_exit();
Packit 7838c8
        return 0;
Packit 7838c8
}
Packit 7838c8
Packit 7838c8
static void 
Packit 7838c8
cleanup_and_exit(void)
Packit 7838c8
{
Packit 7838c8
        TIFFRGBAImageEnd(&img;;
Packit 7838c8
        if (filelist != NULL)
Packit 7838c8
                _TIFFfree(filelist);
Packit 7838c8
        if (raster != NULL)
Packit 7838c8
                _TIFFfree(raster);
Packit 7838c8
        if (tif != NULL)
Packit 7838c8
                TIFFClose(tif);
Packit 7838c8
        exit(0);
Packit 7838c8
}
Packit 7838c8
Packit 7838c8
static int
Packit 7838c8
initImage(void)
Packit 7838c8
{
Packit 7838c8
        uint32 w, h;
Packit 7838c8
Packit 7838c8
        if (order)
Packit 7838c8
                TIFFSetField(tif, TIFFTAG_FILLORDER, order);
Packit 7838c8
        if (photo != (uint16) -1)
Packit 7838c8
                TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photo);
Packit 7838c8
        if (!TIFFRGBAImageBegin(&img, tif, stoponerr, title)) {
Packit 7838c8
                TIFFError(filelist[fileindex], "%s", title);
Packit 7838c8
                TIFFClose(tif);
Packit 7838c8
                tif = NULL;
Packit 7838c8
                return -1;
Packit 7838c8
        }
Packit 7838c8
Packit 7838c8
        /*
Packit 7838c8
         * Setup the image raster as required.
Packit 7838c8
         */
Packit 7838c8
        h = img.height;
Packit 7838c8
        w = img.width;
Packit 7838c8
        if (h > ymax) {
Packit 7838c8
                w = (int)(w * ((float)ymax / h));
Packit 7838c8
                h = ymax;
Packit 7838c8
        }
Packit 7838c8
        if (w > xmax) {
Packit 7838c8
                h = (int)(h * ((float)xmax / w));
Packit 7838c8
                w = xmax;
Packit 7838c8
        }
Packit 7838c8
Packit 7838c8
	if (w != width || h != height) {
Packit 7838c8
		uint32 rastersize =
Packit 7838c8
			_TIFFMultiply32(tif, img.width, img.height, "allocating raster buffer");
Packit 7838c8
		if (raster != NULL)
Packit 7838c8
			_TIFFfree(raster), raster = NULL;
Packit 7838c8
		raster = (uint32*) _TIFFCheckMalloc(tif, rastersize, sizeof (uint32),
Packit 7838c8
						    "allocating raster buffer");
Packit 7838c8
		if (raster == NULL) {
Packit 7838c8
			width = height = 0;
Packit 7838c8
			TIFFError(filelist[fileindex], "No space for raster buffer");
Packit 7838c8
			cleanup_and_exit();
Packit 7838c8
		}
Packit 7838c8
		width = w;
Packit 7838c8
		height = h;
Packit 7838c8
	}
Packit 7838c8
	TIFFRGBAImageGet(&img, raster, img.width, img.height);
Packit 7838c8
#if HOST_BIGENDIAN
Packit 7838c8
	TIFFSwabArrayOfLong(raster,img.width*img.height);
Packit 7838c8
#endif
Packit 7838c8
	return 0;
Packit 7838c8
}
Packit 7838c8
Packit 7838c8
static int
Packit 7838c8
prevImage(void)
Packit 7838c8
{
Packit 7838c8
        if (fileindex > 0)
Packit 7838c8
                fileindex--;
Packit 7838c8
        else if (tif)
Packit 7838c8
                return fileindex;
Packit 7838c8
        if (tif)
Packit 7838c8
                TIFFClose(tif);
Packit 7838c8
        tif = TIFFOpen(filelist[fileindex], "r");
Packit 7838c8
        if (tif == NULL)
Packit 7838c8
                return -1;
Packit 7838c8
        return fileindex;
Packit 7838c8
}
Packit 7838c8
Packit 7838c8
static int
Packit 7838c8
nextImage(void)
Packit 7838c8
{
Packit 7838c8
        if (fileindex < filenum - 1)
Packit 7838c8
                fileindex++;
Packit 7838c8
        else if (tif)
Packit 7838c8
                return fileindex;
Packit 7838c8
        if (tif)
Packit 7838c8
                TIFFClose(tif);
Packit 7838c8
        tif = TIFFOpen(filelist[fileindex], "r");
Packit 7838c8
        if (tif == NULL)
Packit 7838c8
                return -1;
Packit 7838c8
        return fileindex;
Packit 7838c8
}
Packit 7838c8
Packit 7838c8
static void
Packit 7838c8
setWindowSize(void)
Packit 7838c8
{
Packit 7838c8
        glutReshapeWindow(width, height);
Packit 7838c8
}
Packit 7838c8
Packit 7838c8
static void
Packit 7838c8
raster_draw(void)
Packit 7838c8
{
Packit 7838c8
  glDrawPixels(img.width, img.height, GL_RGBA, GL_UNSIGNED_BYTE, (const GLvoid *) raster);
Packit 7838c8
  glFlush();
Packit 7838c8
}
Packit 7838c8
Packit 7838c8
static void
Packit 7838c8
raster_reshape(int win_w, int win_h)
Packit 7838c8
{
Packit 7838c8
        GLfloat xratio = (GLfloat)win_w/img.width;
Packit 7838c8
        GLfloat yratio = (GLfloat)win_h/img.height;
Packit 7838c8
        int     ratio = (int)(((xratio > yratio)?xratio:yratio) * 100);
Packit 7838c8
Packit 7838c8
        glPixelZoom(xratio, yratio);
Packit 7838c8
        glViewport(0, 0, win_w, win_h);
Packit 7838c8
        snprintf(title, 1024, "%s [%u] %d%%", filelist[fileindex],
Packit 7838c8
                (unsigned int) TIFFCurrentDirectory(tif), ratio);
Packit 7838c8
        glutSetWindowTitle(title);
Packit 7838c8
}
Packit 7838c8
Packit 7838c8
static void
Packit 7838c8
raster_keys(unsigned char key, int x, int y)
Packit 7838c8
{
Packit 7838c8
        (void) x;
Packit 7838c8
        (void) y;
Packit 7838c8
        switch (key) {
Packit 7838c8
                case 'b':                       /* photometric MinIsBlack */
Packit 7838c8
                    photo = PHOTOMETRIC_MINISBLACK;
Packit 7838c8
                    initImage();
Packit 7838c8
                    break;
Packit 7838c8
                case 'l':                       /* lsb-to-msb FillOrder */
Packit 7838c8
                    order = FILLORDER_LSB2MSB;
Packit 7838c8
                    initImage();
Packit 7838c8
                    break;
Packit 7838c8
                case 'm':                       /* msb-to-lsb FillOrder */
Packit 7838c8
                    order = FILLORDER_MSB2LSB;
Packit 7838c8
                    initImage();
Packit 7838c8
                    break;
Packit 7838c8
                case 'w':                       /* photometric MinIsWhite */
Packit 7838c8
                    photo = PHOTOMETRIC_MINISWHITE;
Packit 7838c8
                    initImage();
Packit 7838c8
                    break;
Packit 7838c8
                case 'W':                       /* toggle warnings */
Packit 7838c8
                    owarning = TIFFSetWarningHandler(owarning);
Packit 7838c8
                    initImage();
Packit 7838c8
                    break;
Packit 7838c8
                case 'E':                       /* toggle errors */
Packit 7838c8
                    oerror = TIFFSetErrorHandler(oerror);
Packit 7838c8
                    initImage();
Packit 7838c8
                    break;
Packit 7838c8
                case 'z':                       /* reset to defaults */
Packit 7838c8
                case 'Z':
Packit 7838c8
                    order = order0;
Packit 7838c8
                    photo = photo0;
Packit 7838c8
                    if (owarning == NULL)
Packit 7838c8
                        owarning = TIFFSetWarningHandler(NULL);
Packit 7838c8
                    if (oerror == NULL)
Packit 7838c8
                        oerror = TIFFSetErrorHandler(NULL);
Packit 7838c8
                    initImage();
Packit 7838c8
                    break;
Packit 7838c8
                case 'q':                       /* exit */
Packit 7838c8
                case '\033':
Packit 7838c8
                    cleanup_and_exit();
Packit 7838c8
        }
Packit 7838c8
        glutPostRedisplay();
Packit 7838c8
}
Packit 7838c8
Packit 7838c8
static void
Packit 7838c8
raster_special(int key, int x, int y)
Packit 7838c8
{
Packit 7838c8
        (void) x;
Packit 7838c8
        (void) y;
Packit 7838c8
        switch (key) {
Packit 7838c8
                case GLUT_KEY_PAGE_UP:          /* previous logical image */
Packit 7838c8
                    if (TIFFCurrentDirectory(tif) > 0) {
Packit 7838c8
                            if (TIFFSetDirectory(tif,
Packit 7838c8
                                                 TIFFCurrentDirectory(tif)-1)) {
Packit 7838c8
                                    initImage();
Packit 7838c8
                                    setWindowSize();
Packit 7838c8
                        }
Packit 7838c8
                    } else {
Packit 7838c8
                            TIFFRGBAImageEnd(&img;;
Packit 7838c8
                            prevImage();
Packit 7838c8
                            initImage();
Packit 7838c8
                            setWindowSize();
Packit 7838c8
                    }
Packit 7838c8
                break;
Packit 7838c8
                case GLUT_KEY_PAGE_DOWN:        /* next logical image */
Packit 7838c8
                    if (!TIFFLastDirectory(tif)) {
Packit 7838c8
                            if (TIFFReadDirectory(tif)) {
Packit 7838c8
                                    initImage();
Packit 7838c8
                                    setWindowSize();
Packit 7838c8
                            }
Packit 7838c8
                    } else {
Packit 7838c8
                            TIFFRGBAImageEnd(&img;;
Packit 7838c8
                            nextImage();
Packit 7838c8
                            initImage();
Packit 7838c8
                            setWindowSize();
Packit 7838c8
                    }
Packit 7838c8
                break;
Packit 7838c8
                case GLUT_KEY_HOME:             /* 1st image in current file */
Packit 7838c8
                        if (TIFFSetDirectory(tif, 0)) {
Packit 7838c8
                                TIFFRGBAImageEnd(&img;;
Packit 7838c8
                                initImage();
Packit 7838c8
                                setWindowSize();
Packit 7838c8
                        }
Packit 7838c8
                break;
Packit 7838c8
                case GLUT_KEY_END:              /* last image in current file */
Packit 7838c8
                        TIFFRGBAImageEnd(&img;;
Packit 7838c8
                        while (!TIFFLastDirectory(tif))
Packit 7838c8
                                TIFFReadDirectory(tif);
Packit 7838c8
                        initImage();
Packit 7838c8
                        setWindowSize();
Packit 7838c8
                break;
Packit 7838c8
        }
Packit 7838c8
        glutPostRedisplay();
Packit 7838c8
}
Packit 7838c8
Packit 7838c8
/* GLUT framework on MacOS X produces deprecation warnings */
Packit 7838c8
# if defined(__GNUC__) && defined(__APPLE__)
Packit 7838c8
#  pragma GCC diagnostic pop
Packit 7838c8
# endif
Packit 7838c8
Packit 7838c8
char* stuff[] = {
Packit 7838c8
"usage: tiffgt [options] file.tif",
Packit 7838c8
"where options are:",
Packit 7838c8
" -c            use colormap visual",
Packit 7838c8
" -d dirnum     set initial directory (default is 0)",
Packit 7838c8
" -e            enable display of TIFF error messages",
Packit 7838c8
" -l            force lsb-to-msb FillOrder",
Packit 7838c8
" -m            force msb-to-lsb FillOrder",
Packit 7838c8
" -o offset     set initial directory offset",
Packit 7838c8
" -p photo      override photometric interpretation",
Packit 7838c8
" -r            use fullcolor visual",
Packit 7838c8
" -s            stop decoding on first error (default is ignore errors)",
Packit 7838c8
" -v            enable verbose mode",
Packit 7838c8
" -w            enable display of TIFF warning messages",
Packit 7838c8
NULL
Packit 7838c8
};
Packit 7838c8
Packit 7838c8
static void
Packit 7838c8
usage(void)
Packit 7838c8
{
Packit 7838c8
        char buf[BUFSIZ];
Packit 7838c8
        int i;
Packit 7838c8
Packit 7838c8
        setbuf(stderr, buf);
Packit 7838c8
                fprintf(stderr, "%s\n\n", TIFFGetVersion());
Packit 7838c8
        for (i = 0; stuff[i] != NULL; i++)
Packit 7838c8
                fprintf(stderr, "%s\n", stuff[i]);
Packit 7838c8
        exit(-1);
Packit 7838c8
}
Packit 7838c8
Packit 7838c8
static uint16
Packit 7838c8
photoArg(const char* arg)
Packit 7838c8
{
Packit 7838c8
        if (strcmp(arg, "miniswhite") == 0)
Packit 7838c8
            return (PHOTOMETRIC_MINISWHITE);
Packit 7838c8
        else if (strcmp(arg, "minisblack") == 0)
Packit 7838c8
            return (PHOTOMETRIC_MINISBLACK);
Packit 7838c8
        else if (strcmp(arg, "rgb") == 0)
Packit 7838c8
            return (PHOTOMETRIC_RGB);
Packit 7838c8
        else if (strcmp(arg, "palette") == 0)
Packit 7838c8
            return (PHOTOMETRIC_PALETTE);
Packit 7838c8
        else if (strcmp(arg, "mask") == 0)
Packit 7838c8
            return (PHOTOMETRIC_MASK);
Packit 7838c8
        else if (strcmp(arg, "separated") == 0)
Packit 7838c8
            return (PHOTOMETRIC_SEPARATED);
Packit 7838c8
        else if (strcmp(arg, "ycbcr") == 0)
Packit 7838c8
            return (PHOTOMETRIC_YCBCR);
Packit 7838c8
        else if (strcmp(arg, "cielab") == 0)
Packit 7838c8
            return (PHOTOMETRIC_CIELAB);
Packit 7838c8
        else if (strcmp(arg, "logl") == 0)
Packit 7838c8
            return (PHOTOMETRIC_LOGL);
Packit 7838c8
        else if (strcmp(arg, "logluv") == 0)
Packit 7838c8
            return (PHOTOMETRIC_LOGLUV);
Packit 7838c8
        else
Packit 7838c8
            return ((uint16) -1);
Packit 7838c8
}
Packit 7838c8
Packit 7838c8
/* vim: set ts=8 sts=8 sw=8 noet: */
Packit 7838c8
/*
Packit 7838c8
 * Local Variables:
Packit 7838c8
 * mode: c
Packit 7838c8
 * c-basic-offset: 8
Packit 7838c8
 * fill-column: 78
Packit 7838c8
 * End:
Packit 7838c8
 */