浏览代码

Comments fix

disintegration 12 年之前
父节点
当前提交
b1b003b30c
共有 2 个文件被更改,包括 7 次插入5 次删除
  1. 2 2
      README.md
  2. 5 3
      imaging.go

+ 2 - 2
README.md

@@ -3,8 +3,8 @@
 Package imaging provides basic image manipulation functions 
 (resize, rotate, crop, etc.) as well as simplified image loading and saving.
 This package is based on the standard Go image package. All the image 
-manipulation functions provided by the package take any type of image that 
-implements image.Image interface, and return a new image of 
+manipulation functions provided by the package take any image type that 
+implements `image.Image` interface, and return a new image of 
 `*image.NRGBA` type (32 bit RGBA colors, not premultiplied by alpha). 
 
 ###Recent changes

+ 5 - 3
imaging.go

@@ -2,7 +2,9 @@
 // (resize, rotate, crop, etc.) as well as simplified image loading and saving.
 // 
 // This package is based on the standard Go image package. All the image 
-// manipulation functions provided by the package return a new *image.NRGBA.
+// manipulation functions provided by the package take any image type that 
+// implements image.Image interface, and return a new image of 
+// *image.NRGBA type (32 bit RGBA colors, not premultiplied by alpha).
 package imaging
 
 import (
@@ -515,7 +517,7 @@ func FlipV(img image.Image) *image.NRGBA {
 	return dst
 }
 
-// Antialias filter for Resize is a basic quadratic function.
+// Anti-aliasing filter for Resize is a cubic function.
 func antialiasFilter(x float64) float64 {
 	x = math.Abs(x)
 	if x <= 1.0 {
@@ -623,11 +625,11 @@ func Resize(img image.Image, width, height int) *image.NRGBA {
 
 				weight := antialiasFilter((float64(y) - fy) / radiusY)
 				weightSum += weight
+
 				r += (rTmp / weightSumTmp) * weight
 				g += (gTmp / weightSumTmp) * weight
 				b += (bTmp / weightSumTmp) * weight
 				a += (aTmp / weightSumTmp) * weight
-
 			}
 
 			r = math.Min(r/weightSum, 255.0)