boilerplate for hsv colourspace

This commit is contained in:
John Cupitt 2015-06-09 10:18:30 +01:00
parent 33788f7336
commit a42232a9a1
10 changed files with 304 additions and 10 deletions

View File

@ -25,6 +25,7 @@ TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
SETUP_FILES = \
$(content_files) \
$(expand_content_files) \
$(DOC_MAIN_SGML_FILE) \
$(DOC_MODULE)-sections.txt \
$(DOC_MODULE)-overrides.txt
@ -86,7 +87,7 @@ GTK_DOC_V_SETUP_0=@echo " DOC Preparing build";
setup-build.stamp:
-$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \
files=`echo $(SETUP_FILES) $(DOC_MODULE).types`; \
if test "x$$files" != "x" ; then \
for file in $$files ; do \
destdir=`dirname $(abs_builddir)/$$file`; \
@ -118,7 +119,7 @@ scan-build.stamp: setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
$(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
scanobj_options=""; \
gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \
if test "$(?)" = "0"; then \
if test "$$?" = "0"; then \
if test "x$(V)" = "x1"; then \
scanobj_options="--verbose"; \
fi; \
@ -162,17 +163,17 @@ GTK_DOC_V_XREF=$(GTK_DOC_V_XREF_$(V))
GTK_DOC_V_XREF_=$(GTK_DOC_V_XREF_$(AM_DEFAULT_VERBOSITY))
GTK_DOC_V_XREF_0=@echo " DOC Fixing cross-references";
html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
$(GTK_DOC_V_HTML)rm -rf html && mkdir html && \
mkhtml_options=""; \
gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \
if test "$(?)" = "0"; then \
if test "$$?" = "0"; then \
if test "x$(V)" = "x1"; then \
mkhtml_options="$$mkhtml_options --verbose"; \
fi; \
fi; \
gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
if test "$(?)" = "0"; then \
if test "$$?" = "0"; then \
mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \
fi; \
cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
@ -194,11 +195,11 @@ GTK_DOC_V_PDF=$(GTK_DOC_V_PDF_$(V))
GTK_DOC_V_PDF_=$(GTK_DOC_V_PDF_$(AM_DEFAULT_VERBOSITY))
GTK_DOC_V_PDF_0=@echo " DOC Building PDF";
pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
$(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \
mkpdf_options=""; \
gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \
if test "$(?)" = "0"; then \
if test "$$?" = "0"; then \
if test "x$(V)" = "x1"; then \
mkpdf_options="$$mkpdf_options --verbose"; \
fi; \
@ -223,12 +224,15 @@ clean-local:
@if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \
rm -f $(DOC_MODULE).types; \
fi
@if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-sections" ; then \
rm -f $(DOC_MODULE)-sections.txt; \
fi
distclean-local:
@rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \
$(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \
rm -f $(SETUP_FILES) $(DOC_MODULE).types; \
fi
maintainer-clean-local:

119
libvips/colour/HSV2sRGB.c Normal file
View File

@ -0,0 +1,119 @@
/* to sRGB from HSV
*
* 9/6/15
* - from HSV2sRGB.c
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#include <stdio.h>
#include <vips/vips.h>
#include "pcolour.h"
typedef VipsColourCode VipsHSV2sRGB;
typedef VipsColourCodeClass VipsHSV2sRGBClass;
G_DEFINE_TYPE( VipsHSV2sRGB, vips_HSV2sRGB, VIPS_TYPE_COLOUR_CODE );
static void
vips_HSV2sRGB_line( VipsColour *colour, VipsPel *out, VipsPel **in, int width )
{
unsigned char *p = (unsigned char *) in[0];
unsigned char *q = (unsigned char *) out;
int i;
for( i = 0; i < width; i++ ) {
q[0] = p[0];
q[1] = p[1];
q[2] = p[2];
p += 3;
q += 3;
}
}
static void
vips_HSV2sRGB_class_init( VipsHSV2sRGBClass *class )
{
VipsObjectClass *object_class = (VipsObjectClass *) class;
VipsColourClass *colour_class = VIPS_COLOUR_CLASS( class );
object_class->nickname = "HSV2sRGB";
object_class->description = _( "transform HSV to sRGB" );
colour_class->process_line = vips_HSV2sRGB_line;
}
static void
vips_HSV2sRGB_init( VipsHSV2sRGB *HSV2sRGB )
{
VipsColour *colour = VIPS_COLOUR( HSV2sRGB );
VipsColourCode *code = VIPS_COLOUR_CODE( HSV2sRGB );
colour->interpretation = VIPS_INTERPRETATION_HSV;
colour->format = VIPS_FORMAT_UCHAR;
colour->bands = 3;
colour->input_bands = 3;
code->input_coding = VIPS_CODING_NONE;
code->input_format = VIPS_FORMAT_UCHAR;
code->input_interpretation = VIPS_INTERPRETATION_sRGB;
}
/**
* vips_HSV2sRGB:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Convert HSV to sRGB.
*
* See also: vips_sRGB2HSV().
*
* Returns: 0 on success, -1 on error.
*/
int
vips_HSV2sRGB( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_call_split( "HSV2sRGB", ap, in, out );
va_end( ap );
return( result );
}

View File

@ -26,6 +26,8 @@ libcolour_la_SOURCES = \
LabQ2LabS.c \
LabQ2sRGB.c \
sRGB2scRGB.c \
sRGB2HSV.c \
HSV2sRGB.c \
scRGB2XYZ.c \
scRGB2BW.c \
XYZ2scRGB.c \

View File

@ -602,7 +602,9 @@ vips_colour_code_class_init( VipsColourCodeClass *class )
static void
vips_colour_code_init( VipsColourCode *code )
{
code->input_coding = VIPS_CODING_NONE;
code->input_interpretation = VIPS_INTERPRETATION_ERROR;
code->input_format = VIPS_FORMAT_NOTSET;
}
G_DEFINE_ABSTRACT_TYPE( VipsColourDifference, vips_colour_difference,
@ -737,6 +739,8 @@ vips_colour_operation_init( void )
extern GType vips_LabQ2sRGB_get_type( void );
extern GType vips_XYZ2sRGB_get_type( void );
extern GType vips_sRGB2scRGB_get_type( void );
extern GType vips_sRGB2HSV_get_type( void );
extern GType vips_HSV2sRGB_get_type( void );
extern GType vips_scRGB2XYZ_get_type( void );
extern GType vips_scRGB2BW_get_type( void );
extern GType vips_XYZ2scRGB_get_type( void );
@ -771,6 +775,8 @@ vips_colour_operation_init( void )
vips_sRGB2scRGB_get_type();
vips_scRGB2XYZ_get_type();
vips_scRGB2BW_get_type();
vips_sRGB2HSV_get_type();
vips_HSV2sRGB_get_type();
vips_XYZ2scRGB_get_type();
vips_scRGB2sRGB_get_type();
#if defined(HAVE_LCMS) || defined(HAVE_LCMS2)

View File

@ -207,6 +207,7 @@ typedef struct _VipsColourRoute {
#define LABS VIPS_INTERPRETATION_LABS
#define scRGB VIPS_INTERPRETATION_scRGB
#define sRGB VIPS_INTERPRETATION_sRGB
#define HSV VIPS_INTERPRETATION_HSV
#define RGB16 VIPS_INTERPRETATION_RGB16
#define GREY16 VIPS_INTERPRETATION_GREY16
#define YXY VIPS_INTERPRETATION_YXY
@ -222,6 +223,7 @@ static VipsColourRoute vips_colour_routes[] = {
{ XYZ, LABS, { vips_XYZ2Lab, vips_Lab2LabS, NULL } },
{ XYZ, scRGB, { vips_XYZ2scRGB, NULL } },
{ XYZ, sRGB, { vips_XYZ2scRGB, vips_scRGB2sRGB, NULL } },
{ XYZ, HSV, { vips_XYZ2scRGB, vips_scRGB2sRGB, vips_sRGB2HSV, NULL } },
{ XYZ, BW, { vips_XYZ2scRGB, vips_scRGB2BW, NULL } },
{ XYZ, RGB16, { vips_XYZ2scRGB, vips_scRGB2RGB16, NULL } },
{ XYZ, GREY16, { vips_XYZ2scRGB, vips_scRGB2BW16, NULL } },
@ -234,6 +236,7 @@ static VipsColourRoute vips_colour_routes[] = {
{ LAB, LABS, { vips_Lab2LabS, NULL } },
{ LAB, scRGB, { vips_Lab2XYZ, vips_XYZ2scRGB, NULL } },
{ LAB, sRGB, { vips_Lab2XYZ, vips_XYZ2scRGB, vips_scRGB2sRGB, NULL } },
{ LAB, HSV, { vips_Lab2XYZ, vips_XYZ2scRGB, vips_scRGB2sRGB, vips_sRGB2HSV, NULL } },
{ LAB, BW, { vips_Lab2XYZ, vips_XYZ2scRGB, vips_scRGB2BW, NULL } },
{ LAB, RGB16, { vips_Lab2XYZ, vips_XYZ2scRGB,
vips_scRGB2RGB16, NULL } },
@ -248,6 +251,7 @@ static VipsColourRoute vips_colour_routes[] = {
{ LABQ, LABS, { vips_LabQ2LabS, NULL } },
{ LABQ, scRGB, { vips_LabQ2Lab, vips_Lab2XYZ, vips_XYZ2scRGB } },
{ LABQ, sRGB, { vips_LabQ2sRGB, NULL } },
{ LABQ, HSV, { vips_LabQ2sRGB, vips_sRGB2HSV, NULL } },
{ LABQ, BW, { vips_LabQ2Lab, vips_Lab2XYZ, vips_XYZ2scRGB,
vips_scRGB2BW, NULL } },
{ LABQ, RGB16, { vips_LabQ2Lab, vips_Lab2XYZ, vips_XYZ2scRGB,
@ -264,6 +268,8 @@ static VipsColourRoute vips_colour_routes[] = {
{ LCH, scRGB, { vips_LCh2Lab, vips_Lab2XYZ, vips_XYZ2scRGB, NULL } },
{ LCH, sRGB, { vips_LCh2Lab, vips_Lab2XYZ, vips_XYZ2scRGB,
vips_scRGB2sRGB, NULL } },
{ LCH, HSV, { vips_LCh2Lab, vips_Lab2XYZ, vips_XYZ2scRGB,
vips_scRGB2sRGB, vips_sRGB2HSV, NULL } },
{ LCH, BW, { vips_LCh2Lab, vips_Lab2XYZ, vips_XYZ2scRGB,
vips_scRGB2BW, NULL } },
{ LCH, RGB16, { vips_LCh2Lab, vips_Lab2XYZ, vips_XYZ2scRGB,
@ -281,6 +287,8 @@ static VipsColourRoute vips_colour_routes[] = {
vips_XYZ2scRGB, NULL } },
{ CMC, sRGB, { vips_CMC2LCh, vips_LCh2Lab, vips_Lab2XYZ,
vips_XYZ2scRGB, vips_scRGB2sRGB, NULL } },
{ CMC, HSV, { vips_CMC2LCh, vips_LCh2Lab, vips_Lab2XYZ,
vips_XYZ2scRGB, vips_scRGB2sRGB, vips_sRGB2HSV, NULL } },
{ CMC, BW, { vips_CMC2LCh, vips_LCh2Lab, vips_Lab2XYZ,
vips_XYZ2scRGB, vips_scRGB2BW, NULL } },
{ CMC, RGB16, { vips_CMC2LCh, vips_LCh2Lab, vips_Lab2XYZ,
@ -298,6 +306,8 @@ static VipsColourRoute vips_colour_routes[] = {
{ LABS, scRGB, { vips_LabS2Lab, vips_Lab2XYZ, vips_XYZ2scRGB, NULL } },
{ LABS, sRGB, { vips_LabS2Lab, vips_Lab2XYZ, vips_XYZ2scRGB,
vips_scRGB2sRGB, NULL } },
{ LABS, HSV, { vips_LabS2Lab, vips_Lab2XYZ, vips_XYZ2scRGB,
vips_scRGB2sRGB, vips_sRGB2HSV, NULL } },
{ LABS, BW, { vips_LabS2Lab, vips_Lab2XYZ, vips_XYZ2scRGB,
vips_scRGB2BW, NULL } },
{ LABS, RGB16, { vips_LabS2Lab, vips_Lab2XYZ, vips_XYZ2scRGB,
@ -313,6 +323,7 @@ static VipsColourRoute vips_colour_routes[] = {
{ scRGB, CMC, { vips_scRGB2XYZ, vips_XYZ2Lab,
vips_Lab2LCh, vips_LCh2CMC, NULL } },
{ scRGB, sRGB, { vips_scRGB2sRGB, NULL } },
{ scRGB, HSV, { vips_scRGB2sRGB, vips_sRGB2HSV, NULL } },
{ scRGB, BW, { vips_scRGB2BW, NULL } },
{ scRGB, LABS, { vips_scRGB2XYZ, vips_XYZ2Lab, vips_Lab2LabS, NULL } },
{ scRGB, RGB16, { vips_scRGB2RGB16, NULL } },
@ -328,6 +339,7 @@ static VipsColourRoute vips_colour_routes[] = {
{ sRGB, CMC, { vips_sRGB2scRGB, vips_scRGB2XYZ, vips_XYZ2Lab,
vips_Lab2LCh, vips_LCh2CMC, NULL } },
{ sRGB, scRGB, { vips_sRGB2scRGB, NULL } },
{ sRGB, HSV, { vips_sRGB2HSV, NULL } },
{ sRGB, BW, { vips_sRGB2scRGB, vips_scRGB2BW, NULL } },
{ sRGB, LABS, { vips_sRGB2scRGB, vips_scRGB2XYZ, vips_XYZ2Lab,
vips_Lab2LabS, NULL } },
@ -335,6 +347,26 @@ static VipsColourRoute vips_colour_routes[] = {
{ sRGB, GREY16, { vips_sRGB2scRGB, vips_scRGB2BW16, NULL } },
{ sRGB, YXY, { vips_sRGB2scRGB, vips_scRGB2XYZ, vips_XYZ2Yxy, NULL } },
{ HSV, XYZ, { vips_HSV2sRGB, vips_sRGB2scRGB, vips_scRGB2XYZ, NULL } },
{ HSV, LAB, { vips_HSV2sRGB, vips_sRGB2scRGB, vips_scRGB2XYZ,
vips_XYZ2Lab, NULL } },
{ HSV, LABQ, { vips_HSV2sRGB, vips_sRGB2scRGB, vips_scRGB2XYZ,
vips_XYZ2Lab, vips_Lab2LabQ, NULL } },
{ HSV, LCH, { vips_HSV2sRGB, vips_sRGB2scRGB, vips_scRGB2XYZ,
vips_XYZ2Lab, vips_Lab2LCh, NULL } },
{ HSV, CMC, { vips_HSV2sRGB, vips_sRGB2scRGB, vips_scRGB2XYZ,
vips_XYZ2Lab, vips_Lab2LCh, vips_LCh2CMC, NULL } },
{ HSV, scRGB, { vips_HSV2sRGB, vips_sRGB2scRGB, NULL } },
{ HSV, sRGB, { vips_HSV2sRGB, NULL } },
{ HSV, BW, { vips_HSV2sRGB, vips_sRGB2scRGB, vips_scRGB2BW, NULL } },
{ HSV, LABS, { vips_HSV2sRGB, vips_sRGB2scRGB, vips_scRGB2XYZ,
vips_XYZ2Lab, vips_Lab2LabS, NULL } },
{ HSV, RGB16, { vips_HSV2sRGB, vips_sRGB2RGB16, NULL } },
{ HSV, GREY16, { vips_HSV2sRGB, vips_sRGB2scRGB,
vips_scRGB2BW16, NULL } },
{ HSV, YXY, { vips_HSV2sRGB, vips_sRGB2scRGB, vips_scRGB2XYZ,
vips_XYZ2Yxy, NULL } },
{ RGB16, XYZ, { vips_sRGB2scRGB, vips_scRGB2XYZ, NULL } },
{ RGB16, LAB, { vips_sRGB2scRGB, vips_scRGB2XYZ, vips_XYZ2Lab, NULL } },
{ RGB16, LABQ, { vips_sRGB2scRGB, vips_scRGB2XYZ, vips_XYZ2Lab,
@ -345,6 +377,7 @@ static VipsColourRoute vips_colour_routes[] = {
vips_Lab2LCh, vips_LCh2CMC, NULL } },
{ RGB16, scRGB, { vips_sRGB2scRGB, NULL } },
{ RGB16, sRGB, { vips_RGB162sRGB, NULL } },
{ RGB16, HSV, { vips_RGB162sRGB, vips_sRGB2HSV, NULL } },
{ RGB16, BW, { vips_sRGB2scRGB, vips_scRGB2BW, NULL } },
{ RGB16, LABS, { vips_sRGB2scRGB, vips_scRGB2XYZ, vips_XYZ2Lab,
vips_Lab2LabS, NULL } },
@ -363,6 +396,7 @@ static VipsColourRoute vips_colour_routes[] = {
vips_XYZ2Lab, vips_Lab2LCh, vips_LCh2CMC, NULL } },
{ GREY16, scRGB, { vips_GREY162RGB16, vips_sRGB2scRGB, NULL } },
{ GREY16, sRGB, { vips_GREY162RGB16, vips_RGB162sRGB, NULL } },
{ GREY16, HSV, { vips_GREY162RGB16, vips_RGB162sRGB, vips_sRGB2HSV, NULL } },
{ GREY16, BW, { vips_GREY162RGB16, vips_sRGB2scRGB,
vips_scRGB2BW, NULL } },
{ GREY16, LABS, { vips_GREY162RGB16, vips_sRGB2scRGB, vips_scRGB2XYZ,
@ -382,6 +416,7 @@ static VipsColourRoute vips_colour_routes[] = {
vips_XYZ2Lab, vips_Lab2LCh, vips_LCh2CMC, NULL } },
{ BW, scRGB, { vips_BW2sRGB, vips_sRGB2scRGB, NULL } },
{ BW, sRGB, { vips_BW2sRGB, NULL } },
{ BW, HSV, { vips_BW2sRGB, vips_sRGB2HSV, NULL } },
{ BW, LABS, { vips_BW2sRGB, vips_sRGB2scRGB, vips_scRGB2XYZ,
vips_XYZ2Lab, vips_Lab2LabS, NULL } },
{ BW, RGB16, { vips_BW2sRGB, vips_sRGB2RGB16, NULL } },
@ -399,10 +434,12 @@ static VipsColourRoute vips_colour_routes[] = {
{ YXY, LABS, { vips_Yxy2XYZ, vips_XYZ2Lab, vips_Lab2LabS, NULL } },
{ YXY, scRGB, { vips_Yxy2XYZ, vips_XYZ2scRGB, NULL } },
{ YXY, sRGB, { vips_Yxy2XYZ, vips_XYZ2scRGB, vips_scRGB2sRGB, NULL } },
{ YXY, HSV, { vips_Yxy2XYZ, vips_XYZ2scRGB, vips_scRGB2sRGB, vips_sRGB2HSV, NULL } },
{ YXY, BW, { vips_Yxy2XYZ, vips_XYZ2scRGB, vips_scRGB2BW, NULL } },
{ YXY, RGB16, { vips_Yxy2XYZ, vips_XYZ2scRGB,
vips_scRGB2RGB16, NULL } },
{ YXY, GREY16, { vips_Yxy2XYZ, vips_XYZ2scRGB, vips_scRGB2BW16, NULL } }
};
/* Is an image in a supported colourspace.

119
libvips/colour/sRGB2HSV.c Normal file
View File

@ -0,0 +1,119 @@
/* to HSV ... useful for compatibility with other packages
*
* 9/6/15
* - from LabS2Lab.c
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#include <stdio.h>
#include <vips/vips.h>
#include "pcolour.h"
typedef VipsColourCode VipssRGB2HSV;
typedef VipsColourCodeClass VipssRGB2HSVClass;
G_DEFINE_TYPE( VipssRGB2HSV, vips_sRGB2HSV, VIPS_TYPE_COLOUR_CODE );
static void
vips_sRGB2HSV_line( VipsColour *colour, VipsPel *out, VipsPel **in, int width )
{
unsigned char *p = (unsigned char *) in[0];
unsigned char *q = (unsigned char *) out;
int i;
for( i = 0; i < width; i++ ) {
q[0] = p[0];
q[1] = p[1];
q[2] = p[2];
p += 3;
q += 3;
}
}
static void
vips_sRGB2HSV_class_init( VipssRGB2HSVClass *class )
{
VipsObjectClass *object_class = (VipsObjectClass *) class;
VipsColourClass *colour_class = VIPS_COLOUR_CLASS( class );
object_class->nickname = "sRGB2HSV";
object_class->description = _( "transform sRGB to HSV" );
colour_class->process_line = vips_sRGB2HSV_line;
}
static void
vips_sRGB2HSV_init( VipssRGB2HSV *sRGB2HSV )
{
VipsColour *colour = VIPS_COLOUR( sRGB2HSV );
VipsColourCode *code = VIPS_COLOUR_CODE( sRGB2HSV );
colour->interpretation = VIPS_INTERPRETATION_HSV;
colour->format = VIPS_FORMAT_UCHAR;
colour->bands = 3;
colour->input_bands = 3;
code->input_coding = VIPS_CODING_NONE;
code->input_format = VIPS_FORMAT_UCHAR;
code->input_interpretation = VIPS_INTERPRETATION_sRGB;
}
/**
* vips_sRGB2HSV:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Convert to HSV.
*
* See also: vips_HSV2sRGB().
*
* Returns: 0 on success, -1 on error.
*/
int
vips_sRGB2HSV( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_call_split( "sRGB2HSV", ap, in, out );
va_end( ap );
return( result );
}

View File

@ -149,6 +149,10 @@ int vips_sRGB2scRGB( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_scRGB2XYZ( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_HSV2sRGB( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_sRGB2HSV( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_LCh2CMC( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));

View File

@ -90,7 +90,8 @@ typedef enum {
VIPS_INTERPRETATION_GREY16 = 26,
VIPS_INTERPRETATION_MATRIX = 27,
VIPS_INTERPRETATION_scRGB = 28,
VIPS_INTERPRETATION_LAST = 29
VIPS_INTERPRETATION_HSV = 29,
VIPS_INTERPRETATION_LAST = 30
} VipsInterpretation;
typedef enum {

View File

@ -540,6 +540,7 @@ vips_interpretation_get_type( void )
{VIPS_INTERPRETATION_GREY16, "VIPS_INTERPRETATION_GREY16", "grey16"},
{VIPS_INTERPRETATION_MATRIX, "VIPS_INTERPRETATION_MATRIX", "matrix"},
{VIPS_INTERPRETATION_scRGB, "VIPS_INTERPRETATION_scRGB", "scrgb"},
{VIPS_INTERPRETATION_HSV, "VIPS_INTERPRETATION_HSV", "hsv"},
{VIPS_INTERPRETATION_LAST, "VIPS_INTERPRETATION_LAST", "last"},
{0, NULL, NULL}
};

View File

@ -209,6 +209,7 @@
* @VIPS_INTERPRETATION_LCH: pixels are in CIE LCh space
* @VIPS_INTERPRETATION_LABS: CIE LAB coded as three signed 16-bit values
* @VIPS_INTERPRETATION_sRGB: pixels are sRGB
* @VIPS_INTERPRETATION_HSV: pixels are HSV
* @VIPS_INTERPRETATION_scRGB: pixels are scRGB
* @VIPS_INTERPRETATION_YXY: pixels are CIE Yxy
* @VIPS_INTERPRETATION_RGB16: generic 16-bit RGB
@ -684,7 +685,7 @@ vips_image_sanity( VipsObject *object, VipsBuf *buf )
image->Coding != VIPS_CODING_NONE &&
image->Coding != VIPS_CODING_LABQ &&
image->Coding != VIPS_CODING_RAD) ||
image->Type > VIPS_INTERPRETATION_scRGB ||
image->Type >= VIPS_INTERPRETATION_LAST ||
image->dtype > VIPS_IMAGE_PARTIAL ||
image->dhint > VIPS_DEMAND_STYLE_ANY )
vips_buf_appends( buf, "bad enum\n" );