summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/disintegration
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-08-17 17:19:06 -0700
committerGitHub <noreply@github.com>2017-08-17 17:19:06 -0700
commit96eab1202717e073782ec399a4e0820cae15b1bb (patch)
tree011012982be971c7e9ef91466f026bc0956ac9a2 /vendor/github.com/disintegration
parent2c895ee66eed626721135acfcc48254c6e3f3b29 (diff)
downloadchat-96eab1202717e073782ec399a4e0820cae15b1bb.tar.gz
chat-96eab1202717e073782ec399a4e0820cae15b1bb.tar.bz2
chat-96eab1202717e073782ec399a4e0820cae15b1bb.zip
Updating server dependancies. (#7246)
Diffstat (limited to 'vendor/github.com/disintegration')
-rw-r--r--vendor/github.com/disintegration/imaging/adjust.go18
-rw-r--r--vendor/github.com/disintegration/imaging/effects.go4
-rw-r--r--vendor/github.com/disintegration/imaging/resize.go8
-rw-r--r--vendor/github.com/disintegration/imaging/tools.go8
-rw-r--r--vendor/github.com/disintegration/imaging/transform.go13
-rw-r--r--vendor/github.com/disintegration/imaging/transform_test.go164
6 files changed, 196 insertions, 19 deletions
diff --git a/vendor/github.com/disintegration/imaging/adjust.go b/vendor/github.com/disintegration/imaging/adjust.go
index 9b1b83a4f..daee893cc 100644
--- a/vendor/github.com/disintegration/imaging/adjust.go
+++ b/vendor/github.com/disintegration/imaging/adjust.go
@@ -10,17 +10,17 @@ import (
//
// Example:
//
-// dstImage = imaging.AdjustFunc(
-// srcImage,
-// func(c color.NRGBA) color.NRGBA {
-// // shift the red channel by 16
+// dstImage = imaging.AdjustFunc(
+// srcImage,
+// func(c color.NRGBA) color.NRGBA {
+// // shift the red channel by 16
// r := int(c.R) + 16
// if r > 255 {
-// r = 255
-// }
-// return color.NRGBA{uint8(r), c.G, c.B, c.A}
-// }
-// )
+// r = 255
+// }
+// return color.NRGBA{uint8(r), c.G, c.B, c.A}
+// }
+// )
//
func AdjustFunc(img image.Image, fn func(c color.NRGBA) color.NRGBA) *image.NRGBA {
src := toNRGBA(img)
diff --git a/vendor/github.com/disintegration/imaging/effects.go b/vendor/github.com/disintegration/imaging/effects.go
index 25c940381..f358a48ea 100644
--- a/vendor/github.com/disintegration/imaging/effects.go
+++ b/vendor/github.com/disintegration/imaging/effects.go
@@ -14,7 +14,7 @@ func gaussianBlurKernel(x, sigma float64) float64 {
//
// Usage example:
//
-// dstImage := imaging.Blur(srcImage, 3.5)
+// dstImage := imaging.Blur(srcImage, 3.5)
//
func Blur(img image.Image, sigma float64) *image.NRGBA {
if sigma <= 0 {
@@ -138,7 +138,7 @@ func blurVertical(src *image.NRGBA, kernel []float64) *image.NRGBA {
//
// Usage example:
//
-// dstImage := imaging.Sharpen(srcImage, 3.5)
+// dstImage := imaging.Sharpen(srcImage, 3.5)
//
func Sharpen(img image.Image, sigma float64) *image.NRGBA {
if sigma <= 0 {
diff --git a/vendor/github.com/disintegration/imaging/resize.go b/vendor/github.com/disintegration/imaging/resize.go
index 937f63fe9..1659bbce8 100644
--- a/vendor/github.com/disintegration/imaging/resize.go
+++ b/vendor/github.com/disintegration/imaging/resize.go
@@ -59,7 +59,7 @@ func precomputeWeights(dstSize, srcSize int, filter ResampleFilter) [][]indexWei
//
// Usage example:
//
-// dstImage := imaging.Resize(srcImage, 800, 600, imaging.Lanczos)
+// dstImage := imaging.Resize(srcImage, 800, 600, imaging.Lanczos)
//
func Resize(img image.Image, width, height int, filter ResampleFilter) *image.NRGBA {
dstW, dstH := width, height
@@ -239,7 +239,7 @@ func resizeNearest(src *image.NRGBA, width, height int) *image.NRGBA {
//
// Usage example:
//
-// dstImage := imaging.Fit(srcImage, 800, 600, imaging.Lanczos)
+// dstImage := imaging.Fit(srcImage, 800, 600, imaging.Lanczos)
//
func Fit(img image.Image, width, height int, filter ResampleFilter) *image.NRGBA {
maxW, maxH := width, height
@@ -284,7 +284,7 @@ func Fit(img image.Image, width, height int, filter ResampleFilter) *image.NRGBA
//
// Usage example:
//
-// dstImage := imaging.Fill(srcImage, 800, 600, imaging.Center, imaging.Lanczos)
+// dstImage := imaging.Fill(srcImage, 800, 600, imaging.Center, imaging.Lanczos)
//
func Fill(img image.Image, width, height int, anchor Anchor, filter ResampleFilter) *image.NRGBA {
minW, minH := width, height
@@ -326,7 +326,7 @@ func Fill(img image.Image, width, height int, anchor Anchor, filter ResampleFilt
//
// Usage example:
//
-// dstImage := imaging.Thumbnail(srcImage, 100, 100, imaging.Lanczos)
+// dstImage := imaging.Thumbnail(srcImage, 100, 100, imaging.Lanczos)
//
func Thumbnail(img image.Image, width, height int, filter ResampleFilter) *image.NRGBA {
return Fill(img, width, height, Center, filter)
diff --git a/vendor/github.com/disintegration/imaging/tools.go b/vendor/github.com/disintegration/imaging/tools.go
index 2c6d68eea..e57225c58 100644
--- a/vendor/github.com/disintegration/imaging/tools.go
+++ b/vendor/github.com/disintegration/imaging/tools.go
@@ -136,11 +136,11 @@ func PasteCenter(background, img image.Image) *image.NRGBA {
//
// Usage examples:
//
-// // draw the sprite over the background at position (50, 50)
-// dstImage := imaging.Overlay(backgroundImage, spriteImage, image.Pt(50, 50), 1.0)
+// // draw the sprite over the background at position (50, 50)
+// dstImage := imaging.Overlay(backgroundImage, spriteImage, image.Pt(50, 50), 1.0)
//
-// // blend two opaque images of the same size
-// dstImage := imaging.Overlay(imageOne, imageTwo, image.Pt(0, 0), 0.5)
+// // blend two opaque images of the same size
+// dstImage := imaging.Overlay(imageOne, imageTwo, image.Pt(0, 0), 0.5)
//
func Overlay(background, img image.Image, pos image.Point, opacity float64) *image.NRGBA {
opacity = math.Min(math.Max(opacity, 0.0), 1.0) // check: 0.0 <= opacity <= 1.0
diff --git a/vendor/github.com/disintegration/imaging/transform.go b/vendor/github.com/disintegration/imaging/transform.go
index 30410c278..43668dfd7 100644
--- a/vendor/github.com/disintegration/imaging/transform.go
+++ b/vendor/github.com/disintegration/imaging/transform.go
@@ -206,6 +206,19 @@ func Rotate270(img image.Image) *image.NRGBA {
// The angle parameter is the rotation angle in degrees.
// The bgColor parameter specifies the color of the uncovered zone after the rotation.
func Rotate(img image.Image, angle float64, bgColor color.Color) *image.NRGBA {
+ angle = angle - math.Floor(angle/360)*360
+
+ switch angle {
+ case 0:
+ return Clone(img)
+ case 90:
+ return Rotate90(img)
+ case 180:
+ return Rotate180(img)
+ case 270:
+ return Rotate270(img)
+ }
+
src := toNRGBA(img)
srcW := src.Bounds().Max.X
srcH := src.Bounds().Max.Y
diff --git a/vendor/github.com/disintegration/imaging/transform_test.go b/vendor/github.com/disintegration/imaging/transform_test.go
index 3772225a3..447dd1ea0 100644
--- a/vendor/github.com/disintegration/imaging/transform_test.go
+++ b/vendor/github.com/disintegration/imaging/transform_test.go
@@ -406,6 +406,170 @@ func TestRotate(t *testing.T) {
},
},
},
+ {
+ "Rotate -360*10",
+ &image.NRGBA{
+ Rect: image.Rect(-1, -1, 0, 1),
+ Stride: 1 * 4,
+ Pix: []uint8{
+ 0x00, 0xff, 0x00, 0xff,
+ 0xff, 0x00, 0x00, 0xff,
+ },
+ },
+ -360 * 10,
+ color.Black,
+ &image.NRGBA{
+ Rect: image.Rect(0, 0, 1, 2),
+ Stride: 1 * 4,
+ Pix: []uint8{
+ 0x00, 0xff, 0x00, 0xff,
+ 0xff, 0x00, 0x00, 0xff,
+ },
+ },
+ },
+ {
+ "Rotate -360*10 + 90",
+ &image.NRGBA{
+ Rect: image.Rect(-1, -1, 0, 1),
+ Stride: 1 * 4,
+ Pix: []uint8{
+ 0xff, 0x00, 0x00, 0xff,
+ 0x00, 0xff, 0x00, 0xff,
+ },
+ },
+ -360*10 + 90,
+ color.Black,
+ &image.NRGBA{
+ Rect: image.Rect(0, 0, 2, 1),
+ Stride: 2 * 4,
+ Pix: []uint8{
+ 0xff, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff,
+ },
+ },
+ },
+ {
+ "Rotate -360*10 + 180",
+ &image.NRGBA{
+ Rect: image.Rect(-1, -1, 0, 1),
+ Stride: 1 * 4,
+ Pix: []uint8{
+ 0xff, 0x00, 0x00, 0xff,
+ 0x00, 0xff, 0x00, 0xff,
+ },
+ },
+ -360*10 + 180,
+ color.Black,
+ &image.NRGBA{
+ Rect: image.Rect(0, 0, 1, 2),
+ Stride: 1 * 4,
+ Pix: []uint8{
+ 0x00, 0xff, 0x00, 0xff,
+ 0xff, 0x00, 0x00, 0xff,
+ },
+ },
+ },
+ {
+ "Rotate -360*10 + 270",
+ &image.NRGBA{
+ Rect: image.Rect(-1, -1, 0, 1),
+ Stride: 1 * 4,
+ Pix: []uint8{
+ 0xff, 0x00, 0x00, 0xff,
+ 0x00, 0xff, 0x00, 0xff,
+ },
+ },
+ -360*10 + 270,
+ color.Black,
+ &image.NRGBA{
+ Rect: image.Rect(0, 0, 2, 1),
+ Stride: 2 * 4,
+ Pix: []uint8{
+ 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff,
+ },
+ },
+ },
+ {
+ "Rotate 360*10",
+ &image.NRGBA{
+ Rect: image.Rect(-1, -1, 0, 1),
+ Stride: 1 * 4,
+ Pix: []uint8{
+ 0x00, 0xff, 0x00, 0xff,
+ 0xff, 0x00, 0x00, 0xff,
+ },
+ },
+ 360 * 10,
+ color.Black,
+ &image.NRGBA{
+ Rect: image.Rect(0, 0, 1, 2),
+ Stride: 1 * 4,
+ Pix: []uint8{
+ 0x00, 0xff, 0x00, 0xff,
+ 0xff, 0x00, 0x00, 0xff,
+ },
+ },
+ },
+ {
+ "Rotate 360*10 + 90",
+ &image.NRGBA{
+ Rect: image.Rect(-1, -1, 0, 1),
+ Stride: 1 * 4,
+ Pix: []uint8{
+ 0xff, 0x00, 0x00, 0xff,
+ 0x00, 0xff, 0x00, 0xff,
+ },
+ },
+ 360*10 + 90,
+ color.Black,
+ &image.NRGBA{
+ Rect: image.Rect(0, 0, 2, 1),
+ Stride: 2 * 4,
+ Pix: []uint8{
+ 0xff, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff,
+ },
+ },
+ },
+ {
+ "Rotate 360*10 + 180",
+ &image.NRGBA{
+ Rect: image.Rect(-1, -1, 0, 1),
+ Stride: 1 * 4,
+ Pix: []uint8{
+ 0xff, 0x00, 0x00, 0xff,
+ 0x00, 0xff, 0x00, 0xff,
+ },
+ },
+ 360*10 + 180,
+ color.Black,
+ &image.NRGBA{
+ Rect: image.Rect(0, 0, 1, 2),
+ Stride: 1 * 4,
+ Pix: []uint8{
+ 0x00, 0xff, 0x00, 0xff,
+ 0xff, 0x00, 0x00, 0xff,
+ },
+ },
+ },
+ {
+ "Rotate 360*10 + 270",
+ &image.NRGBA{
+ Rect: image.Rect(-1, -1, 0, 1),
+ Stride: 1 * 4,
+ Pix: []uint8{
+ 0xff, 0x00, 0x00, 0xff,
+ 0x00, 0xff, 0x00, 0xff,
+ },
+ },
+ 360*10 + 270,
+ color.Black,
+ &image.NRGBA{
+ Rect: image.Rect(0, 0, 2, 1),
+ Stride: 2 * 4,
+ Pix: []uint8{
+ 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff,
+ },
+ },
+ },
}
for _, test := range testCases {
got := Rotate(test.src, test.angle, test.bg)