1 module stb.imageresize;
2 
3 
4 alias stbir_edge = int;
5 alias stbir_filter = int;
6 alias stbir_colorspace = int;
7 alias stbir_datatype = int;
8 
9 enum
10 {
11 	STBIR_EDGE_CLAMP = 1,
12 	STBIR_EDGE_REFLECT,
13 	STBIR_EDGE_WRAP,
14 	STBIR_EDGE_ZERO,
15 }
16 
17 enum
18 {
19 	STBIR_FILTER_DEFAULT,
20 	STBIR_FILTER_BOX,
21 	STBIR_FILTER_TRIANGLE,
22 	STBIR_FILTER_CUBICBSPLINE,
23 	STBIR_FILTER_CATMULLROM,
24 	STBIR_FILTER_MITCHELL,
25 }
26 
27 enum
28 {
29 	STBIR_COLORSPACE_LINEAR,
30 	STBIR_COLORSPACE_SRGB,
31 	STBIR_MAX_COLORSPACES,
32 }
33 
34 enum
35 {
36 	STBIR_TYPE_UINT8,
37 	STBIR_TYPE_UINT16,
38 	STBIR_TYPE_UINT32,
39 	STBIR_TYPE_FLOAT,
40 	STBIR_MAX_TYPES
41 }
42 
43 extern(C):
44 
45 int stbir_resize_uint8(	in ubyte* input_pixels, int input_w, int input_h, int input_stride_in_bytes,
46 						ubyte* output_pixels, int output_w, int output_h, int output_stride_in_bytes,
47 						int num_channels);
48 
49 int stbir_resize_float(	in float* input_pixels, int input_w, int input_h, int input_stride_in_bytes,
50 						float* output_pixels, int output_w, int output_h, int output_stride_in_bytes,
51 						int num_channels);
52 
53 int stbir_resize_uint8_srgb(in ubyte* input_pixels, int input_w, int input_h, int input_stride_in_bytes,
54 							ubyte* output_pixels, int output_w, int output_h, int output_stride_in_bytes,
55 							int num_channels, int alpha_channel, int flags);
56 
57 
58 int stbir_resize_uint8_srgb_edgemode(	in ubyte* input_pixels, int input_w, int input_h, int input_stride_in_bytes,
59 										ubyte* output_pixels, int output_w, int output_h, int output_stride_in_bytes,
60 										int num_channels, int alpha_channel, int flags,
61 										stbir_edge edge_wrap_mode);
62 
63 
64 int stbir_resize_uint8_generic(	in ubyte* input_pixels, int input_w, int input_h, int input_stride_in_bytes,
65 								ubyte* output_pixels, int output_w, int output_h, int output_stride_in_bytes,
66 								int num_channels, int alpha_channel, int flags,
67 								stbir_edge edge_wrap_mode, stbir_filter filter, stbir_colorspace space,
68 								void* alloc_context);
69 
70 int stbir_resize_uint16_generic(in ushort* input_pixels, int input_w, int input_h, int input_stride_in_bytes,
71 								ushort* output_pixels, int output_w, int output_h, int output_stride_in_bytes,
72 								int num_channels, int alpha_channel, int flags,
73 								stbir_edge edge_wrap_mode, stbir_filter filter, stbir_colorspace space,
74 								void* alloc_context);
75 
76 int stbir_resize_float_generic(	in float* input_pixels, int input_w, int input_h, int input_stride_in_bytes,
77 								float* output_pixels, int output_w, int output_h, int output_stride_in_bytes,
78 								int num_channels, int alpha_channel, int flags,
79 								stbir_edge edge_wrap_mode, stbir_filter filter, stbir_colorspace space,
80 								void* alloc_context);
81 
82 
83 int stbir_resize(	in void* input_pixels, int input_w, int input_h, int input_stride_in_bytes,
84 					void* output_pixels, int output_w, int output_h, int output_stride_in_bytes,
85 					stbir_datatype datatype,
86 					int num_channels, int alpha_channel, int flags,
87 					stbir_edge edge_mode_horizontal, stbir_edge edge_mode_vertical,
88 					stbir_filter filter_horizontal, stbir_filter filter_vertical,
89 					stbir_colorspace space, void* alloc_context);
90 
91 int stbir_resize_subpixel(	in void* input_pixels, int input_w, int input_h, int input_stride_in_bytes,
92 							void* output_pixels, int output_w, int output_h, int output_stride_in_bytes,
93 							stbir_datatype datatype,
94 							int num_channels, int alpha_channel, int flags,
95 							stbir_edge edge_mode_horizontal, stbir_edge edge_mode_vertical,
96 							stbir_filter filter_horizontal, stbir_filter filter_vertical,
97 							stbir_colorspace space, void* alloc_context,
98 							float x_scale, float y_scale,
99 							float x_offset, float y_offset);
100 
101 int stbir_resize_region(in void* input_pixels, int input_w, int input_h, int input_stride_in_bytes,
102 						void* output_pixels, int output_w, int output_h, int output_stride_in_bytes,
103 						stbir_datatype datatype,
104 						int num_channels, int alpha_channel, int flags,
105 						stbir_edge edge_mode_horizontal, stbir_edge edge_mode_vertical,
106 						stbir_filter filter_horizontal, stbir_filter filter_vertical,
107 						stbir_colorspace space, void* alloc_context,
108 						float s0, float t0, float s1, float t1);