scaler: support Stretch
This commit is contained in:
parent
1a7a435460
commit
bc4eb13058
@ -12,6 +12,7 @@ const (
|
|||||||
|
|
||||||
FitOutside AspectFormat = 80 // Pad out with black bars to dimensions
|
FitOutside AspectFormat = 80 // Pad out with black bars to dimensions
|
||||||
FitInside AspectFormat = 82 // Crop to dimensions
|
FitInside AspectFormat = 82 // Crop to dimensions
|
||||||
|
Stretch AspectFormat = 83 // Doesn't preserve aspect ratio
|
||||||
|
|
||||||
NearestNeighbour ScaleFormat = 120
|
NearestNeighbour ScaleFormat = 120
|
||||||
BilinearFast ScaleFormat = 121
|
BilinearFast ScaleFormat = 121
|
||||||
|
@ -52,6 +52,10 @@ func (this *DirectThumbnailer) scaleImage(src image.Image) (image.Image, error)
|
|||||||
srcCopyPosition = image.Rect(offsetX, offsetY, srcSmallestDim+offsetX, srcSmallestDim+offsetY)
|
srcCopyPosition = image.Rect(offsetX, offsetY, srcSmallestDim+offsetX, srcSmallestDim+offsetY)
|
||||||
destCopyPosition = image.Rect(0, 0, this.cfg.Width, this.cfg.Height)
|
destCopyPosition = image.Rect(0, 0, this.cfg.Width, this.cfg.Height)
|
||||||
|
|
||||||
|
case Stretch:
|
||||||
|
srcCopyPosition = src.Bounds()
|
||||||
|
destCopyPosition = image.Rect(0, 0, this.cfg.Width, this.cfg.Height)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nil, ErrInvalidOption
|
return nil, ErrInvalidOption
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user