mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Upgrade to libvips v8.6.0
Expose offset coordinates of strategy-based crop Switch to Github releases for prebuilt libvips Move packaging scripts to lovell/sharp-libvips repo
This commit is contained in:
@@ -565,34 +565,6 @@ VImage::new_from_buffer( void *buf, size_t len, const char *option_string,
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage
|
||||
VImage::new_from_image( std::vector<double> pixel )
|
||||
{
|
||||
VImage onepx = VImage::black( 1, 1,
|
||||
VImage::option()->set( "bands", bands() ) );
|
||||
|
||||
onepx = (onepx + pixel).cast( format() );
|
||||
|
||||
VImage big = onepx.embed( 0, 0, width(), height(),
|
||||
VImage::option()->set( "extend", VIPS_EXTEND_COPY ) );
|
||||
|
||||
big = big.copy(
|
||||
VImage::option()->
|
||||
set( "interpretation", interpretation() )->
|
||||
set( "xres", xres() )->
|
||||
set( "yres", yres() )->
|
||||
set( "xoffset", xres() )->
|
||||
set( "yoffset", yres() ) );
|
||||
|
||||
return( big );
|
||||
}
|
||||
|
||||
VImage
|
||||
VImage::new_from_image( double pixel )
|
||||
{
|
||||
return( new_from_image( to_vectorv( 1, pixel ) ) );
|
||||
}
|
||||
|
||||
VImage
|
||||
VImage::new_matrix( int width, int height )
|
||||
{
|
||||
@@ -693,10 +665,10 @@ VImage::bandsplit( VOption *options )
|
||||
VImage
|
||||
VImage::bandjoin( VImage other, VOption *options )
|
||||
{
|
||||
VImage v[2] = { *this, other };
|
||||
std::vector<VImage> vec( v, v + VIPS_NUMBER( v ) );
|
||||
VImage v[2] = { *this, other };
|
||||
std::vector<VImage> vec( v, v + VIPS_NUMBER( v ) );
|
||||
|
||||
return( bandjoin( vec, options ) );
|
||||
return( bandjoin( vec, options ) );
|
||||
}
|
||||
|
||||
std::complex<double>
|
||||
|
||||
@@ -534,6 +534,9 @@ class PipelineWorker : public Nan::AsyncWorker {
|
||||
// Attention-based or Entropy-based crop
|
||||
image = image.smartcrop(baton->width, baton->height, VImage::option()
|
||||
->set("interesting", baton->crop == 16 ? VIPS_INTERESTING_ENTROPY : VIPS_INTERESTING_ATTENTION));
|
||||
baton->hasCropOffset = true;
|
||||
baton->cropOffsetLeft = image.xoffset();
|
||||
baton->cropOffsetTop = image.yoffset();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1005,9 +1008,11 @@ class PipelineWorker : public Nan::AsyncWorker {
|
||||
Set(info, New("height").ToLocalChecked(), New<v8::Uint32>(static_cast<uint32_t>(height)));
|
||||
Set(info, New("channels").ToLocalChecked(), New<v8::Uint32>(static_cast<uint32_t>(baton->channels)));
|
||||
Set(info, New("premultiplied").ToLocalChecked(), New<v8::Boolean>(baton->premultiplied));
|
||||
if (baton->cropCalcLeft != -1 && baton->cropCalcLeft != -1) {
|
||||
Set(info, New("cropCalcLeft").ToLocalChecked(), New<v8::Uint32>(static_cast<uint32_t>(baton->cropCalcLeft)));
|
||||
Set(info, New("cropCalcTop").ToLocalChecked(), New<v8::Uint32>(static_cast<uint32_t>(baton->cropCalcTop)));
|
||||
if (baton->hasCropOffset) {
|
||||
Set(info, New("cropOffsetLeft").ToLocalChecked(),
|
||||
New<v8::Int32>(static_cast<int32_t>(baton->cropOffsetLeft)));
|
||||
Set(info, New("cropOffsetTop").ToLocalChecked(),
|
||||
New<v8::Int32>(static_cast<int32_t>(baton->cropOffsetTop)));
|
||||
}
|
||||
|
||||
if (baton->bufferOutLength > 0) {
|
||||
|
||||
@@ -62,8 +62,9 @@ struct PipelineBaton {
|
||||
int channels;
|
||||
Canvas canvas;
|
||||
int crop;
|
||||
int cropCalcLeft;
|
||||
int cropCalcTop;
|
||||
bool hasCropOffset;
|
||||
int cropOffsetLeft;
|
||||
int cropOffsetTop;
|
||||
bool premultiplied;
|
||||
std::string kernel;
|
||||
std::string interpolator;
|
||||
@@ -145,8 +146,9 @@ struct PipelineBaton {
|
||||
channels(0),
|
||||
canvas(Canvas::CROP),
|
||||
crop(0),
|
||||
cropCalcLeft(-1),
|
||||
cropCalcTop(-1),
|
||||
hasCropOffset(false),
|
||||
cropOffsetLeft(0),
|
||||
cropOffsetTop(0),
|
||||
premultiplied(false),
|
||||
centreSampling(false),
|
||||
flatten(false),
|
||||
|
||||
Reference in New Issue
Block a user