@@ -185,6 +185,58 @@ pythagoras( VipsSmartcrop *smartcrop, VipsImage *in, VipsImage **out )
185
185
return ( 0 );
186
186
}
187
187
188
+ /* FIXME
189
+ *
190
+ * Needed until 8.6, when this is in iofuncs/image.c
191
+ */
192
+
193
+ static VipsImage *
194
+ vips_image_new_from_image ( VipsImage * image , const double * c , int n )
195
+ {
196
+ VipsObject * scope = (VipsObject * ) vips_image_new ();
197
+ VipsImage * * t = (VipsImage * * ) vips_object_local_array ( scope , 5 );
198
+
199
+ double * ones ;
200
+ int i ;
201
+ VipsImage * result ;
202
+
203
+ if ( !(ones = VIPS_ARRAY ( scope , n , double )) ) {
204
+ g_object_unref ( scope );
205
+ return ( NULL );
206
+ }
207
+ for ( i = 0 ; i < n ; i ++ )
208
+ ones [i ] = 1.0 ;
209
+
210
+ if ( vips_black ( & t [0 ], 1 , 1 , NULL ) ||
211
+ vips_linear ( t [0 ], & t [1 ], ones , (double * ) c , n , NULL ) ||
212
+ vips_cast ( t [1 ], & t [2 ], image -> BandFmt , NULL ) ||
213
+ vips_embed ( t [2 ], & t [3 ], 0 , 0 , image -> Xsize , image -> Ysize ,
214
+ "extend" , VIPS_EXTEND_COPY , NULL ) ||
215
+ vips_copy ( t [3 ], & t [4 ],
216
+ "interpretation" , image -> Type ,
217
+ "xres" , image -> Xres ,
218
+ "yres" , image -> Yres ,
219
+ "xoffset" , image -> Xoffset ,
220
+ "yoffset" , image -> Yoffset ,
221
+ NULL ) ) {
222
+ g_object_unref ( scope );
223
+ return ( NULL );
224
+ }
225
+
226
+ result = t [4 ];
227
+ g_object_ref ( result );
228
+
229
+ g_object_unref ( scope );
230
+
231
+ return ( result );
232
+ }
233
+
234
+ static VipsImage *
235
+ vips_image_new_from_image1 ( VipsImage * image , double c )
236
+ {
237
+ return ( vips_image_new_from_image ( image , (const double * ) & c , 1 ) );
238
+ }
239
+
188
240
static int
189
241
vips_smartcrop_attention ( VipsSmartcrop * smartcrop ,
190
242
VipsImage * in , int * left , int * top )
0 commit comments