Adds VipsRegionShrink type

This commit is contained in:
Simon Harris 2018-03-28 07:35:49 +11:00
parent 442f4e55c9
commit 36076f8294
6 changed files with 616 additions and 570 deletions

View File

@ -447,6 +447,7 @@ struct _VipsForeignSaveDz {
VipsAngle angle;
VipsForeignDzContainer container;
int compression;
VipsRegionShrink region_shrink;
/* Tile and overlap geometry. The members above are the parameters we
* accept, this next set are the derived values which are actually
@ -2099,6 +2100,14 @@ vips_foreign_save_dz_class_init( VipsForeignSaveDzClass *class )
G_STRUCT_OFFSET( VipsForeignSaveDz, compression ),
-1, 9, 0 );
VIPS_ARG_ENUM( class, "region_shrink", 18,
_( "Region shrink" ),
_( "Method for blah" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsForeignSaveDz, region_shrink ),
VIPS_TYPE_REGION_SHRINK,
VIPS_REGION_SHRINK_MEAN );
/* How annoying. We stupidly had these in earlier versions.
*/
@ -2137,6 +2146,7 @@ vips_foreign_save_dz_init( VipsForeignSaveDz *dz )
dz->angle = VIPS_ANGLE_D0;
dz->container = VIPS_FOREIGN_DZ_CONTAINER_FS;
dz->compression = 0;
dz->region_shrink = VIPS_REGION_SHRINK_MEAN;
}
typedef struct _VipsForeignSaveDzFile {
@ -2333,6 +2343,7 @@ vips_foreign_save_dz_buffer_init( VipsForeignSaveDzBuffer *buffer )
* * @container: #VipsForeignDzContainer set container type
* * @properties: %gboolean write a properties file
* * @compression: %gint zip deflate compression level
* * @shrink_region: #VipsRegionShrink How to shrink each 2x2 region.
*
* Save an image as a set of tiles at various resolutions. By default dzsave
* uses DeepZoom layout -- use @layout to pick other conventions.
@ -2370,6 +2381,10 @@ vips_foreign_save_dz_buffer_init( VipsForeignSaveDzBuffer *buffer )
* (use zlib default), 0 (store, compression disabled) to 9 (max compression).
* If no value is given, the default is to store files without compression.
*
* You can use @region_shrink to control the method for shrinking each 2x2
* region. This defaults to using the average of the 4 input pixels but you can
* also use the median in cases where you want to preseve the range of values.
*
* See also: vips_tiffsave().
*
* Returns: 0 on success, -1 on error.

View File

@ -72,7 +72,8 @@ vips_scan_headers = \
${top_srcdir}/libvips/include/vips/morphology.h \
${top_srcdir}/libvips/include/vips/draw.h \
${top_srcdir}/libvips/include/vips/basic.h \
${top_srcdir}/libvips/include/vips/object.h
${top_srcdir}/libvips/include/vips/object.h \
${top_srcdir}/libvips/include/vips/region.h
enumtypes.h: $(vips_scan_headers) Makefile.am
glib-mkenums --template enumtemplate $(vips_scan_headers) > enumtypes.h

View File

@ -1,15 +1,58 @@
/* Generated data (by glib-mkenums) */
/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
#ifndef VIPS_ENUM_TYPES_H
#define VIPS_ENUM_TYPES_H
G_BEGIN_DECLS
/* enumerations from "../../../libvips/include/vips/resample.h" */
GType vips_kernel_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_KERNEL (vips_kernel_get_type())
GType vips_size_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_SIZE (vips_size_get_type())
/* enumerations from "../../../libvips/include/vips/arithmetic.h" */
GType vips_operation_math_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_MATH (vips_operation_math_get_type())
GType vips_operation_math2_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_MATH2 (vips_operation_math2_get_type())
GType vips_operation_round_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_ROUND (vips_operation_round_get_type())
GType vips_operation_relational_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_RELATIONAL (vips_operation_relational_get_type())
GType vips_operation_boolean_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_BOOLEAN (vips_operation_boolean_get_type())
GType vips_operation_complex_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_COMPLEX (vips_operation_complex_get_type())
GType vips_operation_complex2_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_COMPLEX2 (vips_operation_complex2_get_type())
GType vips_operation_complexget_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_COMPLEXGET (vips_operation_complexget_get_type())
/* enumerations from "../../../libvips/include/vips/basic.h" */
GType vips_precision_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_PRECISION (vips_precision_get_type())
/* enumerations from "../../../libvips/include/vips/colour.h" */
GType vips_intent_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_INTENT (vips_intent_get_type())
GType vips_pcs_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_PCS (vips_pcs_get_type())
/* enumerations from "../../../libvips/include/vips/conversion.h" */
GType vips_extend_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_EXTEND (vips_extend_get_type())
GType vips_compass_direction_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_COMPASS_DIRECTION (vips_compass_direction_get_type())
GType vips_direction_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_DIRECTION (vips_direction_get_type())
GType vips_align_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_ALIGN (vips_align_get_type())
GType vips_angle_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_ANGLE (vips_angle_get_type())
GType vips_angle45_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_ANGLE45 (vips_angle45_get_type())
GType vips_interesting_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_INTERESTING (vips_interesting_get_type())
GType vips_blend_mode_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_BLEND_MODE (vips_blend_mode_get_type())
/* enumerations from "../../../libvips/include/vips/convolution.h" */
GType vips_combine_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_COMBINE (vips_combine_get_type())
/* enumerations from "../../../libvips/include/vips/draw.h" */
GType vips_combine_mode_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_COMBINE_MODE (vips_combine_mode_get_type())
/* enumerations from "../../../libvips/include/vips/foreign.h" */
GType vips_foreign_flags_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_FLAGS (vips_foreign_flags_get_type())
@ -31,43 +74,6 @@ GType vips_foreign_dz_depth_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_DZ_DEPTH (vips_foreign_dz_depth_get_type())
GType vips_foreign_dz_container_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_DZ_CONTAINER (vips_foreign_dz_container_get_type())
/* enumerations from "../../../libvips/include/vips/arithmetic.h" */
GType vips_operation_math_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_MATH (vips_operation_math_get_type())
GType vips_operation_math2_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_MATH2 (vips_operation_math2_get_type())
GType vips_operation_round_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_ROUND (vips_operation_round_get_type())
GType vips_operation_relational_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_RELATIONAL (vips_operation_relational_get_type())
GType vips_operation_boolean_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_BOOLEAN (vips_operation_boolean_get_type())
GType vips_operation_complex_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_COMPLEX (vips_operation_complex_get_type())
GType vips_operation_complex2_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_COMPLEX2 (vips_operation_complex2_get_type())
GType vips_operation_complexget_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_COMPLEXGET (vips_operation_complexget_get_type())
/* enumerations from "../../../libvips/include/vips/conversion.h" */
GType vips_extend_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_EXTEND (vips_extend_get_type())
GType vips_compass_direction_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_COMPASS_DIRECTION (vips_compass_direction_get_type())
GType vips_direction_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_DIRECTION (vips_direction_get_type())
GType vips_align_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_ALIGN (vips_align_get_type())
GType vips_angle_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_ANGLE (vips_angle_get_type())
GType vips_angle45_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_ANGLE45 (vips_angle45_get_type())
GType vips_interesting_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_INTERESTING (vips_interesting_get_type())
GType vips_blend_mode_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_BLEND_MODE (vips_blend_mode_get_type())
/* enumerations from "../../../libvips/include/vips/util.h" */
GType vips_token_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_TOKEN (vips_token_get_type())
/* enumerations from "../../../libvips/include/vips/image.h" */
GType vips_demand_style_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_DEMAND_STYLE (vips_demand_style_get_type())
@ -81,29 +87,26 @@ GType vips_coding_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_CODING (vips_coding_get_type())
GType vips_access_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_ACCESS (vips_access_get_type())
/* enumerations from "../../../libvips/include/vips/colour.h" */
GType vips_intent_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_INTENT (vips_intent_get_type())
GType vips_pcs_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_PCS (vips_pcs_get_type())
/* enumerations from "../../../libvips/include/vips/operation.h" */
GType vips_operation_flags_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_FLAGS (vips_operation_flags_get_type())
/* enumerations from "../../../libvips/include/vips/convolution.h" */
GType vips_combine_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_COMBINE (vips_combine_get_type())
/* enumerations from "../../../libvips/include/vips/morphology.h" */
GType vips_operation_morphology_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_MORPHOLOGY (vips_operation_morphology_get_type())
/* enumerations from "../../../libvips/include/vips/draw.h" */
GType vips_combine_mode_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_COMBINE_MODE (vips_combine_mode_get_type())
/* enumerations from "../../../libvips/include/vips/basic.h" */
GType vips_precision_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_PRECISION (vips_precision_get_type())
/* enumerations from "../../../libvips/include/vips/object.h" */
GType vips_argument_flags_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_ARGUMENT_FLAGS (vips_argument_flags_get_type())
/* enumerations from "../../../libvips/include/vips/operation.h" */
GType vips_operation_flags_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_FLAGS (vips_operation_flags_get_type())
/* enumerations from "../../../libvips/include/vips/region.h" */
GType vips_region_shrink_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_REGION_SHRINK (vips_region_shrink_get_type())
/* enumerations from "../../../libvips/include/vips/resample.h" */
GType vips_kernel_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_KERNEL (vips_kernel_get_type())
GType vips_size_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_SIZE (vips_size_get_type())
/* enumerations from "../../../libvips/include/vips/util.h" */
GType vips_token_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_TOKEN (vips_token_get_type())
G_END_DECLS
#endif /*VIPS_ENUM_TYPES_H*/

View File

@ -55,6 +55,13 @@ extern "C" {
(G_TYPE_INSTANCE_GET_CLASS( (obj), \
VIPS_TYPE_REGION, VipsRegionClass ))
/**
* VipsRegionShrink:
* @VIPS_REGION_SHRINK_MEAN: use the average
* @VIPS_REGION_SHRINK_MEDIAN: use the median
*
* How to calculate the output pixels when shrinking a 2x2 region.
*/
typedef enum {
VIPS_REGION_SHRINK_MEAN,
VIPS_REGION_SHRINK_MEDIAN,

View File

@ -70,7 +70,8 @@ vips_scan_headers = \
${top_srcdir}/libvips/include/vips/morphology.h \
${top_srcdir}/libvips/include/vips/draw.h \
${top_srcdir}/libvips/include/vips/basic.h \
${top_srcdir}/libvips/include/vips/object.h
${top_srcdir}/libvips/include/vips/object.h \
${top_srcdir}/libvips/include/vips/region.h
enumtypes.c: $(vips_scan_headers) Makefile.am
glib-mkenums --template enumtemplate $(vips_scan_headers) > enumtypes.c

File diff suppressed because it is too large Load Diff